diff frontends/src/primitivus/primitivus @ 1290:faa1129559b8 frontends_multi_profiles

core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit): /!\ not finished, everything is still instable ! - bridge: DBus bridge has been modified to allow blocking call to be called in the same way as asynchronous calls - bridge: calls with a callback and no errback are now possible, default errback log the error - constants: removed hack to manage presence without OrderedDict, as an OrderedDict like class has been implemented in Libervia - core: getLastResource has been removed and replaced by getMainResource (there is a global better management of resources) - various style improvments: use of constants when possible, fixed variable overlaps, import of module instead of direct class import - frontends: printInfo and printMessage methods in (Quick)Chat are more generic (use of extra instead of timestamp) - frontends: bridge creation and option parsing (command line arguments) are now specified by the frontend in QuickApp __init__ - frontends: ProfileManager manage a more complete plug sequence (some stuff formerly manage in contact_list have moved to ProfileManager) - quick_frontend (quick_widgets): QuickWidgetsManager is now iterable (all widgets are then returned), or can return an iterator on a specific class (return all widgets of this class) with getWidgets - frontends: tools.jid can now be used in Pyjamas, with some care - frontends (XMLUI): profile is now managed - core (memory): big improvment on entities cache management (and specially resource management) - core (params/exceptions): added PermissionError - various fixes and improvments, check diff for more details
author Goffi <goffi@goffi.org>
date Sat, 24 Jan 2015 01:00:29 +0100
parents e3a9ea76de35
children 0f92b6a150ff 2ecc07a8f91b
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus	Sat Jan 24 00:15:01 2015 +0100
+++ b/frontends/src/primitivus/primitivus	Sat Jan 24 01:00:29 2015 +0100
@@ -27,8 +27,9 @@
 import urwid
 from urwid_satext import sat_widgets
 from urwid_satext.files_management import FileDialog
+from sat_frontends.bridge.DBus import DBusBridgeFrontend
 from sat_frontends.quick_frontend.quick_app import QuickApp
-from sat_frontends.quick_frontend.quick_utils import getNewPath
+from sat_frontends.quick_frontend import quick_utils
 from sat_frontends.quick_frontend import quick_chat
 from sat_frontends.primitivus.profile_manager import ProfileManager
 from sat_frontends.primitivus.contact_list import ContactList
@@ -277,14 +278,14 @@
 class PrimitivusApp(QuickApp, InputHistory):
 
     def __init__(self):
-        QuickApp.__init__(self)
+        QuickApp.__init__(self, create_bridge=DBusBridgeFrontend, check_options=quick_utils.check_options)
 
         ## main loop setup ##
         self.main_widget = ProfileManager(self)
         self.loop = urwid.MainLoop(self.main_widget, C.PALETTE, event_loop=urwid.GLibEventLoop(), input_filter=self.inputFilter, unhandled_input=self.keyHandler)
 
-
         ##misc setup##
+        self._visible_widgets = set()
         self.notif_bar = sat_widgets.NotificationBar()
         urwid.connect_signal(self.notif_bar, 'change', self.onNotification)
 
@@ -298,6 +299,10 @@
         signal.signal(signal.SIGINT, signal.SIG_IGN)
 
     @property
+    def visible_widgets(self):
+        return self._visible_widgets
+
+    @property
     def mode(self):
         return self.editBar.mode
 
@@ -496,14 +501,14 @@
         self.redraw()
 
     def newWidget(self, widget):
+        self.selectWidget(widget)
+
+    def selectWidget(self, widget):
         """Display a widget if possible,
 
         else add it in the notification bar queue
         @param widget: BoxWidget
         """
-        self.selectWidget(widget)
-
-    def selectWidget(self, widget):
         assert len(self.center_part.widget_list)<=2
         wid_idx = len(self.center_part.widget_list)-1
         self.center_part.widget_list[wid_idx] = widget
@@ -512,7 +517,7 @@
         except KeyError:
             log.debug("No menu to delete")
         self.selected_widget = widget
-        self.visible_widgets = set([widget]) # XXX: we can only have one widget visible at the time for now
+        self._visible_widgets = set([widget]) # XXX: we can only have one widget visible at the time for now
         for contact_list in self.contact_lists.itervalues():
             contact_list.unselectAll()
 
@@ -642,7 +647,7 @@
 
         def dir_selected_cb(path):
             dest_path = join(path, data['filename'])
-            answer_data["dest_path"] = getNewPath(dest_path)
+            answer_data["dest_path"] = quick_utils.getNewPath(dest_path)
             self.addProgress(confirmation_id, dest_path)
             accept_cb(None)