Permalink
Browse files

Merge branch 'master' of git://github.com/drf/amsn2

  • Loading branch information...
2 parents 80e4e5f + 10ac7bd commit c1e26951f0eb6e090b3d864fcf1db6e075368d78 alexandernst committed Sep 23, 2009
View
@@ -1,7 +1,8 @@
class aMSNBackendManager(object):
- def __init__(self):
+ def __init__(self, core):
self._backend = None
+ self._core = core
self.switchToBackend('nullbackend')
def setBackendForFunc(self, funcname, backend):
@@ -21,6 +22,7 @@ def switchToBackend(self, backend):
del self._backend
self._backend = backend_class()
+ self._backend._core = self._core
self.current_backend = backend
# Config management methods
@@ -40,7 +40,7 @@ def loadAccount(self, email):
accfile.close()
account = root_tree.getroot()
if account.tag == "aMSNAccount":
- accview = AccountView()
+ accview = AccountView(self._core)
#email
emailElmt = account.find("email")
if emailElmt is None:
View
@@ -49,35 +49,35 @@ def __init__(self, options):
options.front_end = the front end's name to use
options.debug = whether or not to enable debug output
"""
+ self.p2s = {papyon.Presence.ONLINE:"online",
+ papyon.Presence.BUSY:"busy",
+ papyon.Presence.IDLE:"idle",
+ papyon.Presence.AWAY:"away",
+ papyon.Presence.BE_RIGHT_BACK:"brb",
+ papyon.Presence.ON_THE_PHONE:"phone",
+ papyon.Presence.OUT_TO_LUNCH:"lunch",
+ papyon.Presence.INVISIBLE:"hidden",
+ papyon.Presence.OFFLINE:"offline"}
+ self.Presence = papyon.Presence
+
self._event_manager = aMSNEventManager(self)
self._options = options
self._gui_name = None
self._gui = None
self._loop = None
self._main = None
+ self._account = None
self.loadUI(self._options.front_end)
- self._backend_manager = aMSNBackendManager()
+ self._backend_manager = aMSNBackendManager(self)
self._account_manager = aMSNAccountManager(self, options)
- self._account = None
- self._theme_manager = aMSNThemeManager()
+ self._theme_manager = aMSNThemeManager(self)
self._contactlist_manager = aMSNContactListManager(self)
self._oim_manager = aMSNOIMManager(self)
self._conversation_manager = aMSNConversationManager(self)
self._personalinfo_manager = aMSNPersonalInfoManager(self)
-
- self.p2s = {papyon.Presence.ONLINE:"online",
- papyon.Presence.BUSY:"busy",
- papyon.Presence.IDLE:"idle",
- papyon.Presence.AWAY:"away",
- papyon.Presence.BE_RIGHT_BACK:"brb",
- papyon.Presence.ON_THE_PHONE:"phone",
- papyon.Presence.OUT_TO_LUNCH:"lunch",
- papyon.Presence.INVISIBLE:"hidden",
- papyon.Presence.OFFLINE:"offline"}
-
# TODO: redirect the logs somewhere, something like ctrl-s ctrl-d for amsn-0.9x
logging.basicConfig(level=logging.WARNING)
@@ -103,6 +103,9 @@ def loadUI(self, ui_name):
self._gui_name = ui_name
self._gui = gui.GUIManager(self, self._gui_name)
+ if not self._gui.gui:
+ print "Unable to load UI %s" %(self._gui_name,)
+ self.quit()
self._loop = self._gui.gui.aMSNMainLoop(self)
self._main = self._gui.gui.aMSNMainWindow(self)
self._skin_manager = self._gui.gui.SkinManager(self)
@@ -209,10 +212,12 @@ def timerAdd(self, delay, func):
self._loop.timerAdd(delay, func)
def quit(self):
- if self._account is not None:
+ if self._account:
self._account.signOut()
- self._loop.quit()
+ if self._loop:
+ self._loop.quit()
logging.shutdown()
+ exit(0)
# TODO: move to UImanager
def addContact(self):
@@ -24,7 +24,8 @@
import os
class aMSNThemeManager:
- def __init__(self):
+ def __init__(self, core):
+ self._core = core
self._buttons = {}
self._statusicons = {}
self._displaypic = {}
@@ -3,12 +3,13 @@
from stringview import *
class AccountView:
- def __init__(self):
+ def __init__(self, core):
+ self._core = core
self.email = None
self.password = None
self.nick = StringView()
self.psm = StringView()
- self.presence = 'online'
+ self.presence = core.Presence.ONLINE
self.dp = ImageView()
self.save = False
@@ -19,7 +20,8 @@ def __init__(self):
self.preferred_backend = 'defaultbackend'
def __str__(self):
- out = "{ email=" + str(self.email) + " presence=" + str(self.presence)
+ out = "{ email=" + str(self.email)
+ out += " presence=" + self._core.p2s[self.presence]
out += " save=" + str(self.save) + " save_password=" + str(self.save_password)
out += " autologin=" + str(self.autologin) + " preferred_ui=" + str(self.preferred_ui)
out += " preferred_backend=" + self.preferred_backend + " }"
2 papyon
Submodule papyon updated from cc69fd to b8cf87

0 comments on commit c1e2695

Please sign in to comment.