diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index 285f963..a7eed07 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -134,6 +134,9 @@ class ProgressDialog(object): WILDCARD_OPEN = "InVesalius 3 project (*.inv3)|*.inv3|"\ "All files (*.*)|*.*" +WILDCARD_ANALYZE = "Analyze (*.hdr)|*.hdr|"\ + "All files (*.*)|*.*" + def ShowOpenProjectDialog(): # Default system path current_dir = os.path.abspath(".") @@ -161,6 +164,35 @@ def ShowOpenProjectDialog(): os.chdir(current_dir) return filepath + +def ShowOpenAnalyzeDialog(): + # Default system path + current_dir = os.path.abspath(".") + dlg = wx.FileDialog(None, message=_("Open Analyze File..."), + defaultDir="", + defaultFile="", wildcard=WILDCARD_ANALYZE, + style=wx.OPEN|wx.CHANGE_DIR) + + # inv3 filter is default + dlg.SetFilterIndex(0) + + # Show the dialog and retrieve the user response. If it is the OK response, + # process the data. + filepath = None + try: + if dlg.ShowModal() == wx.ID_OK: + # This returns a Python list of files that were selected. + filepath = dlg.GetPath() + except(wx._core.PyAssertionError): #FIX: win64 + filepath = dlg.GetPath() + + # Destroy the dialog. Don't do this until you are done with it! + # BAD things can happen otherwise! + dlg.Destroy() + os.chdir(current_dir) + return filepath + + def ShowImportDirDialog(): current_dir = os.path.abspath(".") diff --git a/invesalius/gui/frame.py b/invesalius/gui/frame.py index 83b83fe..8e1e2e8 100755 --- a/invesalius/gui/frame.py +++ b/invesalius/gui/frame.py @@ -294,6 +294,8 @@ class Frame(wx.Frame): self.ShowImportDicomPanel() elif id == const.ID_PROJECT_OPEN: self.ShowOpenProject() + elif id == const.ID_ANALYZE_IMPORT: + self.ShowAnalyzeImporter() elif id == const.ID_PROJECT_SAVE: session = ses.Session() if session.temp_item: @@ -355,6 +357,12 @@ class Frame(wx.Frame): Show save as dialog. """ ps.Publisher().sendMessage('Show save dialog', True) + + def ShowAnalyzeImporter(self): + """ + Show save as dialog. + """ + ps.Publisher().sendMessage('Show analyze dialog', True) # ------------------------------------------------------------------ # ------------------------------------------------------------------ @@ -396,12 +404,16 @@ class MenuBar(wx.MenuBar): Create all menu and submenus, and add them to self. """ # TODO: This definetely needs improvements... ;) + + #Import Others Files + others_file_menu = wx.Menu() + others_file_menu.Append(const.ID_ANALYZE_IMPORT, "Analyze") # FILE file_menu = wx.Menu() app = file_menu.Append app(const.ID_DICOM_IMPORT, _("Import DICOM...\tCtrl+I")) - #app(const.ID_DICOM_LOAD_NET, _("Import DICOM from PACS...")) + file_menu.AppendMenu(const.ID_IMPORT_OTHERS_FILES, _("Import Others Files"), others_file_menu) app(const.ID_PROJECT_OPEN, _("Open Project...\tCtrl+O")) app(const.ID_PROJECT_SAVE, _("Save Project\tCtrl+S")) app(const.ID_PROJECT_SAVE_AS, _("Save Project As...")) -- libgit2 0.21.2