Mercurial > libervia-backend
changeset 607:c123dddaea6b
primitivus: fixed urwid issues with recent urwid versions
fix bug 18
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 24 Feb 2013 13:57:37 +0100 |
parents | 21ddafccf32d |
children | ea9aa51234eb |
files | frontends/src/primitivus/card_game.py frontends/src/primitivus/chat.py frontends/src/primitivus/primitivus frontends/src/primitivus/xmlui.py setup.py |
diffstat | 5 files changed, 17 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/primitivus/card_game.py Sat Feb 23 17:50:58 2013 +0100 +++ b/frontends/src/primitivus/card_game.py Sun Feb 24 13:57:37 2013 +0100 @@ -111,15 +111,13 @@ @param hand: list of Card""" del self.columns.widget_list[:] del self.columns.column_types[:] - self.columns.widget_list.append(urwid.Text('')) - self.columns.column_types.append(('weight',1)) + self.columns.contents.append((urwid.Text(''),('weight',1, False))) for card in hand: widget = CardDisplayer(card) self.columns.widget_list.append(widget) self.columns.column_types.append(('fixed',3)) urwid.connect_signal(widget, 'click', self.__onClick) - self.columns.widget_list.append(urwid.Text('')) - self.columns.column_types.append(('weight',1)) + self.columns.contents.append((urwid.Text(''),('weight',1, False))) self.columns.set_focus(1) def __onClick(self,card_wid):
--- a/frontends/src/primitivus/chat.py Sat Feb 23 17:50:58 2013 +0100 +++ b/frontends/src/primitivus/chat.py Sun Feb 24 13:57:37 2013 +0100 @@ -95,7 +95,7 @@ def keypress(self, size, key): if key == "meta p": #user wants to (un)hide the presents panel if self.type == 'group': - widgets = self.chat_colums.widget_list + widgets = [widget for (widget, options) in self.chat_colums.contents] if self.present_panel in widgets: self.__removePresentPanel() else: @@ -141,7 +141,7 @@ if type == 'one2one': self.historyPrint(profile=self.host.profile) elif type == 'group': - if len(self.chat_colums.widget_list) == 1: + if len(self.chat_colums.contents) == 1: present_widget = self.__buildPresentList() self.present_panel = sat_widgets.VerticalSeparator(present_widget) self.__appendPresentPanel() @@ -177,27 +177,23 @@ return self.present_wid def __appendPresentPanel(self): - self.chat_colums.widget_list.append(self.present_panel) - self.chat_colums.column_types.append(('weight', 2)) + self.chat_colums.contents.append((self.present_panel,('weight', 2, False))) def __removePresentPanel(self): - self.chat_colums.set_focus(0) #necessary as the focus change to the next object, we can go out of range if we are on the last object of self.chat_colums - self.chat_colums.widget_list.remove(self.present_panel) - del self.chat_colums.column_types[-1] + for widget, options in self.chat_colums.contents: + if widget is self.present_panel: + self.chat_colums.contents.remove((widget, options)) + break def __appendGamePanel(self, widget): - assert (len(self.pile.widget_list) == 1) - self.pile.widget_list.insert(0,widget) - self.pile.item_types.insert(0,('weight', 1)) - self.pile.widget_list.insert(1,urwid.Filler(urwid.Divider('-'))) - self.pile.item_types.insert(1,('fixed', 1)) + assert (len(self.pile.contents) == 1) + self.pile.contents.insert(0,(widget,('weight', 1, False))) + self.pile.contents.insert(1,(urwid.Filler(urwid.Divider('-'),('fixed', 1)))) self.host.redraw() def __removeGamePanel(self): - assert (len(self.pile.widget_list) == 3) - self.pile.set_focus(0) #necessary as the focus change to the next object, we can go out of range if we are on the last object of self.chat_colums - del self.pile.widget_list[0] - del self.pile.item_types[0] + assert (len(self.pile.contents) == 3) + del self.pile.contents[0] self.host.redraw() def setSubject(self, subject, wrap='space'):
--- a/frontends/src/primitivus/primitivus Sat Feb 23 17:50:58 2013 +0100 +++ b/frontends/src/primitivus/primitivus Sun Feb 24 13:57:37 2013 +0100 @@ -156,8 +156,7 @@ center_widgets.remove(self.contact_list) del self.center_part.column_types[0] else: - center_widgets.insert(0, self.contact_list) - self.center_part.column_types.insert(0, ('weight', 2)) + self.center_part.contents.insert(0, (self.contact_list, ('weight', 2, False))) except AttributeError: #The main widget is not built (probably in Profile Manager) pass
--- a/frontends/src/primitivus/xmlui.py Sat Feb 23 17:50:58 2013 +0100 +++ b/frontends/src/primitivus/xmlui.py Sun Feb 24 13:57:37 2013 +0100 @@ -41,8 +41,7 @@ if self.idx == 1: self._w.set_focus(1) else: - pile.widget_list.append(widget) - pile.item_types.append(('weight',getattr(self,'weight_'+str(self.idx)))) + pile.contents.append((widget,('weight',getattr(self,'weight_'+str(self.idx)), False))) self.idx = (self.idx + 1) % 2 class InvalidXMLUI(Exception):
--- a/setup.py Sat Feb 23 17:50:58 2013 +0100 +++ b/setup.py Sun Feb 24 13:57:37 2013 +0100 @@ -173,6 +173,6 @@ scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus', 'frontends/src/wix/wix'], zip_safe=False, dependency_links=['http://www.blarg.net/%7Esteveha/pyfeed-0.7.4.tar.gz', 'http://www.blarg.net/%7Esteveha/xe-0.7.4.tar.gz'], - install_requires=['twisted', 'wokkel', 'progressbar', 'urwid', 'urwid-satext', 'pyfeed', 'xe', 'mutagen', 'imaging'], + install_requires=['twisted', 'wokkel', 'progressbar', 'urwid >= 1.1.0', 'urwid-satext', 'pyfeed', 'xe', 'mutagen', 'imaging'], cmdclass={'install': CustomInstall}, ) # XXX: wxpython doesn't work, it's managed with preinstall_check