Changeset 914ba0a in sasview for src/sas/sasgui/guiframe/startup_configuration.py
- Timestamp:
- May 2, 2017 1:58:01 PM (7 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- d66dbcc
- Parents:
- 74d9780 (diff), 658dd57 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/startup_configuration.py
refe730d r914ba0a 1 2 1 ################################################################################ 3 2 #This software was developed by the University of Tennessee as part of the 4 3 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 5 #project funded by the US National Science Foundation. 4 #project funded by the US National Science Foundation. 6 5 # 7 6 #See the license text in license.txt … … 14 13 import wx 15 14 16 from sas.sasgui.customdir import get_custom_config_path 15 from sas.sasgui import get_custom_config_path 16 from sas.sasgui.guiframe.events import StatusEvent 17 17 from sas.sasgui.guiframe.gui_style import GUIFRAME 18 18 from sas.sasgui.guiframe import gui_manager as CURRENT … … 32 32 'CLEANUP_PLOT':False, 33 33 'DEFAULT_PERSPECTIVE':'Fitting', 34 'DEFAULT_OPEN_FOLDER': None} 34 'DEFAULT_OPEN_FOLDER': None, 35 'SAS_OPENCL': None} 35 36 try: 36 37 CURRENT_STRINGS = {'GUIFRAME_WIDTH':CURRENT.GUIFRAME_WIDTH, … … 46 47 'CLEANUP_PLOT':CURRENT.CLEANUP_PLOT, 47 48 'DEFAULT_PERSPECTIVE':CURRENT.DEFAULT_PERSPECTIVE, 48 'DEFAULT_OPEN_FOLDER':CURRENT.DEFAULT_OPEN_FOLDER} 49 'DEFAULT_OPEN_FOLDER':CURRENT.DEFAULT_OPEN_FOLDER, 50 'SAS_OPENCL': None} 49 51 except: 50 52 CURRENT_STRINGS = DEFAULT_STRINGS … … 61 63 """ 62 64 def __init__(self, parent, gui, id=-1, title="Startup Setting"): 63 wx.Dialog.__init__(self, parent, id, title, 65 wx.Dialog.__init__(self, parent, id, title, 64 66 size=(PANEL_WIDTH, PANEL_HEIGHT)) 65 67 # parent 66 68 self.parent = parent 67 69 self._gui = gui 68 # font size 70 # font size 69 71 self.SetWindowVariant(variant=FONT_VARIANT) 70 72 self.current_string = copy.deepcopy(CURRENT_STRINGS) … … 74 76 title_text = wx.StaticText(self, id=wx.NewId(), label='Set interface configuration') 75 77 76 default_bt = wx.RadioButton(self, -1, 'Default View', (15, 30), 78 default_bt = wx.RadioButton(self, -1, 'Default View', (15, 30), 77 79 style=wx.RB_GROUP) 78 80 default_bt.Bind(wx.EVT_RADIOBUTTON, self.OnDefault) … … 85 87 note_txt = wx.StaticText(self, -1, msg, (15, 75)) 86 88 note_txt.SetForegroundColour("black") 87 89 88 90 hbox = wx.BoxSizer(wx.HORIZONTAL) 89 91 okButton = wx.Button(self, wx.ID_OK, 'Set', size=(70, 25)) 90 closeButton = wx.Button(self, wx.ID_CANCEL, 'Cancel', size=(70, 25))92 closeButton = wx.Button(self, wx.ID_CANCEL, 'Cancel', size=(70, 25)) 91 93 hbox.Add(closeButton, 1, wx.RIGHT, 5) 92 94 hbox.Add(okButton, 1, wx.RIGHT, 5) … … 100 102 self.SetSizer(vbox) 101 103 102 104 103 105 def OnDefault(self, event=None): 104 106 """ … … 109 111 self.return_string = copy.deepcopy(DEFAULT_STRINGS) 110 112 return self.return_string 111 113 112 114 def OnCurrent(self, event=None): 113 115 """ … … 127 129 width, _ = panel.frame.GetSizeTuple() 128 130 if panel.frame.IsShown(): 129 if p_size ==None or width > p_size:131 if p_size is None or width > p_size: 130 132 p_size = width 131 if p_size ==None:133 if p_size is None: 132 134 p_size = CURRENT_STRINGS['PLOPANEL_WIDTH'] 133 135 self.current_string['PLOPANEL_WIDTH'] = p_size 134 136 135 137 try: 136 138 control_frame = self.parent.get_current_perspective().frame … … 141 143 self.current_string['CONTROL_WIDTH'] = -1 142 144 self.current_string['CONTROL_HEIGHT'] = -1 143 145 144 146 data_pw, _ = self.parent.panels["data_panel"].frame.GetSizeTuple() 145 if data_pw ==None:147 if data_pw is None: 146 148 data_pw = CURRENT_STRINGS['DATAPANEL_WIDTH'] 147 149 self.current_string['DATAPANEL_WIDTH'] = data_pw 148 150 149 151 #label = self.parent._data_panel_menu.GetText() 150 152 label = self.parent.panels['data_panel'].frame.IsShown() … … 153 155 else: 154 156 self.current_string['DATALOADER_SHOW'] = False 155 157 156 158 if self.parent._toolbar.IsShown(): 157 159 self.current_string['TOOLBAR_SHOW'] = True 158 160 else: 159 161 self.current_string['TOOLBAR_SHOW'] = False 160 162 161 163 style = self._gui & GUIFRAME.FLOATING_PANEL 162 if style == GUIFRAME.FLOATING_PANEL: 164 if style == GUIFRAME.FLOATING_PANEL: 163 165 self.current_string['FIXED_PANEL'] = False 164 166 else: 165 167 self.current_string['FIXED_PANEL'] = True 166 168 167 169 if self.parent.panels['default'].frame.IsShown(): 168 170 self.current_string['WELCOME_PANEL_SHOW'] = True … … 180 182 self.current_string['DEFAULT_OPEN_FOLDER'] = location 181 183 #self.parent._default_save_location.ascii_letters 182 184 183 185 except: 184 186 raise … … 186 188 self.return_string = self.current_string 187 189 return self.return_string 188 190 191 189 192 def write_custom_config(self): 190 193 """ … … 193 196 path = get_custom_config_path() 194 197 with open(path, 'w') as out_f: 195 out_f.write("#Application appearance custom configuration\n" 198 out_f.write("#Application appearance custom configuration\n") 196 199 for key, item in self.return_string.iteritems(): 197 200 if (key == 'DEFAULT_PERSPECTIVE') or \ 198 201 (key == 'DEFAULT_OPEN_FOLDER' and item != None): 199 out_f.write("%s = \"%s\"\n" % (key, str(item)))202 out_f.write("%s = \"%s\"\n" % (key, str(item))) 200 203 else: 201 out_f.write("%s = %s\n" % (key, str(item)))204 out_f.write("%s = %s\n" % (key, str(item)))
Note: See TracChangeset
for help on using the changeset viewer.