Changeset 52070a1 in sasview


Ignore:
Timestamp:
Jan 17, 2010 2:35:43 PM (14 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:
d68c655
Parents:
aafa962
Message:

gui_frame: updated the version checker to minimize visible effect on performance.

Location:
guiframe
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/gui_manager.py

    r6bbcbd9 r52070a1  
    518518                n_panels += 1 
    519519        
    520         if n_panels>5: 
     520        if n_panels>2: 
    521521            viewmenu = wx.Menu() 
    522522            for plug in self.plugins: 
     
    689689        """ 
    690690            Check with the deployment server whether a new version 
    691             of the application is available 
    692         """ 
    693         import urllib 
    694         try:  
    695             h = urllib.urlopen(config.__update_URL__) 
    696             lines = h.readlines() 
    697             line = '' 
    698             if len(lines)>0: 
    699                 line = lines[0] 
    700                  
    701                 toks = line.lstrip().rstrip().split('.') 
    702                 toks_current = config.__version__.split('.') 
    703                 update_available = False 
    704                 for i in range(len(toks)): 
    705                     if len(toks[i].strip())>0: 
    706                         if int(toks[i].strip())>int(toks_current[i]): 
    707                             update_available = True 
    708                 if update_available: 
    709                     #print "Version %s is available" % line.rstrip().lstrip() 
    710                     self.SetStatusText("Version %s is available! See the Help menu to download it." % line.rstrip().lstrip()) 
    711                     if event != None: 
    712                         import webbrowser 
    713                         webbrowser.open(config.__download_page__) 
    714                 else: 
    715                     if event != None: 
    716                         self.SetStatusText("You have the latest version of %s" % config.__appname__) 
     691            of the application is available. 
     692            A thread is started for the connecting with the server. The thread calls 
     693            a call-back method when the current version number has been obtained. 
     694        """ 
     695        import version 
     696        checker = version.VersionThread(config.__update_URL__, self._process_version, baggage=event==None) 
     697        checker.start()   
     698     
     699    def _process_version(self, version, standalone=True): 
     700        """ 
     701            Call-back method for the process of checking for updates. 
     702            This methods is called by a VersionThread object once the current 
     703            version number has been obtained. If the check is being done in the 
     704            background, the user will not be notified unless there's an update. 
     705             
     706            @param version: version string 
     707            @param standalone: True of the update is being checked in the background, False otherwise. 
     708        """ 
     709        try: 
     710            if cmp(version, config.__version__)>0: 
     711                self.SetStatusText("Version %s is available! See the Help menu to download it." % version) 
     712                if not standalone: 
     713                    import webbrowser 
     714                    webbrowser.open(config.__download_page__) 
     715            else: 
     716                if not standalone: 
     717                    self.SetStatusText("You have the latest version of %s" % config.__appname__) 
    717718        except: 
    718719            logging.error("guiframe: could not get latest application version number\n  %s" % sys.exc_value) 
    719             if event != None: 
    720                 self.SetStatusText("You have the latest version of %s" % config.__appname__) 
    721              
    722              
     720            if not standalone: 
     721                self.SetStatusText("Could not connect to the application server. Please try again later.") 
     722                     
     723         
    723724    def _onAbout(self, evt): 
    724725        """ 
Note: See TracChangeset for help on using the changeset viewer.