Now it's easier to dismiss all of those random little dialogues.
import gobject as GO
import gtk.gdk as GDK
GL = GO
import gobject as GO
import gtk.gdk as GDK
GL = GO
+ GDK.KEY_Escape = G.keysyms.Escape
def raise_window(w): w.window.raise_()
combo_box_text = G.combo_box_new_text
def set_entry_bg(e, c): e.modify_base(G.STATE_NORMAL, c)
def raise_window(w): w.window.raise_()
combo_box_text = G.combo_box_new_text
def set_entry_bg(e, c): e.modify_base(G.STATE_NORMAL, c)
G.Window.__init__(me, kind)
me.mywininit()
G.Window.__init__(me, kind)
me.mywininit()
+class TrivialWindowMixin (MyWindowMixin):
+ """A simple window which you can close with Escape."""
+ def mywininit(me):
+ super(TrivialWindowMixin, me).mywininit()
+ me.connect('key-press-event', me._keypress)
+ def _keypress(me, _, ev):
+ if ev.keyval == GDK.KEY_Escape: me.destroy()
+
+class TrivialWindow (MyWindow, TrivialWindowMixin):
+ pass
+
class MyDialog (G.Dialog, MyWindowMixin, HookClient):
"""A dialogue box with a closehook and sensible button binding."""
class MyDialog (G.Dialog, MyWindowMixin, HookClient):
"""A dialogue box with a closehook and sensible button binding."""
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."""
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."""
-class AboutBox (G.AboutDialog, MyWindowMixin):
+class AboutBox (G.AboutDialog, TrivialWindowMixin):
"""The program `About' box."""
def __init__(me):
G.AboutDialog.__init__(me)
"""The program `About' box."""
def __init__(me):
G.AboutDialog.__init__(me)
"""Call with a new warning message."""
me.add(tag, ' '.join([T.quotify(w) for w in rest]))
"""Call with a new warning message."""
me.add(tag, ' '.join([T.quotify(w) for w in rest]))
-class LogViewer (MyWindow):
+class LogViewer (TrivialWindow):
"""
Create a log viewer showing the LogModel MODEL.
"""
"""
Create a log viewer showing the LogModel MODEL.
"""
+ TrivialWindow.__init__(me)
me.model = model
scr = MyScrolledWindow()
me.list = MyTreeView(me.model)
me.model = model
scr = MyScrolledWindow()
me.list = MyTreeView(me.model)
except T.TripeError, exc:
T.defer(moanbox, ' '.join(exc))
except T.TripeError, exc:
T.defer(moanbox, ' '.join(exc))
-class ServInfo (MyWindow):
+class ServInfo (TrivialWindow):
"""
Show information about the server and available services.
"""
Show information about the server and available services.
+ TrivialWindow.__init__(me)
me.set_title('TrIPE server info')
table = GridPacker()
me.add(table)
me.set_title('TrIPE server info')
table = GridPacker()
me.add(table)
'%(ip-packets-in)s (%(ip-bytes-in)s) / %(ip-packets-out)s (%(ip-bytes-out)s)'),
('Rejected packets', '%(rejected-packets)s')]
'%(ip-packets-in)s (%(ip-bytes-in)s) / %(ip-packets-out)s (%(ip-bytes-out)s)'),
('Rejected packets', '%(rejected-packets)s')]
-class PeerWindow (MyWindow):
+class PeerWindow (TrivialWindow):
"""
Show information about a peer.
"""
Show information about a peer.
def __init__(me, peer):
"""Construct a PeerWindow, showing information about PEER."""
def __init__(me, peer):
"""Construct a PeerWindow, showing information about PEER."""
+ TrivialWindow.__init__(me)
me.set_title('TrIPE statistics: %s' % peer.name)
me.peer = peer
me.set_title('TrIPE statistics: %s' % peer.name)
me.peer = peer
###--------------------------------------------------------------------------
### Cryptographic status.
###--------------------------------------------------------------------------
### Cryptographic status.
-class CryptoInfo (MyWindow):
+class CryptoInfo (TrivialWindow):
"""Simple display of cryptographic algorithms in use."""
def __init__(me):
"""Simple display of cryptographic algorithms in use."""
def __init__(me):
+ TrivialWindow.__init__(me)
me.set_title('Cryptographic algorithms')
T.aside(me.populate)
def populate(me):
me.set_title('Cryptographic algorithms')
T.aside(me.populate)
def populate(me):