Changeset 2229

Show
Ignore:
Timestamp:
02/29/08 04:27:05 (3 months ago)
Author:
arj..@yirdis.nl
Message:

gaphor command line can accept a model file as argument. Fixes #101

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/trunk/gaphor/__init__.py

    r2134 r2229  
    2727 
    2828 
    29 def main(gaphor_file=None): 
     29def launch(gaphor_file=None): 
    3030    """ 
    3131    Start the main application by initiating and running 
     
    3737    Application.init() 
    3838 
    39     main_window = Application.get_service('gui_manager').main_window 
    40     action_manager = Application.get_service('action_manager') 
     39    file_manager = Application.get_service('file_manager') 
    4140    if gaphor_file: 
    42         main_window.set_filename(gaphor_file) 
    43         action_manager.execute('file-revert') 
     41        file_manager.load(gaphor_file) 
    4442    else: 
    45         action_manager.execute('file-new') 
     43        file_manager.new() 
     44 
    4645    Application.run() 
    4746    Application.shutdown() 
     47 
     48 
     49def main(): 
     50    """ 
     51    Main from the command line 
     52    """ 
     53    import sys 
     54    if len(sys.argv) > 1: 
     55        launch(sys.argv[1]) 
     56    else: 
     57        launch() 
    4858 
    4959 
  • gaphor/trunk/gaphor/services/filemanager.py

    r2199 r2229  
    120120        recent_files = self.properties.get('recent-files', [])  
    121121        filename = recent_files[index] 
    122         self._load(filename) 
     122        self.load(filename) 
    123123        self._app.handle(FileManagerStateChanged(self)) 
    124124         
     
    153153 
    154154 
    155     def _load(self, filename): 
     155    def load(self, filename): 
    156156        try: 
    157157            from gaphor.storage import storage 
     
    239239        filename = self._open_dialog('New Gaphor model from template') 
    240240        if filename: 
    241             self._load(filename) 
     241            self.load(filename) 
    242242 
    243243            # It's a template: unset filename 
     
    250250        filename = self._open_dialog('Open Gaphor model') 
    251251        if filename: 
    252             self._load(filename) 
     252            self.load(filename) 
    253253            self._app.handle(FileManagerStateChanged(self)) 
    254254 
  • gaphor/trunk/setup.cfg

    r1190 r2229  
    11 
    22[egg_info] 
    3 # Point egg_base to compiled sources, cause some sources have to be generated 
    4 #egg_base=build/lib 
     3#tag_build = .dev 
     4#tag_svn_revision = 1 
    55 
  • gaphor/trunk/utils/command/run.py

    r1690 r2229  
    107107        else: 
    108108            print 'Launching Gaphor...' 
    109             #gaphor.main(self.model) 
     109            del sys.argv[1:] 
    110110            starter = load_entry_point('gaphor==%s' % (self.distribution.get_version(),), 'console_scripts', 'gaphor') 
    111111