medit/tests/pyapp.py.in

52 lines
1.3 KiB
Python
Raw Normal View History

2005-06-22 11:20:32 -07:00
#
# tests/pyapp.py.in
#
# Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# See COPYING file that comes with this distribution.
#
import moo
import gobject
import sys
class App (moo.App):
def __init__ (self):
moo.App.__init__ (self)
self.set_property ('short-name', 'pyapp')
self.set_property ('full-name', 'PyApp')
self.set_property ('window-policy', moo.app.APP_MANY_EDITORS | moo.app.APP_ONE_TERMINAL |
moo.app.APP_QUIT_ON_CLOSE_ALL_WINDOWS)
self.set_property ('run-python', False)
gobject.type_register (App)
app = App()
try:
file = open('@srcdir@/editor-ui.xml')
except:
try:
file = open('editor-ui.xml')
except:
print 'could not find editor-ui.xml'
sys.exit (1)
xml = app.get_ui_xml ()
if not xml.add_ui_from_string (file.read()):
print '%s: error' % __line__
app.init()
editor = app.get_editor ()
win = editor.new_window ()
if len(sys.argv) > 1:
win.open (sys.argv[1])
app.run ()