Changeset 133812c7 in sasview for src/sas/qtgui/MainWindow/GuiManager.py
- Timestamp:
- Nov 12, 2018 4:47:59 AM (5 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- e5ae812
- Parents:
- ebcdb02
- git-author:
- Piotr Rozyczko <piotr.rozyczko@…> (10/31/18 04:34:14)
- git-committer:
- Piotr Rozyczko <piotr.rozyczko@…> (11/12/18 04:47:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/GuiManager.py
rebcdb02 r133812c7 51 51 52 52 from sas.qtgui.Utilities.AddMultEditor import AddMultEditor 53 from sas.qtgui.Utilities.ImageViewer import ImageViewer 53 54 54 55 logger = logging.getLogger(__name__) … … 352 353 # Exit if yes 353 354 if reply == QMessageBox.Yes: 355 # save the paths etc. 356 self.saveCustomConfig() 354 357 reactor.callFromThread(reactor.stop) 355 358 return True … … 457 460 self._workspace.actionReset.setVisible(False) 458 461 self._workspace.actionStartup_Settings.setVisible(False) 459 self._workspace.actionImage_Viewer.setVisible(False)462 #self._workspace.actionImage_Viewer.setVisible(False) 460 463 self._workspace.actionCombine_Batch_Fit.setVisible(False) 461 464 # orientation viewer set to invisible SASVIEW-1132 … … 825 828 """ 826 829 """ 827 print("actionImage_Viewer TRIGGERED") 828 pass 830 try: 831 self.image_viewer = ImageViewer(self) 832 if sys.platform == "darwin": 833 self.image_viewer.menubar.setNativeMenuBar(False) 834 self.image_viewer.show() 835 except Exception as ex: 836 logging.error(str(ex)) 837 return 829 838 830 839 #============ FITTING ================= … … 1114 1123 elif isinstance(perspective, Perspectives.PERSPECTIVES["Corfunc"]): 1115 1124 self.checkAnalysisOption(self._workspace.actionCorfunc) 1125 1126 def saveCustomConfig(self): 1127 """ 1128 Save the config file based on current session values 1129 """ 1130 # Load the current file 1131 config_content = GuiUtils.custom_config 1132 1133 changed = self.customSavePaths(config_content) 1134 changed = changed or self.customSaveOpenCL(config_content) 1135 1136 if changed: 1137 self.writeCustomConfig(config_content) 1138 1139 def customSavePaths(self, config_content): 1140 """ 1141 Update the config module with current session paths 1142 Returns True if update was done, False, otherwise 1143 """ 1144 changed = False 1145 # Find load path 1146 open_path = GuiUtils.DEFAULT_OPEN_FOLDER 1147 defined_path = self.filesWidget.default_load_location 1148 if open_path != defined_path: 1149 # Replace the load path 1150 config_content.DEFAULT_OPEN_FOLDER = defined_path 1151 changed = True 1152 return changed 1153 1154 def customSaveOpenCL(self, config_content): 1155 """ 1156 Update the config module with current session OpenCL choice 1157 Returns True if update was done, False, otherwise 1158 """ 1159 changed = False 1160 # Find load path 1161 file_value = GuiUtils.SAS_OPENCL 1162 session_value = os.environ.get("SAS_OPENCL", "") 1163 if file_value != session_value: 1164 # Replace the load path 1165 config_content.SAS_OPENCL = session_value 1166 changed = True 1167 return changed 1168 1169 def writeCustomConfig(self, config): 1170 """ 1171 Write custom configuration 1172 """ 1173 from sas import make_custom_config_path 1174 path = make_custom_config_path() 1175 # Just clobber the file - we already have its content read in 1176 with open(path, 'w') as out_f: 1177 out_f.write("#Application appearance custom configuration\n") 1178 for key, item in config.__dict__.items(): 1179 if key[:2] != "__": 1180 if isinstance(item, str): 1181 item = '"' + item + '"' 1182 out_f.write("%s = %s\n" % (key, str(item))) 1183 pass # debugger anchor
Note: See TracChangeset
for help on using the changeset viewer.