Пример #1
0
    def __init__(self, parent=None, text=""):
        QtWidgets.QDialog.__init__(self, parent)

        self.resize(400, 300)

        vbox = QtWidgets.QVBoxLayout()
        self.textedit = Qsci.QsciScintilla(None)
        self.textedit.setFont(QtGui.QFont("mono", 10))
        self.textedit.setEdgeMode(Qsci.QsciScintilla.EdgeLine)
        self.textedit.setEdgeColumn(35)
        self.textedit.setEdgeColor(QtGui.QColor("#FF0000"))
        self.textedit.setText(text)
        self.textedit.cursorPositionChanged.connect(self.curPosChanged)

        quit_button = QtWidgets.QPushButton("OK")
        quit_button.clicked.connect(self.ok)

        self.label = QtWidgets.QLabel()

        vbox.addWidget(self.textedit)
        vbox.addWidget(quit_button)
        vbox.addWidget(self.label)

        self.setLayout(vbox)
        self.text = ""
Пример #2
0
 def __init__(self, parent, title='', caption='', data='', size=(600, 400)):
     "create a window with a scintilla text widget and an ok button"
     self._parent = parent
     super().__init__(parent)
     self.setWindowTitle(title)
     ## self.setWindowIcon(self._parent._parent.appicon)
     self.resize(size[0], size[1])
     vbox = qtw.QVBoxLayout()
     hbox = qtw.QHBoxLayout()
     hbox.addWidget(qtw.QLabel(caption, self))
     vbox.addLayout(hbox)
     hbox = qtw.QHBoxLayout()
     self.text = sci.QsciScintilla(self)
     self.setup_text()
     self.text.setText(data)
     self.text.setReadOnly(True)
     hbox.addWidget(self.text)
     vbox.addLayout(hbox)
     hbox = qtw.QHBoxLayout()
     ok_button = qtw.QPushButton('&Ok', self)
     ok_button.clicked.connect(self.close)
     ok_button.setDefault(True)
     hbox.addStretch()
     hbox.addWidget(ok_button)
     hbox.addStretch()
     vbox.addLayout(hbox)
     self.setLayout(vbox)
     do = qtw.QAction('Done', self)
     do.triggered.connect(self.close)
     do.setShortcut('Esc')
     self.addAction(do)
Пример #3
0
 def new_file(self):
     if self.tab_widget.tabText(self.tab_widget.currentIndex()) is not 'new':
         text = Qsci.QsciScintilla()
         self.text_setting(text)
         self.tab_widget.addTab(text, 'new')
         self.tab_widget.setCurrentWidget(text)
         self.text = text # set the current text editor to be self.text
     else:
         return
Пример #4
0
    def new_editor(self) -> Qsci.QsciScintilla:
        """"""
        # Create editor object
        editor = Qsci.QsciScintilla()

        # Set editor font
        font = QtGui.QFont()
        font.setFamily('Consolas')
        font.setFixedPitch(True)
        font.setPointSize(10)

        editor.setFont(font)
        editor.setMarginsFont(font)

        # Set margin for line numbers
        font_metrics = QtGui.QFontMetrics(font)
        editor.setMarginWidth(0, font_metrics.width("00000") + 6)
        editor.setMarginLineNumbers(0, True)
        editor.setMarginsBackgroundColor(QtGui.QColor("#cccccc"))

        # Set brace matching
        editor.setBraceMatching(Qsci.QsciScintilla.SloppyBraceMatch)

        # Hide horizontal scroll bar
        editor.SendScintilla(Qsci.QsciScintilla.SCI_SETHSCROLLBAR, 0)

        # Set current line color
        editor.setCaretLineVisible(True)
        editor.setCaretLineBackgroundColor(QtGui.QColor("#ffe4e4"))

        # Set Python lexer
        lexer = Qsci.QsciLexerPython()
        lexer.setDefaultFont(font)
        editor.setLexer(lexer)

        # Add minimum editor size
        editor.setMinimumSize(600, 450)

        # Enable auto complete
        editor.setAutoCompletionSource(Qsci.QsciScintilla.AcsAll)
        editor.setAutoCompletionThreshold(2)
        editor.setAutoCompletionCaseSensitivity(False)
        editor.setAutoCompletionReplaceWord(False)

        # Use space indentation
        editor.setIndentationsUseTabs(False)
        editor.setTabWidth(4)
        editor.setIndentationGuides(True)

        # Enable folding
        editor.setFolding(True)

        return editor
Пример #5
0
    def __init__(self, *args, action, **kwargs):
        self._action = action
        super().__init__(*args, **kwargs)

        self._sci = Qsci.QsciScintilla(self)
        self._sci.setUtf8(True)
        self._sci.setEolMode(self._sci.EolUnix)
        self._sci.setIndentationsUseTabs(True)
        self._sci.setIndentationGuides(True)
        self._sci.setCaretLineVisible(True)
        self._sci.setMargins(1)
        self._sci.setMarginType(0, self._sci.NumberMargin)
        self._sci.setMarginWidth(0, '000')
        self._sci.setLexer(Qsci.QsciLexerCPP(self._sci))
        self._sci.setText(self._action.source())

        self._report = QtWidgets.QTreeWidget(self)
        self._report.setColumnCount(2)
        self._report.setHeaderHidden(True)
        self._report.itemClicked.connect(self._reportClicked)

        self._errorMarker = self._sci.markerDefine(self._sci.Background)
        self._sci.setMarkerBackgroundColor(QtCore.Qt.red, self._errorMarker)
        self._warningMarker = self._sci.markerDefine(self._sci.Background)
        self._sci.setMarkerBackgroundColor(QtCore.Qt.yellow, self._warningMarker)

        btnOK = QtWidgets.QPushButton(_('Done'), self)
        btnCancel = QtWidgets.QPushButton(_('Cancel'), self)

        bld = LayoutBuilder(self)
        with bld.vbox() as vbox:
            vbox.addWidget(self._sci, stretch=5)
            vbox.addWidget(self._report, stretch=1)
            with bld.hbox() as buttons:
                buttons.addStretch(1)
                buttons.addWidget(btnCancel)
                buttons.addWidget(btnOK)

        btnOK.clicked.connect(self.accept)
        btnCancel.clicked.connect(self.reject)

        with Settings().grouped('IDE') as settings:
            if settings.contains('WindowGeometry'):
                self.restoreGeometry(settings.value('WindowGeometry'))
            else:
                self.resize(1024, 768)

        self._timer = QtCore.QTimer(self)
        self._timer.timeout.connect(self._tryCompile)
        self._timer.setSingleShot(True)
        self._sci.textChanged.connect(self._onTextChanged)
        self._tryCompile()
Пример #6
0
 def setup_editor(self):
     "define the editor panel"
     # self.editor = qtw.QTextEdit(self)
     self.editor = qsc.QsciScintilla(self)
     self.editor.setWrapMode(qsc.QsciScintilla.WrapWord)
     self.editor.setBraceMatching(qsc.QsciScintilla.SloppyBraceMatch)
     self.editor.setAutoIndent(True)
     self.editor.setFolding(qsc.QsciScintilla.PlainFoldStyle)
     self.editor.setCaretLineVisible(True)
     self.editor.setCaretLineBackgroundColor(gui.QColor("#ffe4e4"))
     self.editor.setLexer(qsc.QsciLexerMarkdown())
     self.editor.setEnabled(False)
     return self.editor
Пример #7
0
    def __initScintilla(self):
        # delete text editor placeholder
        scintilla = Qsci.QsciScintilla(self)

        ########################
        # setup scintilla
        # set default font
        font = QtGui.QFont()
        font.setFamily('Deja Vu Sans Mono')
        font.setFixedPitch(True)
        font.setPointSize(11)

        # brace matching
        scintilla.setBraceMatching(Qsci.QsciScintilla.SloppyBraceMatch)

        # set lexer
        lexer = Qsci.QsciLexerCPP()
        lexer.setDefaultFont(font)
        lexer.setFont(font)
        scintilla.setLexer(lexer)

        scintilla.setLexer(lexer)
        scintilla.__myLexer = lexer  # save reference to retain scope

        # auto-completion api
        scintilla.__myApi = Qsci.QsciAPIs(lexer)

        scintilla.setAutoCompletionThreshold(1)
        scintilla.setAutoCompletionSource(Qsci.QsciScintilla.AcsAPIs)

        # remove horizontal scrollbar
        scintilla.SendScintilla(Qsci.QsciScintilla.SCI_SETHSCROLLBAR, 0)

        # display default line numbers
        fm = QtGui.QFontMetrics(font)
        scintilla.setMarginWidth(0, fm.width("00000"))
        scintilla.setMarginLineNumbers(0, True)
        ########################

        # insert widget into main vlayout
        self.ui.vlayout.addWidget(scintilla)
        self.__scintilla = scintilla
Пример #8
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(640, 480)
        self.vindu = QtWidgets.QWidget(MainWindow)
        self.vindu.setStyleSheet(_fromUtf8('notusedasyet'))
        #MainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.filename = ""
        self.vindu.setObjectName(_fromUtf8("vindu"))
        self.verticalLayout = PyQt5.QtWidgets.QVBoxLayout(self.vindu)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/ico/python.png")), QtGui.QIcon.Normal, QtGui.QIcon.On)
        MainWindow.setWindowIcon(icon)
        self.verticalLayout.setContentsMargins(0,0,0,0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(_fromUtf8('verticalLayout'))
        self.codebox = Qsci.QsciScintilla(self.vindu)
        self.codebox.setToolTip(_fromUtf8(""))
        self.codebox.setWhatsThis(_fromUtf8(""))
        self.codebox.setAutoFillBackground(False)
        self.codebox.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.codebox.setObjectName(_fromUtf8("codebox"))
        self.verticalLayout.addWidget(self.codebox)
        MainWindow.setCentralWidget(self.vindu)
        #toolbar
        self.toolBar = QtWidgets.QToolBar(MainWindow)
        self.toolBar.setAutoFillBackground(False)
        self.toolBar.setIconSize(QtCore.QSize(32, 32))
        self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        self.toolBar.setObjectName(_fromUtf8("toolBar2"))
        MainWindow.addToolBar(QtCore.Qt.LeftToolBarArea, self.toolBar)
        self.toolBar.addSeparator()
        #toolbar2 debugger
        #self.toolBar2 = QtGui.QToolBar(MainWindow)
        #self.toolBar2.setAutoFillBackground(False)
        #self.toolBar2.setIconSize(QtCore.QSize(32, 32))
        #self.toolBar2.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        #self.toolBar2.setObjectName(_fromUtf8("toolBar"))
       # MainWindow.addToolBar(QtCore.Qt.RightToolBarArea, self.toolBar2)
#        self.toolBar2.addSeparator()
        #getting ready for debugger
        self.codebox.setMarginSensitivity(1, True)
        self.codebox.marginClicked.connect(self.on_margin_clicked)
        self.codebox.markerDefine(QsciScintilla.FullRectangle, self.ARROW_MARKER_NUM)
        self.codebox.setMarkerBackgroundColor(QColor("#ee1111"), self.ARROW_MARKER_NUM)
        #first action Newfile
        self.toolBar.newAction = QtWidgets.QAction(QtGui.QIcon(":/ico/new.png"),"New",self.toolBar)
        self.toolBar.newAction.setStatusTip("Clear TextBox or make new document.")
        self.toolBar.newAction.setShortcut("Ctrl+N")
        self.toolBar.newAction.triggered.connect(self.newfile)
        #second Action OpenFile
        self.toolBar.secondAction = QtWidgets.QAction(QtGui.QIcon(":/ico/open.png"),"Open",self.toolBar)
        self.toolBar.secondAction.setStatusTip("Create a new document from scratch.")
        self.toolBar.secondAction.setShortcut("Ctrl+O")
        self.toolBar.secondAction.triggered.connect(self.open)
        # action 3 save file
        self.toolBar.Action3 = QtWidgets.QAction(QtGui.QIcon(":/ico/save.png"),"Save",self.toolBar)
        self.toolBar.Action3.setStatusTip("Save Your File.")
        self.toolBar.Action3.setShortcut("Ctrl+S")
        self.toolBar.Action3.triggered.connect(self.savefile)
        #action 4 run file
        self.toolBar.Action4 = QtWidgets.QAction(QtGui.QIcon(":/ico/run32.png"),"Run",self.toolBar)
        self.toolBar.Action4.setStatusTip("Run")
        self.toolBar.Action4.setShortcut("Ctrl+E")
        self.toolBar.Action4.triggered.connect(self.runto)
        #action 21 debug
        #self.toolBar2.Action21 = QtGui.QAction(QtGui.QIcon(":/ico/run32.png"),"Debug",self.toolBar)
        #self.toolBar2.Action21.setStatusTip("Debug File.")
        #self.toolBar2.Action21.setShortcut("Ctrl+7")
        #self.toolBar2.Action21.triggered.connect(self.debugto)
        #action 6 undo
        self.toolBar.Action6 =  QtWidgets.QAction(QtGui.QIcon(":/ico/undo.png"),"Redo",self.toolBar)
        self.toolBar.Action6.setStatusTip("Undo.")
        self.toolBar.Action6.setShortcut("Ctrl+Z")
        self.toolBar.Action6.triggered.connect(self.codebox.undo)
        #action 7 redo
        self.toolBar.Action7 = QtWidgets.QAction(QtGui.QIcon(":/ico/redo.png"),"Redo",self.toolBar)
        self.toolBar.Action7.setStatusTip("Redo.")
        self.toolBar.Action7.setShortcut("Ctrl+Y")
        self.toolBar.Action7.triggered.connect(self.codebox.redo)
        #action8 rerset Folding
        self.toolBar.Action8 = QtWidgets.QAction(QtGui.QIcon(":/ico/align-justify.png"),"Reset Folding",self.toolBar)
        self.toolBar.Action8.setStatusTip("Reset Folding.")
        self.toolBar.Action8.setShortcut("Ctrl+R")
        self.toolBar.Action8.triggered.connect(self.nofoldingl)
        #actions9 CircledTreeFoldStyle
        self.toolBar.Action9 = QtWidgets.QAction(QtGui.QIcon(":/ico/bullet.png"),"Circled Tree Folding",self.toolBar)
        self.toolBar.Action9.setStatusTip("Circled Tree Folding.")
        self.toolBar.Action9.setShortcut("Ctrl+C")
        self.toolBar.Action9.triggered.connect(self.Circledfold)
        #actions10 plainFoldStyle
        self.toolBar.Action10 = QtWidgets.QAction(QtGui.QIcon(":/ico/number.png"),"Plain Folding",self.toolBar)
        self.toolBar.Action10.setStatusTip("Plain Folding")
        self.toolBar.Action10.setShortcut("Ctrl+P")
        self.toolBar.Action10.triggered.connect(self.plainfold)
        # fonts
        self.toolBar.Action21 = QtWidgets.QAction(QtGui.QIcon(":/ico4/font.png"), "Fonts", self.toolBar)
        self.toolBar.Action21.setStatusTip("Fonts")
        self.toolBar.Action21.setShortcut("Ctrl+F")
        self.toolBar.Action21.triggered.connect(self.font_choice)
        #web baby
        self.toolBar.Action11 = QtWidgets.QAction(QtGui.QIcon(":/ico/web.png"),"Hex-rays Homepage",self.toolBar)
        self.toolBar.Action11.setStatusTip("Home of Hex-rays")
        self.toolBar.Action11.setShortcut("Ctrl+W")
        self.toolBar.Action11.triggered.connect(self.webopen)
        #irc
        self.toolBar.Action12 = QtWidgets.QAction(QtGui.QIcon(":/ico3/settings.png"),"Open Ida Pro Python SDK",self.toolBar)
        self.toolBar.Action12.setStatusTip("Ida Pro Python SDK")
        self.toolBar.Action12.setShortcut("Ctrl+I")
        self.toolBar.Action12.triggered.connect(self.sdkopen)
        #github Python
        self.toolBar.Action14 = QtWidgets.QAction(QtGui.QIcon(":/ico/github.png"),"Open git python",self.toolBar)
        self.toolBar.Action14.setStatusTip("Open git python")
        self.toolBar.Action14.setShortcut("Ctrl+G")
        self.toolBar.Action14.triggered.connect(self.gitopen)
        #auther me :)
        self.toolBar.Action15 = QtWidgets.QAction(QtGui.QIcon(":/ico/auth.png"),"Author",self.toolBar)
        self.toolBar.Action15.setStatusTip("Author")
        self.toolBar.Action15.setShortcut("Ctrl+B")
        self.toolBar.Action15.triggered.connect(self.Author)
        #toggle off code regonision
        self.toolBar.Action16 = QtWidgets.QAction(QtGui.QIcon(":/ico2/pythonminus.png"),"Disable Code recognition",self.toolBar)
        self.toolBar.Action16.setStatusTip("Disable Code recognition")
        self.toolBar.Action16.setShortcut("Alt+D")
        self.toolBar.Action16.triggered.connect(self.Diablecode)
        #toogle on
        self.toolBar.Action17 = QtWidgets.QAction(QtGui.QIcon(":/ico2/pypluss.png"),"Enable Code recognition",self.toolBar)
        self.toolBar.Action17.setStatusTip("Enable Code recognition")
        self.toolBar.Action17.setShortcut("Alt+E")
        self.toolBar.Action17.triggered.connect(self.Reiablecode)
        # zoom in
        self.toolBar.Action18 = QtWidgets.QAction(QtGui.QIcon(":/ico3/in.png"),"Zoom In",self.toolBar)
        self.toolBar.Action18.setStatusTip("Zoom In")
        self.toolBar.Action18.setShortcut("CTRL+SHIFT++")
        self.toolBar.Action18.triggered.connect(self.udder)
        #zoom out
        self.toolBar.Action19 = QtWidgets.QAction(QtGui.QIcon(":/ico3/out.png"),"Zoom Out",self.toolBar)
        self.toolBar.Action19.setStatusTip("Zoom Out")
        self.toolBar.Action19.setShortcut("CTRL+SHIFT+-")
        self.toolBar.Action19.triggered.connect(self.odder)

        self.toolBar.Action20 = QtWidgets.QAction(QtGui.QIcon(":/ico3/10.png"),"Profile Code",self.toolBar)
        self.toolBar.Action20.setStatusTip("Profile Code")
        self.toolBar.Action20.setShortcut("CTRL+SHIFT+E")
        self.toolBar.Action20.triggered.connect(self.runtoprob)

        #actions
        self.toolBar.addAction(self.toolBar.newAction)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.secondAction)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action3)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action4)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action6)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action7)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action8)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action9)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action10)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action21)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action11)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action12)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action14)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action15)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action16)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action17)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action18)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action19)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action20)

        #self.toolBar2.addAction(self.toolBar.Action21)
        #self.toolBar2.addSeparator()
        #font
        self.skrift = QFont()
        self.skrift.setFamily('Consolas')
        self.skrift.setFixedPitch(True)
        self.skrift.setPointSize(12)
        self.codebox.setFont(self.skrift)

        #python style
        self.lexer = QsciLexerPython(self.codebox)
        self.lexer.setFont(self.skrift)
        self.lexer.setEolFill(True)
        #api test not working
        api = Qsci.QsciAPIs(self.lexer)
        API_FILE = dn+'\\Python.api'
        API_FILE2 = dn+'\\idc.api'
        API_FILE3 = dn+'\\idaapi.api'
        api.load(API_FILE)
        api.load(API_FILE2)
        api.load(API_FILE3)

        api.prepare()
        self.codebox.setAutoCompletionThreshold(0)
        self.codebox.setAutoCompletionThreshold(6)
        self.codebox.setAutoCompletionThreshold(8)
        self.codebox.setAutoCompletionSource(Qsci.QsciScintilla.AcsAPIs)
        self.lexer.setDefaultFont(self.skrift)
        self.codebox.setLexer(self.lexer)
        self.codebox.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Consolas')

        #line numbers
        fontmetrics = QFontMetrics(self.skrift)
        self.codebox.setMarginsFont(self.skrift)
        self.codebox.setMarginWidth(0, fontmetrics.width("00000") + 6)
        self.codebox.setTabWidth(4)

        #brace
        self.codebox.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        #auto line tab =4
        self.codebox.setAutoIndent(True)

        #scroolbar
        self.codebox.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 1)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Пример #9
0
    def create_widget(self):
        """ Create the underlying label widget.

        """
        self.widget = Qsci.QsciScintilla(self.parent_widget())
Пример #10
0
    def __init__(self, main_window, config):
        super(MainInterface, self).__init__(main_window)
        self.config = config

        # Main Window
        main_window.setObjectName("main_window")
        main_window.resize(800, 600)
        size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                            QtWidgets.QSizePolicy.Preferred)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(
            main_window.sizePolicy().hasHeightForWidth())
        main_window.setSizePolicy(size_policy)
        main_window.setTabShape(QtWidgets.QTabWidget.Rounded)

        # Central Widget
        self.central_widget = QtWidgets.QWidget(main_window)
        self.central_widget.setObjectName("central_widget")
        self.central_layout = QtWidgets.QVBoxLayout(self.central_widget)
        self.central_layout.setObjectName("verticalLayout")

        # Main Splitter
        self.main_splitter = QtWidgets.QSplitter(self.central_widget)
        self.main_splitter.setOrientation(QtCore.Qt.Horizontal)
        self.main_splitter.setObjectName("main_splitter")

        # Library Browser
        self.library_browser = QtWidgets.QTreeWidget(self.main_splitter)
        self.library_browser.setObjectName("library_browser")

        # Main Tab Widget
        self.main_tab_widget = QtWidgets.QTabWidget(self.main_splitter)
        self.main_tab_widget.setTabPosition(QtWidgets.QTabWidget.North)
        self.main_tab_widget.setTabShape(QtWidgets.QTabWidget.Rounded)
        self.main_tab_widget.setElideMode(QtCore.Qt.ElideNone)
        self.main_tab_widget.setDocumentMode(False)
        self.main_tab_widget.setTabsClosable(False)
        self.main_tab_widget.setMovable(True)
        self.main_tab_widget.setTabBarAutoHide(False)
        self.main_tab_widget.setObjectName("main_tab_widget")

        # Code Tab
        self.code_tab = QtWidgets.QWidget()
        self.code_tab.setObjectName("code_tab")
        self.code_tab_layout = QtWidgets.QHBoxLayout(self.code_tab)
        self.code_tab_layout.setObjectName("horizontalLayout_2")
        self.code_layout = QtWidgets.QVBoxLayout()
        self.code_layout.setObjectName("code_layout")
        self.code_editor = Qsci.QsciScintilla(self.code_tab)
        self.code_editor.setToolTip("")
        self.code_editor.setWhatsThis("")
        self.code_editor.setObjectName("code_editor")
        self.code_layout.addWidget(self.code_editor)
        self.code_tab_layout.addLayout(self.code_layout)
        self.main_tab_widget.addTab(self.code_tab, "")

        # Console Tab
        self.console_tab = QtWidgets.QWidget()
        self.console_tab.setObjectName("console_tab")
        self.console_tab_layout = QtWidgets.QHBoxLayout(self.console_tab)
        self.console_tab_layout.setObjectName("horizontalLayout_3")

        # Console Log
        self.console_layout = QtWidgets.QVBoxLayout()
        self.console_layout.setObjectName("console_layout")
        self.console_log = QtWidgets.QPlainTextEdit(self.console_tab)
        self.console_log.setReadOnly(True)
        self.console_log.setObjectName("console_log")
        self.console_layout.addWidget(self.console_log)

        # Console Prompt
        self.prompt_layout = QtWidgets.QHBoxLayout()
        self.prompt_layout.setObjectName("prompt_layout")
        self.console_prompt = QtWidgets.QLabel(self.console_tab)
        self.console_prompt.setText("")
        self.console_prompt.setObjectName("console_prompt")
        self.prompt_layout.addWidget(self.console_prompt)

        # Console Input
        self.console_input = QtWidgets.QLineEdit(self.console_tab)
        self.console_input.setFrame(True)
        self.console_input.setObjectName("console_input")
        self.prompt_layout.addWidget(self.console_input)
        self.console_layout.addLayout(self.prompt_layout)
        self.console_tab_layout.addLayout(self.console_layout)
        self.main_tab_widget.addTab(self.console_tab, "")
        self.central_layout.addWidget(self.main_splitter)

        # Set Central and Index
        self.main_tab_widget.setCurrentIndex(1)
        main_window.setCentralWidget(self.central_widget)

        # Menu Bar
        self.menu_bar = QtWidgets.QMenuBar(main_window)
        self.menu_bar.setGeometry(QtCore.QRect(0, 0, 800, 25))
        self.menu_bar.setObjectName("menu_bar")
        main_window.setMenuBar(self.menu_bar)

        # Menu Bar -> File
        self.file_menu = self.menu_bar.addMenu('File')

        # Menu Bar -> File -> Settings
        self.settings_dialog = SettingsDialog(config)
        self.settings_action = QtWidgets.QAction('Settings...')
        self.settings_action.setShortcut('Ctrl+Alt+S')
        self.file_menu.addAction(self.settings_action)
        self.settings_action.triggered.connect(self.settings_dialog.show)

        # Tool Bar
        self.tool_bar = main_window.addToolBar('Main Tool Bar')
        self.tool_bar.setMaximumHeight(self.tool_bar.height() / 1.10)

        # Tool Bar Spacer
        self.tool_bar_spacer = QWidget()
        self.tool_bar_spacer.setSizePolicy(QSizePolicy.Expanding,
                                           QSizePolicy.Preferred)
        self.tool_bar_spacer.setVisible(True)
        self.tool_bar.addWidget(self.tool_bar_spacer)

        # Tool Bar -> Interpreter
        self.interpreter_combo = QComboBox()
        self.interpreter_combo.setSizePolicy(QSizePolicy.Preferred,
                                             QSizePolicy.Expanding)
        self.interpreter_combo.addItems(self.config["Languages"])
        self.tool_bar.addWidget(self.interpreter_combo)

        # Tool Bar -> Run
        self.interpreter_run = QPushButton()
        self.interpreter_run.setSizePolicy(QSizePolicy.Preferred,
                                           QSizePolicy.Expanding)
        self.interpreter_run.setIcon(QIcon(":/icons/interpreter_run"))
        self.interpreter_run.setFlat(True)
        self.interpreter_run.installEventFilter(self)
        self.tool_bar.addWidget(self.interpreter_run)

        # Status Bar
        self.status_bar = QtWidgets.QStatusBar(main_window)
        self.status_bar.setObjectName("status_bar")
        main_window.setStatusBar(self.status_bar)

        self.re_translate_ui(main_window)
        QtCore.QMetaObject.connectSlotsByName(main_window)
Пример #11
0
    def init_GUI(self):
        # ----------------------------------------------------------------------
        self.resize(700, 500)
        self.setWindowTitle('Editor')
        text = Qsci.QsciScintilla()
        self.text_setting(text)

        #initiate the tab widget
        self.tab_widget = TextEditorTab()

        # at start, one default tab
        self.tab_widget.addTab(text,'new')
        self.text = text
        self.setCentralWidget(self.tab_widget)

        self.statusBar()

        # COMMON ACTIONS--------------------------------------------------------
        exit_action = self.make_action(name='Exit',
                                        shortCut='Ctrl+Q',
                                        statusTip='Exit',
                                        callback=QtWidgets.qApp.quit)
        # TODO
        run_code_action = self.make_action(name='Run',
                                        shortCut='Ctrl+R',
                                        statusTip='Run Code',
                                        callback=self.run_code)

        # ADD TOOLBAR-----------------------------------------------------------
        self.toolBar = self.addToolBar('Exit')
        self.toolBar.addAction(exit_action)
        self.toolBar.addAction(run_code_action)

        # create menu bar-------------------------------------------------------
        menu_bar = self.menuBar()
        # create actions under file menu----------------------------------------
        file_actions = []
        file_actions.append(self.make_action(name='New',
                                        shortCut='Ctrl+N',
                                        statusTip='New File',
                                        callback=self.new_file))
        file_actions.append(self.make_action(name='Open File...',
                                        shortCut='Ctrl+O',
                                        statusTip='Open File',
                                        callback=self.open_file))
        file_actions.append(self.make_action(name='Save',
                                        shortCut='Ctrl+S',
                                        statusTip='Save File',
                                        callback=self.save_file))
        file_actions.append(self.make_action(name='Save As...',
                                        shortCut='Ctrl+Alt+S',
                                        statusTip='Save File As...',
                                        callback=self.save_as_file))
        file_actions.append(exit_action)



        file_menu = menu_bar.addMenu('File')
        file_menu.addActions(file_actions)

        # create actions under format menu--------------------------------------
        format_actions = []
        format_actions.append(self.make_action(name='Format Code',
                                        shortCut='Ctrl+Alt+F',
                                        statusTip='Format Code',
                                        callback=self.format_code))

        format_actions.append(self.make_action(name='Simplify Code',
                                        shortCut='Ctrl+Shift+S',
                                        statusTip='Simplify Code',
                                        callback=self.simplify_code))

        format_menu = menu_bar.addMenu('Format')
        format_menu.addActions(format_actions)
Пример #12
0
    def setupUi(self, projectwindow):
        projectwindow.setObjectName("projectwindow")
        projectwindow.resize(1172, 835)
        icon = QtGui.QIcon()
        icon.addPixmap(
            QtGui.QPixmap(":/browser/browser.svg"),
            QtGui.QIcon.Normal,
            QtGui.QIcon.Off)
        projectwindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(projectwindow)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.centralwidget.sizePolicy().hasHeightForWidth())
        self.centralwidget.setSizePolicy(sizePolicy)
        self.centralwidget.setAcceptDrops(True)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.project_work_area = QtWidgets.QMdiArea(self.centralwidget)
        self.project_work_area.setObjectName("project_work_area")
        self.project_browser = QtWidgets.QWidget()
        self.project_browser.setObjectName("project_browser")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.project_browser)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.WebView = QtWebEngineWidgets.QWebEngineView(self.project_browser)
        self.WebView.setUrl(QtCore.QUrl("about:blank"))
        self.WebView.setObjectName("WebView")
        self.gridLayout_2.addWidget(self.WebView, 0, 0, 1, 1)
        self.project_text_editor = QtWidgets.QWidget()
        self.project_text_editor.setObjectName("project_text_editor")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.project_text_editor)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.textEdit = Qsci.QsciScintilla(self.project_text_editor)
        self.textEdit.setToolTip("")
        self.textEdit.setWhatsThis("")
        self.textEdit.setObjectName("textEdit")
        self.gridLayout_4.addWidget(self.textEdit, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.project_work_area, 1, 0, 1, 1)
        projectwindow.setCentralWidget(self.centralwidget)
        self.ToolBox = QtWidgets.QDockWidget(projectwindow)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.ToolBox.sizePolicy().hasHeightForWidth())
        self.ToolBox.setSizePolicy(sizePolicy)
        self.ToolBox.setMouseTracking(True)
        self.ToolBox.setFloating(False)
        self.ToolBox.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
        self.ToolBox.setObjectName("ToolBox")
        self.dockWidgetContents_2 = QtWidgets.QWidget()
        self.dockWidgetContents_2.setObjectName("dockWidgetContents_2")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_2)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.treeWidget = QtWidgets.QTreeWidget(self.dockWidgetContents_2)
        self.treeWidget.setObjectName("treeWidget")
        item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget)
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setBold(True)
        font.setItalic(True)
        font.setUnderline(True)
        font.setWeight(75)
        item_0.setFont(0, font)
        brush = QtGui.QBrush(QtGui.QColor(166, 166, 166))
        brush.setStyle(QtCore.Qt.SolidPattern)
        item_0.setBackground(0, brush)
        brush = QtGui.QBrush(QtGui.QColor(29, 38, 202))
        brush.setStyle(QtCore.Qt.NoBrush)
        item_0.setForeground(0, brush)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        item_1 = QtWidgets.QTreeWidgetItem(item_0)
        self.gridLayout_3.addWidget(self.treeWidget, 0, 0, 1, 1)
        self.ToolBox.setWidget(self.dockWidgetContents_2)
        projectwindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.ToolBox)

        self.retranslateUi(projectwindow)
        QtCore.QMetaObject.connectSlotsByName(projectwindow)
Пример #13
0
    def __init__(self, parent=None):
        BaseDialog.__init__(self, parent, remove_stretch=True)
        message = _("Edit Standard Letters")
        self.setWindowTitle(message)

        self._standard_letters = None
        self.deleted_letters = []

        header_label = QtWidgets.QLabel("<b>%s</b>" % message)

        self.list_model = ListModel()

        self.list_view = QtWidgets.QListView()
        self.list_view.setModel(self.list_model)

        icon = QtGui.QIcon(":/eraser.png")
        delete_but = QtWidgets.QPushButton(icon, "")
        delete_but.setToolTip(_("Delete the currently selected letter"))
        delete_but.setMaximumWidth(80)

        icon = QtGui.QIcon(":/add_user.png")
        add_but = QtWidgets.QPushButton(icon, "")
        add_but.setToolTip(_("Add a New Letter"))
        add_but.setMaximumWidth(80)

        left_frame = QtWidgets.QFrame()
        layout = QtWidgets.QGridLayout(left_frame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.list_view, 0, 0, 1, 3)
        layout.addWidget(delete_but, 1, 0)
        layout.addWidget(add_but, 1, 1)
        left_frame.setMaximumWidth(250)

        right_frame = QtWidgets.QFrame()
        layout = QtWidgets.QFormLayout(right_frame)
        layout.setContentsMargins(0, 0, 0, 0)
        self.description_line_edit = QtWidgets.QLineEdit()
        self.text_edit = Qsci.QsciScintilla()
        self.text_edit.setLexer(Qsci.QsciLexerHTML())
        self.footer_text_edit = Qsci.QsciScintilla()
        self.footer_text_edit.setLexer(Qsci.QsciLexerHTML())

        layout.addRow(_("Desctription"), self.description_line_edit)
        layout.addRow(_("Body Text"), self.text_edit)
        layout.addRow(_("Footer"), self.footer_text_edit)

        splitter = QtWidgets.QSplitter()
        splitter.addWidget(left_frame)
        splitter.addWidget(right_frame)
        splitter.setSizes([1, 10])
        self.insertWidget(header_label)
        self.insertWidget(splitter)

        self.list_view.pressed.connect(self.show_data)

        self.cancel_but.setText(_("Close"))
        self.apply_but.setText(_("Apply Changes"))

        self.set_check_on_cancel(True)
        self.signals()
        add_but.clicked.connect(self.add_letter)
        delete_but.clicked.connect(self.remove_letter)

        self.orig_data = []
        QtCore.QTimer.singleShot(100, self.load_existing)
Пример #14
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8('MainWindow'))
        MainWindow.resize(640, 480)
        self.vindu = QtWidgets.QWidget(MainWindow)
        self.vindu.setStyleSheet(_fromUtf8('notusedasyet'))
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        #MainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.filename = ''
        self.vindu.setObjectName(_fromUtf8('vindu'))
        self.verticalLayout = PyQt5.QtWidgets.QVBoxLayout(self.vindu)
        app_icon = QtGui.QIcon()
        app_icon.addFile(':/ico/ico.png', QtCore.QSize(16, 16))
        MainWindow.setWindowIcon(app_icon)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(_fromUtf8('verticalLayout'))
        self.codebox = Qsci.QsciScintilla(self.vindu)
        self.codebox.setToolTip(_fromUtf8(''))
        self.codebox.setWhatsThis(_fromUtf8(''))
        self.codebox.setAutoFillBackground(False)
        self.codebox.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.codebox.setObjectName(_fromUtf8('codebox'))
        self.verticalLayout.addWidget(self.codebox)
        MainWindow.setCentralWidget(self.vindu)
        self.toolBar = QtWidgets.QToolBar(MainWindow)
        self.toolBar.setAutoFillBackground(False)
        self.toolBar.setIconSize(QtCore.QSize(32, 32))
        self.toolBar.setObjectName(_fromUtf8('toolBar'))
        MainWindow.addToolBar(QtCore.Qt.LeftToolBarArea, self.toolBar)
        self.toolBar.addSeparator()

        #getting ready for debugger
        self.codebox.setMarginSensitivity(1, True)
        self.codebox.marginClicked.connect(self.on_margin_clicked)

        #self.codebox.connect(self.codebox, QtCore.SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'), self.on_margin_clicked)
        self.codebox.markerDefine(QsciScintilla.FullRectangle,
                                  self.ARROW_MARKER_NUM)
        self.codebox.setMarkerBackgroundColor(QColor("#ee1111"),
                                              self.ARROW_MARKER_NUM)
        #first action Newfile
        self.toolBar.newAction = QtWidgets.QAction(
            QtGui.QIcon(":/ico/new.png"), "New", self.toolBar)
        self.toolBar.newAction.setStatusTip(
            "Clear TextBox or make new document.")
        self.toolBar.newAction.setShortcut("Ctrl+N")
        self.toolBar.newAction.triggered.connect(self.newfile)
        #second Action OpenFile
        self.toolBar.secondAction = QtWidgets.QAction(
            QtGui.QIcon(":/ico/open.png"), "Open", self.toolBar)
        self.toolBar.secondAction.setStatusTip(
            "Create a new document from scratch.")
        self.toolBar.secondAction.setShortcut("Ctrl+O")
        self.toolBar.secondAction.triggered.connect(self.open)
        # action 3 save file
        self.toolBar.Action3 = QtWidgets.QAction(QtGui.QIcon(":/ico/save.png"),
                                                 "Save", self.toolBar)
        self.toolBar.Action3.setStatusTip("Save Your File.")
        self.toolBar.Action3.setShortcut("Ctrl+S")
        self.toolBar.Action3.triggered.connect(self.savefile)
        #action 4 run file
        self.toolBar.Action4 = QtWidgets.QAction(
            QtGui.QIcon(":/ico/run32.png"), "Run To Debugger", self.toolBar)
        self.toolBar.Action4.setStatusTip("Run your file within debugger.")
        self.toolBar.Action4.setShortcut("Ctrl+E")
        self.toolBar.Action4.triggered.connect(self.runto)
        #action 4 run file on windows
        '''self.toolBar.Action5 = QtWidgets.QAction(QtGui.QIcon("icons/Folder_Open.ico"),"Run On windows",self.toolBar)
        self.toolBar.Action5.setStatusTip("Run your file within windows.")
        self.toolBar.Action5.setShortcut("Ctrl+S")
        self.toolBar.Action5.triggered.connect(self.runtoglobal)
        '''
        #action 6 undo
        self.toolBar.Action6 = QtWidgets.QAction(QtGui.QIcon(":/ico/undo.png"),
                                                 "Undo", self.toolBar)
        self.toolBar.Action6.setStatusTip("Undo.")
        self.toolBar.Action6.setShortcut("Ctrl+Z")
        self.toolBar.Action6.triggered.connect(self.codebox.undo)
        #action 7 redo
        self.toolBar.Action7 = QtWidgets.QAction(QtGui.QIcon(":/ico/redo.png"),
                                                 "Redo", self.toolBar)
        self.toolBar.Action7.setStatusTip("Redo.")
        self.toolBar.Action7.setShortcut("Ctrl+Y")
        self.toolBar.Action7.triggered.connect(self.codebox.redo)
        #action8 rerset Folding
        self.toolBar.Action8 = QtWidgets.QAction(
            QtGui.QIcon(":/ico/align-justify.png"), "Reset Folding",
            self.toolBar)
        self.toolBar.Action8.setStatusTip("Reset Folding.")
        self.toolBar.Action8.setShortcut("Ctrl+R")
        self.toolBar.Action8.triggered.connect(self.nofoldingl)
        #actions9 CircledTreeFoldStyle
        self.toolBar.Action9 = QtWidgets.QAction(
            QtGui.QIcon(":/ico/bullet.png"), "Circled Tree Folding",
            self.toolBar)
        self.toolBar.Action9.setStatusTip("Circled Tree Folding.")
        self.toolBar.Action9.setShortcut("Ctrl+C")
        self.toolBar.Action9.triggered.connect(self.Circledfold)
        #actions10 plainFoldStyle
        self.toolBar.Action10 = QtWidgets.QAction(
            QtGui.QIcon(":/ico/number.png"), "Plain Folding", self.toolBar)
        self.toolBar.Action10.setStatusTip("Plain Folding")
        self.toolBar.Action10.setShortcut("Ctrl+P")
        self.toolBar.Action10.triggered.connect(self.plainfold)
        # fonts
        self.toolBar.Action21 = QtWidgets.QAction(
            QtGui.QIcon(":/ico4/font.png"), "Fonts", self.toolBar)
        self.toolBar.Action21.setStatusTip("Fonts")
        self.toolBar.Action21.setShortcut("Ctrl+F")
        self.toolBar.Action21.triggered.connect(self.font_choice)
        #web baby
        self.toolBar.Action11 = QtWidgets.QAction(QtGui.QIcon(":/ico/web.png"),
                                                  "Goto x64dbg homepage",
                                                  self.toolBar)
        self.toolBar.Action11.setStatusTip("Home of x64dbg")
        self.toolBar.Action11.setShortcut("Ctrl+W")
        self.toolBar.Action11.triggered.connect(self.webopen)
        #irc
        self.toolBar.Action12 = QtWidgets.QAction(QtGui.QIcon(":/ico/irc.png"),
                                                  "Open X64dbg Irc",
                                                  self.toolBar)
        self.toolBar.Action12.setStatusTip("Talk about x64dbg on irc")
        self.toolBar.Action12.setShortcut("Ctrl+I")
        self.toolBar.Action12.triggered.connect(self.ircopen)
        #github Python
        self.toolBar.Action14 = QtWidgets.QAction(
            QtGui.QIcon(":/ico/github.png"), "Open git python", self.toolBar)
        self.toolBar.Action14.setStatusTip("Open git python")
        self.toolBar.Action14.setShortcut("Ctrl+G")
        self.toolBar.Action14.triggered.connect(self.gitopen)
        #auther me :)
        self.toolBar.Action15 = QtWidgets.QAction(
            QtGui.QIcon(":/ico/auth.png"), "Author", self.toolBar)
        self.toolBar.Action15.setStatusTip("Author")
        self.toolBar.Action15.setShortcut("Ctrl+B")
        self.toolBar.Action15.triggered.connect(self.Author)
        #toggle off code regonision
        self.toolBar.Action16 = QtWidgets.QAction(
            QtGui.QIcon(":/ico2/pythonminus.png"), "Disable Code recognition",
            self.toolBar)
        self.toolBar.Action16.setStatusTip("Disable Code recognition")
        self.toolBar.Action16.setShortcut("Alt+D")
        self.toolBar.Action16.triggered.connect(self.Diablecode)
        #toogle on
        self.toolBar.Action17 = QtWidgets.QAction(
            QtGui.QIcon(":/ico2/pypluss.png"), "Enable Code recognition",
            self.toolBar)
        self.toolBar.Action17.setStatusTip("Enable Code recognition")
        self.toolBar.Action17.setShortcut("Alt+E")
        self.toolBar.Action17.triggered.connect(self.Reiablecode)
        # zoom in
        self.toolBar.Action18 = QtWidgets.QAction(QtGui.QIcon(":/ico3/in.png"),
                                                  "Zoom In", self.toolBar)
        self.toolBar.Action18.setStatusTip("Zoom In")
        self.toolBar.Action18.setShortcut("CTRL+SHIFT++")
        self.toolBar.Action18.triggered.connect(self.udder)
        #zoom out
        self.toolBar.Action19 = QtWidgets.QAction(
            QtGui.QIcon(":/ico3/out.png"), "Zoom Out", self.toolBar)
        self.toolBar.Action19.setStatusTip("Zoom Out")
        self.toolBar.Action19.setShortcut("CTRL+SHIFT+-")
        self.toolBar.Action19.triggered.connect(self.odder)

        self.toolBar.Action20 = QtWidgets.QAction(QtGui.QIcon(":/ico3/10.png"),
                                                  "Profile Code", self.toolBar)
        self.toolBar.Action20.setStatusTip("Profile Code")
        self.toolBar.Action20.setShortcut("CTRL+SHIFT+E")
        self.toolBar.Action20.triggered.connect(self.runtoprob)

        #actions
        self.toolBar.addAction(self.toolBar.newAction)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.secondAction)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action3)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action4)
        #self.toolBar.addSeparator()
        #For now global run isent here
        #self.toolBar.addAction(self.toolBar.Action5)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action6)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action7)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action8)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action9)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action10)
        self.toolBar.addAction(self.toolBar.Action21)
        self.toolBar.addSeparator()
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action11)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action12)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action14)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action15)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action16)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action17)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action18)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action19)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action20)

        #font
        self.skrift = QFont()
        self.skrift.setFamily('Consolas')
        self.skrift.setFixedPitch(True)
        self.skrift.setPointSize(12)
        self.codebox.setFont(self.skrift)

        #python style
        self.lexer = QsciLexerPython(self.codebox)
        self.lexer.setFont(self.skrift)
        self.lexer.setEolFill(True)
        #api test not working
        api = Qsci.QsciAPIs(self.lexer)
        apidir = os.path.dirname(os.path.realpath(__file__))
        API_FILE = apidir + r'\Python.api'
        api.load(API_FILE)
        api.prepare()
        self.codebox.setAutoCompletionThreshold(1)
        self.codebox.setAutoCompletionThreshold(6)
        self.codebox.setAutoCompletionThreshold(8)
        self.codebox.setAutoCompletionSource(Qsci.QsciScintilla.AcsAPIs)
        self.lexer.setDefaultFont(self.skrift)
        self.codebox.setLexer(self.lexer)
        self.codebox.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1,
                                   'Consolas')

        #line numbers
        fontmetrics = QFontMetrics(self.skrift)
        self.codebox.setMarginsFont(self.skrift)
        self.codebox.setMarginWidth(0, fontmetrics.width("0000") + 6)
        self.codebox.setTabWidth(4)

        #brace
        self.codebox.setBraceMatching(QsciScintilla.SloppyBraceMatch)
        self.codebox.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        #auto line tab =4
        self.codebox.setAutoIndent(True)

        #scroolbar
        self.codebox.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 1)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)