medit/tests/pyapp.py.in

51 lines
1.2 KiB
Python
Raw Normal View History

2005-06-22 11:20:32 -07:00
#
# tests/pyapp.py.in
#
2007-06-24 10:56:20 -07:00
# Copyright (C) 2004-2007 by Yevgen Muntyan <muntyan@math.tamu.edu>
2005-06-22 11:20:32 -07:00
#
2007-06-24 10:56:20 -07:00
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
2007-09-23 09:47:28 -07:00
# License version 2.1 as published by the Free Software Foundation.
2005-06-22 11:20:32 -07:00
#
# 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)
2007-06-24 10:56:20 -07:00
gobject.type_register (App)
2005-06-22 11:20:32 -07:00
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 ()