|
Revision 1135, 2.1 kB
(checked in by arjanmol, 2 years ago)
|
cleanup
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
"""This is Gaphor, a Python based UML editor. |
|---|
| 4 |
""" |
|---|
| 5 |
|
|---|
| 6 |
__all__ = [ 'main', 'resource', 'GaphorError' ] |
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
import misc.logger |
|---|
| 14 |
|
|---|
| 15 |
import version |
|---|
| 16 |
|
|---|
| 17 |
from misc.resource import Resource |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
resource = Resource(initial_resources={ |
|---|
| 26 |
'Name': 'gaphor', |
|---|
| 27 |
'Version': version.VERSION, |
|---|
| 28 |
'DataDir': version.DATA_DIR, |
|---|
| 29 |
'UserDataDir': version.USER_DATA_DIR, |
|---|
| 30 |
'ui.toolbox.classes': True, |
|---|
| 31 |
}) |
|---|
| 32 |
|
|---|
| 33 |
class GaphorError(Exception): |
|---|
| 34 |
""" |
|---|
| 35 |
Gaphor specific exception class |
|---|
| 36 |
""" |
|---|
| 37 |
def __init__(self, args=None): |
|---|
| 38 |
Exception.__init__(self) |
|---|
| 39 |
self.args = args |
|---|
| 40 |
|
|---|
| 41 |
def main(gaphor_file=None): |
|---|
| 42 |
"""Start the interactive application. |
|---|
| 43 |
|
|---|
| 44 |
This involves importing plugins and creating the main window. |
|---|
| 45 |
""" |
|---|
| 46 |
|
|---|
| 47 |
import gtk |
|---|
| 48 |
import ui |
|---|
| 49 |
import adapters |
|---|
| 50 |
import actions |
|---|
| 51 |
|
|---|
| 52 |
import pluginmanager |
|---|
| 53 |
from ui.mainwindow import MainWindow |
|---|
| 54 |
|
|---|
| 55 |
resource('PluginManager').bootstrap() |
|---|
| 56 |
|
|---|
| 57 |
ui.load_accel_map() |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
main_window = resource(MainWindow) |
|---|
| 61 |
main_window.construct() |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
main_window.connect(lambda win: win.get_state() == MainWindow.STATE_CLOSED and gtk.main_quit()) |
|---|
| 65 |
|
|---|
| 66 |
if gaphor_file: |
|---|
| 67 |
main_window.set_filename(gaphor_file) |
|---|
| 68 |
main_window.execute_action('FileRevert') |
|---|
| 69 |
else: |
|---|
| 70 |
main_window.execute_action('FileNew') |
|---|
| 71 |
|
|---|
| 72 |
gtk.main() |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
resource.save() |
|---|
| 76 |
|
|---|
| 77 |
ui.save_accel_map() |
|---|
| 78 |
|
|---|
| 79 |
log.info('Bye!') |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
import __builtin__ |
|---|
| 84 |
__builtin__.__dict__['log'] = misc.logger.Logger() |
|---|
| 85 |
|
|---|
| 86 |
if __debug__: |
|---|
| 87 |
refs = [] |
|---|
| 88 |
|
|---|