mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Check for updates now works from the menu bar too
This commit is contained in:
parent
b7193d16ee
commit
3a9a49d64c
@ -2,6 +2,7 @@
|
||||
from wxUI import (view, dialogs, commonMessageDialogs)
|
||||
from twitter import utils
|
||||
from sessionmanager import manager
|
||||
from update import updater
|
||||
import buffersController
|
||||
import messages
|
||||
import settings
|
||||
@ -138,6 +139,7 @@ class Controller(object):
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_more_items, menuitem=self.view.load_previous_items)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.clear_buffer, menuitem=self.view.clear)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.remove_buffer, self.view.deleteTl)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.check_for_updates, self.view.check_for_updates)
|
||||
widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed)
|
||||
|
||||
def __init__(self):
|
||||
@ -344,8 +346,10 @@ class Controller(object):
|
||||
def report_error(self):
|
||||
pass
|
||||
|
||||
def check_for_updates(self, show_msg=True):
|
||||
pass
|
||||
def check_for_updates(self, *args, **kwargs):
|
||||
update = updater.do_update()
|
||||
if update == False:
|
||||
view.no_update_available()
|
||||
|
||||
def show_details_for_user(self, user):
|
||||
pass
|
||||
|
@ -19,11 +19,11 @@ def perform_update(endpoint, current_version, app_name='', password=None, update
|
||||
available_update = find_update(endpoint, requests_session=requests_session)
|
||||
if not available_update:
|
||||
logger.debug("No update available")
|
||||
return
|
||||
return False
|
||||
available_version = available_update['current_version']
|
||||
if not str(available_version) > str(current_version) or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']:
|
||||
logger.debug("No update for this architecture")
|
||||
return
|
||||
return False
|
||||
available_description = available_update.get('description', None)
|
||||
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
|
||||
logger.info("A new update is available. Version %s" % available_version)
|
||||
|
@ -6,6 +6,6 @@ from wxUpdater import *
|
||||
|
||||
def do_update():
|
||||
# try:
|
||||
update.perform_update(endpoint=application.update_url, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
||||
return update.perform_update(endpoint=application.update_url, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
||||
# except:
|
||||
# pass
|
@ -76,7 +76,6 @@ class mainFrame(wx.Frame):
|
||||
self.changelog = help.Append(wx.NewId(), _(u"&What's new in this version?"))
|
||||
self.changelog.Enable(False)
|
||||
self.check_for_updates = help.Append(wx.NewId(), _(u"&Check for updates"))
|
||||
self.check_for_updates.Enable(False)
|
||||
self.reportError = help.Append(wx.NewId(), _(u"&Report an error"))
|
||||
self.reportError.Enable(False)
|
||||
self.visit_website = help.Append(-1, _(u"TW Blue &website"))
|
||||
@ -172,4 +171,7 @@ class mainFrame(wx.Frame):
|
||||
wx.MessageDialog(self, address, _(u"Address"), wx.OK).ShowModal()
|
||||
|
||||
def delete_buffer(self, pos):
|
||||
self.nb.DeletePage(pos)
|
||||
self.nb.DeletePage(pos)
|
||||
|
||||
def no_update_available():
|
||||
wx.MessageDialog(None, _(u"Your TW Blue version is up to date"), _(u"Update"), style=wx.OK).ShowModal()
|
||||
|
Loading…
Reference in New Issue
Block a user