3
Module that provides an object oriented abstraction to pygtk and libglade.
4
Copyright (C) 2004 Sandino Flores Moreno
7
# This library is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU Lesser General Public
9
# License as published by the Free Software Foundation; either
10
# version 2.1 of the License, or (at your option) any later version.
12
# This library is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# Lesser General Public License for more details.
17
# You should have received a copy of the GNU Lesser General Public
18
# License along with this library; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28
# based on SimpleGladeApp
29
class SimpleGtkbuilderApp:
31
def __init__(self, path):
32
self.builder = gtk.Builder()
33
self.builder.add_from_file(path)
34
self.builder.connect_signals(self)
35
for o in self.builder.get_objects():
36
if issubclass(type(o), gtk.Buildable):
37
name = gtk.Buildable.get_name(o)
38
setattr(self, name, o)
40
print >>sys.stderr, "WARNING: can not get name for '%s'" % o
44
Starts the main loop of processing events checking for Control-C.
46
The default implementation checks wheter a Control-C is pressed,
47
then calls on_keyboard_interrupt().
49
Use this method for starting programs.
53
except KeyboardInterrupt:
54
self.on_keyboard_interrupt()
56
def on_keyboard_interrupt(self):
58
This method is called by the default implementation of run()
59
after a program is finished by pressing Control-C.