diff frontends/primitivus/chat.py @ 222:3198bfd66daa

primitivus: refactoring to use urwid-satext which is now a separate project
author Goffi <goffi@goffi.org>
date Tue, 28 Dec 2010 23:10:13 +0100
parents 754e12eaea14
children
line wrap: on
line diff
--- a/frontends/primitivus/chat.py	Mon Dec 27 21:56:12 2010 +0100
+++ b/frontends/primitivus/chat.py	Tue Dec 28 23:10:13 2010 +0100
@@ -22,11 +22,11 @@
 import urwid
 from quick_frontend.quick_contact_list import QuickContactList
 from quick_frontend.quick_chat import QuickChat
-import custom_widgets
+from urwid_satext import sat_widgets
 import time
 from tools.jid  import JID
 from card_game import CardGame
-from files_management import FileDialog
+from urwid_satext.files_management import FileDialog
 
 
 class ChatText(urwid.FlowWidget):
@@ -107,7 +107,7 @@
             for wid in self.content:
                 wid._invalidate()
         elif key == "meta l": #user wants to (un)hide widget decoration
-            show = not isinstance(self._w, custom_widgets.LabelLine)
+            show = not isinstance(self._w, sat_widgets.LabelLine)
             self.showDecoration(show)
             self._invalidate()
         elif key == "meta s": #user wants to (un)hide group's subject or change its apperance
@@ -126,7 +126,7 @@
     
     def getMenu(self):
         """Return Menu bar"""
-        menu = custom_widgets.Menu(self.host.loop)
+        menu = sat_widgets.Menu(self.host.loop)
         if self.type == 'group':
             game = _("Game")
             menu.addMenu(game, "Tarot", self.onTarotRequest)
@@ -141,11 +141,11 @@
         elif type == 'group':
             if len(self.chat_colums.widget_list) == 1:
                 present_widget = self.__buildPresentList()
-                self.present_panel = custom_widgets.VerticalSeparator(present_widget)
+                self.present_panel = sat_widgets.VerticalSeparator(present_widget)
                 self.__appendPresentPanel()
           
     def __getDecoration(self, widget):
-        return custom_widgets.LabelLine(widget, custom_widgets.SurroundedText(unicode(self.target)))
+        return sat_widgets.LabelLine(widget, sat_widgets.SurroundedText(unicode(self.target)))
 
     def showDecoration(self, show=True):
         """Show/Hide the decoration around the chat window"""
@@ -157,7 +157,7 @@
 
 
     def __buildPresentList(self):
-        self.present_wid = custom_widgets.GenericList([],option_type = custom_widgets.ClickableText)
+        self.present_wid = sat_widgets.GenericList([],option_type = sat_widgets.ClickableText)
         return self.present_wid
    
     def __appendPresentPanel(self):
@@ -241,7 +241,7 @@
             normal: general info like "toto has joined the room"
             me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
         """
-        self.content.append(custom_widgets.ClickableText(msg))
+        self.content.append(sat_widgets.ClickableText(msg))
         self.text_list.set_focus(len(self.content)-1)
         self.host.redraw()
     
@@ -263,7 +263,7 @@
     #MENU EVENTS#
     def onTarotRequest(self, menu):
         if len(self.occupants) != 4:
-            self.host.showPopUp(custom_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp)) 
+            self.host.showPopUp(sat_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp)) 
         else:
             self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile)