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,7 +69,7 @@ class Controller():
69 ps.Publisher().subscribe(self.OnLoadImportPanel, "End dicom load") 69 ps.Publisher().subscribe(self.OnLoadImportPanel, "End dicom load")
70 ps.Publisher().subscribe(self.OnCancelImport, 'Cancel DICOM load') 70 ps.Publisher().subscribe(self.OnCancelImport, 'Cancel DICOM load')
71 ps.Publisher().subscribe(self.OnShowDialogCloseProject, 'Close Project') 71 ps.Publisher().subscribe(self.OnShowDialogCloseProject, 'Close Project')
72 - 72 + ps.Publisher().subscribe(self.OnOpenProject, 'Open project')
73 73
74 def OnCancelImport(self, pubsub_evt): 74 def OnCancelImport(self, pubsub_evt):
75 #self.cancel_import = True 75 #self.cancel_import = True
@@ -144,8 +144,12 @@ class Controller(): @@ -144,8 +144,12 @@ class Controller():
144 144
145 145
146 def ShowDialogCloseProject(self): 146 def ShowDialogCloseProject(self):
  147 + print "ShowDialogCloseProject"
147 session = ses.Session() 148 session = ses.Session()
148 st = session.project_status 149 st = session.project_status
  150 + print "* st", st
  151 + if st == const.PROJ_CLOSE:
  152 + return -1
149 filename = session.project_path[1] 153 filename = session.project_path[1]
150 if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE): 154 if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE):
151 answer = dialog.SaveChangesDialog(filename) 155 answer = dialog.SaveChangesDialog(filename)
@@ -162,6 +166,10 @@ class Controller(): @@ -162,6 +166,10 @@ class Controller():
162 self.CloseProject() 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 def OpenProject(self, filepath): 174 def OpenProject(self, filepath):
167 path = os.path.abspath(filepath) 175 path = os.path.abspath(filepath)