primitivus: fixed urwid issues with recent urwid versions
fix bug 18
This commit is contained in:
parent
9f149e89f3
commit
05c53bf2d6
5 changed files with 17 additions and 25 deletions
|
|
@ -111,15 +111,13 @@ class Hand(urwid.WidgetWrap):
|
|||
@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):
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
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 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
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 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
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'):
|
||||
|
|
|
|||
|
|
@ -156,8 +156,7 @@ class PrimitivusApp(QuickApp):
|
|||
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
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@ class Pairs(urwid.WidgetWrap):
|
|||
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):
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -173,6 +173,6 @@ setup(name=NAME,
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue