1616from PyQt5 .QtWidgets import QFrame ,QApplication ,QWidget ,QTabWidget ,QLineEdit ,QHBoxLayout ,QVBoxLayout ,QRadioButton ,QPushButton , QLabel ,QCheckBox ,QComboBox ,QScrollArea ,QGridLayout , QFileDialog ,QSpinBox ,QDoubleSpinBox , QButtonGroup # , QMessageBox
1717# from PyQt5.QtWidgets import QMessageBox
1818
19- from studio_classes import QLabelSeparator , QLineEdit_custom , QCheckBox_custom , QRadioButton_custom
19+ from studio_classes import QLabelSeparator , QLineEdit_custom , QCheckBox_custom , QRadioButton_custom , HoverWarning
2020from studio_functions import style_sheet_template
2121
2222class RandomSeedIntValidator (QtGui .QValidator ):
@@ -43,16 +43,17 @@ def validate(self, text, pos):
4343
4444class Config (QWidget ):
4545 # def __init__(self, nanohub_flag):
46- def __init__ (self , studio_flag ):
46+ def __init__ (self , xml_creator ):
4747 super ().__init__ ()
4848 # global self.config_params
4949
50+ self .xml_creator = xml_creator
51+
5052 self .default_time_units = "min"
5153
5254 # self.nanohub_flag = nanohub_flag
5355 self .nanohub_flag = False
5456
55- self .studio_flag = studio_flag
5657 self .vis_tab = None
5758 self .ics_tab = None
5859
@@ -358,9 +359,8 @@ def __init__(self, studio_flag):
358359 self .random_seed_integer .setValidator (RandomSeedIntValidator ())
359360 hbox .addWidget (self .random_seed_integer )
360361
361- self .random_seed_warning = QLabel ()
362- self .random_seed_warning .setStyleSheet ("color: red;" )
363- hbox .addWidget (self .random_seed_warning )
362+ self .random_seed_warning_label = HoverWarning ("WARNING: random_seed in user_parameters will take precedence if it remains." )
363+ hbox .addWidget (self .random_seed_warning_label )
364364
365365 hbox .addStretch ()
366366
@@ -585,6 +585,17 @@ def random_seed_gp_cb(self, id):
585585 self .random_seed_integer .setEnabled (True )
586586 self .random_seed_integer .check_validity () # set color based on current validity
587587
588+ # see if random_seed remains in user_parameters
589+ if hasattr (self .xml_creator , 'user_params_tab' ):
590+ # this is called before user_params_tab is created one time, so make sure it exists
591+ for idx in range (self .xml_creator .user_params_tab .count ):
592+ v_name = self .xml_creator .user_params_tab .utable .cellWidget (idx ,self .xml_creator .user_params_tab .var_icol_name ).text ()
593+ if v_name == "random_seed" :
594+ self .random_seed_warning_label .show_icon ()
595+ return
596+ self .random_seed_warning_label .hide_icon ()
597+
598+
588599 def random_seed_integer_cb (self , text ):
589600 if text == "" :
590601 self .random_seed_integer .setPlaceholderText ("system_clock" ) # warn the user that this will set the seed to system_clock
@@ -717,7 +728,7 @@ def fill_gui(self):
717728 self .random_seed_random_button .setChecked (True )
718729
719730 if self .xml_root .find (".//user_parameters//random_seed" ) is not None :
720- self .random_seed_warning . setText ( "WARNING: random_seed in user_parameters found in xml loading. \n That parameter will take precedence if it remains." )
731+ self .random_seed_warning_label . show_icon ( )
721732
722733 # self.disable_auto_springs.setChecked(False)
723734 # if self.xml_root.find(".//disable_automated_spring_adhesions") is not None:
@@ -742,9 +753,6 @@ def fill_gui(self):
742753 self .num_threads .setText (self .xml_root .find (".//omp_num_threads" ).text )
743754
744755 self .folder .setText (self .xml_root .find (".//save//folder" ).text )
745- # print("\n----------------config_tab: fill_gui(): folder= ",self.folder.text())
746- # if self.studio_flag:
747- # self.plot_folder.setText(self.xml_root.find(".//folder").text)
748756
749757 self .svg_interval .setText (self .xml_root .find (".//SVG//interval" ).text )
750758 # NOTE: do this *after* filling the mcds_interval, directly above, due to the callback/constraints on them??
@@ -1054,7 +1062,7 @@ def import_seeding_cb(self):
10541062
10551063 # self.add_new_model(self.current_xml_file, True)
10561064 # self.config_file = self.current_xml_file
1057- # if self.studio_flag:
1065+ # if self.xml_creator. studio_flag:
10581066 # self.run_tab.config_file = self.current_xml_file
10591067 # self.run_tab.config_xml_name.setText(self.current_xml_file)
10601068 # self.show_sample_model()
0 commit comments