예제 #1
0
    def __init__(self, parent, main):
        QtGui.QDialog.__init__(self, parent)
        self.main = main

        self.setWindowIcon(Icon(Ico.Help))
        self.setWindowTitle("Help")
        self.setMinimumWidth(800)
        self.setMinimumHeight(500)

        self.statusLabel = GenericWidgets.StatusLabel(self)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        self.setLayout(layout)

        splitter = QtGui.QSplitter(self)
        layout.addWidget(splitter)

        self.helpTree = gui.widgets.HelpWidgets.HelpTree(self, self.main)
        splitter.addWidget(self.helpTree)
        #splitter.setStretchFactor(0, 1)

        self.browser = QtWebKit.QWebView()
        splitter.addWidget(self.browser)
예제 #2
0
    def __init__(self, parent, main, arduino_mode=False):
        QtGui.QWidget.__init__(self)

        self.main = main
        self.current_file_path = None
        self.board = "board_name"
        self.port = "Sanderman"

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.setSpacing(0)
        self.setLayout(mainLayout)

        ##############################################################
        ### File Info Bar at the top
        ##############################################################
        fileInfoBox = QtGui.QHBoxLayout()
        mainLayout.addLayout(fileInfoBox, 0)

        self.lblFileName = QtGui.QLabel(self)
        self.lblFileName.setText("Filename")
        style_grad = "background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #efefef, stop: 1 %s);" % "#6A7885"
        style_grad += "font-weight: bold; border: 1px outset #41484E; padding: 3px;"
        self.lblFileName.setStyleSheet(style_grad)
        fileInfoBox.addWidget(self.lblFileName, 4)

        #########################################
        ## Save Button
        self.buttonSave = QtGui.QPushButton(self)
        self.buttonSave.setText("Save")
        self.buttonSave.setIcon(Icon(Ico.Save))
        fileInfoBox.addWidget(self.buttonSave)
        self.connect(self.buttonSave, QtCore.SIGNAL("clicked()"),
                     self.on_save_button_clicked)

        ###########################################
        ## Actions button with dropdown menu
        buttActions = QtGui.QPushButton(self)
        buttActions.setText("Actions")
        buttActions.setIcon(Icon(Ico.Green))
        fileInfoBox.addWidget(buttActions)

        fileActionsMenu = QtGui.QMenu(buttActions)
        buttActions.setMenu(fileActionsMenu)
        self.fileActionsGroup = QtGui.QActionGroup(self)
        self.connect(self.fileActionsGroup,
                     QtCore.SIGNAL("triggered(QAction*)"), self.on_file_action)
        for act in [['rename', 'Rename'], ['copy', 'Copy'],
                    ['commit', 'Commit']]:
            nuAction = fileActionsMenu.addAction(act[1])
            nuAction.setProperty('action_name', act[0])
            # TODO - maybe this should be in button group

        ####################################################
        ## Scintilla Editor
        ####################################################
        self.editor = QsciScintilla(self)
        self.editor.setUtf8(True)
        self.editor.setFolding(QsciScintilla.BoxedTreeFoldStyle)
        self.editor.setMarginLineNumbers(1, True)
        self.editor.setMarginWidth(1, 30)
        self.editor.setAutoIndent(True)
        mainLayout.addWidget(self.editor, 200)

        bottomStatusBar = QtGui.QStatusBar(self)
        mainLayout.addWidget(bottomStatusBar, 0)

        #########################################
        ## File Size and Modified info
        self.lblFileSize = GenericWidgets.StatusLabel(self, "Size")
        bottomStatusBar.addPermanentWidget(self.lblFileSize)

        self.lblFileModified = GenericWidgets.StatusLabel(self, "Modified")
        bottomStatusBar.addPermanentWidget(self.lblFileModified)

        ##############################################################
        ### Arduino Compiler With compile and board selector
        ##############################################################
        """if arduino_mode:
예제 #3
0
    def __init__(self, parent, main, arduino_mode=False):
        QtGui.QWidget.__init__(self)

        self.main = main
        self.current_file_path = None

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.setSpacing(0)
        self.setLayout(mainLayout)

        ##############################################################
        ### File Info Bar
        ##############################################################
        hbox = QtGui.QHBoxLayout()
        mainLayout.addLayout(hbox)

        self.lblFileName = QtGui.QLabel(self)
        self.lblFileName.setText("Filename")
        style_grad = "background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #efefef, stop: 1 %s);" % "#6A7885"
        style_grad += "font-weight: bold; border: 1px outset #41484E; padding: 3px;"
        self.lblFileName.setStyleSheet(style_grad)
        hbox.addWidget(self.lblFileName, 4)

        self.lblFileSize = GenericWidgets.StatusLabel(self, "Size")
        hbox.addWidget(self.lblFileSize, 1)

        self.lblFileModified = GenericWidgets.StatusLabel(self, "Modified")
        hbox.addWidget(self.lblFileModified, 2)

        ##############################################################
        ### Arduino Compiler
        ##############################################################
        if arduino_mode:
            toolbar = QtGui.QToolBar()
            toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
            mainLayout.addWidget(toolbar)

            ## spacer for right
            toolbar.addWidget(GenericWidgets.ToolBarSpacer(self))

            ### Action Buttons
            buttz = []
            buttz.append(['Compile', Ico.Compile])
            buttz.append(['Upload', Ico.Upload])
            buttz.append(['Compile Upload', Ico.CompileUpload])
            self.buttCompileGroup = QtGui.QButtonGroup()
            self.connect(self.buttCompileGroup,
                         QtCore.SIGNAL("buttonClicked (QAbstractButton *)"),
                         self.on_compile_group_button)
            ## TODO connect
            for caption, ico in buttz:
                butt = QtGui.QPushButton()
                butt.setText(caption)
                butt.setIcon(Icon(ico))
                toolbar.addWidget(butt)
                self.buttCompileGroup.addButton(butt)
            toolbar.addSeparator()

        ####################################################
        ## Source Editor
        ####################################################
        self.editor = QsciScintilla(self)
        self.editor.setUtf8(True)
        self.editor.setFolding(QsciScintilla.BoxedTreeFoldStyle)
        self.editor.setMarginLineNumbers(1, True)
        self.editor.setAutoIndent(True)
        mainLayout.addWidget(self.editor, 3)

        ## The Syntax Higlighter = standard CPP atmo = cish
        #self.lexer = ArduinoLexer(self)
        #self.editor.setLexer(self.lexer)

        ## Aarduino API Functions
        #self.arduinoFunctionsAPI = QsciAPIs(self.lexer)
        #keywords_file = self.main.settings.api_path().append("/autocomplete.txt")

        #self.arduinoFunctionsAPI.load(keywords_file)
        #self.arduinoFunctionsAPI.prepare()
        #self.lexer.setAPIs(self.arduinoFunctionsAPI)

        #self.editor.setAutoCompletionThreshold(1);
        #self.editor.setAutoCompletionSource(QsciScintilla.AcsAPIs);

        if arduino_mode:
            self.terminalWidget = TerminalWidget(self, self.main)
            mainLayout.addWidget(self.terminalWidget, 1)