Example #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)
    def __init__(self, title, parent, main):
        QtGui.QWidget.__init__(self, parent)

        self.main = main
        if title == "Examples":  ## TODO sody path to view
            self.dir_to_browse = settings.examples_path()
        else:
            self.dir_to_browse = settings.sketches_path()

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

        headLabel = GenericWidgets.HeaderLabel(self,
                                               self.main,
                                               icon=Ico.Projects,
                                               title=title,
                                               color="black",
                                               wash_to="#456D91")
        mainLayout.addWidget(headLabel)

        self.statusWidget = GenericWidgets.StatusWidget(self)

        ## redundant listings tree of bookmaarks.. maybe later
        if 1 == 0:
            self.treePlaces = QtGui.QTreeWidget()
            mainLayout.addWidget(self.treePlaces, 1)
            self.treePlaces.headerItem().setText(0, "Location")
            self.treePlaces.headerItem().setText(1, "Path")
            self.treePlaces.header().hide()
            self.treePlaces.setColumnHidden(1, True)
            self.treePlaces.setRootIsDecorated(False)
            self.treePlaces.setAlternatingRowColors(True)
            self.connect(self.treePlaces,
                         QtCore.SIGNAL("itemClicked (QTreeWidgetItem *,int)"),
                         self.on_tree_place_clicked)
            for panel in [["Examples", settings.examples_path()],
                          ["Sketches", settings.sketchbooks_path()]]:
                item = QtGui.QTreeWidgetItem()
                self.treePlaces.addTopLevelItem(item)
                item.setText(0, panel[0])
                font = item.font(0)
                font.setBold(True)
                item.setFont(0, font)
                item.setIcon(0, Icon(Ico.Folder))
                if panel[1]:
                    item.setText(1, panel[1])

            self.dir_to_browse = None

        toolbar = QtGui.QToolBar(self)
        toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        mainLayout.addWidget(toolbar)

        self.toolButtonGroup = QtGui.QButtonGroup(self)
        self.toolButtonGroup.setExclusive(True)
        self.connect(self.toolButtonGroup,
                     QtCore.SIGNAL("buttonClicked(QAbstractButton *)"),
                     self.on_view_selected)

        listButton = QtGui.QToolButton()
        listButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        listButton.setText("Tree")
        listButton.setIcon(Icon(Ico.Black))
        listButton.setStyleSheet("padding: 0px; margin: 0px;")
        listButton.setCheckable(True)
        listButton.setChecked(True)
        toolbar.addWidget(listButton)
        self.toolButtonGroup.addButton(listButton, 0)

        listButton = QtGui.QToolButton()
        listButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        listButton.setText("List")
        listButton.setIcon(Icon(Ico.Yellow))
        listButton.setStyleSheet("padding: 0px; margin: 0px;")
        listButton.setCheckable(True)
        toolbar.addWidget(listButton)
        self.toolButtonGroup.addButton(listButton, 1)

        #######################################
        ## Tree
        #######################################
        self.tree = QtGui.QTreeWidget()
        mainLayout.addWidget(self.tree, 10)

        self.tree.setSortingEnabled(True)
        self.tree.setRootIsDecorated(True)
        self.tree.setAlternatingRowColors(False)
        self.tree.headerItem().setText(0, "Files")
        self.connect(
            self.tree,
            QtCore.SIGNAL("itemDoubleClicked (QTreeWidgetItem *,int)"),
            self.on_tree_double_clicked)
        self.connect(self.tree,
                     QtCore.SIGNAL("itemClicked (QTreeWidgetItem *,int)"),
                     self.on_tree_clicked)

        self.load_list()
    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:
Example #4
0
	def __init__(self, parent, main, function_file, path, paths):
		QtGui.QDialog.__init__(self, parent)

		self.main = main
		self.function_file = function_file
		self.path = path
		self.paths = paths
		self.dic = None
		#print function_file, path, paths

		self.setMinimumWidth(1100)
		self.setMinimumHeight(800)

		mainLayout = QtGui.QVBoxLayout()
		self.setLayout(mainLayout)


		gridLayout = QtGui.QGridLayout()
		mainLayout.addLayout(gridLayout)
		row = 0

		## Function
		gridLayout.addWidget(QtGui.QLabel("Function:"), row, 0, QtCore.Qt.AlignRight)
		self.txtFunction = QtGui.QLineEdit()
		gridLayout.addWidget(self.txtFunction, row, 1)
		gridLayout.addWidget(QtGui.QLabel("Name eg digitialFilter (no brackets)"), row, 2)
		self.connect(self.txtFunction, QtCore.SIGNAL("textChanged(const QString&)"), self.on_function_text_changed)


		## Lib
		row  += 1
		gridLayout.addWidget(QtGui.QLabel("Lib:"), row, 0, QtCore.Qt.AlignRight)
		self.comboLib = QtGui.QComboBox()
		for pth in paths:
			newIdx = self.comboLib.count()
			self.comboLib.insertItem(newIdx, pth)
			print pth, self.path
			if pth == self.path:
				self.comboLib.setCurrentIndex(newIdx)
		gridLayout.addWidget(self.comboLib, row, 1)
		gridLayout.addWidget(QtGui.QLabel("Lib eg arduino"), row, 2)


		## Section
		row  += 1
		gridLayout.addWidget(QtGui.QLabel("Section:"), row, 0, QtCore.Qt.AlignRight)
		self.txtSection = QtGui.QLineEdit()
		gridLayout.addWidget(self.txtSection, row, 1)
		gridLayout.addWidget(QtGui.QLabel("Nav section eg math or digtital IO"), row, 2)


		## Syntax
		"""
		row  += 1
		gridLayout.addWidget(QtGui.QLabel("Syntax:"), row, 0, QtCore.Qt.AlignRight)
		self.txtSyntax = QtGui.QLineEdit()
		self.txtSyntax.setReadOnly(True)
		gridLayout.addWidget(self.txtSyntax, row, 1)
		gridLayout.addWidget(QtGui.QLabel(""), row, 2)
		"""

		## Summary
		row  += 1
		gridLayout.addWidget(QtGui.QLabel("Summary:"), row, 0, QtCore.Qt.AlignRight)
		self.txtSummary = QtGui.QLineEdit()
		gridLayout.addWidget(self.txtSummary, row, 1, 1, 2)
		#gridLayout.addWidget(QtGui.QLabel("Brief popup description"), row, 2)

		## Parameters Widgets tree
		row  += 1
		grpBox = QtGui.QGroupBox("Parameters")
		gridLayout.addWidget(grpBox, row, 0, 1, 3)
		grpLayout = QtGui.QVBoxLayout()
		grpLayout.setSpacing(0)
		grpBox.setLayout(grpLayout)

		toolbar = QtGui.QToolBar()
		toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
		grpLayout.addWidget(toolbar)

		
		self.radioFixed = QtGui.QRadioButton("Fixed params", self)
		toolbar.addWidget(self.radioFixed)
		self.radioFixed.hide()
		self.radioVariable = QtGui.QRadioButton("Variable params", self)
		self.radioVariable.hide()
		toolbar.addWidget(self.radioVariable)
		toolbar.addSeparator()
		

		toolbar.addAction(Icon(Ico.Add), "Add Syntax", self.on_add_syntax)
		toolbar.addAction(Icon(Ico.Remove), "Remove", self.on_remove_parameter)
		toolbar.addSeparator()
		toolbar.addAction(Icon(Ico.Up), "Up", self.on_move_up)
		toolbar.addAction(Icon(Ico.Down), "Down", self.on_move_down)

		self.tree = QtGui.QTreeWidget()
		self.tree.setRootIsDecorated(False)
		self.tree.headerItem().setText(0, "Parameter")
		self.tree.headerItem().setText(1, "Description")
		grpLayout.addWidget(self.tree)
		self.connect(self.tree, QtCore.SIGNAL("itemChanged(QTreeWidgetItem *,int)"), self.on_tree_changed)

		## Returns
		row  += 1
		self.chkReturn = QtGui.QCheckBox("Return")
		self.connect(self.chkReturn, QtCore.SIGNAL("toggled(bool)"), self.on_chk_return)
		gridLayout.addWidget(self.chkReturn, row, 0, QtCore.Qt.AlignRight)
		self.txtReturn = QtGui.QLineEdit()
		gridLayout.addWidget(self.txtReturn, row, 1, 1, 2)
		#gridLayout.addWidget(QtGui.QLabel("eg milliseconds elapsed"), row, 2)

		## Description
		row  += 1
		grpBox = QtGui.QGroupBox("Description")
		gridLayout.addWidget(grpBox, row, 0, 1, 3)
		grpLayout = QtGui.QVBoxLayout()
		grpBox.setLayout(grpLayout)
		self.txtDescription = QtGui.QPlainTextEdit()
		grpLayout.addWidget(self.txtDescription)

		## Example
		#row  += 1
		grpBox = QtGui.QGroupBox("Example")
		gridLayout.addWidget(grpBox, 0, 3, 7, 1)
		grpLayout = QtGui.QVBoxLayout()
		grpBox.setLayout(grpLayout)
		self.txtExample = QtGui.QPlainTextEdit()
		grpLayout.addWidget(self.txtExample)

		gridLayout.setColumnStretch(0, 0)
		gridLayout.setColumnStretch(1, 2)
		gridLayout.setColumnStretch(2, 0)
		gridLayout.setColumnStretch(3, 3)

		############################################
		## Bottom Buttons
		bbox = QtGui.QHBoxLayout()
		mainLayout.addLayout(bbox)
		bbox.addStretch(20)
		cancelButton = GenericWidgets.CancelButton(self, "Cancel")
		bbox.addWidget(cancelButton, 1)
		self.saveButton = GenericWidgets.SaveButton(self)
		bbox.addWidget(self.saveButton, 1)

		self.statusBar = QtGui.QStatusBar(self)
		mainLayout.addWidget(self.statusBar)

		if self.function_file:
			self.load_file()
Example #5
0
    def __init__(self, parent, main, function_name=None):
        QtGui.QWidget.__init__(self, parent)

        self.main = main
        self.function_name = function_name

        mainLayout = QtGui.QVBoxLayout()
        self.setLayout(mainLayout)

        gridLayout = QtGui.QGridLayout()
        mainLayout.addLayout(gridLayout)
        row = 0

        ## Function
        gridLayout.addWidget(QtGui.QLabel("Function:"), row, 0,
                             QtCore.Qt.AlignRight)
        self.txtFunction = QtGui.QLineEdit()
        gridLayout.addWidget(self.txtFunction, row, 1)
        gridLayout.addWidget(QtGui.QLabel("Name eg digitialFilter()"), row, 2)

        ## Lib
        row += 1
        gridLayout.addWidget(QtGui.QLabel("Lib:"), row, 0,
                             QtCore.Qt.AlignRight)
        self.txtLib = QtGui.QLineEdit()
        #self.cmbLib.addItem("arduino")
        #self.cmbLib.addItem("servo")
        #self.cmbLib.addItem("stepper")
        gridLayout.addWidget(self.txtLib, row, 1)
        gridLayout.addWidget(QtGui.QLabel("Lib eg arduino"), row, 2)

        ## Section
        row += 1
        gridLayout.addWidget(QtGui.QLabel("Section:"), row, 0,
                             QtCore.Qt.AlignRight)
        self.txtSection = QtGui.QLineEdit()
        gridLayout.addWidget(self.txtSection, row, 1)
        gridLayout.addWidget(
            QtGui.QLabel("Nav section eg math or digtital IO"), row, 2)

        ## Syntax
        row += 1
        gridLayout.addWidget(QtGui.QLabel("Syntax:"), row, 0,
                             QtCore.Qt.AlignRight)
        self.txtSyntax = QtGui.QLineEdit()
        gridLayout.addWidget(self.txtSyntax, row, 1)
        gridLayout.addWidget(QtGui.QLabel("eg digitalWrite(pin, value)"), row,
                             2)

        ## Tooltip
        row += 1
        gridLayout.addWidget(QtGui.QLabel("Summary:"), row, 0,
                             QtCore.Qt.AlignRight)
        self.txtSummary = QtGui.QLineEdit()
        gridLayout.addWidget(self.txtSummary, row, 1)
        gridLayout.addWidget(QtGui.QLabel("Brief popup description"), row, 2)

        ## Parameters Widgets tree
        row += 1
        grpBox = QtGui.QGroupBox("Parameters")
        gridLayout.addWidget(grpBox, row, 0, 1, 3)
        grpLayout = QtGui.QVBoxLayout()
        grpLayout.setSpacing(0)
        grpBox.setLayout(grpLayout)

        toolbar = QtGui.QToolBar()
        toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        grpLayout.addWidget(toolbar)
        toolbar.addAction(Icon(Ico.Add), "Add", self.on_add_parameter)
        toolbar.addAction(Icon(Ico.Remove), "Remove", self.on_remove_parameter)
        toolbar.addSeparator()
        toolbar.addAction(Icon(Ico.Up), "Up", self.on_move_up)
        toolbar.addAction(Icon(Ico.Down), "Down", self.on_move_down)

        self.tree = QtGui.QTreeWidget()
        self.tree.setRootIsDecorated(False)
        self.tree.headerItem().setText(0, "Parameter")
        self.tree.headerItem().setText(1, "Description")
        grpLayout.addWidget(self.tree)

        ## Description
        row += 1
        grpBox = QtGui.QGroupBox("Description")
        gridLayout.addWidget(grpBox, row, 0, 1, 3)
        grpLayout = QtGui.QVBoxLayout()
        grpBox.setLayout(grpLayout)
        self.txtDescription = QtGui.QPlainTextEdit()
        grpLayout.addWidget(self.txtDescription)

        ## Example
        #row  += 1
        grpBox = QtGui.QGroupBox("Example")
        gridLayout.addWidget(grpBox, 0, 3, 7, 1)
        grpLayout = QtGui.QVBoxLayout()
        grpBox.setLayout(grpLayout)
        self.txtExample = QtGui.QPlainTextEdit()
        grpLayout.addWidget(self.txtExample)

        gridLayout.setColumnStretch(0, 0)
        gridLayout.setColumnStretch(1, 2)
        gridLayout.setColumnStretch(2, 0)
        gridLayout.setColumnStretch(3, 3)

        ############################################
        ## Bottom Buttons
        bbox = QtGui.QHBoxLayout()
        mainLayout.addLayout(bbox)
        bbox.addStretch(20)
        cancelButton = GenericWidgets.CancelButton(self, "Cancel")
        bbox.addWidget(cancelButton, 1)
        self.saveButton = GenericWidgets.SaveButton(self)
        bbox.addWidget(self.saveButton, 1)

        if self.function_name:
            self.load_file()
Example #6
0
    def __init__(self, parent, main):
        QtGui.QWidget.__init__(self)

        self.main = main

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

        ##################################################################
        ##  Filter Text bar
        ##################################################################
        filterBarLayout = QtGui.QHBoxLayout()
        layout.addLayout(filterBarLayout)

        buttClearFilter = QtGui.QPushButton(self)
        #buttClearFilter.setIcon( Icon(Ico.Black) )
        buttClearFilter.setFlat(True)
        buttClearFilter.setText("Clear >>")
        self.connect(buttClearFilter, QtCore.SIGNAL("clicked()"),
                     self.on_filter_clear)
        filterBarLayout.addWidget(buttClearFilter, 1)

        self.txtFilter = QtGui.QLineEdit("")
        self.connect(self.txtFilter,
                     QtCore.SIGNAL('textChanged(const QString &)'),
                     self.on_filter_changed)
        filterBarLayout.addWidget(self.txtFilter, 222)

        ##################################################################
        ##  Filter Buttons
        ##################################################################
        filterButtonsLayout = QtGui.QHBoxLayout()
        layout.addLayout(filterButtonsLayout)
        buttz = []
        buttz.append(['html', Ico.Html, "Html"])
        buttz.append(['function', Ico.Functions, 'Functions'])
        buttz.append(['keyword', Ico.Help, 'Keywords'])
        """filterButtonsGroup = QtGui.QButtonGroup(self)
		self.connect(filterButtonsGroup, QtCore.SIGNAL(""), self.on_filter_button_clicked)
		for ki, ico, caption in buttz:
			newButton = QtGui.QPushButton()
			newButton.setText(caption)
			newButton.setIcon(Icon(ico))
			newButton.setCheckable(True)
			newButton.setChecked(True if ki == 'functions' else False) # TODO remember last view
			## TODO restore state
			filterButtonsLayout.addWidget(newButton)
		
		"""
        self.filterButtons = {}
        for ki, ico, caption in buttz:
            self.filterButtons[ki] = QtGui.QCheckBox()
            self.filterButtons[ki].setText(caption)
            self.filterButtons[ki].setChecked(
                True if ki == 'function' else False)  # TODO remember last view
            self.connect(self.filterButtons[ki],
                         QtCore.SIGNAL("stateChanged(int)"), self.load_list)
            filterButtonsLayout.addWidget(self.filterButtons[ki])

        ##################################################################
        ### Models
        ##################################################################
        self.model = QtGui.QStandardItemModel(0, 1, self)
        self.model.setHeaderData(0, QtCore.Qt.Horizontal,
                                 QtCore.QVariant("Topic"))
        self.proxyModel = QtGui.QSortFilterProxyModel(self)
        self.proxyModel.setSourceModel(self.model)

        #################################################################
        ### Tree
        ##################################################################
        self.tree = QtGui.QTreeView()
        self.tree.setRootIsDecorated(False)
        self.tree.setAlternatingRowColors(True)
        self.tree.setSortingEnabled(True)
        self.tree.setModel(self.proxyModel)
        layout.addWidget(self.tree)
        self.connect(self.tree,
                     QtCore.SIGNAL("doubleClicked(const QModelIndex&)"),
                     self.on_tree_double_clicked)

        self.statusWidget = GenericWidgets.StatusWidget(self)
        self.load_list()
Example #7
0
	def __init__(self, parent, main):
		QtGui.QDialog.__init__(self, parent)
		self.main = main

		self.setWindowTitle("Settings")
		self.setWindowIcon(Icon(Ico.Settings))
		self.setMinimumWidth(700)
		self.setMinimumHeight(500)

		mainLayout = QtGui.QVBoxLayout()
		self.setLayout(mainLayout)

		self.path_keys = []
		self.path_keys.append( ['path/arduino_path','Arduino Path', 'Directory of arduino installation'] )
		self.path_keys.append( ['path/sketchbooks_path', 'Sketchbooks',	'Directory to sketchbooks'] )
		self.path_keys.append( ['path/arduino_svn_path', 'Arduino Svn', 'Path to svn trunk/'] )

		vBox = QtGui.QVBoxLayout()
		vBox.setSpacing(20)
		mainLayout.addLayout(vBox)


		promptButtonGroup = QtGui.QButtonGroup(self)
		self.connect(promptButtonGroup, QtCore.SIGNAL("buttonClicked(QAbstractButton *)"), self.on_prompt_button)

		browseButtonGroup = QtGui.QButtonGroup(self)
		self.connect(browseButtonGroup, QtCore.SIGNAL("buttonClicked(QAbstractButton *)"), self.on_browse_button)

		self.txt = {}
		self.lbl = {}
		#butt = {}
		#buttP = {}
		for fKey, title, description in self.path_keys:

			grp = QtGui.QGroupBox( "%s" % (title) )
			vBox.addWidget(grp)
			vb = QtGui.QVBoxLayout()
			grp.setLayout(vb)
			
			lbl = QtGui.QLabel( description )
			vb.addWidget(lbl)

			pth = self.main.settings.value(fKey)
			self.txt[fKey] = QtGui.QLineEdit(pth) #setval.toString())
			self.txt[fKey].setReadOnly(True)
			vb.addWidget(self.txt[fKey])

			hBox = QtGui.QHBoxLayout()
			vb.addLayout(hBox)

			self.lbl[fKey] = QtGui.QLabel("-")
			hBox.addWidget(self.lbl[fKey])
			self.check_file(fKey)

			buttP = QtGui.QToolButton(self)
			#buttP[fKey].setIcon(dIcon(dIco.Green))
			buttP.setText("Prompt")
			buttP.setProperty("ki", QtCore.QVariant(fKey) )
			buttP.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
			hBox.addWidget(buttP)
			buttP.setVisible(False)
			promptButtonGroup.addButton(buttP)

			buttB = QtGui.QToolButton(self)
			#butt[fKey].setIcon(dIcon(dIco.Green))
			buttB.setText("Browse")
			buttB.setProperty("ki", QtCore.QVariant(fKey) )
			buttB.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
			hBox.addWidget(buttB)
			browseButtonGroup.addButton(buttB)	

		vBox.addStretch(10)

		#########################################
		## Save Cancel Buttons
		buttonBox = QtGui.QHBoxLayout()
		mainLayout.addLayout(buttonBox)
		buttonBox.addStretch(20)

		cancelButton = GenericWidgets.CancelButton(self, "Cancel")
		buttonBox.addWidget(cancelButton)

		saveButton = GenericWidgets.SaveButton(self)
		buttonBox.addWidget(saveButton)
Example #8
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)