예제 #1
0
    def ShowDialogImportOtherFiles(self, id_type):
        # Offer to save current project if necessary
        session = ses.Session()
        st = session.project_status
        if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE):
            filename = session.project_path[1]
            answer = dialog.SaveChangesDialog2(filename)
            if answer:
                self.ShowDialogSaveProject()
            self.CloseProject()
            # Publisher.sendMessage("Enable state project", False)
            Publisher.sendMessage('Set project name')
            Publisher.sendMessage("Stop Config Recording")
            Publisher.sendMessage("Set slice interaction style",
                                  const.STATE_DEFAULT)

        # Warning for limited support to Analyze format
        if id_type == const.ID_ANALYZE_IMPORT:
            dialog.ImportAnalyzeWarning()

        # Import project treating compressed nifti exception
        suptype = ('hdr', 'nii', 'nii.gz', 'par')
        filepath = dialog.ShowImportOtherFilesDialog(id_type)
        if filepath is not None:
            name = filepath.rpartition('\\')[-1].split('.')

            if name[-1] == 'gz':
                name[1] = 'nii.gz'

            filetype = name[1].lower()

            if filetype in suptype:
                Publisher.sendMessage("Open other files", filepath)
            else:
                dialog.ImportInvalidFiles()
예제 #2
0
    def ShowDialogImportOtherFiles(self, id_type):
        # Offer to save current project if necessary
        session = ses.Session()
        st = session.project_status
        if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE):
            filename = session.project_path[1]
            answer = dialog.SaveChangesDialog2(filename)
            if answer:
                self.ShowDialogSaveProject()
            self.CloseProject()
            # Publisher.sendMessage("Enable state project", state=False)
            Publisher.sendMessage('Set project name')
            Publisher.sendMessage("Stop Config Recording")
            Publisher.sendMessage("Enable style", style=const.STATE_DEFAULT)

        # Warning for limited support to Analyze format
        if id_type == const.ID_ANALYZE_IMPORT:
            dialog.ImportAnalyzeWarning()

        filepath = dialog.ShowImportOtherFilesDialog(id_type)
        Publisher.sendMessage("Open other files", filepath=filepath)