Ignore:
File:
1 edited

Legend:

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

    radb0851 re6de6b8  
    11521152                self.delete_panel(ID) 
    11531153                break 
    1154         self.cpanel_on_focus.SetFocus() 
     1154        if self.cpanel_on_focus is not None: 
     1155            self.cpanel_on_focus.SetFocus() 
    11551156 
    11561157 
     
    13331334                    self._applications_menu_name = name 
    13341335 
    1335     def _on_marketplace_click(self, event): 
    1336         """ 
    1337             Click event for the help menu item linking to the Marketplace. 
    1338         """ 
    1339         import webbrowser 
    1340         webbrowser.open_new(config.marketplace_url) 
    1341  
    13421336    def _add_help_menu(self): 
    13431337        """ 
     
    13451339        tutorial PDF and documentation pages. 
    13461340        """ 
     1341        # Help menu 
    13471342        self._help_menu = wx.Menu() 
     1343        style = self.__gui_style & GUIFRAME.WELCOME_PANEL_ON 
    13481344 
    13491345        wx_id = wx.NewId() 
    13501346        self._help_menu.Append(wx_id, '&Documentation', '') 
    13511347        wx.EVT_MENU(self, wx_id, self._onSphinxDocs) 
     1348        self._help_menu.AppendSeparator() 
    13521349 
    13531350        if config._do_tutorial and (IS_WIN or sys.platform == 'darwin'): 
     
    13551352            self._help_menu.Append(wx_id, '&Tutorial', 'Software tutorial') 
    13561353            wx.EVT_MENU(self, wx_id, self._onTutorial) 
     1354            self._help_menu.AppendSeparator() 
     1355 
    13571356 
    13581357        if config._do_acknowledge: 
     
    13601359            self._help_menu.Append(wx_id, '&Acknowledge', 'Acknowledging SasView') 
    13611360            wx.EVT_MENU(self, wx_id, self._onAcknowledge) 
     1361            self._help_menu.AppendSeparator() 
     1362 
    13621363 
    13631364        if config._do_aboutbox: 
     
    13661367            self._help_menu.Append(wx_id, '&About', 'Software information') 
    13671368            wx.EVT_MENU(self, wx_id, self._onAbout) 
    1368  
    1369         if config.marketplace_url: 
    1370             wx_id = wx.NewId() 
    1371             self._help_menu.Append(wx_id, '&Model marketplace', '') 
    1372             wx.EVT_MENU(self, wx_id, self._on_marketplace_click) 
     1369            self._help_menu.AppendSeparator() 
     1370 
    13731371 
    13741372        # Checking for updates 
     
    19071905        if self._default_save_location == None: 
    19081906            self._default_save_location = os.getcwd() 
    1909         wx.PostEvent(self, StatusEvent(status="Loading Project file...")) 
    1910         dlg = wx.FileDialog(self, 
     1907        msg = "This operation will set SasView to its freshly opened state " 
     1908        msg += "before loading the project. Do you wish to continue?" 
     1909        if not self._data_panel.on_remove(None, msg): 
     1910            wx.PostEvent(self, StatusEvent(status="Loading Project file...")) 
     1911            dlg = wx.FileDialog(self, 
    19111912                            "Choose a file", 
    19121913                            self._default_save_location, "", 
    19131914                            APPLICATION_WLIST) 
    1914         if dlg.ShowModal() == wx.ID_OK: 
    1915             path = dlg.GetPath() 
     1915            if dlg.ShowModal() == wx.ID_OK: 
     1916                path = dlg.GetPath() 
    19161917            if path is not None: 
    19171918                self._default_save_location = os.path.dirname(path) 
    1918         dlg.Destroy() 
    1919  
    1920         self.load_state(path=path, is_project=True) 
     1919                dlg.Destroy() 
     1920                # Reset to a base state 
     1921                self._on_reset_state() 
     1922                # Load the project file 
     1923                self.load_state(path=path, is_project=True) 
     1924 
     1925    def _on_reset_state(self): 
     1926        """ 
     1927        Resets SasView to its freshly opened state. 
     1928        :return: None 
     1929        """ 
     1930        # Reset all plugins to their base state 
     1931        self._data_panel.set_panel_on_focus() 
     1932        # Remove all loaded data 
     1933        self._data_panel.selection_cbox.SetValue('Select all Data') 
     1934        self._data_panel._on_selection_type(None) 
     1935        for plugin in self.plugins: 
     1936            plugin.clear_panel() 
     1937        # Reset plot number to 0 
     1938        self.graph_num = 0 
    19211939 
    19221940    def _on_save_application(self, event): 
     
    20662084            except: 
    20672085                logging.info("Failed to connect to www.sasview.org") 
    2068         self._process_version(version_info, standalone=event == None)     
    2069  
    2070          
    2071          
    2072 #          
    2073 #         try: 
    2074 #             req = urllib2.Request(config.__update_URL__) 
    2075 #             res = urllib2.urlopen(req) 
    2076 #             content = res.read().strip() 
    2077 #             logging.info("Connected to www.sasview.org. Latest version: %s" 
    2078 #                          % (content)) 
    2079 #             version_info = json.loads(content) 
    2080 #         except: 
    2081 #             logging.info("Failed to connect to www.sasview.org") 
    2082 #             version_info = {"version": "0.0.0"} 
    2083 #         self._process_version(version_info, standalone=event == None) 
     2086        self._process_version(version_info, standalone=event == None) 
    20842087 
    20852088    def _process_version(self, version_info, standalone=True): 
Note: See TracChangeset for help on using the changeset viewer.