From d79ab9c3f74365471337bf0769c13ac961fefd13 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 13 Jun 2023 12:01:39 -0400 Subject: [PATCH 1/5] try-except cmin,cmax --- bin/vis_base.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/bin/vis_base.py b/bin/vis_base.py index 696dba36..4a36c5f1 100644 --- a/bin/vis_base.py +++ b/bin/vis_base.py @@ -2171,17 +2171,21 @@ def fix_cmap_toggle_cb(self,bval): # print("field_name= ",field_name) # print(self.cmap_fixed_toggle.value) # if (self.colormap_fixed_toggle.value): # toggle on fixed range - if (bval): # toggle on fixed range - # self.colormap_min.disabled = False - # self.colormap_max.disabled = False - self.field_min_max[field_name][0] = self.cmin.text - self.field_min_max[field_name][1] = self.cmax.text - self.field_min_max[field_name][2] = True - # self.save_min_max.disabled = False - else: # toggle off fixed range - # self.colormap_min.disabled = True - # self.colormap_max.disabled = True - self.field_min_max[field_name][2] = False + # --- rwh: TODO + try: + if (bval): # toggle on fixed range + # self.colormap_min.disabled = False + # self.colormap_max.disabled = False + self.field_min_max[field_name][0] = self.cmin.text + self.field_min_max[field_name][1] = self.cmax.text + self.field_min_max[field_name][2] = True + # self.save_min_max.disabled = False + else: # toggle off fixed range + # self.colormap_min.disabled = True + # self.colormap_max.disabled = True + self.field_min_max[field_name][2] = False + except: + print("------- vis_base: fix_cmap_toggle_cb(): exception updating field_min_max for ",field_name) # print("\n>>> calling update_plots() from "+ inspect.stack()[0][3]) self.update_plots() From e345eb53478fcdb3d525f361b5269e7ca15b0f23 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Fri, 16 Jun 2023 04:31:26 -0400 Subject: [PATCH 2/5] remove File->Samples --- bin/studio.py | 88 +++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/bin/studio.py b/bin/studio.py index 46ee9f47..2979b9f4 100644 --- a/bin/studio.py +++ b/bin/studio.py @@ -597,64 +597,64 @@ def menu(self): export_menu.setEnabled(False) #------ - file_menu.addSeparator() - samples_menu = file_menu.addMenu("Samples") + # file_menu.addSeparator() + # samples_menu = file_menu.addMenu("Samples") - template_act = QAction('template', self) - samples_menu.addAction(template_act) - template_act.triggered.connect(self.template_cb) + # template_act = QAction('template', self) + # samples_menu.addAction(template_act) + # template_act.triggered.connect(self.template_cb) - biorobots_act = QAction('biorobots', self) - samples_menu.addAction(biorobots_act) - biorobots_act.triggered.connect(self.biorobots_cb) + # biorobots_act = QAction('biorobots', self) + # samples_menu.addAction(biorobots_act) + # biorobots_act.triggered.connect(self.biorobots_cb) - cancer_biorobots_act = QAction('cancer biorobots', self) - samples_menu.addAction(cancer_biorobots_act) - cancer_biorobots_act.triggered.connect(self.cancer_biorobots_cb) + # cancer_biorobots_act = QAction('cancer biorobots', self) + # samples_menu.addAction(cancer_biorobots_act) + # cancer_biorobots_act.triggered.connect(self.cancer_biorobots_cb) - hetero_act = QAction('heterogeneity', self) - samples_menu.addAction(hetero_act) - hetero_act.triggered.connect(self.hetero_cb) + # hetero_act = QAction('heterogeneity', self) + # samples_menu.addAction(hetero_act) + # hetero_act.triggered.connect(self.hetero_cb) - pred_prey_act = QAction('predator-prey-farmer', self) - samples_menu.addAction(pred_prey_act) - pred_prey_act.triggered.connect(self.pred_prey_cb) + # pred_prey_act = QAction('predator-prey-farmer', self) + # samples_menu.addAction(pred_prey_act) + # pred_prey_act.triggered.connect(self.pred_prey_cb) - virus_mac_act = QAction('virus-macrophage', self) - samples_menu.addAction(virus_mac_act) - virus_mac_act.triggered.connect(self.virus_mac_cb) + # virus_mac_act = QAction('virus-macrophage', self) + # samples_menu.addAction(virus_mac_act) + # virus_mac_act.triggered.connect(self.virus_mac_cb) - worm_act = QAction('worm', self) - samples_menu.addAction(worm_act) - worm_act.triggered.connect(self.worm_cb) + # worm_act = QAction('worm', self) + # samples_menu.addAction(worm_act) + # worm_act.triggered.connect(self.worm_cb) - interactions_act = QAction('interactions', self) - samples_menu.addAction(interactions_act) - interactions_act.triggered.connect(self.interactions_cb) + # interactions_act = QAction('interactions', self) + # samples_menu.addAction(interactions_act) + # interactions_act.triggered.connect(self.interactions_cb) - mechano_act = QAction('mechano', self) - samples_menu.addAction(mechano_act) - mechano_act.triggered.connect(self.mechano_cb) + # mechano_act = QAction('mechano', self) + # samples_menu.addAction(mechano_act) + # mechano_act.triggered.connect(self.mechano_cb) - cancer_immune_act = QAction('cancer immune (3D)', self) - samples_menu.addAction(cancer_immune_act) - cancer_immune_act.triggered.connect(self.cancer_immune_cb) + # cancer_immune_act = QAction('cancer immune (3D)', self) + # samples_menu.addAction(cancer_immune_act) + # cancer_immune_act.triggered.connect(self.cancer_immune_cb) - physiboss_cell_lines_act = QAction('PhysiBoSS cell lines', self) - samples_menu.addAction(physiboss_cell_lines_act) - physiboss_cell_lines_act.triggered.connect(self.physiboss_cell_lines_cb) + # physiboss_cell_lines_act = QAction('PhysiBoSS cell lines', self) + # samples_menu.addAction(physiboss_cell_lines_act) + # physiboss_cell_lines_act.triggered.connect(self.physiboss_cell_lines_cb) - subcell_act = QAction('subcellular', self) - # samples_menu.addAction(subcell_act) - subcell_act.triggered.connect(self.subcell_cb) + # subcell_act = QAction('subcellular', self) + # # samples_menu.addAction(subcell_act) + # subcell_act.triggered.connect(self.subcell_cb) - covid19_act = QAction('covid19_v5', self) - # samples_menu.addAction(covid19_act) - covid19_act.triggered.connect(self.covid19_cb) + # covid19_act = QAction('covid19_v5', self) + # # samples_menu.addAction(covid19_act) + # covid19_act.triggered.connect(self.covid19_cb) - test_gui_act = QAction('test-gui', self) - # samples_menu.addAction(test_gui_act) - test_gui_act.triggered.connect(self.test_gui_cb) + # test_gui_act = QAction('test-gui', self) + # # samples_menu.addAction(test_gui_act) + # test_gui_act.triggered.connect(self.test_gui_cb) # else: # file_menu.addAction("Save as mymodel.xml", self.save_as_cb) From d10238f0e2d18ec449d6ed1f51aef47a8452852a Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Fri, 16 Jun 2023 04:37:26 -0400 Subject: [PATCH 3/5] init user_projects --- user_projects/empty.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 user_projects/empty.txt diff --git a/user_projects/empty.txt b/user_projects/empty.txt new file mode 100644 index 00000000..e69de29b From 6a6912de1b494b4b099d7eacef734213fc4cc04f Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Fri, 16 Jun 2023 06:35:46 -0400 Subject: [PATCH 4/5] load,save user proj --- bin/studio.py | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/bin/studio.py b/bin/studio.py index 2979b9f4..5a9983a0 100644 --- a/bin/studio.py +++ b/bin/studio.py @@ -20,6 +20,7 @@ import logging import traceback import shutil # for possible copy of file +import glob from pathlib import Path import xml.etree.ElementTree as ET # https://docs.python.org/2/library/xml.etree.elementtree.html # from xml.dom import minidom # possibly explore later if we want to access/update *everything* in the DOM @@ -596,6 +597,20 @@ def menu(self): print("simularium_installed is ",simularium_installed) export_menu.setEnabled(False) + #------ + file_menu.addSeparator() + file_menu.addAction("Save user project", self.save_user_proj_cb) + file_menu.addAction("Load user project", self.load_user_proj_cb) + # user_proj_menu = file_menu.addMenu("User project") + + # save_user_proj = QAction('Save', self) + # user_proj_menu.addAction(save_user_proj) + # save_user_proj.triggered.connect(self.save_user_proj_cb) + + # load_user_proj = QAction('Load', self) + # user_proj_menu.addAction(load_user_proj) + # load_user_proj.triggered.connect(self.load_user_proj_cb) + #------ # file_menu.addSeparator() # samples_menu = file_menu.addMenu("Samples") @@ -812,6 +827,7 @@ def indent(elem, level=0): elem.tail = i + #--------------------------------- def save_as_cb(self): # print("------ save_as_cb():") self.celldef_tab.check_valid_cell_defs() @@ -893,7 +909,95 @@ def save_cb(self): except CellDefException as e: self.show_error_message(str(e) + " : save_cb(): Error: Please finish the definition before saving.") + #--------------------------------- + def save_user_proj_cb(self): + # print("------ save_user_proj_cb():") + # self.celldef_tab.check_valid_cell_defs() + + dialog = QFileDialog(self) + dialog.setFileMode(QFileDialog.Directory) + folder_path = dialog.getExistingDirectory(None, "Select project folder","user_projects",QFileDialog.ShowDirsOnly) + print("save_user_proj_cb(): folder_path=",folder_path) + # e.g., /Users/heiland/dev/PhysiCell_v1.12.0/user_projects/rwh3 + + # mkdir -p ./user_projects + # mkdir -p ./user_projects/rwh1 + # mkdir -p ./user_projects/rwh1/custom_modules + # mkdir -p ./user_projects/rwh1/config + # cp main.cpp ./user_projects/rwh1 + # cp Makefile ./user_projects/rwh1 + # cp VERSION.txt ./user_projects/rwh1 + # cp ./config/* ./user_projects/rwh1/config + # cp ./custom_modules/* ./user_projects/rwh1/custom_modules + + for f in ["main.cpp", "Makefile", "VERSION.txt"]: + try: + shutil.copy(f, folder_path) + except: + print(f"--- Warning: cannot save {f}") + + #--------- + subdir = Path(folder_path, "config") + try: + os.makedirs(subdir) + except: + print(f"--- Warning: {subdir} already exists.") + + try: + for f in glob.glob("config/*"): + shutil.copy(f, subdir) + except: + print(f"--- Warning: cannot copy config/*") + + #--------- + subdir = Path(folder_path, "custom_modules") + try: + os.makedirs(subdir) + except: + print(f"--- Warning: {dir1} already exists.") + + try: + for f in glob.glob("custom_modules/*"): + shutil.copy(f, subdir) + except: + print(f"--- Warning: cannot copy custom_modules/*") + + #--------------------------------- + def load_user_proj_cb(self): + try: + dialog = QFileDialog(self) + dialog.setFileMode(QFileDialog.Directory) + folder_path = dialog.getExistingDirectory(None, "Select project folder","user_projects",QFileDialog.ShowDirsOnly) + print("load_user_proj_cb(): folder_path=",folder_path) + + # cp ./user_projects/rwh1/main.cpp . + # cp ./user_projects/rwh1/Makefile . + # cp ./user_projects/rwh1/config/* ./config/ + # cp ./user_projects/rwh1/custom_modules/* ./custom_modules/ + + for f in ["main.cpp", "Makefile"]: + try: + f2 = os.path.join(folder_path, f) + shutil.copy(f2, '.') + print(f"copy {f2} to root") + except: + print(f"--- Warning: cannot copy {f2}") + + for d in ["config", "custom_modules"]: + d1 = os.path.join(folder_path, d) + print(f"d1 = {d1}") + for f in glob.glob(str(d1) + "/*"): + print(f"try copying {f} to {d}") + shutil.copy(f, d) + + except: + msgBox = QMessageBox() + msgBox.setIcon(QMessageBox.Information) + msgBox.setText("load_user_proj_cb(): Possible failure. See terminal output.") + msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) + returnValue = msgBox.exec() + #--------------------------------- def validate_cb(self): # not used currently msgBox = QMessageBox() msgBox.setIcon(QMessageBox.Information) From d5b64abb3398f92ef72979a7c4a4ca75868d5020 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Fri, 16 Jun 2023 06:36:17 -0400 Subject: [PATCH 5/5] bump --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index ed1d6005..3953e8ad 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -2.26.2 +2.26.3