summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-29 07:46:46 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-05-29 07:46:46 +0000
commit2f908ad94636bed6fe1a20dfcfd7049bacf4a153 (patch)
tree0fde6c9652c3f1ed4dde23e195e7adad25839cd2
parent218b66ef41e5dc1b2e51ed7fc065f9383a688489 (diff)
downloadomegle-2f908ad94636bed6fe1a20dfcfd7049bacf4a153.tar.gz
omegle-2f908ad94636bed6fe1a20dfcfd7049bacf4a153.zip
blah
git-svn-id: http://xapek.org/svn/common/omegle@1037 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
-rw-r--r--gui.py29
1 files changed, 21 insertions, 8 deletions
diff --git a/gui.py b/gui.py
index 93a14c0..9fe06ab 100644
--- a/gui.py
+++ b/gui.py
@@ -1,11 +1,11 @@
import urwid.curses_display
import urwid
-import time
+import sys,time
class Conversation(object):
def __init__(self):
self.column1_edit = urwid.Edit(caption="Send: ")
- self.column1_check = urwid.CheckBox("Link to other",state=True)
+ self.column1_check = urwid.CheckBox("Link to other",state=True,on_state_change=self.on_link1_changed)
self.column1_disconnect = urwid.Button("Disconnect", lambda x:
self.add_message(time.strftime("%H:%M:%S: ") + "FOO")
)
@@ -15,7 +15,7 @@ class Conversation(object):
urwid.AttrWrap(self.column1_disconnect,'button')])
self.column2_edit = urwid.Edit(caption="Send: ")
- self.column2_check = urwid.CheckBox("Link to other",state=True)
+ self.column2_check = urwid.CheckBox("Link to other",state=True,on_state_change=self.on_link2_changed)
self.column2_disconnect = urwid.Button("Disconnect", lambda x:
self.add_message(time.strftime("%H:%M:%S: ") + "FOO")
)
@@ -30,7 +30,7 @@ class Conversation(object):
self.textbox = urwid.ListBox(self.messages)
self.body = urwid.Pile([self.columns,self.textbox])
- self.widget_header = urwid.Text("F1 ... | ... | F8 - EXIT")
+ self.widget_header = urwid.Text("F2 Toggle Link 1 | F3 Toggle Link 2 | | F10 - EXIT")
self.top = urwid.Frame(body=self.body, header=urwid.AttrWrap(self.widget_header,'header'))
@@ -53,7 +53,7 @@ class Conversation(object):
self.ui.register_palette([
('header', 'black', 'dark cyan', 'standout'),
('button', 'white', 'dark blue', 'standout'),
-# ('I say', 'default', 'default', 'bold'),
+ ('keylabel', 'white', 'dark cyan', 'standout'),
])
self.ui.run_wrapper( self.run )
@@ -61,9 +61,11 @@ class Conversation(object):
size = self.ui.get_cols_rows()
while True:
- keys = self.ui.get_input()
- if "f8" in keys:
- break
+ try:
+ keys = self.ui.get_input()
+ except KeyboardInterrupt:
+ sys.exit(0)
+
for k in keys:
if k == "window resize":
size = self.ui.get_cols_rows()
@@ -85,6 +87,12 @@ class Conversation(object):
pair[0].set_focus(pair[1])
self.focus_ring.insert(0,elem)
self.focus_ring.reverse()
+ elif k == "f2":
+ self.column1_check.toggle_state()
+ elif k == "f3":
+ self.column2_check.toggle_state()
+ elif k == "f10":
+ sys.exit(0)
else:
self.top.keypress( size, k )
@@ -94,4 +102,9 @@ class Conversation(object):
canvas = self.top.render( size, focus=True )
self.ui.draw_screen( size, canvas )
+ def on_link1_changed(self,a,b):
+ pass
+ def on_link2_changed(self,a,b):
+ pass
+
Conversation().main()