root/gaphor/branches/gaphor-0.12/gaphor/__init__.py

Revision 1267, 1.1 kB (checked in by arj..@yirdis.nl, 2 years ago)

More updates on file manager.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/env python
2 # vim:sw=4
3 """This is Gaphor, a Python based UML editor.
4 """
5
6 __all__ = [ 'main', 'GaphorError' ]
7
8 import os
9
10 import misc.logger
11
12 if os.name == 'nt':
13     home = 'USERPROFILE'
14 else:
15     home = 'HOME'
16
17 user_data_dir = os.path.join(os.getenv(home), '.gaphor')
18
19
20 class GaphorError(Exception):
21     """
22     Gaphor specific exception class
23     """
24     def __init__(self, args=None):
25             Exception.__init__(self)
26             self.args = args
27
28
29 def main(gaphor_file=None):
30     """
31     Start the main application by initiating and running
32     gaphor.application.Application.
33     """
34     import pkg_resources
35
36     from gaphor.application import Application
37     Application.init()
38
39     main_window = Application.get_service('gui_manager').main_window
40     action_manager = Application.get_service('action_manager')
41     if gaphor_file:
42         main_window.set_filename(gaphor_file)
43         action_manager.execute('file-revert')
44     else:
45         action_manager.execute('file-new')
46     Application.run()
47     Application.shutdown()
48
49
50 # TODO: Remove this
51 import __builtin__
52 __builtin__.__dict__['log'] = misc.logger.Logger()
53
54 if __debug__:
55     refs = []
56
Note: See TracBrowser for help on using the browser.