/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to window.py

  • Committer: John Arbash Meinel
  • Date: 2007-04-19 21:30:38 UTC
  • mto: This revision was merged to the branch mainline in revision 195.
  • Revision ID: john@arbash-meinel.com-20070419213038-80g223n0050jmphn
Update code to properly handle loading failures.
And do more searching to find the glade and .ui files.
In 'olive-gtk' the '_' function was not defined, so it would die when
trying to report startup failures.
In 'olive/guifiles.py' it now searches around for olive.glade
rather than only looking in 2 places. Once it finds olive.glade,
it assumes that cmenu.ui will be nearby.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
from gi.repository import Gdk
3
 
from gi.repository import Gtk
4
 
 
5
 
 
6
 
class Window(Gtk.Window):
7
 
 
8
 
    def __init__(self, parent=None):
9
 
        super(Window, self).__init__(type=Gtk.WindowType.TOPLEVEL)
10
 
        self._parent = parent
11
 
 
12
 
        self.connect('key-press-event', self._on_key_press)
13
 
 
14
 
    def _on_key_press(self, widget, event):
15
 
        keyname = Gdk.keyval_name(event.keyval)
16
 
        if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
17
 
            if keyname is "w":
18
 
                self.destroy()
19
 
                if self._parent is None:
20
 
                    Gtk.main_quit()
21
 
            elif keyname is "q":
22
 
                Gtk.main_quit()
23