Skip to content

Commit

Permalink
Little enhancement in the qt4 ui. Also, add the skin and the theme ma…
Browse files Browse the repository at this point in the history
…nager in __init__ in login.py
  • Loading branch information
alexandernst authored and borisfaure committed Jan 17, 2010
1 parent 2885e58 commit b73b97e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions amsn2/core/userinterface_manager.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-

from views import *

Expand Down
11 changes: 8 additions & 3 deletions amsn2/ui/front_ends/qt4/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class aMSNLoginWindow(StyledWidget, base.aMSNLoginWindow):
def __init__(self, amsn_core, parent):
StyledWidget.__init__(self, parent)
self._amsn_core = amsn_core
self._parent = parent
self._skin = amsn_core._skin_manager.skin
self._theme_manager = self._amsn_core._theme_manager
self._ui_manager = self._amsn_core._ui_manager
self.ui = Ui_Login()
self.ui.setupUi(self)
Expand All @@ -68,11 +71,13 @@ def __init__(self, amsn_core, parent):
status_n = 0
for key in self._amsn_core.p2s:
name = self._amsn_core.p2s[key]
if (name == 'offline'): continue
self.status_values[name] = status_n
_, path = self._theme_manager.get_statusicon("buddy_%s" % name)
if (name == self._amsn_core.Presence.OFFLINE): continue
self.status_values[key] = status_n
self.status_dict[str.capitalize(name)] = key
status_n = status_n +1
self.ui.comboStatus.addItem(str.capitalize(name))
icon = QIcon(path)
self.ui.comboStatus.addItem(icon, str.capitalize(name))

def setTestStyle(self):
styleData = QFile()
Expand Down
8 changes: 7 additions & 1 deletion amsn2/ui/front_ends/qt4/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ def __fadeIn(self):
def __activateNewWidget(self):
self.stackedLayout.setCurrentIndex(self.stackedLayout.count()-1)

def __on_show(self):
self._amsn_core.mainWindowShown()

def show(self):
self.setVisible(True)
self._amsn_core.mainWindowShown()
self._amsn_core.idlerAdd(self.__on_show)

def hide(self):
self.setVisible(False)
Expand All @@ -87,3 +90,6 @@ def setMenu(self, menu):
menu.addAction(subitem.label)

self.setMenuBar(mb)

def set_view(self, view):
pass
10 changes: 5 additions & 5 deletions amsn2/ui/front_ends/qt4/main_loop.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from amsn2.ui import base
import sys

Expand All @@ -8,6 +9,7 @@
class aMSNMainLoop(base.aMSNMainLoop):
def __init__(self, amsn_core):
import os
self._amsn_core = amsn_core
os.putenv("QT_NO_GLIB", "1") # FIXME: Temporary workaround for segfault
# caused by GLib Event Loop integration
self.app = QApplication(sys.argv)
Expand All @@ -30,12 +32,10 @@ def on_idle(self):
iter += 1

def idlerAdd(self, func):
print "idlerAdd req"
pass
gobject.idle_add(func)

def timerAdd(self, delay, func):
print "timerAdd req"
pass
gobject.timeout_add(delay, func)

def quit(self):
pass
self.gmainloop.quit()

0 comments on commit b73b97e

Please sign in to comment.