comparison frontends/primitivus/custom_widgets.py @ 14:f7d24eff1272

Primitivus: Tarot card game implementation - quick frontend: card_game added - wix: card_game splitted with quick frontend - tools: new game library - primitivus: new card_game widget (not finished yet) - primitivus: SàT XML UI management: first draft
author Goffi <goffi@goffi.org>
date Mon, 26 Jul 2010 19:43:44 +0800
parents 8cccbaadb9c5
children 8241b3157699
comparison
equal deleted inserted replaced
13:8cccbaadb9c5 14:f7d24eff1272
21 21
22 import urwid 22 import urwid
23 from urwid.escape import utf8decode 23 from urwid.escape import utf8decode
24 24
25 class Password(urwid.Edit): 25 class Password(urwid.Edit):
26 toto=0
27 """Edit box which doesn't show what is entered (show '*' or other char instead)""" 26 """Edit box which doesn't show what is entered (show '*' or other char instead)"""
28 27
29 def __init__(self, *args, **kwargs): 28 def __init__(self, *args, **kwargs):
30 """Same args than Edit.__init__ with an additional keyword arg 'hidden_char' 29 """Same args than Edit.__init__ with an additional keyword arg 'hidden_char'
31 @param hidden_char: char to show instead of what is actually entered: default '*' 30 @param hidden_char: char to show instead of what is actually entered: default '*'
45 def insert_text(self, text): 44 def insert_text(self, text):
46 self._edit_text = self.__real_text 45 self._edit_text = self.__real_text
47 super(Password,self).insert_text(text) 46 super(Password,self).insert_text(text)
48 47
49 def render(self, size, focus=False): 48 def render(self, size, focus=False):
50 Password.toto+=1
51 if Password.toto==30:
52 import os,pdb
53 os.system('reset')
54 pdb.set_trace()
55 return super(Password, self).render(size, focus) 49 return super(Password, self).render(size, focus)
56 50
57 class AdvancedEdit(urwid.Edit): 51 class AdvancedEdit(urwid.Edit):
58 """Edit box with some custom improvments 52 """Edit box with some custom improvments
59 new chars: 53 new chars: