fixes for updater
This commit is contained in:
		
							parent
							
								
									52a5d248c7
								
							
						
					
					
						commit
						e598d027eb
					
				
					 2 changed files with 7 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -259,6 +259,8 @@ class Toxygen:
 | 
			
		|||
        self.tray.show()
 | 
			
		||||
        self.tray.activated.connect(tray_activated)
 | 
			
		||||
 | 
			
		||||
        self.ms.show()
 | 
			
		||||
 | 
			
		||||
        updating = False
 | 
			
		||||
        if settings['update'] and updater.updater_available() and updater.connection_available():  # auto update
 | 
			
		||||
            version = updater.check_for_updates()
 | 
			
		||||
| 
						 | 
				
			
			@ -268,7 +270,7 @@ class Toxygen:
 | 
			
		|||
                    updating = True
 | 
			
		||||
                else:
 | 
			
		||||
                    reply = QtGui.QMessageBox.question(None,
 | 
			
		||||
                                                       '',
 | 
			
		||||
                                                       'Toxygen',
 | 
			
		||||
                                                       QtGui.QApplication.translate("login",
 | 
			
		||||
                                                                                    'Update for Toxygen was found. Download and install it?',
 | 
			
		||||
                                                                                    None,
 | 
			
		||||
| 
						 | 
				
			
			@ -286,8 +288,6 @@ class Toxygen:
 | 
			
		|||
            del self.tox
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
        self.ms.show()
 | 
			
		||||
 | 
			
		||||
        plugin_helper = PluginLoader(self.tox, settings)  # plugin support
 | 
			
		||||
        plugin_helper.load()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,14 +50,14 @@ def get_url(version):
 | 
			
		|||
        return 'https://github.com/toxygen-project/toxygen/archive/v' + version + '.zip'
 | 
			
		||||
    else:
 | 
			
		||||
        name = 'toxygen_windows.zip' if platform.system() == 'Windows' else 'toxygen_linux.tar.gz'
 | 
			
		||||
        return 'https://github.com/toxygen-project/toxygen/releases/tag/v{}/{}'.format(version, name)
 | 
			
		||||
        return 'https://github.com/toxygen-project/toxygen/releases/download/v{}/{}'.format(version, name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_params(url, version):
 | 
			
		||||
    if is_from_sources():
 | 
			
		||||
        return ['python3', 'toxygen_updater.py', url, version]
 | 
			
		||||
    elif platform.system() == 'Windows':
 | 
			
		||||
        return ['run', 'toxygen_updater.exe', url, version]
 | 
			
		||||
        return [util.curr_directory() + '/toxygen_updater.exe', url, version]
 | 
			
		||||
    else:
 | 
			
		||||
        return ['./toxygen_updater', url, version]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -66,6 +66,7 @@ def download(version):
 | 
			
		|||
    os.chdir(util.curr_directory())
 | 
			
		||||
    url = get_url(version)
 | 
			
		||||
    params = get_params(url, version)
 | 
			
		||||
    print('Updating Toxygen')
 | 
			
		||||
    try:
 | 
			
		||||
        subprocess.Popen(params)
 | 
			
		||||
    except Exception as ex:
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +90,7 @@ def send_request(version):
 | 
			
		|||
            QtCore.QThread.msleep(1)
 | 
			
		||||
            QtCore.QCoreApplication.processEvents()
 | 
			
		||||
        attr = reply.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
 | 
			
		||||
        return 200 <= attr < 300
 | 
			
		||||
        return attr is not None and 200 <= attr < 300
 | 
			
		||||
    except Exception as ex:
 | 
			
		||||
        util.log('TOXYGEN UPDATER ERROR: ' + str(ex))
 | 
			
		||||
        return False
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue