Commit a8886d178504b9a9f9ac2409f79acbb62636cc15

Authored by tatiana
1 parent 360d4cba

ADD: Open inv3 projects using command line (no tag is needed)

Showing 1 changed file with 9 additions and 1 deletions   Show diff stats
invesalius/control.py
... ... @@ -69,7 +69,7 @@ class Controller():
69 69 ps.Publisher().subscribe(self.OnLoadImportPanel, "End dicom load")
70 70 ps.Publisher().subscribe(self.OnCancelImport, 'Cancel DICOM load')
71 71 ps.Publisher().subscribe(self.OnShowDialogCloseProject, 'Close Project')
72   -
  72 + ps.Publisher().subscribe(self.OnOpenProject, 'Open project')
73 73  
74 74 def OnCancelImport(self, pubsub_evt):
75 75 #self.cancel_import = True
... ... @@ -144,8 +144,12 @@ class Controller():
144 144  
145 145  
146 146 def ShowDialogCloseProject(self):
  147 + print "ShowDialogCloseProject"
147 148 session = ses.Session()
148 149 st = session.project_status
  150 + print "* st", st
  151 + if st == const.PROJ_CLOSE:
  152 + return -1
149 153 filename = session.project_path[1]
150 154 if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE):
151 155 answer = dialog.SaveChangesDialog(filename)
... ... @@ -162,6 +166,10 @@ class Controller():
162 166 self.CloseProject()
163 167  
164 168 ###########################
  169 + def OnOpenProject(self, pubsub_evt):
  170 + path = pubsub_evt.data
  171 + self.OpenProject(path)
  172 +
165 173  
166 174 def OpenProject(self, filepath):
167 175 path = os.path.abspath(filepath)
... ...