Changeset 3d6b00c in sasview


Ignore:
Timestamp:
Apr 7, 2014 3:49:02 PM (10 years ago)
Author:
Mathieu Doucet <doucetm@…>
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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d11d1aa
Parents:
443a487
Message:

Fix wx3.0 issues with windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sans/guiframe/gui_manager.py

    r4d7e5d5 r3d6b00c  
    298298        # Welcome panel 
    299299        self.defaultPanel = None 
     300        self.welcome_panel_class = None 
    300301        #panel on focus 
    301302        self.panel_on_focus = None 
     
    758759        # set tool bar 
    759760        self._setup_tool_bar() 
     761 
     762        # Create the menu bar. To be filled later. 
     763        # WX 3.0 needs us to create the menu bar first. 
     764        self._menubar = wx.MenuBar() 
     765        self.SetMenuBar(self._menubar) 
    760766        # Set up the layout 
    761767        self._setup_layout() 
     
    770776                                             str(self._input_file)) 
    771777            msg += str(sys.exc_value) + '\n' 
    772             print msg 
     778            logging.error(msg) 
    773779        if self._data_panel is not None and len(self.plugins) > 0: 
    774780            self._data_panel.fill_cbox_analysis(self.plugins) 
     
    932938 
    933939        return plugins 
    934      
    935     def set_welcome_panel(self, panel_class): 
    936         """ 
    937         Sets the default panel as the given welcome panel  
    938          
    939         :param panel_class: class of the welcome panel to be instantiated 
    940          
    941         """ 
    942         win = MDIFrame(self, None, 'None', (100, 200)) 
    943         self.defaultPanel = panel_class(win, -1, style=wx.RAISED_BORDER) 
    944         win.set_panel(self.defaultPanel) 
    945         self.defaultPanel.set_frame(win) 
    946         win.Show(False) 
    947          
     940 
    948941    def _get_panels_size(self, p): 
    949942        """ 
     
    986979                ps = item.get_panels(self) 
    987980                panels.extend(ps) 
    988         
    989         # Show a default panel with some help information 
    990         # It also sets the size of the application windows 
    991         #TODO: Use this for splash screen 
    992         #if self.defaultPanel is None: 
    993         #    self.defaultPanel = DefaultPanel(self, -1, style=wx.RAISED_BORDER) 
    994         # add a blank default panel always present  
     981         
     982        # Set up welcome panel 
     983        #TODO: this needs serious simplification 
     984        if self.welcome_panel_class is not None: 
     985            welcome_panel = MDIFrame(self, None, 'None', (100, 200)) 
     986            self.defaultPanel = self.welcome_panel_class(welcome_panel, -1, style=wx.RAISED_BORDER) 
     987            welcome_panel.set_panel(self.defaultPanel) 
     988            self.defaultPanel.set_frame(welcome_panel) 
     989            welcome_panel.Show(False) 
     990         
    995991        self.panels["default"] = self.defaultPanel 
    996         w, h = self._get_panels_size(self.defaultPanel) 
    997         frame = self.defaultPanel.get_frame() 
    998         frame.SetSize((self._window_width, self._window_height)) 
    999992        size_t_bar = 70 
    1000         if not IS_WIN: 
    1001             if IS_LINUX: 
    1002                 size_t_bar = 115 
    1003             frame.SetPosition((0, mac_pos_y + size_t_bar)) 
    1004         frame.Show(True) 
     993        if IS_LINUX: 
     994            size_t_bar = 115 
     995        if self.defaultPanel is not None: 
     996            w, h = self._get_panels_size(self.defaultPanel) 
     997            frame = self.defaultPanel.get_frame() 
     998            frame.SetSize((self._window_width, self._window_height)) 
     999            if not IS_WIN: 
     1000                frame.SetPosition((0, mac_pos_y + size_t_bar)) 
     1001            frame.Show(True) 
    10051002        #add data panel  
    10061003        win = MDIFrame(self, None, 'None', (100, 200)) 
     
    12191216        """ 
    12201217        # Menu 
    1221         self._menubar = wx.MenuBar() 
    12221218        self._add_menu_file() 
    12231219        self._add_menu_edit() 
     
    12291225        #self._add_menu_window() 
    12301226        self._add_help_menu() 
    1231         self.SetMenuBar(self._menubar) 
    12321227         
    12331228    def _setup_tool_bar(self): 
     
    12381233        # The legacy code doesn't work well for wx 3.0 
    12391234        # but the old code produces better results with wx 2.8 
    1240         if wx.VERSION_STRING >= '3.0.0.0': 
     1235        if not IS_WIN and wx.VERSION_STRING >= '3.0.0.0': 
    12411236            sizer = wx.BoxSizer(wx.VERTICAL) 
    12421237            sizer.Add(self._toolbar, 0, wx.EXPAND) 
     
    16791674            caption = self.panels[ID].window_caption 
    16801675        except: 
    1681             print "delete_panel: No such plot id as %s" % ID 
     1676            logging.error("delete_panel: No such plot id as %s" % ID) 
    16821677            return 
    16831678        if ID in self.panels.keys(): 
     
    17171712            log_msg += "load: %s\n" % str(basename) 
    17181713            log_msg += "Try Data opening...." 
    1719             logging.info(log_msg) 
    1720             print log_msg 
    1721             #self.load_complete(output=output, error_message=error_message, 
    1722             #       message=log_msg, path=path)     
     1714            logging.error(log_msg) 
    17231715            return 
    17241716         
     
    17991791            log_msg += "load: %s\n" % str(path) 
    18001792            log_msg += "Try File opening ...." 
    1801             print log_msg 
     1793            logging.error(log_msg) 
    18021794            return 
    18031795        log_msg = '' 
     
    18051797        error_message = "" 
    18061798        try: 
    1807             print "Loading Data...:\n" + str(path) + "\n" 
     1799            logging.info("Loading Data...:\n" + str(path) + "\n") 
    18081800            temp =  self.loader.load(path) 
    18091801            if temp.__class__.__name__ == "list": 
     
    18201812            error_message += " Data from cmd:\n %s\n" % str(path) 
    18211813            error_message += str(sys.exc_value) + "\n" 
    1822             print error_message 
     1814            logging.error(error_message) 
    18231815  
    18241816    def load_folder(self, path): 
     
    18411833            error_message += " Data folder from cmd:\n %s\n" % str(path) 
    18421834            error_message += str(sys.exc_value) + "\n" 
    1843             print error_message  
     1835            logging.error(error_message) 
    18441836             
    18451837    def _on_open_state_application(self, event): 
     
    21302122                    dialog.Show(True)  
    21312123                except: 
    2132                     print "Error in _onTutorial: %s" % sys.exc_value 
     2124                    logging.error("Error in _onTutorial: %s" % sys.exc_value) 
    21332125                    try: 
    21342126                        #in case when the pdf default set other than acrobat 
     
    33023294         
    33033295        """ 
    3304         self.frame.set_welcome_panel(panel_class) 
     3296        self.frame.welcome_panel_class = panel_class 
    33053297         
    33063298    def add_perspective(self, perspective): 
     
    34183410    Frame for panels 
    34193411    """ 
    3420     def __init__(self, parent, panel, title="Untitled", 
    3421                 size=(300,200), *args, **kwds): 
     3412    def __init__(self, parent, panel, title="Untitled", size=(300,200)): 
    34223413        """ 
    34233414        comment 
    34243415        :param parent: parent panel/container 
    34253416        """ 
    3426         kwds['size']= size 
    3427         kwds['title']= title 
    3428         kwds['style'] = MDI_STYLE 
    34293417        # Initialize the Frame object 
    3430         CHILD_FRAME.__init__(self, parent, *args, **kwds) 
     3418        CHILD_FRAME.__init__(self, parent=parent, id=wx.ID_ANY, title=title, size=size) 
    34313419        self.parent = parent 
    34323420        self.name = "Untitled" 
Note: See TracChangeset for help on using the changeset viewer.