Beispiel #1
0
    def show(self):
        global dialog
        global ui
        ui = Ui_frmMAClassicNetworkROI()
        QtWidgets.QApplication.setStyle(
            QtWidgets.QStyleFactory.create('Fusion'))
        dialog = QtWidgets.QMainWindow()
        ui.setupUi(dialog)
        self.set_events(self)
        ui.tabWidget.setCurrentIndex(0)

        # Metric
        ui.txtMetric = api.CodeEdit(ui.tab_5)
        ui.txtMetric.setGeometry(QtCore.QRect(10, 10, 700, 350))
        ui.txtMetric.setObjectName("txtMetric")
        ui.txtMetric.backend.start('backend/server.py')
        ui.txtMetric.modes.append(modes.CodeCompletionMode())
        ui.txtMetric.modes.append(modes.CaretLineHighlighterMode())
        ui.txtMetric.modes.append(
            modes.PygmentsSyntaxHighlighter(ui.txtMetric.document()))
        ui.txtMetric.panels.append(panels.LineNumberPanel(),
                                   api.Panel.Position.LEFT)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        ui.txtMetric.setFont(font)
        ui.txtMetric.setPlainText(MetricCode(), "", "")

        # Integration
        ui.txtIntegration = api.CodeEdit(ui.tab_3)
        ui.txtIntegration.setGeometry(QtCore.QRect(10, 10, 700, 350))
        ui.txtIntegration.setObjectName("txtIntegration")
        ui.txtIntegration.backend.start('backend/server.py')
        ui.txtIntegration.modes.append(modes.CodeCompletionMode())
        ui.txtIntegration.modes.append(modes.CaretLineHighlighterMode())
        ui.txtIntegration.modes.append(
            modes.PygmentsSyntaxHighlighter(ui.txtIntegration.document()))
        ui.txtIntegration.panels.append(panels.LineNumberPanel(),
                                        api.Panel.Position.LEFT)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        ui.txtIntegration.setFont(font)
        ui.txtIntegration.setPlainText(IntegrationCode(), "", "")

        dialog.setWindowTitle(
            "easy fMRI Classic Network Analysis (ROI-based) - V" +
            getVersion() + "B" + getBuild())
        dialog.setWindowFlags(dialog.windowFlags()
                              | QtCore.Qt.CustomizeWindowHint)
        dialog.setWindowFlags(dialog.windowFlags()
                              & ~QtCore.Qt.WindowMaximizeButtonHint)
        dialog.setFixedSize(dialog.size())
        dialog.show()
Beispiel #2
0
    def show(self):
        global dialog
        global ui
        ui = Ui_frmAAAtlas()
        QtWidgets.QApplication.setStyle(
            QtWidgets.QStyleFactory.create('Fusion'))
        dialog = QtWidgets.QMainWindow()
        ui.setupUi(dialog)
        self.set_events(self)
        ui.tabWidget.setCurrentIndex(0)

        ui.txtEvents = api.CodeEdit(ui.tab_2)
        ui.txtEvents.setGeometry(QtCore.QRect(10, 10, 641, 200))
        ui.txtEvents.setObjectName("txtEvents")
        ui.txtEvents.backend.start('backend/server.py')
        ui.txtEvents.modes.append(modes.CodeCompletionMode())
        ui.txtEvents.modes.append(modes.CaretLineHighlighterMode())
        ui.txtEvents.modes.append(
            modes.PygmentsSyntaxHighlighter(ui.txtEvents.document()))
        ui.txtEvents.panels.append(panels.LineNumberPanel(),
                                   api.Panel.Position.LEFT)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        ui.txtEvents.setFont(font)
        ui.txtEvents.setPlainText(EventCode(), "", "")

        dialog.setWindowTitle("easy fMRI Atlas based analysis - V" +
                              getVersion() + "B" + getBuild())
        dialog.setWindowFlags(dialog.windowFlags()
                              | QtCore.Qt.CustomizeWindowHint)
        dialog.setWindowFlags(dialog.windowFlags()
                              & ~QtCore.Qt.WindowMaximizeButtonHint)
        dialog.setFixedSize(dialog.size())
        dialog.show()
Beispiel #3
0
    def __init__(self, parent=None):
        super(CodeEditor, self).__init__(parent, False)
        # self.setObjectName( 'CodeEditor' )
        self.font_size = 12
        self.use_spaces_instead_of_tabs = False
        server_script = server.__file__
        interpreter = sys.executable
        # self.backend.start( server_script, interpreter, None, reuse=True )
        # append panels
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           Panel.Position.BOTTOM)

        self.panels.append(panels.FoldingPanel())

        # append modes
        # self.modes.append(modes.AutoCompleteMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.CaseConverterMode())
        # self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.RightMarginMode())
        sh = self.modes.append(
            modes.PygmentsSH(self.document(),
                             color_scheme=ColorScheme('monokai')))
        sh.fold_detector = IndentFoldDetector()
        self.modes.append(modes.ZoomMode())
        # self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.AutoIndentMode())
        self.modes.append(modes.IndenterMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())
    def show(self):
        global dialog
        global ui, currentFile
        ui = Ui_frmManuallyDesignROI()
        QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create('Fusion'))
        dialog = QtWidgets.QMainWindow()
        ui.setupUi(dialog)
        self.set_events(self)

        ui.stb.showMessage("New File")
        currentFile = None

        ui.txtCode = api.CodeEdit(ui.Code)
        #ui.txtCode.setGeometry(QtCore.QRect(10, 10, 641, 451))
        ui.gridLayout.addWidget(ui.txtCode, 0, 0, 1, 1)
        ui.txtCode.setObjectName("txtCode")

        ui.txtCode.backend.start('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)

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

        dialog.setWindowTitle("easy fMRI manually design ROI - V" + getVersion() + "B" + getBuild())
        dialog.show()
Beispiel #5
0
    def __init__(self):
        super(MyPythonCodeEdit, self).__init__(color_scheme='monokai')

        # starts the default pyqode.python server (which enable the jedi code
        # completion worker).
        self.backend.start(server.__file__)

        # some other modes/panels require the analyser mode, the best is to
        # install it first
        #self.modes.append(pymodes.DocumentAnalyserMode())

        #--- core panels
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.CheckerPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           panels.SearchAndReplacePanel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
        # add a context menu separator between editor's
        # builtin action and the python specific actions
        self.add_separator()

        #--- python specific panels
        #self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM)

        #--- core modes
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        #self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.ZoomMode())
Beispiel #6
0
    def __init__(self, viewer, snippets=None):
        self.model = None
        self.viewer = viewer
        QtWidgets.QWidget.__init__(self)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(self.layout)
        self.c = None
        self.tools = QtWidgets.QHBoxLayout(self)
        self.layout.addLayout(self.tools)
        self.runbutton = QtWidgets.QPushButton("Run")
        width = self.runbutton.fontMetrics().boundingRect("Run").width() + 20
        self.runbutton.setMaximumWidth(width)
        self.tools.addWidget(self.runbutton)
        self.runbutton.clicked.connect(self.runCode)

        editor = CodeEdit()
        if has_pyqode:
            editor.backend.start(server.__file__)
            editor.panels.append(panels.FoldingPanel())
            editor.panels.append(panels.LineNumberPanel())
            editor.panels.append(panels.SearchAndReplacePanel(), panels.SearchAndReplacePanel.Position.BOTTOM)
            editor.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
            editor.add_separator()
            editor.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM)
            sh = editor.modes.append(PythonSH(editor.document()))
            editor.modes.append(modes.CaretLineHighlighterMode())
            editor.modes.append(modes.CodeCompletionMode())
            editor.modes.append(modes.ExtendedSelectionMode())
            editor.modes.append(modes.FileWatcherMode())
            editor.modes.append(modes.OccurrencesHighlighterMode())
            editor.modes.append(modes.RightMarginMode())
            editor.modes.append(modes.SmartBackSpaceMode())
            editor.modes.append(modes.SymbolMatcherMode())
            editor.modes.append(modes.ZoomMode())
            editor.modes.append(pymodes.CommentsMode())
            editor.modes.append(pymodes.CalltipsMode())
            auto = pymodes.PyAutoCompleteMode()
            auto.logger.setLevel(logging.CRITICAL)
            editor.modes.append(auto)
            editor.modes.append(pymodes.PyAutoIndentMode())
            editor.modes.append(pymodes.PyIndenterMode())
            editor.show()
        else:
            editor.setStyleSheet("font-size: 10pt; font-family: Consolas, Courier;")

        self.editor = editor
        self.snippets = snippets
        if self.snippets:
            self.list = QtWidgets.QComboBox(self)
            self.replace_snippet(0)
            for snip_name in self.snippets.keys():
                self.list.addItem(snip_name)
            self.tools.addWidget(self.list)
            self.list.currentIndexChanged[int].connect(self.replace_snippet)

        self.layout.addWidget(self.editor)
        self.output = QtWidgets.QTextEdit()
        self.output.setReadOnly(True)
        self.output.setStyleSheet("font-size: 10pt; font-family: Consolas, Courier; background-color: #444;")
        self.layout.addWidget(self.output)
Beispiel #7
0
    def __init__(self, parent=None, server_script=server.__file__,
                 interpreter=sys.executable, args=None,
                 create_default_actions=True, color_scheme='qt'):
        super(GenericCodeEdit, self).__init__(parent, create_default_actions)
        from pyqode.core import panels
        from pyqode.core import modes
        self.backend.start(server_script, interpreter, args)
        # append panels
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           Panel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(),
                           Panel.Position.TOP)

        # append modes
        self.modes.append(modes.AutoCompleteMode())
        self.add_separator()
        self.modes.append(modes.CaseConverterMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.PygmentsSyntaxHighlighter(
            self.document(), color_scheme=ColorScheme(color_scheme)))
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.AutoIndentMode())
        self.modes.append(modes.IndenterMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.ExtendedSelectionMode())

        self.syntax_highlighter.fold_detector = IndentFoldDetector()
Beispiel #8
0
    def __init__(self,
                 parent=None,
                 server_script=server.__file__,
                 interpreter=sys.executable,
                 args=None,
                 create_default_actions=True,
                 color_scheme='qt',
                 reuse_backend=False):
        super(PyCodeEdit,
              self).__init__(parent=parent,
                             create_default_actions=create_default_actions)
        self.backend.start(server_script,
                           interpreter,
                           args,
                           reuse=reuse_backend)
        self.setLineWrapMode(self.NoWrap)
        self.setWindowTitle("pyQode - Python Editor")

        # install those modes first as they are required by other modes/panels
        self.modes.append(modes.OutlineMode(defined_names))

        # panels
        self.panels.append(panels.SearchAndReplacePanel(),
                           panels.SearchAndReplacePanel.Position.BOTTOM)
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.CheckerPanel())
        self.panels.append(panels.GlobalCheckerPanel(),
                           panels.GlobalCheckerPanel.Position.RIGHT)
        self.add_separator()

        # modes
        # generic
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.CaseConverterMode())
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())
        # python specifics
        self.modes.append(pymodes.PyAutoIndentMode())
        self.modes.append(pymodes.PyAutoCompleteMode())
        self.modes.append(pymodes.PyFlakesChecker())
        self.modes.append(pymodes.PEP8CheckerMode())
        self.modes.append(pymodes.CalltipsMode())
        self.modes.append(pymodes.PyIndenterMode())
        self.modes.append(pymodes.GoToAssignmentsMode())
        self.modes.append(pymodes.CommentsMode())
        self.modes.append(
            pymodes.PythonSH(self.document(),
                             color_scheme=ColorScheme(color_scheme)))
        self.syntax_highlighter.fold_detector = PythonFoldDetector()
        self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
        self.panels.append(panels.ReadOnlyPanel(), api.Panel.Position.TOP)
Beispiel #9
0
    def create_controls(self, path):
        editor = api.CodeEdit()
        editor.backend.start(server.__file__)

#        editor.panels.append(panels.FoldingPanel())
        editor.panels.append(panels.LineNumberPanel())
        editor.panels.append(panels.CheckerPanel())

        editor.modes.append(modes.CaretLineHighlighterMode())
        editor.modes.append(modes.CodeCompletionMode())
        editor.modes.append(modes.ExtendedSelectionMode())
        editor.modes.append(modes.FileWatcherMode())
        editor.modes.append(modes.RightMarginMode())
        editor.modes.append(modes.SmartBackSpaceMode())
        editor.modes.append(modes.OccurrencesHighlighterMode())
        editor.modes.append(modes.SymbolMatcherMode())
#        editor.modes.append(modes.WordClickMode())
        editor.modes.append(modes.ZoomMode())

        editor.modes.append(pymodes.PythonSH(editor.document()))
        editor.modes.append(pymodes.CommentsMode())
        editor.modes.append(ConsoleCodeCalltipsMode(self))
        editor.modes.append(ConsoleCodeCheckerMode(self))
        editor.modes.append(pymodes.PEP8CheckerMode())
        editor.modes.append(pymodes.PyAutoCompleteMode())
        editor.modes.append(pymodes.PyAutoIndentMode())
        editor.modes.append(pymodes.PyIndenterMode())

        if path is not None:
            editor.file._path = path
        self.editor = editor
        self.tab = TabWidget(self)
        if path is not None and os.path.isfile(path):
            self.tab.add_code_edit(editor)
        else:
            self.tab.add_code_edit(editor, tr("untitled") + "%d.py")

        self.btn_save = QPushButton(tr("Save"))
        self.btn_run = QPushButton(tr("Run"))
        self.btn_make_plugin = QPushButton(tr("Make Plugin"))
        self.btn_reg_plugin = QPushButton(tr("Register Plugin"))
        self.btn_reg_plugin.setVisible(False)

        self.btn_save.clicked.connect(self.save)
        self.btn_run.clicked.connect(self.run)
        self.btn_make_plugin.clicked.connect(self.make_plugin)
        self.btn_reg_plugin.clicked.connect(self.register_plugin)

        self.hbox = QHBoxLayout()
        for w in [self.btn_save, self.btn_run,
                  self.btn_make_plugin, self.btn_reg_plugin]:
            self.hbox.addWidget(w)

        vbox = QVBoxLayout(self)
        vbox.addWidget(self.tab)
        vbox.addLayout(self.hbox)

        self.setLayout(vbox)
Beispiel #10
0
 def __init__(self):
     super().__init__()
     self.show_context_menu = False
     self.sh = self.modes.append(
         modes.PygmentsSH(self.document(), DiffLexer()))
     self.lines = self.panels.append(panels.LineNumberPanel(),
                                     panels.LineNumberPanel.Position.LEFT)
     self.setReadOnly(True)
     self.syntax_highlighter.color_scheme = api.ColorScheme(
         settings.color_scheme())
Beispiel #11
0
 def _setup_panels(self):
     self.search_panel = self.panels.append(panels.SearchAndReplacePanel(),
                                            api.Panel.Position.BOTTOM)
     self.folding_panel = self.panels.append(panels.FoldingPanel(),
                                             api.Panel.Position.LEFT)
     self.line_nbr_panel = self.panels.append(panels.LineNumberPanel(),
                                              api.Panel.Position.LEFT)
     self.checker_panel = self.panels.append(panels.CheckerPanel(),
                                             api.Panel.Position.LEFT)
     self.global_checker_panel = self.panels.append(
         panels.GlobalCheckerPanel(), api.Panel.Position.RIGHT)
Beispiel #12
0
    def __init__(self,
                 parent=None,
                 server_script=server.__file__,
                 interpreter=sys.executable,
                 args=None,
                 create_default_actions=True,
                 color_scheme='default'):
        super(PyCodeEditor,
              self).__init__(parent=parent,
                             create_default_actions=create_default_actions)
        self.backend.start(server_script, interpreter, args)
        self.setLineWrapMode(self.NoWrap)
        self.setWindowTitle("pyQode for LPy")

        # panels
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.CheckerPanel())
        self.panels.append(panels.GlobalCheckerPanel(),
                           panels.GlobalCheckerPanel.Position.RIGHT)
        self._panel_search = panels.SearchAndReplacePanel()
        self.panels.append(self._panel_search,
                           panels.SearchAndReplacePanel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
        self.add_separator()
        self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM)

        # modes

        # generic
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.ExtendedSelectionMode())

        # python specifics
        self.modes.append(pymodes.PyAutoIndentMode())
        self.modes.append(pymodes.PyAutoCompleteMode())
        # self.modes.append(pymodes.FrostedCheckerMode())
        self.modes.append(pymodes.PEP8CheckerMode())
        self.modes.append(pymodes.CalltipsMode())
        self.modes.append(pymodes.PyIndenterMode())
        self.modes.append(pymodes.GoToAssignmentsMode())
        self.modes.append(pymodes.CommentsMode())

        self.modes.append(
            pymodes.PythonSH(self.document(),
                             color_scheme=ColorScheme(color_scheme)))
        self.syntax_highlighter.fold_detector = PythonFoldDetector()
Beispiel #13
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()
Beispiel #14
0
    def __init__(self, parent=None, color_scheme='qt'):
        super().__init__(parent=parent)
        self.setLineWrapMode(self.NoWrap)
        # install those modes first as they are required by other modes/panels
        self.modes.append(modes.OutlineMode(defined_names))

        # panels
        self.panels.append(panels.SearchAndReplacePanel(),
                           panels.SearchAndReplacePanel.Position.BOTTOM)
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.CheckerPanel())
        self.panels.append(panels.GlobalCheckerPanel(),
                           panels.GlobalCheckerPanel.Position.RIGHT)
        # modes
        # generic
        self.modes.append(modes.CursorHistoryMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.CaseConverterMode())
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())
        # python specifics
        self.modes.append(pymodes.PyAutoIndentMode())
        self.modes.append(pymodes.PyAutoCompleteMode())
        self.modes.append(pymodes.FrostedCheckerMode())
        self.modes.append(pymodes.PEP8CheckerMode())
        self.modes.append(pymodes.CalltipsMode())
        self.modes.append(pymodes.PyIndenterMode())
        self.add_separator()
        self.modes.append(AddImportMode())
        self.modes.append(pymodes.GoToAssignmentsMode())
        self.modes.append(pymodes.CommentsMode())
        self.modes.append(
            pymodes.PythonSH(self.document(),
                             color_scheme=ColorScheme(color_scheme)))
        self.syntax_highlighter.fold_detector = PythonFoldDetector()

        self.panels.append(pypanels.QuickDocPanel(),
                           pyqode_api.Panel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(),
                           pyqode_api.Panel.Position.TOP)

        self.breakpoints_panel = self.panels.append(panels.MarkerPanel())
        self.line_highlighter = self.modes.append(modes.LineHighlighterMode())

        self.restart_backend()
Beispiel #15
0
    def show(self):
        global dialog
        global ui
        ui = Ui_frmMABayesianRSA()
        QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create('Fusion'))
        dialog = QtWidgets.QMainWindow()
        ui.setupUi(dialog)
        self.set_events(self)
        ui.tabWidget.setCurrentIndex(0)

        # Method
        ui.cbMethod.addItem("Bayesian RSA","brsa")
        ui.cbMethod.addItem("Group Bayesian RSA","gbrsa")

        # Nureg Method
        ui.cbNuregMethod.addItem("PCA", "PCA")
        ui.cbNuregMethod.addItem("ICA", "ICA")
        ui.cbNuregMethod.addItem("Factor Analysis", "FA")
        ui.cbNuregMethod.addItem("Sparse PCA", "SPCA")

        # Tau2Prior
        ui.cbTau2Prior.addItem("Gamma", prior_GP_var_inv_gamma)
        ui.cbTau2Prior.addItem("Half Cauchy", prior_GP_var_half_cauchy)

        # SNR_prior
        ui.cbSNRPrior.addItem("Exponential", "exp")
        ui.cbSNRPrior.addItem("Log Norm", "lognorm")
        ui.cbSNRPrior.addItem("Uniform", "unif")

        # Base
        ui.txtEvents = api.CodeEdit(ui.tab_7)
        ui.txtEvents.setGeometry(QtCore.QRect(10, 10, 700, 500))
        ui.txtEvents.setObjectName("txtEvents")
        ui.txtEvents.backend.start('backend/server.py')
        ui.txtEvents.modes.append(modes.CodeCompletionMode())
        ui.txtEvents.modes.append(modes.CaretLineHighlighterMode())
        ui.txtEvents.modes.append(modes.PygmentsSyntaxHighlighter(ui.txtEvents.document()))
        ui.txtEvents.panels.append(panels.LineNumberPanel(),api.Panel.Position.LEFT)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        ui.txtEvents.setFont(font)
        ui.txtEvents.setPlainText(OptimizationCode(),"","")


        ui.txtLic.setText(Lic())

        dialog.setWindowTitle("easy fMRI Bayesian RSA - V" + getVersion() + "B" + getBuild())
        dialog.setWindowFlags(dialog.windowFlags() | QtCore.Qt.CustomizeWindowHint)
        dialog.setWindowFlags(dialog.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint)
        dialog.setFixedSize(dialog.size())
        dialog.show()
Beispiel #16
0
    def create_controls(self):
        """Build the editor's controls"""
        # First set up the stylesheet editor:
        editor = api.CodeEdit()
        editor.backend.start(server.__file__)

        editor.panels.append(panels.LineNumberPanel())
        editor.panels.append(panels.CheckerPanel())

        editor.modes.append(AutoIndentMode())
        editor.modes.append(modes.CaretLineHighlighterMode())
        editor.modes.append(modes.CodeCompletionMode())
        editor.modes.append(modes.ExtendedSelectionMode())
        editor.modes.append(modes.SmartBackSpaceMode())
        editor.modes.append(modes.OccurrencesHighlighterMode())
        editor.modes.append(modes.SymbolMatcherMode())
        editor.modes.append(modes.ZoomMode())

        self.editor = editor

        # Create the pushbuttons for the button bar:
        self.btn_apply = QPushButton(tr("Apply"))
        self.btn_apply.clicked.connect(self.apply)

        self.btn_save = QPushButton(tr("Save"))
        self.btn_save.clicked.connect(self.save)

        self.btn_revert = QPushButton(tr("Revert"))
        self.btn_revert.clicked.connect(self.load)

        self.btn_clear = QPushButton(tr("Clear"))
        self.btn_clear.clicked.connect(self._clear_styles)

        self.hbox = QHBoxLayout()
        for w in [
                self.btn_apply, self.btn_save, self.btn_revert, self.btn_clear
        ]:
            self.hbox.addWidget(w)

        # Create the group-box with the palette editor
        self.palette_box = self.create_palette_colors()

        # Lay out the various components:
        vbox = QVBoxLayout(self)
        vbox.addWidget(self.palette_box)
        vbox.addWidget(editor)
        vbox.addLayout(self.hbox)

        self.setLayout(vbox)
Beispiel #17
0
    def __init__(self):
        super(SourceView, self).__init__()
        self.backend.start(QodeBackend.server.__file__)
        self.modes.append(QodeModes.CodeCompletionMode())
        self.modes.append(QodeModes.PygmentsSyntaxHighlighter(self.document()))
        self.modes.append(QodeModes.CaretLineHighlighterMode())
        self.panels.append(QodePanels.LineNumberPanel())

        margin = self.modes.append(QodeModes.RightMarginMode())
        margin.position = 80
        margin.color = Qt.GlobalColor.gray

        self.font_name = "Inconsolata"
        self.font_size = 12
        self.file.open(__file__)
Beispiel #18
0
    def __init__(self,
                 parent=None,
                 server_script=server.__file__,
                 interpreter=sys.executable,
                 args=None,
                 create_default_actions=True,
                 color_scheme='qt',
                 reuse_backend=False):
        super(JSONCodeEdit,
              self).__init__(parent,
                             create_default_actions=create_default_actions)

        self.backend.start(server_script,
                           interpreter,
                           args,
                           reuse=reuse_backend)

        # append panels
        self.panels.append(panels.SearchAndReplacePanel(),
                           Panel.Position.BOTTOM)
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(json_panels.NavigationPanel(), Panel.Position.TOP)
        self.panels.append(panels.CheckerPanel())

        # append modes
        self.modes.append(json_modes.AutoCompleteMode())
        self.add_separator()
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.CaseConverterMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.CaretLineHighlighterMode())
        self.sh = self.modes.append(
            json_modes.JSONSyntaxHighlighter(
                self.document(), color_scheme=ColorScheme(color_scheme)))
        self.modes.append(modes.IndenterMode())
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.AutoIndentMode())
        self.modes.append(json_modes.AutoIndentMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(json_modes.JSONLinter())
        self.syntax_highlighter.fold_detector = JSONFoldDetector()

        self.panels.append(panels.EncodingPanel(), Panel.Position.TOP)
        self.panels.append(panels.ReadOnlyPanel(), Panel.Position.TOP)
Beispiel #19
0
    def __init__(self):
        super(MyPythonCodeEdit, self).__init__()

        # starts the default pyqode.python server (which enable the jedi code
        # completion worker).
        #Now it does not work,  why?????
        if hasattr(sys, 'frozen'):
            self.backend.start(server.__file__, interpreter="python")
        else:
            self.backend.start(server.__file__)

        # some other modes/panels require the analyser mode, the best is to
        # install it first
        #self.modes.append(pymodes.DocumentAnalyserMode())

        #--- core panels
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.CheckerPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           panels.SearchAndReplacePanel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
        # add a context menu separator between editor's
        # builtin action and the python specific actions
        self.add_separator()

        #--- python specific panels
        self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM)

        #--- core modes
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.ZoomMode())

        #---  python specific modes
        self.modes.append(pymodes.CommentsMode())
        self.modes.append(pymodes.CalltipsMode())
        self.modes.append(pymodes.FrostedCheckerMode())
        self.modes.append(pymodes.PEP8CheckerMode())
        self.modes.append(pymodes.PyAutoCompleteMode())
        self.modes.append(pymodes.PyAutoIndentMode())
        self.modes.append(pymodes.PyIndenterMode())
Beispiel #20
0
    def __init__(self, parent=None, server_script=None,
                 interpreter=sys.executable, args=None,
                 create_default_actions=True, color_scheme='qt',
                 reuse_backend=True):

        super(RstCodeEdit, self).__init__(parent, create_default_actions)

        if server_script is None:
            server_script = self.DEFAULT_SERVER

        print 'is freezed?', hasattr(sys, 'frozen')
        print self.DEFAULT_SERVER
        print sys.executable
        print os.getcwd()

        sys.frozen = True

        self.backend.start(server_script, interpreter, args,
                           reuse=reuse_backend)

        # append panels
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           api.Panel.Position.TOP)

        # append modes
        self.modes.append(modes.CursorHistoryMode())
        self.modes.append(modes.CaseConverterMode())
        self.modes.append(modes.FileWatcherMode())

        # self.modes.append(modes.CaretLineHighlighterMode())

        self.modes.append(modes.RightMarginMode())
        self.modes.append(rstmodes.RstSH(self.document(), color_scheme=api.ColorScheme(color_scheme)))
        self.modes.append(modes.ZoomMode())
        cc = modes.CodeCompletionMode()
        cc.trigger_symbols[:] = []
        self.modes.append(cc)
        self.modes.append(modes.AutoIndentMode())
        self.modes.append(modes.IndenterMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.CheckerMode(workers.linter))

        self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
        self.panels.append(panels.ReadOnlyPanel(), api.Panel.Position.TOP)
        self.panels.append(panels.CheckerPanel())
Beispiel #21
0
    def __init__(self):
        super(MyPythonCodeEdit, self).__init__()

        # starts the default pyqode.python server (which enable the jedi code
        # completion worker).
        self.backend.start(server.__file__)

        # some other modes/panels require the analyser mode, the best is to
        # install it first
        self.modes.append(modes.OutlineMode(defined_names))

        #--- core panels
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.CheckerPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           panels.SearchAndReplacePanel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
        # add a context menu separator between editor's
        # builtin action and the python specific actions
        self.add_separator()

        #--- python specific panels
        self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM)

        #--- core modes
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.ZoomMode())

        #---  python specific modes
        self.modes.append(pymodes.CommentsMode())
        self.modes.append(pymodes.CalltipsMode())
        self.modes.append(pymodes.PyFlakesChecker())
        self.modes.append(pymodes.PEP8CheckerMode())
        self.modes.append(pymodes.PyAutoCompleteMode())
        self.modes.append(pymodes.PyAutoIndentMode())
        self.modes.append(pymodes.PyIndenterMode())
        self.modes.append(pymodes.PythonSH(self.document()))
        self.syntax_highlighter.fold_detector = PythonFoldDetector()
Beispiel #22
0
 def __init__(self, parent=None, color_scheme='qt'):
     super().__init__(parent=parent)
     # panels
     self.panels.append(panels.FoldingPanel())
     self.panels.append(panels.LineNumberPanel())
     self.panels.append(panels.CheckerPanel())
     self.panels.append(panels.GlobalCheckerPanel(),
                        panels.GlobalCheckerPanel.Position.RIGHT)
     # modes
     self.modes.append(modes.RightMarginMode())
     self.caret_highlighter = self.modes.append(
         modes.CaretLineHighlighterMode())
     self.modes.append(
         pymodes.PythonSH(self.document(),
                          color_scheme=ColorScheme(color_scheme)))
     self.syntax_highlighter.fold_detector = PythonFoldDetector()
     self.breakpoints_panel = self.panels.append(panels.MarkerPanel())
Beispiel #23
0
    def __init__(self,
                 parent=None,
                 server_script=None,
                 interpreter=sys.executable,
                 args=None,
                 create_default_actions=True,
                 color_scheme='qt',
                 reuse_backend=False):
        super(GenericCodeEdit, self).__init__(parent, create_default_actions)
        from pyqode.core import panels
        from pyqode.core import modes
        if server_script is None:
            server_script = GenericCodeEdit.DEFAULT_SERVER

        self.backend.start(server_script,
                           interpreter,
                           args,
                           reuse=reuse_backend)
        # append panels
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           Panel.Position.BOTTOM)
        self.panels.append(panels.FoldingPanel())

        # append modes
        self.modes.append(modes.CursorHistoryMode())
        self.modes.append(modes.AutoCompleteMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.CaseConverterMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(
            modes.PygmentsSyntaxHighlighter(
                self.document(), color_scheme=ColorScheme(color_scheme)))
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.AutoIndentMode())
        self.modes.append(modes.IndenterMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.SmartBackSpaceMode())

        self.panels.append(panels.EncodingPanel(), Panel.Position.TOP)
        self.panels.append(panels.ReadOnlyPanel(), Panel.Position.TOP)
Beispiel #24
0
def test_margin_size(editor):
    for panel in editor.panels:
        panel.enabled = False
        panel.hide()

    # we really need to show the window here to get correct margin size.
    editor.show()
    QTest.qWaitForWindowActive(editor)
    for position in Panel.Position.iterable():
        # there is no panel on this widget, all margin must be 0
        assert editor.panels.margin_size(position) == 0
    panel = panels.LineNumberPanel()
    editor.panels.append(panel, position=panel.Position.LEFT)
    panel.setVisible(True)
    QTest.qWait(300)
    # as the window is not visible, we need to refresh panels manually
    assert editor.panels.margin_size(Panel.Position.LEFT) != 0
    for panel in editor.panels:
        panel.enabled = True
Beispiel #25
0
    def __init__(self, path):
        super().__init__()
        self.defFont = QFont()
        self.defFont.setFamily('Courier')
        self.defFont.setFixedPitch(True)
        self.defFont.setPointSize(10)

        self.modes.append(modes.PygmentsSyntaxHighlighter(self.document()))
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.IndenterMode())
        self.modes.append(modes.AutoIndentMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.ZoomMode())
        self.panels.append(panels.SearchAndReplacePanel(),
                           api.Panel.Position.BOTTOM)
        self.panels.append(panels.LineNumberPanel(), api.Panel.Position.LEFT)
        self.file.open(path)
        self.setFont(self.defFont)
        self.head, self.fileName = os.path.split(path)
        self.filePath = path
Beispiel #26
0
def setup_editor(code_edit):
    # append panels
    p = panels.FoldingPanel(highlight_caret_scope=True)
    code_edit.panels.append(p)
    p.show()
    p = panels.LineNumberPanel()
    code_edit.panels.append(p)
    p.show()
    p = panels.MarkerPanel()
    code_edit.panels.append(p)
    p.show()
    p = panels.CheckerPanel()
    code_edit.panels.append(p)
    p.show()
    p = panels.SearchAndReplacePanel()
    code_edit.panels.append(p, p.Position.BOTTOM)
    p.show()
    p = panels.GlobalCheckerPanel()
    code_edit.panels.append(p, p.Position.RIGHT)
    p.show()

    # append modes
    code_edit.modes.append(modes.AutoCompleteMode())
    code_edit.modes.append(modes.CaseConverterMode())
    code_edit.modes.append(modes.FileWatcherMode())
    code_edit.modes.append(modes.CaretLineHighlighterMode())
    code_edit.modes.append(modes.RightMarginMode())
    code_edit.modes.append(
        modes.PygmentsSyntaxHighlighter(code_edit.document()))
    code_edit.modes.append(modes.ZoomMode())
    code_edit.modes.append(modes.CodeCompletionMode())
    code_edit.modes.append(modes.AutoIndentMode())
    code_edit.modes.append(modes.IndenterMode())
    code_edit.modes.append(modes.SymbolMatcherMode())
    code_edit.modes.append(modes.WordClickMode())
    code_edit.modes.get(modes.FileWatcherMode).auto_reload = True
    code_edit.syntax_highlighter.fold_detector = IndentFoldDetector()
    code_edit.modes.append(modes.SmartBackSpaceMode())
    code_edit.modes.append(modes.ExtendedSelectionMode())
    code_edit.modes.append(modes.OccurrencesHighlighterMode())
Beispiel #27
0
    def __init__(self,
                 parent=None,
                 server_script=server.__file__,
                 interpreter=sys.executable,
                 args=None,
                 create_default_actions=True,
                 color_scheme='qt',
                 reuse_backend=False):
        from pyqode.core import panels
        from pyqode.core import modes
        super(TextCodeEdit, self).__init__(parent, create_default_actions)
        self.backend.start(server_script,
                           interpreter,
                           args,
                           reuse=reuse_backend)

        # append panels
        self.panels.append(panels.SearchAndReplacePanel(),
                           Panel.Position.BOTTOM)
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())

        # append modes
        self.modes.append(modes.AutoCompleteMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.CaseConverterMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(
            TextCodeEdit.TextSH(self.document(), ColorScheme(color_scheme)))
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.AutoIndentMode())
        self.modes.append(modes.IndenterMode())
        self.modes.append(modes.SymbolMatcherMode())

        self.panels.append(panels.EncodingPanel(), Panel.Position.TOP)
    def __init__(self):
        super(scripteditoritem, self).__init__()

        # starts the default pyqode.python server (which enable the jedi code
        # completion worker).
        self.backend.start(server.__file__)

        # some other modes/panels require the analyser mode, the best is to
        # install it first
        # self.modes.append(pymodes.DocumentAnalyserMode())

        # --- core panels
        self.panels.append(panels.FoldingPanel())
        self.panels.append(panels.LineNumberPanel())
        self.panels.append(panels.CheckerPanel())
        self.panels.append(panels.SearchAndReplacePanel(),
                           panels.SearchAndReplacePanel.Position.BOTTOM)
        self.panels.append(panels.EncodingPanel(), api.Panel.Position.TOP)
        # add a context menu separator between editor's
        # builtin action and the python specific actions
        self.add_separator()

        # --- python specific panels
        self.panels.append(pypanels.QuickDocPanel(), api.Panel.Position.BOTTOM)

        # --- core modes
        self.modes.append(modes.CaretLineHighlighterMode())
        self.modes.append(modes.CodeCompletionMode())
        self.modes.append(modes.ExtendedSelectionMode())
        self.modes.append(modes.FileWatcherMode())
        self.modes.append(modes.OccurrencesHighlighterMode())
        self.modes.append(modes.RightMarginMode())
        self.modes.append(modes.SmartBackSpaceMode())
        self.modes.append(modes.SymbolMatcherMode())
        self.modes.append(modes.ZoomMode())
        self.modes.append(modes.PygmentsSyntaxHighlighter(self.document()))

        # ---  python specific modes
        self.modes.append(pymodes.CommentsMode())
        self.modes.append(pymodes.CalltipsMode())
        self.modes.append(pymodes.FrostedCheckerMode())
        self.modes.append(pymodes.PEP8CheckerMode())
        self.modes.append(pymodes.PyAutoCompleteMode())
        self.modes.append(pymodes.PyAutoIndentMode())
        self.modes.append(pymodes.PyIndenterMode())

        self.syntax_highlighter.color_scheme = api.ColorScheme('darcula')

        QApplication.instance().aboutToQuit.connect(
            self.cleanup)  # TODO: use this approach in Xi-cam

        # self.file.open('test.py')
        self.insertPlainText('''
# Required to allow controls manipulation in background
import asyncio
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
        
# Setup RunEngine
from bluesky import RunEngine
from bluesky.plans import inner_product_scan
RE = RunEngine({})
        
# Set up simulated hardware.
from ophyd.sim import det4, motor1, motor2, motor3
# The 'det4' example detector a 2D Gaussian function of motor1, motor2.

# Move motor1 from 1-5 while moving motor2 from 10-50 -- both in 5 steps.
RE(inner_product_scan([det4], 5,
                      motor1, 1, 5,
                      motor2, 10, 50))
''')
    def show(self):
        global dialog
        global ui
        ui = Ui_frmMAAtlasEnsemble()
        QtWidgets.QApplication.setStyle(
            QtWidgets.QStyleFactory.create('Fusion'))
        dialog = QtWidgets.QMainWindow()
        ui.setupUi(dialog)
        self.set_events(self)
        ui.tabWidget.setCurrentIndex(0)

        # Base
        ui.txtEvents = api.CodeEdit(ui.tab_2)
        ui.txtEvents.setGeometry(QtCore.QRect(10, 10, 790, 420))
        ui.txtEvents.setObjectName("txtEvents")
        ui.txtEvents.backend.start('backend/server.py')
        ui.txtEvents.modes.append(modes.CodeCompletionMode())
        ui.txtEvents.modes.append(modes.CaretLineHighlighterMode())
        ui.txtEvents.modes.append(
            modes.PygmentsSyntaxHighlighter(ui.txtEvents.document()))
        ui.txtEvents.panels.append(panels.LineNumberPanel(),
                                   api.Panel.Position.LEFT)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        ui.txtEvents.setFont(font)
        ui.txtEvents.setPlainText(EventCode(), "", "")

        # Ensemble
        ui.txtEvents2 = api.CodeEdit(ui.tab_7)
        ui.txtEvents2.setGeometry(QtCore.QRect(10, 10, 790, 420))
        ui.txtEvents2.setObjectName("txtEvents")
        ui.txtEvents2.backend.start('backend/server.py')
        ui.txtEvents2.modes.append(modes.CodeCompletionMode())
        ui.txtEvents2.modes.append(modes.CaretLineHighlighterMode())
        ui.txtEvents2.modes.append(
            modes.PygmentsSyntaxHighlighter(ui.txtEvents.document()))
        ui.txtEvents2.panels.append(panels.LineNumberPanel(),
                                    api.Panel.Position.LEFT)
        font2 = QtGui.QFont()
        font2.setBold(True)
        font2.setWeight(75)
        ui.txtEvents2.setFont(font2)
        ui.txtEvents2.setPlainText(EventCode2(), "", "")

        # Precision Avg
        ui.cbPrecisionAvg.addItem("weighted", "weighted")
        ui.cbPrecisionAvg.addItem("micro", "micro")
        ui.cbPrecisionAvg.addItem("macro", "macro")
        ui.cbPrecisionAvg.addItem("binary", "binary")
        ui.cbPrecisionAvg.addItem("samples", "samples")
        ui.cbPrecisionAvg.addItem("None", None)

        # Average of Precistion Avg
        ui.cbAPrecisionAvg.addItem("macro", "macro")
        ui.cbAPrecisionAvg.addItem("weighted", "weighted")
        ui.cbAPrecisionAvg.addItem("micro", "micro")
        ui.cbAPrecisionAvg.addItem("samples", "samples")
        ui.cbAPrecisionAvg.addItem("None", None)

        # Recall
        ui.cbRecallAvg.addItem("weighted", "weighted")
        ui.cbRecallAvg.addItem("micro", "micro")
        ui.cbRecallAvg.addItem("macro", "macro")
        ui.cbRecallAvg.addItem("binary", "binary")
        ui.cbRecallAvg.addItem("samples", "samples")
        ui.cbRecallAvg.addItem("None", None)

        # f1 score
        ui.cbF1Avg.addItem("weighted", "weighted")
        ui.cbF1Avg.addItem("micro", "micro")
        ui.cbF1Avg.addItem("macro", "macro")
        ui.cbF1Avg.addItem("binary", "binary")
        ui.cbF1Avg.addItem("samples", "samples")
        ui.cbF1Avg.addItem("None", None)

        dialog.setWindowTitle(
            "easy fMRI Atlas-based ensemble analysis: Atlas - V" +
            getVersion() + "B" + getBuild())
        dialog.setWindowFlags(dialog.windowFlags()
                              | QtCore.Qt.CustomizeWindowHint)
        dialog.setWindowFlags(dialog.windowFlags()
                              & ~QtCore.Qt.WindowMaximizeButtonHint)
        dialog.setFixedSize(dialog.size())
        dialog.show()
Beispiel #30
0
    def show(self):
        global dialog
        global ui
        ui = Ui_frmMAAdaBoost()
        QtWidgets.QApplication.setStyle(
            QtWidgets.QStyleFactory.create('Fusion'))
        dialog = QtWidgets.QMainWindow()
        ui.setupUi(dialog)
        self.set_events(self)
        ui.tabWidget.setCurrentIndex(0)

        ui.txtBase = api.CodeEdit(ui.tab_6)
        ui.txtBase.setGeometry(QtCore.QRect(10, 10, 700, 500))
        ui.txtBase.setObjectName("txtBase")

        #ui.txtBase.backend.start('backend/server.py')

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

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

        # Kernels
        ui.cbAlgorithm.addItem("SAMME.R")
        ui.cbAlgorithm.addItem("SAMME")

        # Precision Avg
        ui.cbPrecisionAvg.addItem("weighted", "weighted")
        ui.cbPrecisionAvg.addItem("micro", "micro")
        ui.cbPrecisionAvg.addItem("macro", "macro")
        ui.cbPrecisionAvg.addItem("binary", "binary")
        ui.cbPrecisionAvg.addItem("samples", "samples")
        ui.cbPrecisionAvg.addItem("None", None)

        # Average of Precistion Avg
        ui.cbAPrecisionAvg.addItem("macro", "macro")
        ui.cbAPrecisionAvg.addItem("weighted", "weighted")
        ui.cbAPrecisionAvg.addItem("micro", "micro")
        ui.cbAPrecisionAvg.addItem("samples", "samples")
        ui.cbAPrecisionAvg.addItem("None", None)

        # Recall
        ui.cbRecallAvg.addItem("weighted", "weighted")
        ui.cbRecallAvg.addItem("micro", "micro")
        ui.cbRecallAvg.addItem("macro", "macro")
        ui.cbRecallAvg.addItem("binary", "binary")
        ui.cbRecallAvg.addItem("samples", "samples")
        ui.cbRecallAvg.addItem("None", None)

        # f1 score
        ui.cbF1Avg.addItem("weighted", "weighted")
        ui.cbF1Avg.addItem("micro", "micro")
        ui.cbF1Avg.addItem("macro", "macro")
        ui.cbF1Avg.addItem("binary", "binary")
        ui.cbF1Avg.addItem("samples", "samples")
        ui.cbF1Avg.addItem("None", None)

        dialog.setWindowTitle("easy fMRI AdaBoost Classification - V" +
                              getVersion() + "B" + getBuild())
        dialog.setWindowFlags(dialog.windowFlags()
                              | QtCore.Qt.CustomizeWindowHint)
        dialog.setWindowFlags(dialog.windowFlags()
                              & ~QtCore.Qt.WindowMaximizeButtonHint)
        dialog.setFixedSize(dialog.size())
        dialog.show()