From a7dcc226898fb03278be05b4191f2be20e890a6d Mon Sep 17 00:00:00 2001 From: "tobiaskummer@googlemail.com" Date: Sun, 3 Apr 2016 19:05:06 +0200 Subject: [PATCH] added self-updating capabilities --- BlenderUpdater.py | 18 +++++++++++++++++- setup.py | 13 +++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 setup.py diff --git a/BlenderUpdater.py b/BlenderUpdater.py index 69c5b38..276401c 100644 --- a/BlenderUpdater.py +++ b/BlenderUpdater.py @@ -27,8 +27,13 @@ import configparser import shutil from distutils.dir_util import copy_tree +from esky import * +from esky.util import appexe_from_executable + + +appversion = '0.4' dir_ = '' config = configparser.ConfigParser() btn = {} @@ -97,6 +102,16 @@ def __init__(self, parent=None): self.btn_about.clicked.connect(self.about) # connect About button self.btn_path.clicked.connect(self.select_path) # connect the path button + ''' Auto-update function''' + if hasattr(sys, "frozen"): + exe = esky.Esky(sys.executable, "http://www.overmind-studios.de/blenderupdater") + if exe.find_update(): + reply = QtGui.QMessageBox.question(self, 'Update', "New version of BlenderUpdater available. Do you want to update?", + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) + if reply == QtGui.QMessageBox.Yes: + exe.auto_update() + else: + pass def select_path(self): global dir_ @@ -113,7 +128,8 @@ def about(self): Licensed under the Apache 2.0 license

Project home: \ https://github.com/tobkum/BlenderUpdater

' + underline; color:#2980b9;">https://github.com/tobkum/BlenderUpdater

\ + Application version: ' + appversion + '' QtGui.QMessageBox.about(self, 'About', aboutText) def check_dir(self): diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..afd138f --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +import sys +from esky import bdist_esky +from distutils.core import setup +from esky.bdist_esky import Executable + + +setup( + name = 'BlenderUpdater', + version = '0.4', + options = {"bdist_esky": { + "freezer_module":"cxfreeze" + }}, + scripts = [Executable('BlenderUpdater.py', gui_only=True)],)