Skip to content

Commit 2f2163d

Browse files
authored
Merge pull request #246 from PhysiCell-Tools/development
bug fixes for boolean intracellular UI; radio buttons on Config tab
2 parents a6c48d8 + e3498a4 commit 2f2163d

7 files changed

Lines changed: 956 additions & 41 deletions

File tree

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.38.0
1+
2.39.1

bin/cell_def_tab.py

Lines changed: 100 additions & 28 deletions
Large diffs are not rendered by default.

bin/config_tab.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,28 @@ def __init__(self, studio_flag):
6666

6767
# self.tab = QWidget()
6868
# self.tabs.resize(200,5)
69+
70+
radiobutton_style = """
71+
QRadioButton {
72+
spacing: 10px; /* Space between indicator and text */
73+
color: black; /* Text color */
74+
}
75+
76+
QRadioButton::indicator {
77+
width: 12px; /* Indicator size */
78+
height: 12px;
79+
border-radius: 6px; /* Rounded indicator */
80+
}
81+
82+
QRadioButton::indicator:unchecked {
83+
border: 1px solid gray; /* Border when unchecked */
84+
}
85+
86+
QRadioButton::indicator:checked {
87+
background-color: rgb(21,96,209); /* Filled color when checked */
88+
border: 1px solid black;
89+
}
90+
"""
6991

7092
#-------------------------------------------
7193
label_width = 110
@@ -329,13 +351,12 @@ def __init__(self, studio_flag):
329351
self.random_seed_gp.idToggled.connect(self.random_seed_gp_cb)
330352
random_seed_gp_next_id = 0
331353

332-
self.random_seed_random_button = QRadioButton("system clock")
333-
self.random_seed_random_button.setChecked(True)
354+
self.random_seed_random_button = QRadioButton("system clock",styleSheet=radiobutton_style)
334355
self.random_seed_gp.addButton(self.random_seed_random_button, random_seed_gp_next_id)
335356
hbox.addWidget(self.random_seed_random_button)
336357
random_seed_gp_next_id += 1
337358

338-
self.random_seed_integer_button = QRadioButton("integer \u2192 ")
359+
self.random_seed_integer_button = QRadioButton("integer \u2192 ",styleSheet=radiobutton_style)
339360
self.random_seed_gp.addButton(self.random_seed_integer_button, random_seed_gp_next_id)
340361
hbox.addWidget(self.random_seed_integer_button)
341362
random_seed_gp_next_id += 1
@@ -708,7 +729,8 @@ def fill_gui(self):
708729
if self.xml_root.find(".//random_seed") is not None:
709730
# this intentionally will read in the user_parameter random_seed if it exists. this will facilitate the user using this new placement (importantly, the default custom.cpp will still use the user_parameter to override the value placed here)
710731
text = self.xml_root.find(".//random_seed").text
711-
if text in ["system_clock","random",""]:
732+
print("\n------------------ config_tab: random_seed = ",text)
733+
if text in ["system_clock","random","",None]:
712734
self.random_seed_random_button.setChecked(True)
713735
else:
714736
self.random_seed_integer_button.setChecked(True)

bin/populate_tree_cell_defs.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,9 @@ def populate_tree_cell_defs(cell_def_tab, skip_validate):
14031403
cell_def_tab.param_d[cell_def_name]["intracellular"]["parameters"].append({"name": parameter.attrib["intracellular_name"], "value": parameter.text})
14041404

14051405
# print("cell def : " + cell_def_name + " : dt = " + cell_def_tab.param_d[cell_def_name]["intracellular"]["time_step"])
1406+
# <initial_values>
1407+
# <initial_value intracellular_name="A">1</initial_value>
1408+
# <initial_value intracellular_name="C">0</initial_value>
14061409
cell_def_tab.param_d[cell_def_name]["intracellular"]["initial_values"] = []
14071410
uep_intracellular_iv = uep_intracellular.find("initial_values")
14081411
if uep_intracellular_iv is not None:
@@ -1469,13 +1472,28 @@ def populate_tree_cell_defs(cell_def_tab, skip_validate):
14691472
# <map PC_phenotype="ctr_0_0" sbml_species="Transition_Rate"/>
14701473
cell_def_tab.param_d[cell_def_name]["intracellular"]["type"] = "roadrunner"
14711474

1472-
msg = f"WARNING: a roadrunner intracellular model was detected, but it is not currently possible to modify its parameters from the Studio."
1473-
print(msg)
1474-
msgBox = QMessageBox()
1475-
# msgBox.setTextFormat(Qt.RichText)
1476-
msgBox.setText(msg)
1477-
msgBox.setStandardButtons(QMessageBox.Ok)
1478-
returnValue = msgBox.exec()
1475+
cell_def_tab.param_d[cell_def_name]["intracellular"]["sbml_filename"] = uep_intracellular.find("sbml_filename").text if uep_intracellular.find("sbml_filename") is not None else None
1476+
cell_def_tab.param_d[cell_def_name]["intracellular"]["intracellular_dt"] = uep_intracellular.find("intracellular_dt").text if uep_intracellular.find("intracellular_dt") is not None else None
1477+
1478+
cell_def_tab.param_d[cell_def_name]["intracellular"]["sbml_maps"] = []
1479+
for mymap in uep_intracellular.findall('map'):
1480+
# save triplets
1481+
if 'PC_substrate' in mymap.attrib.keys():
1482+
cell_def_tab.param_d[cell_def_name]["intracellular"]["sbml_maps"].append(['PC_substrate',mymap.attrib['PC_substrate'], mymap.attrib['sbml_species'] ])
1483+
elif 'PC_phenotype' in mymap.attrib.keys():
1484+
cell_def_tab.param_d[cell_def_name]["intracellular"]["sbml_maps"].append(['PC_phenotype',mymap.attrib['PC_phenotype'], mymap.attrib['sbml_species'] ])
1485+
elif 'PC_custom_data' in mymap.attrib.keys():
1486+
cell_def_tab.param_d[cell_def_name]["intracellular"]["sbml_maps"].append(['PC_custom_data',mymap.attrib['PC_custom_data'], mymap.attrib['sbml_species'] ])
1487+
1488+
print("\n--> ",cell_def_tab.param_d[cell_def_name]["intracellular"]["sbml_maps"])
1489+
1490+
# msg = f"WARNING: a roadrunner intracellular model was detected, but it is not currently possible to modify its parameters from the Studio."
1491+
# print(msg)
1492+
# msgBox = QMessageBox()
1493+
# # msgBox.setTextFormat(Qt.RichText)
1494+
# msgBox.setText(msg)
1495+
# msgBox.setStandardButtons(QMessageBox.Ok)
1496+
# returnValue = msgBox.exec()
14791497

14801498

14811499
logging.debug(f'------ done parsing intracellular:')

bin/rules_tab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,7 @@ def fill_gui(self):
21282128
# self.rules_text.setPlainText("")
21292129
self.rules_folder.setText("config")
21302130
self.rules_file.setText("rules.csv")
2131-
self.rules_enabled.setChecked(True)
2131+
# self.rules_enabled.setChecked(True) # Sep 2024: comment out; error w/ physiboss model with no rules block provided in xml
21322132

21332133
self.clear_rules()
21342134
return

0 commit comments

Comments
 (0)