Ejemplo n.º 1
0
 def HistoryPath(self):
     if getHome() is None:
         return getDIR()
     elif not os.path.isdir(getHome() + "/.config"):
         return getDIR()
     else:
         return getHome() + "/.config"
Ejemplo n.º 2
0
 def add_history(self,filename):
     self.exist()
     ProgramPath = getDIR()
     if not self.check_history(filename):
         HFile = open(ProgramPath + "/history", "a")
         HFile.write(filename+"\n")
         HFile.close()
Ejemplo n.º 3
0
    def run(self, ID):
        # General
        if ID == 10001:
            print(sys.executable, getDIR() + "/ezedit.py")
            subprocess.Popen([sys.executable, getDIR() + "/ezedit.py"])

        elif ID == 10002:
            frmResultReport.show(frmResultReport)
        elif ID == 10003:
            frmImageInfo.show(frmImageInfo)
        # Preprocessing
        elif ID == 20001:
            frmScriptEditor.show(frmScriptEditor)
        elif ID == 20002:
            frmRenameFile.show(frmRenameFile)
        elif ID == 20003:
            frmfMRIConcatenator.show(frmfMRIConcatenator)
        elif ID == 20004:
            frmEventConcatenator.show(frmEventConcatenator)
        # Feature Analysis
        elif ID == 30001:
            frmTansformationMatrix.show(frmTansformationMatrix)
        elif ID == 30002:
            frmEzMat.show(frmEzMat)
        elif ID == 30006:
            frmEzEzX.show(frmEzEzX)
        elif ID == 30003:
            frmCombineData.show(frmCombineData)
        elif ID == 30004:
            frmRemoveRestScan.show(frmRemoveRestScan)
        elif ID == 30005:
            frmRemoveRestScanCross.show(frmRemoveRestScanCross)
        # Feature Engineering
        elif ID == 31001:
            frmFETempAlign.show(frmFETempAlign)
        elif ID == 31002:
            frmFELabelAlign.show(frmFELabelAlign)
        # Model Analysis
        elif ID == 40001:
            frmSKModelEditor.show(frmSKModelEditor)
        elif ID == 40002:
            frmSKCModelEditor.show(frmSKCModelEditor)
        # Visualization
        elif ID == 50001:
            frmMatNITF.show(frmMatNITF)
        elif ID == 50002:
            frmNITFAFNI.show(frmNITFAFNI)
Ejemplo n.º 4
0
 def del_history(self,filename):
     self.exist()
     ProgramPath = getDIR()
     HFile = open(ProgramPath + "/history","r")
     Lines = HFile.read().split("\n")
     HFile.close()
     self.clear_history()
     for line in Lines:
         if line != filename:
             self.add_history(line.replace("\n",""))
Ejemplo n.º 5
0
 def load_history(self):
     self.exist()
     ProgramPath = getDIR()
     history = []
     HFile = open(ProgramPath + "/history", "r")
     Lines = HFile.read().split("\n")
     for line in Lines:
         if len(line):
             history.append(line)
     HFile.close()
     return history
Ejemplo n.º 6
0
 def check_history(self,filename):
     self.exist()
     ProgramPath = getDIR()
     HFile = open(ProgramPath + "/history","r")
     Lines = HFile.read().split("\n")
     for line in Lines:
         if line.replace("\n","") == filename:
             HFile.close()
             return True
     HFile.close()
     return False
Ejemplo n.º 7
0
    def show(self, filename=None, pwd=None):
        global dialog
        global ui
        global data
        global root
        global currentFile
        ui = Ui_frmDataEditor()
        QtWidgets.QApplication.setStyle(
            QtWidgets.QStyleFactory.create('Fusion'))
        dialog = QtWidgets.QMainWindow()
        ui.setupUi(dialog)
        self.set_events(self)
        ui.lwData.setColumnCount(4)
        ui.lwData.setHeaderLabels(['Name', 'Class', 'Shape', 'Value'])
        ui.lwData.setColumnWidth(0, 200)
        dialog.setWindowTitle("easy fMRI Data Editor - V" + getVersion() +
                              "B" + getBuild())
        ui.tabWidget.setCurrentIndex(0)
        ui.tabWidget2.setCurrentIndex(0)
        layout = QHBoxLayout(ui.Code)
        ui.txtCode = api.CodeEdit(ui.Code)
        layout.addWidget(ui.txtCode)
        ui.txtCode.setObjectName("txtCode")
        ui.txtCode.backend.start(getDIR() + '/backend/server.py')

        ui.txtCode.modes.append(modes.CodeCompletionMode())
        ui.txtCode.modes.append(modes.CaretLineHighlighterMode())
        ui.txtCode.modes.append(
            modes.PygmentsSyntaxHighlighter(ui.txtCode.document()))
        ui.txtCode.panels.append(panels.SearchAndReplacePanel(),
                                 api.Panel.Position.TOP)
        ui.txtCode.panels.append(panels.LineNumberPanel(),
                                 api.Panel.Position.LEFT)

        ui.lblCodeFile.setText("New File")
        currentFile = None

        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        ui.txtCode.setFont(font)
        ui.txtCode.setPlainText(DefaultCode(), "", "")

        root = queue.Queue()
        data = None
        if filename is not None:
            if os.path.isfile(filename):
                self.OpenFile(self, filename)
            elif pwd is not None:
                if os.path.isfile(pwd + "/" + filename):
                    self.OpenFile(self, pwd + "/" + filename)
                else:
                    print("Data file cannot find!")
        dialog.show()
Ejemplo n.º 8
0
def getFSLxml():
    ProgramPath = getDIR()
    return ProgramPath + "/data/fslatlas.ini"
Ejemplo n.º 9
0
def getDirFSLAtlas():
    ProgramPath = getDIR()
    return ProgramPath + "/data/atlas/"
Ejemplo n.º 10
0
def getDirSpace():
    ProgramPath = getDIR()
    return ProgramPath + "/data/space/"
Ejemplo n.º 11
0
def getDirSpaceINI():
    ProgramPath = getDIR()
    return ProgramPath + "/data/space.ini"
Ejemplo n.º 12
0
 def exist(self):
     ProgramPath = getDIR()
     if not os.path.isfile(ProgramPath + "/history"):
         HFile = open(ProgramPath + "/history", "w")
         HFile.close()
Ejemplo n.º 13
0
 def clear_history(self):
     ProgramPath = getDIR()
     try:
         os.remove(ProgramPath + "/history")
     except:
         return