Mercurial > libervia-backend
changeset 117:1f0fd6f03e2b
misc fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 03 Jul 2010 12:01:01 +0800 (2010-07-03) |
parents | 7c482ecac0ff |
children | 76055a209ed9 |
files | frontends/primitivus/custom_widgets.py frontends/primitivus/primitivus frontends/primitivus/profile_manager.py frontends/quick_frontend/quick_app.py |
diffstat | 4 files changed, 21 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/primitivus/custom_widgets.py Thu Jul 01 18:52:51 2010 +0800 +++ b/frontends/primitivus/custom_widgets.py Sat Jul 03 12:01:01 2010 +0800 @@ -118,7 +118,7 @@ try: self.content.remove(value) except ValueError: - pass + raise ValuError("%s ==> %s" % (str(value),str(self.content))) def getValue(self): """Convenience method to get the value selected as a string in single mode, or None""" @@ -140,7 +140,7 @@ self.content[:] = widgets if self.single and new_values: self.content[0].setState(True) - display_widget = urwid.BoxAdapter(self.list_box, min(len(new_values),5)) + display_widget = urwid.BoxAdapter(self.list_box, min(len(new_values),5) or 1) urwid.WidgetWrap.__init__(self, display_widget) def selectValue(self, value):
--- a/frontends/primitivus/primitivus Thu Jul 01 18:52:51 2010 +0800 +++ b/frontends/primitivus/primitivus Sat Jul 03 12:01:01 2010 +0800 @@ -66,7 +66,7 @@ QuickApp.__init__(self) #XXX: yes it's an unusual place for the constructor of a parent class, but the init order is important ## main loop setup ## - self.main_widget = self.__buildMainWidget() + self.main_widget = ProfileManager(self) self.loop = urwid.MainLoop(self.main_widget, const_PALETTE, event_loop=urwid.GLibEventLoop(), unhandled_input=self.key_handler) def start(self): @@ -77,14 +77,20 @@ raise urwid.ExitMainLoop() def __buildMainWidget(self): - #main_widget = urwid.Filler(ProfileManager(self)) - main_widget = ProfileManager(self) - return main_widget + self.contactList = ContactList(self, self.CM) + return self.contactList def plug_profile(self, profile_key='@DEFAULT@'): - self.loop.widget = self.contactList = ContactList(self, self.CM) + self.main_widget = self.loop.widget = self.__buildMainWidget() QuickApp.plug_profile(self, profile_key) - + + def removePopUp(self): + self.loop.widget = self.main_widget + + def showPopUp(self, pop_up_widget): + display_widget = urwid.Overlay(pop_up_widget, self.main_widget, 'center', ('relative', 40), 'middle', ('relative', 40)) + self.loop.widget = display_widget sat = PrimitivusApp() sat.start() +
--- a/frontends/primitivus/profile_manager.py Thu Jul 01 18:52:51 2010 +0800 +++ b/frontends/primitivus/profile_manager.py Sat Jul 03 12:01:01 2010 +0800 @@ -63,35 +63,31 @@ profiles.sort() self.list_profile.changeValues(profiles) - def __showPopUp(self, pop_up_widget): - display_widget = urwid.Overlay(pop_up_widget, self.main_widget, 'center', ('relative', 40), 'middle', ('relative', 40)) - self._set_w(display_widget) - def cancelDialog(self, button): - self._set_w(self.main_widget) + self.host.removePopUp() def newProfile(self, button, edit): - self._set_w(self.main_widget) name = edit.get_edit_text() self.host.bridge.createProfile(name) self.__refillProfiles() self.list_profile.selectValue(name) + self.host.removePopUp() def deleteProfile(self, button): - self._set_w(self.main_widget) profile_name = self.list_profile.getValue() if profile_name: self.host.bridge.deleteProfile(profile_name) self.__refillProfiles() + self.host.removePopUp() def onNewProfile(self, e): pop_up_widget = InputDialog(_("New profile"), _("Please enter a new profile name"), cancel_cb=self.cancelDialog, ok_cb=self.newProfile) - self.__showPopUp(pop_up_widget) + self.host.showPopUp(pop_up_widget) def onDeleteProfile(self, e): pop_up_widget = ConfirmDialog(_("Are you sure you want to delete the profile %s ?") % self.list_profile.getValue(), no_cb=self.cancelDialog, yes_cb=self.deleteProfile) - self.__showPopUp(pop_up_widget) + self.host.showPopUp(pop_up_widget) def onProfileChange(self, list_wid): profile_name = list_wid.getValue() @@ -105,10 +101,10 @@ profile_name = self.list_profile.getValue() if not profile_name: pop_up_widget = Alert(_('No profile selected'), _('You need to create and select a profile before connecting'), ok_cb=self.cancelDialog) - self.__showPopUp(pop_up_widget) + self.host.showPopUp(pop_up_widget) elif profile_name[0] == '@': pop_up_widget = Alert(_('Bad profile name'), _("A profile name can't start with a @"), ok_cb=self.cancelDialog) - self.__showPopUp(pop_up_widget) + self.host.showPopUp(pop_up_widget) else: profile = self.host.bridge.getProfileName(profile_name) assert(profile)
--- a/frontends/quick_frontend/quick_app.py Thu Jul 01 18:52:51 2010 +0800 +++ b/frontends/quick_frontend/quick_app.py Sat Jul 03 12:01:01 2010 +0800 @@ -190,7 +190,6 @@ def presenceUpdate(self, jabber_id, show, priority, statuses, profile): if not self.__check_profile(profile): return - print "check ok" debug (_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'jid':jabber_id, 'show':show, 'priority':priority, 'statuses':statuses, 'profile':profile}); from_jid=JID(jabber_id) debug ("from_jid.short=%(from_jid)s whoami.short=%(whoami)s" % {'from_jid':from_jid.short, 'whoami':self.profiles[profile]['whoami'].short}) @@ -284,7 +283,6 @@ if not self.__check_profile(profile): return debug (_("New Tarot Game")) - print "room: %s, hand: %s" % (room_jid,hand) if self.chat_wins.has_key(room_jid): self.chat_wins[room_jid].getGame("Tarot").newGame(hand)