/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
298.2.2 by Daniel Schierbeck
Added the new Window base class.
1
import pygtk
2
from gi.repository import Gtk
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
3
298.2.2 by Daniel Schierbeck
Added the new Window base class.
4
class Window(Gtk.Window):
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
5
298.2.2 by Daniel Schierbeck
Added the new Window base class.
6
    def __init__(self, parent=None):
7
        GObject.GObject.__init__(self, Gtk.WindowType.TOPLEVEL)
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
8
        self._parent = parent
298.2.2 by Daniel Schierbeck
Added the new Window base class.
9
614.1.1 by Vincent Ladeuil
Fix bug #131589 by using a gtk.Window instead of a gtk.Dialog.
10
        self.connect('key-press-event', self._on_key_press)
298.2.2 by Daniel Schierbeck
Added the new Window base class.
11
614.1.1 by Vincent Ladeuil
Fix bug #131589 by using a gtk.Window instead of a gtk.Dialog.
12
    def _on_key_press(self, widget, event):
298.2.2 by Daniel Schierbeck
Added the new Window base class.
13
        keyname = Gdk.keyval_name(event.keyval)
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
14
        if event.get_state() & Gdk.EventMask.CONTROL_MASK:
15
            if keyname is "w":
298.2.2 by Daniel Schierbeck
Added the new Window base class.
16
                self.destroy()
17
                if self._parent is None:
18
                    Gtk.main_quit()
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
19
            elif keyname is "q":
298.2.2 by Daniel Schierbeck
Added the new Window base class.
20
                Gtk.main_quit()
734.1.1 by Curtis Hovey
Mechanical changes made by pygi.convert.sh.
21
298.2.2 by Daniel Schierbeck
Added the new Window base class.
22