Ignore:
Timestamp:
May 2, 2017 1:58:01 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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.
Message:

merge with master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/startup_configuration.py

    refe730d r914ba0a  
    1  
    21################################################################################ 
    32#This software was developed by the University of Tennessee as part of the 
    43#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. 
    65# 
    76#See the license text in license.txt 
     
    1413import wx 
    1514 
    16 from sas.sasgui.customdir import get_custom_config_path 
     15from sas.sasgui import get_custom_config_path 
     16from sas.sasgui.guiframe.events import StatusEvent 
    1717from sas.sasgui.guiframe.gui_style import GUIFRAME 
    1818from sas.sasgui.guiframe import gui_manager as CURRENT 
     
    3232                   'CLEANUP_PLOT':False, 
    3333                   'DEFAULT_PERSPECTIVE':'Fitting', 
    34                    'DEFAULT_OPEN_FOLDER': None} 
     34                   'DEFAULT_OPEN_FOLDER': None, 
     35                   'SAS_OPENCL': None} 
    3536try: 
    3637    CURRENT_STRINGS = {'GUIFRAME_WIDTH':CURRENT.GUIFRAME_WIDTH, 
     
    4647                       'CLEANUP_PLOT':CURRENT.CLEANUP_PLOT, 
    4748                       '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} 
    4951except: 
    5052    CURRENT_STRINGS = DEFAULT_STRINGS 
     
    6163    """ 
    6264    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, 
    6466                           size=(PANEL_WIDTH, PANEL_HEIGHT)) 
    6567        # parent 
    6668        self.parent = parent 
    6769        self._gui = gui 
    68         # font size  
     70        # font size 
    6971        self.SetWindowVariant(variant=FONT_VARIANT) 
    7072        self.current_string = copy.deepcopy(CURRENT_STRINGS) 
     
    7476        title_text = wx.StaticText(self, id=wx.NewId(), label='Set interface configuration') 
    7577 
    76         default_bt = wx.RadioButton(self, -1, 'Default View', (15, 30),  
     78        default_bt = wx.RadioButton(self, -1, 'Default View', (15, 30), 
    7779                                    style=wx.RB_GROUP) 
    7880        default_bt.Bind(wx.EVT_RADIOBUTTON, self.OnDefault) 
     
    8587        note_txt = wx.StaticText(self, -1, msg, (15, 75)) 
    8688        note_txt.SetForegroundColour("black") 
    87          
     89 
    8890        hbox = wx.BoxSizer(wx.HORIZONTAL) 
    8991        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)) 
    9193        hbox.Add(closeButton, 1, wx.RIGHT, 5) 
    9294        hbox.Add(okButton, 1, wx.RIGHT, 5) 
     
    100102        self.SetSizer(vbox) 
    101103 
    102          
     104 
    103105    def OnDefault(self, event=None): 
    104106        """ 
     
    109111        self.return_string = copy.deepcopy(DEFAULT_STRINGS) 
    110112        return self.return_string 
    111          
     113 
    112114    def OnCurrent(self, event=None): 
    113115        """ 
     
    127129                width, _ = panel.frame.GetSizeTuple() 
    128130                if panel.frame.IsShown(): 
    129                     if p_size == None or width > p_size: 
     131                    if p_size is None or width > p_size: 
    130132                        p_size = width 
    131             if p_size == None: 
     133            if p_size is None: 
    132134                p_size = CURRENT_STRINGS['PLOPANEL_WIDTH'] 
    133135            self.current_string['PLOPANEL_WIDTH'] = p_size 
    134              
     136 
    135137            try: 
    136138                control_frame = self.parent.get_current_perspective().frame 
     
    141143                self.current_string['CONTROL_WIDTH'] = -1 
    142144                self.current_string['CONTROL_HEIGHT'] = -1 
    143                  
     145 
    144146            data_pw, _ = self.parent.panels["data_panel"].frame.GetSizeTuple() 
    145             if data_pw == None: 
     147            if data_pw is None: 
    146148                data_pw = CURRENT_STRINGS['DATAPANEL_WIDTH'] 
    147149            self.current_string['DATAPANEL_WIDTH'] = data_pw 
    148              
     150 
    149151            #label = self.parent._data_panel_menu.GetText() 
    150152            label = self.parent.panels['data_panel'].frame.IsShown() 
     
    153155            else: 
    154156                self.current_string['DATALOADER_SHOW'] = False 
    155                  
     157 
    156158            if self.parent._toolbar.IsShown(): 
    157159                self.current_string['TOOLBAR_SHOW'] = True 
    158160            else: 
    159161                self.current_string['TOOLBAR_SHOW'] = False 
    160                  
     162 
    161163            style = self._gui & GUIFRAME.FLOATING_PANEL 
    162             if style == GUIFRAME.FLOATING_PANEL:  
     164            if style == GUIFRAME.FLOATING_PANEL: 
    163165                self.current_string['FIXED_PANEL'] = False 
    164166            else: 
    165167                self.current_string['FIXED_PANEL'] = True 
    166                  
     168 
    167169            if self.parent.panels['default'].frame.IsShown(): 
    168170                self.current_string['WELCOME_PANEL_SHOW'] = True 
     
    180182            self.current_string['DEFAULT_OPEN_FOLDER'] = location 
    181183                        #self.parent._default_save_location.ascii_letters 
    182              
     184 
    183185        except: 
    184186            raise 
     
    186188        self.return_string = self.current_string 
    187189        return self.return_string 
    188      
     190 
     191 
    189192    def write_custom_config(self): 
    190193        """ 
     
    193196        path = get_custom_config_path() 
    194197        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") 
    196199            for key, item in self.return_string.iteritems(): 
    197200                if (key == 'DEFAULT_PERSPECTIVE') or \ 
    198201                    (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))) 
    200203                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.