mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-17 21:56:07 -04:00
Made code indentation to comply with PEP8
This commit is contained in:
@@ -7,4 +7,4 @@ Contents of this package:
|
||||
manager: Handles multiple sessions, setting the configuration files and check if the session is valid. Part of the model.
|
||||
session: Creates a twitter session for an user. The other part of the model.
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import unicode_literals
|
||||
|
@@ -3,55 +3,55 @@ from gi.repository import Gtk
|
||||
import widgetUtils
|
||||
|
||||
class sessionManagerWindow(widgetUtils.baseDialog):
|
||||
def __init__(self):
|
||||
super(sessionManagerWindow, self).__init__("Session Manager", None, 0, (Gtk.STOCK_OK, widgetUtils.OK, Gtk.STOCK_CANCEL, widgetUtils.CANCEL))
|
||||
self.list = widgetUtils.list("Session")
|
||||
self.box.add(self.list.list)
|
||||
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()
|
||||
def __init__(self):
|
||||
super(sessionManagerWindow, self).__init__("Session Manager", None, 0, (Gtk.STOCK_OK, widgetUtils.OK, Gtk.STOCK_CANCEL, widgetUtils.CANCEL))
|
||||
self.list = widgetUtils.list("Session")
|
||||
self.box.add(self.list.list)
|
||||
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()
|
||||
|
||||
def fill_list(self, sessionsList):
|
||||
for i in sessionsList:
|
||||
self.list.insert_item(False, i)
|
||||
if self.list.get_count() > 0:
|
||||
self.list.select_item(0)
|
||||
def fill_list(self, sessionsList):
|
||||
for i in sessionsList:
|
||||
self.list.insert_item(False, i)
|
||||
if self.list.get_count() > 0:
|
||||
self.list.select_item(0)
|
||||
|
||||
def new_account_dialog(self):
|
||||
dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Authorization")
|
||||
dialog.format_secondary_text("The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?")
|
||||
answer = dialog.run()
|
||||
dialog.destroy()
|
||||
return answer
|
||||
def new_account_dialog(self):
|
||||
dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Authorization")
|
||||
dialog.format_secondary_text("The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?")
|
||||
answer = dialog.run()
|
||||
dialog.destroy()
|
||||
return answer
|
||||
|
||||
def add_new_session_to_list(self):
|
||||
total = self.list.get_count()
|
||||
name = "Authorized account %d" % (total+1)
|
||||
self.list.insert_item(name)
|
||||
if self.list.get_count() == 1:
|
||||
self.list.select_item(0)
|
||||
def add_new_session_to_list(self):
|
||||
total = self.list.get_count()
|
||||
name = "Authorized account %d" % (total+1)
|
||||
self.list.insert_item(name)
|
||||
if self.list.get_count() == 1:
|
||||
self.list.select_item(0)
|
||||
|
||||
def show_unauthorised_error(self):
|
||||
dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CANCEL, "Invalid user token")
|
||||
dialog.format_secondary_text("Your access token is invalid or the authorization has failed. Please try again.")
|
||||
answer = dialog.run()
|
||||
return answer
|
||||
def show_unauthorised_error(self):
|
||||
dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CANCEL, "Invalid user token")
|
||||
dialog.format_secondary_text("Your access token is invalid or the authorization has failed. Please try again.")
|
||||
answer = dialog.run()
|
||||
return answer
|
||||
|
||||
def remove_account_dialog(self):
|
||||
dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Remove account")
|
||||
dialog.format_secondary_text("Do you really want delete this account?")
|
||||
answer = dialog.run()
|
||||
return answer
|
||||
def remove_account_dialog(self):
|
||||
dialog = Gtk.MessageDialog(self, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Remove account")
|
||||
dialog.format_secondary_text("Do you really want delete this account?")
|
||||
answer = dialog.run()
|
||||
return answer
|
||||
|
||||
def get_selected(self):
|
||||
return self.list.get_selected()
|
||||
def get_selected(self):
|
||||
return self.list.get_selected()
|
||||
|
||||
def remove_session(self, sessionID):
|
||||
self.list.remove_item(sessionID)
|
||||
def remove_session(self, sessionID):
|
||||
self.list.remove_item(sessionID)
|
||||
|
||||
|
@@ -11,41 +11,41 @@ from sessions import session_exceptions
|
||||
|
||||
manager = None
|
||||
def setup():
|
||||
global manager
|
||||
if not manager:
|
||||
manager = sessionManager()
|
||||
global manager
|
||||
if not manager:
|
||||
manager = sessionManager()
|
||||
|
||||
class sessionManager(object):
|
||||
# def __init__(self):
|
||||
# FILE = "sessions.conf"
|
||||
# SPEC = "app-configuration.defaults"
|
||||
# try:
|
||||
# self.main = Configuration(paths.config_path(FILE), paths.app_path(SPEC))
|
||||
# except ConfigurationResetException:
|
||||
# pass
|
||||
# def __init__(self):
|
||||
# FILE = "sessions.conf"
|
||||
# SPEC = "app-configuration.defaults"
|
||||
# try:
|
||||
# self.main = Configuration(paths.config_path(FILE), paths.app_path(SPEC))
|
||||
# except ConfigurationResetException:
|
||||
# pass
|
||||
|
||||
def get_current_session(self):
|
||||
if self.is_valid(config.app["sessions"]["current_session"]):
|
||||
return config.app["sessions"]["current_session"]
|
||||
else:
|
||||
return False
|
||||
def get_current_session(self):
|
||||
if self.is_valid(config.app["sessions"]["current_session"]):
|
||||
return config.app["sessions"]["current_session"]
|
||||
else:
|
||||
return False
|
||||
|
||||
def add_session(self, id):
|
||||
log.debug("Adding a new session: %s" % (id,))
|
||||
path = os.path.join(paths.config_path(), id)
|
||||
if not os.path.exists(path):
|
||||
log.debug("Creating %s path" % (os.path.join(paths.config_path(), path),))
|
||||
os.mkdir(path)
|
||||
config.app["sessions"]["sessions"].append(id)
|
||||
def add_session(self, id):
|
||||
log.debug("Adding a new session: %s" % (id,))
|
||||
path = os.path.join(paths.config_path(), id)
|
||||
if not os.path.exists(path):
|
||||
log.debug("Creating %s path" % (os.path.join(paths.config_path(), path),))
|
||||
os.mkdir(path)
|
||||
config.app["sessions"]["sessions"].append(id)
|
||||
|
||||
def set_current_session(self, sessionID):
|
||||
config.app["sessions"]["current_session"] = sessionID
|
||||
config.app.write()
|
||||
def set_current_session(self, sessionID):
|
||||
config.app["sessions"]["current_session"] = sessionID
|
||||
config.app.write()
|
||||
|
||||
def is_valid(self, id):
|
||||
if not os.path.exists(os.path.join(paths.config_path(), id)):
|
||||
raise session_exceptions.NonExistentSessionError("That session does not exist.")
|
||||
config.app["sessions"]["current_session"] = ""
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
def is_valid(self, id):
|
||||
if not os.path.exists(os.path.join(paths.config_path(), id)):
|
||||
raise session_exceptions.NonExistentSessionError("That session does not exist.")
|
||||
config.app["sessions"]["current_session"] = ""
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
@@ -4,10 +4,10 @@ import widgetUtils
|
||||
import platform
|
||||
import output
|
||||
if platform.system() == "Windows":
|
||||
from . import wxUI as view
|
||||
from controller import settings
|
||||
from . import wxUI as view
|
||||
from controller import settings
|
||||
elif platform.system() == "Linux":
|
||||
from . import gtkUI as view
|
||||
from . import gtkUI as view
|
||||
import paths
|
||||
import time
|
||||
import os
|
||||
@@ -21,106 +21,106 @@ from tweepy.error import TweepError
|
||||
log = logging.getLogger("sessionmanager.sessionManager")
|
||||
|
||||
class sessionManagerController(object):
|
||||
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 = []
|
||||
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 = []
|
||||
|
||||
def fill_list(self):
|
||||
sessionsList = []
|
||||
reserved_dirs = ["dicts"]
|
||||
log.debug("Filling the sessions list.")
|
||||
self.sessions = []
|
||||
for i in os.listdir(paths.config_path()):
|
||||
if os.path.isdir(os.path.join(paths.config_path(), i)) and i not in reserved_dirs:
|
||||
log.debug("Adding session %s" % (i,))
|
||||
strconfig = "%s/session.conf" % (os.path.join(paths.config_path(), i))
|
||||
config_test = config_utils.load_config(strconfig)
|
||||
if len(config_test) == 0:
|
||||
try:
|
||||
log.debug("Deleting session %s" % (i,))
|
||||
shutil.rmtree(os.path.join(paths.config_path(), i))
|
||||
continue
|
||||
except:
|
||||
output.speak("An exception was raised while attempting to clean malformed session data. See the error log for details. If this message persists, contact the developers.",True)
|
||||
os.exception("Exception thrown while removing malformed session")
|
||||
continue
|
||||
name = config_test["twitter"]["user_name"]
|
||||
if config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != "":
|
||||
sessionsList.append(name)
|
||||
self.sessions.append(i)
|
||||
else:
|
||||
try:
|
||||
log.debug("Deleting session %s" % (i,))
|
||||
shutil.rmtree(os.path.join(paths.config_path(), i))
|
||||
except:
|
||||
output.speak("An exception was raised while attempting to clean malformed session data. See the error log for details. If this message persists, contact the developers.",True)
|
||||
os.exception("Exception thrown while removing malformed session")
|
||||
self.view.fill_list(sessionsList)
|
||||
def fill_list(self):
|
||||
sessionsList = []
|
||||
reserved_dirs = ["dicts"]
|
||||
log.debug("Filling the sessions list.")
|
||||
self.sessions = []
|
||||
for i in os.listdir(paths.config_path()):
|
||||
if os.path.isdir(os.path.join(paths.config_path(), i)) and i not in reserved_dirs:
|
||||
log.debug("Adding session %s" % (i,))
|
||||
strconfig = "%s/session.conf" % (os.path.join(paths.config_path(), i))
|
||||
config_test = config_utils.load_config(strconfig)
|
||||
if len(config_test) == 0:
|
||||
try:
|
||||
log.debug("Deleting session %s" % (i,))
|
||||
shutil.rmtree(os.path.join(paths.config_path(), i))
|
||||
continue
|
||||
except:
|
||||
output.speak("An exception was raised while attempting to clean malformed session data. See the error log for details. If this message persists, contact the developers.",True)
|
||||
os.exception("Exception thrown while removing malformed session")
|
||||
continue
|
||||
name = config_test["twitter"]["user_name"]
|
||||
if config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != "":
|
||||
sessionsList.append(name)
|
||||
self.sessions.append(i)
|
||||
else:
|
||||
try:
|
||||
log.debug("Deleting session %s" % (i,))
|
||||
shutil.rmtree(os.path.join(paths.config_path(), i))
|
||||
except:
|
||||
output.speak("An exception was raised while attempting to clean malformed session data. See the error log for details. If this message persists, contact the developers.",True)
|
||||
os.exception("Exception thrown while removing malformed session")
|
||||
self.view.fill_list(sessionsList)
|
||||
|
||||
def show(self):
|
||||
if self.view.get_response() == widgetUtils.OK:
|
||||
self.do_ok()
|
||||
def show(self):
|
||||
if self.view.get_response() == widgetUtils.OK:
|
||||
self.do_ok()
|
||||
# else:
|
||||
self.view.destroy()
|
||||
self.view.destroy()
|
||||
|
||||
def do_ok(self):
|
||||
log.debug("Starting sessions...")
|
||||
for i in self.sessions:
|
||||
if (i in sessions.sessions) == True: continue
|
||||
s = session.Session(i)
|
||||
s.get_configuration()
|
||||
if i not in config.app["sessions"]["ignored_sessions"]:
|
||||
try:
|
||||
s.login()
|
||||
except TweepError:
|
||||
self.show_auth_error(s.settings["twitter"]["user_name"])
|
||||
continue
|
||||
sessions.sessions[i] = s
|
||||
self.new_sessions[i] = s
|
||||
def do_ok(self):
|
||||
log.debug("Starting sessions...")
|
||||
for i in self.sessions:
|
||||
if (i in sessions.sessions) == True: continue
|
||||
s = session.Session(i)
|
||||
s.get_configuration()
|
||||
if i not in config.app["sessions"]["ignored_sessions"]:
|
||||
try:
|
||||
s.login()
|
||||
except TweepError:
|
||||
self.show_auth_error(s.settings["twitter"]["user_name"])
|
||||
continue
|
||||
sessions.sessions[i] = s
|
||||
self.new_sessions[i] = s
|
||||
# self.view.destroy()
|
||||
|
||||
def show_auth_error(self, user_name):
|
||||
error = view.auth_error(user_name)
|
||||
def show_auth_error(self, user_name):
|
||||
error = view.auth_error(user_name)
|
||||
|
||||
def manage_new_account(self, *args, **kwargs):
|
||||
if self.view.new_account_dialog() == widgetUtils.YES:
|
||||
location = (str(time.time())[-6:])
|
||||
log.debug("Creating session in the %s path" % (location,))
|
||||
s = session.Session(location)
|
||||
manager.manager.add_session(location)
|
||||
s.get_configuration()
|
||||
def manage_new_account(self, *args, **kwargs):
|
||||
if self.view.new_account_dialog() == widgetUtils.YES:
|
||||
location = (str(time.time())[-6:])
|
||||
log.debug("Creating session in the %s path" % (location,))
|
||||
s = session.Session(location)
|
||||
manager.manager.add_session(location)
|
||||
s.get_configuration()
|
||||
# try:
|
||||
s.authorise()
|
||||
self.sessions.append(location)
|
||||
self.view.add_new_session_to_list()
|
||||
s.settings.write()
|
||||
s.authorise()
|
||||
self.sessions.append(location)
|
||||
self.view.add_new_session_to_list()
|
||||
s.settings.write()
|
||||
# except:
|
||||
# log.exception("Error authorising the session")
|
||||
# self.view.show_unauthorised_error()
|
||||
# return
|
||||
|
||||
def remove(self, *args, **kwargs):
|
||||
if self.view.remove_account_dialog() == widgetUtils.YES:
|
||||
selected_account = self.sessions[self.view.get_selected()]
|
||||
self.view.remove_session(self.view.get_selected())
|
||||
self.removed_sessions.append(selected_account)
|
||||
self.sessions.remove(selected_account)
|
||||
shutil.rmtree(path=os.path.join(paths.config_path(), selected_account), ignore_errors=True)
|
||||
def remove(self, *args, **kwargs):
|
||||
if self.view.remove_account_dialog() == widgetUtils.YES:
|
||||
selected_account = self.sessions[self.view.get_selected()]
|
||||
self.view.remove_session(self.view.get_selected())
|
||||
self.removed_sessions.append(selected_account)
|
||||
self.sessions.remove(selected_account)
|
||||
shutil.rmtree(path=os.path.join(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()
|
||||
def configuration(self, *args, **kwargs):
|
||||
""" Opens the global settings dialogue."""
|
||||
d = settings.globalSettingsController()
|
||||
if d.response == widgetUtils.OK:
|
||||
d.save_configuration()
|
||||
|
@@ -5,77 +5,77 @@ from multiplatform_widgets import widgets
|
||||
import application
|
||||
|
||||
class sessionManagerWindow(wx.Dialog):
|
||||
def __init__(self):
|
||||
super(sessionManagerWindow, self).__init__(parent=None, title=_(u"Session manager"), size=wx.DefaultSize)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(panel, -1, _(u"Accounts list"), size=wx.DefaultSize)
|
||||
listSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.list = widgets.list(panel, _(u"Account"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT)
|
||||
listSizer.Add(label, 0, wx.ALL, 5)
|
||||
listSizer.Add(self.list.list, 0, wx.ALL, 5)
|
||||
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)
|
||||
panel.SetSizer(sizer)
|
||||
min = sizer.CalcMin()
|
||||
self.SetClientSize(min)
|
||||
def __init__(self):
|
||||
super(sessionManagerWindow, self).__init__(parent=None, title=_(u"Session manager"), size=wx.DefaultSize)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(panel, -1, _(u"Accounts list"), size=wx.DefaultSize)
|
||||
listSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
self.list = widgets.list(panel, _(u"Account"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT)
|
||||
listSizer.Add(label, 0, wx.ALL, 5)
|
||||
listSizer.Add(self.list.list, 0, wx.ALL, 5)
|
||||
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)
|
||||
panel.SetSizer(sizer)
|
||||
min = sizer.CalcMin()
|
||||
self.SetClientSize(min)
|
||||
|
||||
def fill_list(self, sessionsList):
|
||||
for i in sessionsList:
|
||||
self.list.insert_item(False, i)
|
||||
if self.list.get_count() > 0:
|
||||
self.list.select_item(0)
|
||||
self.list.list.SetSize(self.list.list.GetBestSize())
|
||||
def fill_list(self, sessionsList):
|
||||
for i in sessionsList:
|
||||
self.list.insert_item(False, i)
|
||||
if self.list.get_count() > 0:
|
||||
self.list.select_item(0)
|
||||
self.list.list.SetSize(self.list.list.GetBestSize())
|
||||
|
||||
def ok(self, ev):
|
||||
if self.list.get_count() == 0:
|
||||
wx.MessageDialog(None, _(u"You need to configure an account."), _(u"Account Error"), wx.ICON_ERROR).ShowModal()
|
||||
return
|
||||
self.controller.do_ok()
|
||||
self.EndModal(wx.ID_OK)
|
||||
def ok(self, ev):
|
||||
if self.list.get_count() == 0:
|
||||
wx.MessageDialog(None, _(u"You need to configure an account."), _(u"Account Error"), wx.ICON_ERROR).ShowModal()
|
||||
return
|
||||
self.controller.do_ok()
|
||||
self.EndModal(wx.ID_OK)
|
||||
|
||||
def new_account_dialog(self):
|
||||
return wx.MessageDialog(self, _(u"The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?"), _(u"Authorization"), wx.YES_NO).ShowModal()
|
||||
def new_account_dialog(self):
|
||||
return wx.MessageDialog(self, _(u"The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?"), _(u"Authorization"), wx.YES_NO).ShowModal()
|
||||
|
||||
def add_new_session_to_list(self):
|
||||
total = self.list.get_count()
|
||||
name = _(u"Authorized account %d") % (total+1)
|
||||
self.list.insert_item(False, name)
|
||||
if self.list.get_count() == 1:
|
||||
self.list.select_item(0)
|
||||
def add_new_session_to_list(self):
|
||||
total = self.list.get_count()
|
||||
name = _(u"Authorized account %d") % (total+1)
|
||||
self.list.insert_item(False, name)
|
||||
if self.list.get_count() == 1:
|
||||
self.list.select_item(0)
|
||||
|
||||
def show_unauthorised_error(self):
|
||||
wx.MessageDialog(None, _(u"Your access token is invalid or the authorization has failed. Please try again."), _(u"Invalid user token"), wx.ICON_ERROR).ShowModal()
|
||||
def show_unauthorised_error(self):
|
||||
wx.MessageDialog(None, _(u"Your access token is invalid or the authorization has failed. Please try again."), _(u"Invalid user token"), wx.ICON_ERROR).ShowModal()
|
||||
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
||||
def get_response(self):
|
||||
return self.ShowModal()
|
||||
|
||||
def remove_account_dialog(self):
|
||||
return wx.MessageDialog(self, _(u"Do you really want to delete this account?"), _(u"Remove account"), wx.YES_NO).ShowModal()
|
||||
def remove_account_dialog(self):
|
||||
return wx.MessageDialog(self, _(u"Do you really want to delete this account?"), _(u"Remove account"), wx.YES_NO).ShowModal()
|
||||
|
||||
def get_selected(self):
|
||||
return self.list.get_selected()
|
||||
def get_selected(self):
|
||||
return self.list.get_selected()
|
||||
|
||||
def remove_session(self, sessionID):
|
||||
self.list.remove_item(sessionID)
|
||||
def remove_session(self, sessionID):
|
||||
self.list.remove_item(sessionID)
|
||||
|
||||
|
||||
def hide_configuration(self):
|
||||
self.configuration.Hide()
|
||||
def hide_configuration(self):
|
||||
self.configuration.Hide()
|
||||
|
||||
def destroy(self):
|
||||
self.Destroy()
|
||||
def destroy(self):
|
||||
self.Destroy()
|
||||
|
||||
def auth_error(user_name):
|
||||
return wx.MessageDialog(None, _("TWBlue is unable to authenticate the account for {} in Twitter. It might be due to an invalid or expired token, revoqued access to the application, or after an account reactivation. Please remove the account manually from your Twitter sessions in order to stop seeing this message.").format(user_name,), _("Authentication error for session {}").format(user_name,), wx.OK).ShowModal()
|
||||
return wx.MessageDialog(None, _("TWBlue is unable to authenticate the account for {} in Twitter. It might be due to an invalid or expired token, revoqued access to the application, or after an account reactivation. Please remove the account manually from your Twitter sessions in order to stop seeing this message.").format(user_name,), _("Authentication error for session {}").format(user_name,), wx.OK).ShowModal()
|
||||
|
Reference in New Issue
Block a user