Esempio n. 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()
Esempio n. 2
0
 def _setup_modes(self, color_scheme):
     self.cursor_history = self.modes.append(modes.CursorHistoryMode())
     self.extended_selection_mode = self.modes.append(
         modes.ExtendedSelectionMode())
     self.case_converter = self.modes.append(modes.CaseConverterMode())
     self.auto_complete = self.modes.append(modes.AutoCompleteMode())
     self.outline_mode = self.modes.append(modes.OutlineMode(get_outline))
     self.add_separator()
     self.goto_def_mode = self.modes.append(cobmodes.GoToDefinitionMode())
     self.code_completion_mode = self.modes.append(
         modes.CodeCompletionMode())
     self.code_completion_mode.trigger_symbols[:] = []
     self.file_watcher = self.modes.append(modes.FileWatcherMode())
     self.auto_indent_mode = self.modes.append(
         cobmodes.CobolAutoIndentMode())
     self.caret_line_mode = self.modes.append(
         modes.CaretLineHighlighterMode())
     self.zoom_mode = self.modes.append(modes.ZoomMode())
     self.indenter_mode = self.modes.append(cobmodes.IndenterMode())
     self.auto_indent_mode = self.modes.append(modes.AutoIndentMode())
     self.modes.append(
         cobmodes.CobolSyntaxHighlighter(
             self.document(), color_scheme=api.ColorScheme(color_scheme)))
     self.syntax_highlighter.fold_detector = CobolFoldDetector()
     self.margins = self.modes.append(cobmodes.MarginsMode())
     self.comments_mode = self.modes.append(cobmodes.CommentsMode())
     self.offset_calculator = self.modes.append(
         cobmodes.OffsetCalculatorMode())
     self.occurences_highlighter_mode = self.modes.append(
         modes.OccurrencesHighlighterMode())
     self.occurences_highlighter_mode.case_sensitive = False
     self.backspace_mode = self.modes.append(cobmodes.SmartBackSpaceMode())
Esempio n. 3
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QMainWindow()

    # code from the simple example
    editor = api.CodeEdit()
    editor.file.open(__file__)
    editor.modes.append(modes.CaretLineHighlighterMode())
    sh = modes.PygmentsSyntaxHighlighter(editor.document())
    editor.modes.append(sh)
    editor.panels.append(panels.SearchAndReplacePanel(),
                      api.Panel.Position.TOP)
    # make the code edit show whitespaces in dark gray
    editor.show_white_spaces = True
    editor.whitespaces_foreground = QtGui.QColor('#606020')

    # make a dark editor using the monokai theme
    sh.pygments_style = 'monokai'

    window.setCentralWidget(editor)
    window.show()

    app.exec_()

    editor.file.close()
    del editor
    del window
    del app
Esempio n. 4
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()
Esempio n. 5
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())
Esempio n. 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)
Esempio n. 7
0
def main():
    app = QtWidgets.QApplication(sys.argv)

    # create editor and window
    window = QtWidgets.QMainWindow()
    editor = api.CodeEdit()
    window.setCentralWidget(editor)

    # start the backend as soon as possible
    editor.backend.start('server.py')

    # append some modes and panels
    editor.modes.append(modes.CodeCompletionMode())
    editor.modes.append(modes.CaretLineHighlighterMode())
    editor.modes.append(modes.PygmentsSyntaxHighlighter(editor.document()))
    editor.panels.append(panels.SearchAndReplacePanel(),
                         api.Panel.Position.BOTTOM)

    # open a file
    editor.file.open(__file__)

    # run
    window.show()
    app.exec_()
    editor.file.close()
Esempio n. 8
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()
Esempio n. 9
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())
Esempio n. 10
0
    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()
Esempio n. 11
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)
Esempio n. 12
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)
Esempio n. 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()
Esempio n. 14
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()
Esempio n. 15
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()
Esempio n. 16
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()
Esempio n. 17
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)
Esempio n. 18
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__)
Esempio n. 19
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)
Esempio n. 20
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())
Esempio n. 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()
Esempio n. 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())
Esempio n. 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)
Esempio n. 24
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(RstCodeEdit, self).__init__(parent, create_default_actions)
        if server_script is None:
            server_script = self.DEFAULT_SERVER

        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.BOTTOM)

        # 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())
Esempio n. 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
Esempio n. 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())
Esempio n. 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)
Esempio n. 28
0
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QMainWindow()

    # configure editor (see examples/simple/basic.py)
    editor = api.CodeEdit()
    editor.file.open(__file__)
    editor.modes.append(modes.CaretLineHighlighterMode())
    editor.modes.append(modes.PygmentsSyntaxHighlighter(editor.document()))
    editor.panels.append(panels.SearchAndReplacePanel(),
                         api.Panel.Position.TOP)
    window.setCentralWidget(editor)
    window.show()

    # Change action properties
    editor.action_duplicate_line.setShortcut('Ctrl+Shift+Down')
    editor.action_duplicate_line.setText('DUPLICATE LINE')

    app.exec_()
    editor.file.close()
    del editor
    del window
    del app
Esempio n. 29
0
 def __init__(self):
     icon = QtGui.QIcon.fromTheme('preferences-desktop-font')
     super().__init__(_('Font & Colors'), icon=icon, category=_('Editor'))
     self.ui = settings_page_editor_colors_ui.Ui_Form()
     self.ui.setupUi(self)
     self.ui.edit_preview.modes.append(modes.CaretLineHighlighterMode())
     self.ui.edit_preview.modes.append(
         modes.PygmentsSH(self.ui.edit_preview.document()))
     self.ui.edit_preview.setPlainText(PREVIEW_TEXT, 'text/x-python',
                                       'utf8')
     self.ui.combo_color_schemes.clear()
     styles = api.PYGMENTS_STYLES
     for custom_style in [
             'qt', 'darcula', 'aube', 'crepuscule', 'ark-dark'
     ]:
         if custom_style not in styles:
             styles.append(custom_style)
     for style in sorted(styles):
         self.ui.combo_color_schemes.addItem(style)
     self.ui.combo_color_schemes.currentIndexChanged.connect(
         self.update_preview)
     self.ui.fontComboBox.currentFontChanged.connect(self.update_preview)
     self.ui.spinbox_font_size.valueChanged.connect(self.update_preview)
Esempio n. 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()