diff options
author | 10se1ucgo <hammaadu1@gmail.com> | 2016-03-24 22:36:32 +0300 |
---|---|---|
committer | 10se1ucgo <hammaadu1@gmail.com> | 2016-03-24 22:36:32 +0300 |
commit | 6766735fe250a9999c4f612435eb64ee705aa94f (patch) | |
tree | bd61b982a38c5cbb31a71a6f964cdae5b0f33baf | |
parent | d64513da403a66d1df4c4da59838cdbc8ff874af (diff) |
Update checker
-rw-r--r-- | dwt.py | 6 | ||||
-rw-r--r-- | dwt_about.py | 23 | ||||
-rw-r--r-- | dwt_util.py | 5 |
3 files changed, 29 insertions, 5 deletions
@@ -14,12 +14,12 @@ # # You should have received a copy of the GNU General Public License # along with DisableWinTracking. If not, see <http://www.gnu.org/licenses/>. -import os import logging import sys import io import platform import traceback +import webbrowser from ctypes import windll import wx @@ -68,7 +68,7 @@ class ConsoleDialog(wx.Dialog): self.SetSizer(top_sizer) def submit_issue(self, event): - os.startfile("https://github.com/10se1ucgo/DisableWinTracking/issues/new") + webbrowser.open_new_tab("https://github.com/10se1ucgo/DisableWinTracking/issues/new") class MainFrame(wx.Frame): @@ -236,7 +236,6 @@ class MainPanel(wx.Panel): self.Bind(wx.EVT_BUTTON, handler=self.go, source=go_button) self.SetSizer(top_sizer) - print(self.GetSize()) def select_all_apps(self, event): # Iters through all children of the wxStaticBox of the wxStaticBoxSizer and checks/un checks all wxCheckBoxes. @@ -422,5 +421,6 @@ if __name__ == '__main__': console = ConsoleDialog(sys.stdout) setup_logging() sys.excepthook = exception_hook + dwt_about.update_check(None) frame.Show() wx_app.MainLoop() diff --git a/dwt_about.py b/dwt_about.py index 1746ff0..4b9b2ec 100644 --- a/dwt_about.py +++ b/dwt_about.py @@ -16,6 +16,11 @@ # along with DisableWinTracking. If not, see <http://www.gnu.org/licenses/>. # dwt.py will become cluttered enough :^) +import json +import urllib.request +import webbrowser +from distutils.version import StrictVersion + import wx import wx.adv import wx.lib.scrolledpanel as sp @@ -158,3 +163,21 @@ class Licenses(wx.Dialog): self.scrolled_panel.SetSizerAndFit(self.scroll_sizer) self.scrolled_panel.SetupScrolling() self.Show() + + +def update_check(parent): + response = urllib.request.urlopen('https://api.github.com/repos/10se1ucgo/DisableWinTracking/releases/latest') + release = json.loads(response.read().decode()) + if release['prerelease']: + return + new = release['tag_name'] + + try: + if StrictVersion(__version__) < StrictVersion(new.lstrip('v')): + info = wx.MessageDialog(parent, message="DWT {v} is now available!\nGo to download page?".format(v=new), + caption="DWT Update", style=wx.OK | wx.CANCEL | wx.ICON_INFORMATION) + if info.ShowModal() == wx.ID_OK: + webbrowser.open_new_tab(release['html_url']) + info.Destroy() + except ValueError: + pass diff --git a/dwt_util.py b/dwt_util.py index 85ce134..31cd033 100644 --- a/dwt_util.py +++ b/dwt_util.py @@ -21,11 +21,12 @@ import pywintypes import shutil import subprocess import tempfile -import win32serviceutil -import winerror import winreg import shlex +import win32serviceutil +import winerror + logger = logging.getLogger('dwt.util') |