From f51c873324821c75e228ac3af906ad1c37317adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 22 Apr 2015 15:34:44 -0500 Subject: [PATCH] New snapshot --- src/application.py | 2 +- src/controller/mainController.py | 2 +- src/languageHandler.py | 14 +++++--------- src/sessionmanager/gtkUI.py | 2 ++ src/sessionmanager/sessionManager.py | 14 +++++++++++++- src/sessionmanager/wxUI.py | 5 +++++ src/update/updater.py | 8 ++++---- 7 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/application.py b/src/application.py index 58da0898..d6c9c3f4 100644 --- a/src/application.py +++ b/src/application.py @@ -5,7 +5,7 @@ if snapshot == False: version = "0.80" update_url = 'http://twblue.es/updates/twblue_ngen.json' else: - version = "9" + version = "9.1" update_url = 'http://twblue.es/updates/snapshots_ngen.json' author = u"Manuel Cortéz" authorEmail = "manuel@manuelcortez.net" diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 8885b183..ba93aa79 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1173,7 +1173,7 @@ class Controller(object): webbrowser.open(application.url) def manage_accounts(self, *args, **kwargs): - sm = sessionManager.sessionManagerController() + sm = sessionManager.sessionManagerController(started=True) sm.fill_list() sm.show() for i in sm.new_sessions: diff --git a/src/languageHandler.py b/src/languageHandler.py index 45546eb4..334213f8 100644 --- a/src/languageHandler.py +++ b/src/languageHandler.py @@ -6,9 +6,6 @@ import locale import gettext import paths import platform -import logging - -log = logging.getLogger("languageHandler") # A fix for the mac locales #if platform.system() == 'Darwin': @@ -119,7 +116,6 @@ def makePgettext(translations): return pgettext def setLanguage(lang): - log.debug("Setting language for: %s" % (lang,)) system = platform.system() global curLang try: @@ -130,10 +126,12 @@ def setLanguage(lang): elif system == "Darwin": import Foundation localeName = Foundation.NSLocale.currentLocale().identifier() - else: - localeName=locale.getdefaultlocale()[0] + elif system == "Linux": + localeName = locale.getdefaultlocale()[0] trans=gettext.translation('twblue', localedir=paths.locale_path(), languages=[localeName]) curLang=localeName +# else: +# localeName=locale.getdefaultlocale()[0] # trans=gettext.translation('twblue', localedir=paths.locale_path(), languages=[localeName]) # curLang=localeName @@ -165,7 +163,6 @@ def setLanguage(lang): trans=gettext.translation("twblue",fallback=True) curLang="en" trans.install(unicode=True) -# log.debug(u"Current language: %s" % (curLang,)) # Install our pgettext function. # __builtin__.__dict__["pgettext"] = makePgettext(trans) @@ -191,13 +188,12 @@ def langToWindowsLocale(lang): languages = {"en": "eng", "ar": "ara", "ca": "cat", - "de": "deu", +"de": "deu", "es": "esp", "fi": "fin", "fr": "fre_FRA", "gl": "glc", "eu": "euq", - "hr": "hrv", "hu": "hun", "it": "ita", "pl": "plk", diff --git a/src/sessionmanager/gtkUI.py b/src/sessionmanager/gtkUI.py index f83f249b..3d190a9b 100644 --- a/src/sessionmanager/gtkUI.py +++ b/src/sessionmanager/gtkUI.py @@ -9,8 +9,10 @@ class sessionManagerWindow(widgetUtils.baseDialog): btnBox = Gtk.Box(spacing=6) self.new = Gtk.Button("New account") self.remove = Gtk.Button("Remove account") + self.configuration = Gtk.Button("Configuration") btnBox.add(self.new) btnBox.add(self.remove) + btnBox.add(self.configuration) self.box.add(btnBox) self.show_all() diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index 62d34686..7dea3c63 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -4,6 +4,7 @@ import widgetUtils import platform if platform.system() == "Windows": import wxUI as view + from controller import settings elif platform.system() == "Linux": import gtkUI as view import paths @@ -18,13 +19,18 @@ import config log = logging.getLogger("sessionmanager.sessionManager") class sessionManagerController(object): - def __init__(self): + def __init__(self, started=False): super(sessionManagerController, self).__init__() log.debug("Setting up the session manager.") + self.started = started manager.setup() self.view = view.sessionManagerWindow() widgetUtils.connect_event(self.view.new, widgetUtils.BUTTON_PRESSED, self.manage_new_account) widgetUtils.connect_event(self.view.remove, widgetUtils.BUTTON_PRESSED, self.remove) + if self.started == False: + widgetUtils.connect_event(self.view.configuration, widgetUtils.BUTTON_PRESSED, self.configuration) + else: + self.view.hide_configuration() self.new_sessions = {} self.removed_sessions = [] @@ -87,3 +93,9 @@ class sessionManagerController(object): self.sessions.remove(selected_account) shutil.rmtree(path=paths.config_path(selected_account), ignore_errors=True) + + def configuration(self, *args, **kwargs): + """ Opens the global settings dialogue.""" + d = settings.globalSettingsController() + if d.response == widgetUtils.OK: + d.save_configuration() diff --git a/src/sessionmanager/wxUI.py b/src/sessionmanager/wxUI.py index 743ee358..b0be10ab 100644 --- a/src/sessionmanager/wxUI.py +++ b/src/sessionmanager/wxUI.py @@ -15,11 +15,13 @@ class sessionManagerWindow(wx.Dialog): sizer.Add(listSizer, 0, wx.ALL, 5) self.new = wx.Button(panel, -1, u"New account", size=wx.DefaultSize) self.remove = wx.Button(panel, -1, _(u"Remove account")) + self.configuration = wx.Button(panel, -1, _(u"Global Settings")) ok = wx.Button(panel, wx.ID_OK, size=wx.DefaultSize) ok.SetDefault() cancel = wx.Button(panel, wx.ID_CANCEL, size=wx.DefaultSize) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(self.new, 0, wx.ALL, 5) + buttons.Add(self.configuration, 0, wx.ALL, 5) buttons.Add(ok, 0, wx.ALL, 5) buttons.Add(cancel, 0, wx.ALL, 5) sizer.Add(buttons, 0, wx.ALL, 5) @@ -66,3 +68,6 @@ class sessionManagerWindow(wx.Dialog): def remove_session(self, sessionID): self.list.remove_item(sessionID) + + def hide_configuration(self): + self.configuration.Hide() \ No newline at end of file diff --git a/src/update/updater.py b/src/update/updater.py index d5635738..f5d250f0 100644 --- a/src/update/updater.py +++ b/src/update/updater.py @@ -5,7 +5,7 @@ import platform from wxUpdater import * def do_update(): -# try: - 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 \ No newline at end of file + try: + 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 \ No newline at end of file