Beispiel #1
0
    def __init__(self, cv_capture, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setGeometry(0,600,60,150)

        self.capture = cv_capture

        self.contrast = QtGui.QSlider(self)
        self.contrast.setRange(0,128)
        self.contrast.setGeometry(0,0,20,100)
        self.contrast.show()
        self.contrast.connect(self.contrast, QtCore.SIGNAL('valueChanged(int)'), self, QtCore.SLOT('udpateContrast(int)'))
        
        self.brightness = QtGui.QSlider(self)
        self.brightness.setRange(0,128)
        self.brightness.setGeometry(30,0,20,100)
        self.brightness.show()
        self.brightness.connect(self.brightness, QtCore.SIGNAL('valueChanged(int)'), self, QtCore.SLOT('udpateBrightness(int)'))
 
        self.color_picker_min = QtGui.QColorDialog(self)
        self.color_picker_min.setParent(self)
        self.color_picker_min.show()
        self.color_picker_min.setWindowTitle("Min")
        self.color_picker_min.setGeometry(300,600,10,10)
        self.connect(self.color_picker_min, QtCore.SIGNAL('currentColorChanged(QColor)'), self, QtCore.SLOT('colorMinSelected(QColor)'))
        
        self.color_picker_max = QtGui.QColorDialog(self)
        self.color_picker_max.setParent(self)
        self.color_picker_max.show()
        self.color_picker_max.setWindowTitle("Max")
        self.color_picker_max.setGeometry(800,600,10,10)
        self.connect(self.color_picker_max, QtCore.SIGNAL('currentColorChanged(QColor)'), self, QtCore.SLOT('colorMaxSelected(QColor)'))
Beispiel #2
0
    def _runColorPicker(self):
        if self.color() is not None:
            dialog = QtGui.QColorDialog(self.color(), parent=self)
        else:
            dialog = QtGui.QColorDialog(parent=self)

        if dialog.exec_():
            self.setColor(dialog.selectedColor())
Beispiel #3
0
 def mouseReleaseEvent(self, ev):
     if ev.button() == QtCore.Qt.MiddleButton:
         # Note we use self.parent() as the dialog's parent and not
         # self. Using self causes the dialog's background to be the
         # same as the button's background, making for a real shitty
         # view.
         if self.color() is not None:
             dialog = QtGui.QColorDialog(self.color(), parent=self.parent())
         else:
             dialog = QtGui.QColorDialog(parent=self.parent())
         if dialog.exec_():
             self.setColor(dialog.selectedColor())
         ev.accept()
     else:
         super(EditableRGBColorCell, self).mouseReleaseEvent(ev)
Beispiel #4
0
    def _colButtonClicked(self):
        self.killTimer(self._timer)

        col = self._colorButton.palette().background().color()
        colDialog = QtGui.QColorDialog(col, self)
        colDialog.setOption(QtGui.QColorDialog.DontUseNativeDialog, True)
        colDialog.setOption(QtGui.QColorDialog.ShowAlphaChannel, True)
        self.connect(colDialog,
                     QtCore.SIGNAL("currentColorChanged(const QColor&)"),
                     self._colorDialogChangedColor)
        colDialog.exec_()

        newCol = col
        if colDialog.result():
            newCol = colDialog.selectedColor()

        rgbStr = str(255 * newCol.redF()) + "," + str(
            255 * newCol.greenF()) + "," + str(
                255 * newCol.blueF()) + "," + str(255 * newCol.alphaF())
        self._colorButton.setStyleSheet("background-color: rgba(" + rgbStr +
                                        ");")
        self._colorButton.setText(
            str(round(newCol.redF(), 2)) + ", " +
            str(round(newCol.greenF(), 2)) + ", " +
            str(round(newCol.blueF(), 2)) + ", " +
            str(round(newCol.alphaF(), 2)))

        self.widgetValueChanged()

        self._timer = self.startTimer(500)
 def contentTextButton_clicked(self):
     dialog = QtGui.QColorDialog()
     def myAccept():
         self.configuration.color_contentText = dialog.currentColor()
         self.updateSettings()
     dialog.accepted.connect(myAccept)
     dialog.exec_()
Beispiel #6
0
 def set_BackGroundColor(self):
     self.colordialog = QtGui.QColorDialog()
     bgcolor = self.colordialog.getColor()
     style = 'QMainWindow {background : rgb(%s,%s,%s);}' % (
         bgcolor.red(), bgcolor.green(), bgcolor.blue())
     set_skin(self.parent.parent(),
              os.sep.join(['skin', 'qss', 'MetroMainwindow.qss']), style)
Beispiel #7
0
 def ColorButtonClicked(self):
     """Dialogo de selección de color"""
     dialog = QtGui.QColorDialog(
         self.button.palette().color(QtGui.QPalette.Button), self)
     if dialog.exec_():
         self.setColor(dialog.currentColor().name())
         self.valueChanged.emit(dialog.currentColor().name())
 def highlighterLineBackgroundButton_clicked(self):
     dialog = QtGui.QColorDialog()
     def myAccept():
         self.configuration.color_highlightLineBackground = dialog.currentColor()
         self.updateSettings()
     dialog.accepted.connect(myAccept)
     dialog.exec_()
    def onContext(self, pos):
        index = self.listWidget.indexAt(pos)

        if not index.isValid():
            return

        item = self.listWidget.itemAt(pos)
        name = item.text()

        menu = QtGui.QMenu(self)

        colorAction = menu.addAction("Change Color")
        if item.visible is True:
            toggleHideAction = menu.addAction("Hide")
        else:
            toggleHideAction = menu.addAction("Show")

        action = menu.exec_(QtGui.QCursor.pos())
        if action == toggleHideAction:
            self.buildColorTab()
            item.toggleVisible()
        elif action == colorAction:
            color = QtGui.QColorDialog().getColor()
            item.setColor(color)
            self.volumeLabels.descriptions[index.row()].color = color.rgba()

            #            self.emit(QtCore.SIGNAL("labelPropertiesChanged()"))
            if self.labelPropertiesChanged_callback is not None:
                self.labelPropertiesChanged_callback()
            self.buildColorTab()
            self.volumeEditor.repaint()
Beispiel #10
0
 def choose_color(self):
     color = QtGui.QColorDialog().getColor()
     b = self.sender()
     tid = int(str(b.text()).split()[1])
     b.setStyleSheet("QWidget { background-color: %s }" % color.name())
     self.parent.tunnel_colors[tid] = color
     self.parent.topoWidget.topologyView.updateAll()
     self.parent.show_TT()
Beispiel #11
0
 def set_ButtonColor(self):
     self.colordialog = QtGui.QColorDialog()
     bgcolor = self.colordialog.getColor()
     style = 'QPushButton {background : rgb(%s,%s,%s);}' % (
         bgcolor.red(), bgcolor.green(), bgcolor.blue())
     set_skin(self.parent,
              os.sep.join(['skin', 'qss', 'MetroNavigationPage.qss']),
              style)
     set_skin(self, os.sep.join(['skin', 'qss', 'MetroToolBar.qss']), style)
Beispiel #12
0
 def colordialog(self):
     """Show dialog to choose font color"""
     dialog = QtGui.QColorDialog(self.notas.textColor(), self)
     if dialog.exec_():
         self.FontColor.setPalette(QtGui.QPalette(dialog.currentColor()))
         self.notas.setTextColor(dialog.currentColor())
         format = QtGui.QTextCharFormat()
         format.setForeground(dialog.currentColor())
         self.MergeFormat(format)
    def chooseColour(self):
        dlg = QtGui.QColorDialog(self.label_attributes.color())
        dlg.setOptions(QtGui.QColorDialog.ShowAlphaChannel)
        dlg.setModal(True)
        dlg.show()
        result = dlg.exec_()

        if result == 1:
            self.label_attributes.setColor(dlg.selectedColor())
Beispiel #14
0
    def handlerSelectLabelColor(self):
        """Slot method when the label color button is clicked.
        """
        dialog = QtGui.QColorDialog(self.labelColor)

        if dialog.exec_():
            self.labelColor = dialog.selectedColor()
            self.buttonLabelColor.setStyleSheet(
                'background-color: {0};'.format(self.labelColor.name()))
    def handleColorLabelClickedSlot(self):
        o_colorDialog = QtGui.QColorDialog(self)
        o_colorDialog.setCurrentColor(self.ui.colorLabel.getFillColor())

        o_newColor = o_colorDialog.getColor()

        if o_newColor != self.ui.colorLabel.getFillColor():
            self.ui.colorLabel.setFillColor(o_newColor)
            self.setColorSpinBoxes(o_newColor)
Beispiel #16
0
    def _setup_ui(self):
        self.viewport_widget.layout().addWidget(self._paint_view)
        self.layers_tree = LayerPanel(dragToggleColumns=[0], columns=['', ''])
        self.layers_tree.setItemDelegate(TreeDelegate())
        self.layers_widget.layout().addWidget(self.layers_tree)

        self.file_dialog = QtGui.QFileDialog(self)
        self.color_dialog = QtGui.QColorDialog()

        self._update_brush_ui()
Beispiel #17
0
    def handle_set_color(self, ok):
        """
        Set item color menu handler

        :param item: SceneTreeWidgetItem
        """
        item = self.selectedItems()[0]
        dialog = QtGui.QColorDialog(QtGui.QColor(*item.object.color), self)
        rgba, ok = dialog.getRgba()
        if ok and type(item) == SceneTreeWidgetItem:
            item.set_color(QtGui.QColor(rgba))
Beispiel #18
0
 def updatePenColor(self, item):
     if item.column() != 1:
         return
     itemKey = self.keyOrder[item.row()]
     # Go get a new color
     colorDialog = QtGui.QColorDialog()
     val = colorDialog.getColor(QtGui.QColor(self.tpDict[itemKey][0]), self)
     # Set the new color (if the dialog was not canceled)
     if val.isValid():
         val = val.rgba()
         item.setBackground(QtGui.QColor(val))
         self.tpDict[itemKey][0] = val
Beispiel #19
0
    def onColorPicker(self):
        """
        Show color-picker dialog to select color.

        Qt will use the native dialog by default.
        """
        dlg = QtGui.QColorDialog(self)
        if self._color:
            dlg.setCurrentColor(QtGui.QColor(self._color))

        if dlg.exec_():
            self.setColor(dlg.currentColor().name())
Beispiel #20
0
 def editColVal(self, num):
     editornum = len(self.colEditors)
     colEditor = QtGui.QColorDialog()
     col = QtGui.QColor()
     col.setRgbF(self.colVals[num].x, self.colVals[num].y,
                 self.colVals[num].z)
     colEditor.setCurrentColor(col)
     #overflow, do this better or get a way to delete this ~.~
     self.colEditors.append(colEditor)
     colEditor.show()
     QtCore.QObject.connect(colEditor, QtCore.SIGNAL("accepted()"),
                            self.currygetEditetColVal(num, editornum))
Beispiel #21
0
def requestColor(prompt, initColor = None, **kwargs):
	dialog = QtGui.QColorDialog( initColor or QtCore.Qt.white )
	dialog.move( QtGui.QCursor.pos() )
	dialog.setWindowTitle( prompt )
	onColorChanged = kwargs.get( 'onColorChanged', None )
	if onColorChanged:
		dialog.currentColorChanged.connect( onColorChanged )
	if dialog.exec_() == 1:
		col = dialog.currentColor()
		# dialog.destroy()
		if col.isValid(): return col
	return initColor
Beispiel #22
0
 def selectColor(self, dest):
     """Open color picker"""
     dlg = QtGui.QColorDialog(self)
     dlg.exec_()
     col = dlg.currentColor()
     if dest == 'F':
         bouton = self.ui.womenColorButton
     else:
         bouton = self.ui.menColorButton
     pal = bouton.palette()
     pal.setColor(0, QtGui.QPalette.Button, col)
     bouton.setPalette(pal)
Beispiel #23
0
 def mostrarPaleta(self):
     col = QtGui.QColor(self.redSlider.value(), self.greenSlider.value(),
                        self.blueSlider.value())
     col = QtGui.QColorDialog().getColor(col)
     if col.isValid():
         self.colorPreview.setStyleSheet(
             'background-color: %s; border-radius: 4px;' % col.name())
         self.redSlider.setValue(col.red())
         self.greenSlider.setValue(col.green())
         self.blueSlider.setValue(col.blue())
         self.colorHex.setText(str(col.name().toUpper()))
         self.statusbar.showMessage(
             'Color recuperat de la paleta de colors...', 3000)
    def cellClicked(self, row, column):

        if column == self.COLOR_COLUMN:
            colorDialog = QtGui.QColorDialog()
            answer = colorDialog.exec_()
            color = colorDialog.selectedColor()
            colorTuple = (color.red(), color.green(), color.blue())
            self.tableWidget.item(row, self.COLOR_COLUMN).setBackground(color)
            self.tableWidget.item(row, self.HIDDEN_COLOR_COLUMN).setText("{};{};{}".format(colorTuple[0], colorTuple[1], colorTuple[2]))
            self.tableWidget.clearSelection()

        if column == self.DELETE_COLUMN:
            self.removeChannelFromTable(row)
Beispiel #25
0
    def handle_set_color(self, ok):
        """
        Set item color menu handler

        :param item: SceneTreeWidgetItem
        """
        item = self.selectedItems()[0]
        dialog = QtGui.QColorDialog(QtGui.QColor(*item.object.color), self)
        rgba, ok = dialog.getRgba()
        if ok and type(item) == SceneTreeWidgetItem:
            item.set_color(QtGui.QColor(rgba))

            # add a session override
            item.object.add_override("color", item.object.color, apply=False)
Beispiel #26
0
    def on_color2(self):
        color = self.vtk_widget.bg_color_2
        initial_color = QtGui.QColor(255 * color[0], 255 * color[1],
                                     255 * color[2])
        color = QtGui.QColorDialog().getColor(initial_color, self)

        if not color.isValid():
            return

        red = color.red() / 255.
        blue = color.blue() / 255.
        green = color.green() / 255.
        color2 = (red, green, blue)
        self.vtk_widget.set_background_color(color2=color2)
Beispiel #27
0
 def __init__(self, parent=None, color=(128, 128, 128)):
     QtGui.QPushButton.__init__(self, parent)
     self.setColor(color)
     self.colorDialog = QtGui.QColorDialog()
     self.colorDialog.setOption(QtGui.QColorDialog.ShowAlphaChannel, True)
     self.colorDialog.setOption(QtGui.QColorDialog.DontUseNativeDialog,
                                True)
     self.colorDialog.currentColorChanged.connect(self.dialogColorChanged)
     self.colorDialog.rejected.connect(self.colorRejected)
     self.colorDialog.colorSelected.connect(self.colorSelected)
     #QtCore.QObject.connect(self.colorDialog, QtCore.SIGNAL('currentColorChanged(const QColor&)'), self.currentColorChanged)
     #QtCore.QObject.connect(self.colorDialog, QtCore.SIGNAL('rejected()'), self.currentColorRejected)
     self.clicked.connect(self.selectColor)
     self.setMinimumHeight(15)
     self.setMinimumWidth(15)
Beispiel #28
0
    def __init__(self,
                 mobject,
                 undolen=defaults.OBJECT_EDIT_UNDO_LENGTH,
                 parent=None):
        QtGui.QTableView.__init__(self, parent)
        #self.setEditTriggers(self.DoubleClicked | self.SelectedClicked | self.EditKeyPressed)
        vh = self.verticalHeader()
        vh.setVisible(False)
        hh = self.horizontalHeader()
        hh.setStretchLastSection(True)
        self.setAlternatingRowColors(True)
        self.resizeColumnsToContents()
        self.setModel(ObjectEditModel(mobject, undolen=undolen))
        self.colorButton = QtGui.QPushButton()
        self.colorDialog = QtGui.QColorDialog()
        self.textEdit = QTextEdit()
        try:
            notesIndex = self.model().fields.index("Notes")
            self.setIndexWidget(self.model().index(notesIndex, 1),
                                self.textEdit)
            info = moose.Annotator(self.model().mooseObject.path + '/info')
            self.textEdit.setText(QtCore.QString(info.getField('notes')))
            self.setRowHeight(notesIndex, self.rowHeight(notesIndex) * 3)

            # self.colorDialog.colorSelected.connect(
            #     lambda color:
            #
            # self.setColor(getColor(self.model().mooseObject.path+'/info')[1])
        except:
            pass

        try:
            colorIndex = self.model().fields.index("Color")
            self.colorButton.clicked.connect(self.colorDialog.show)
            self.colorButton.setFocusPolicy(PyQt4.QtCore.Qt.NoFocus)
            self.colorDialog.colorSelected.connect(
                lambda color: self.colorButton.setStyleSheet(
                    "QPushButton {" + "background-color: {0}; color: {0};".
                    format(color.name()) + "}"))
            self.setIndexWidget(self.model().index(colorIndex, 1),
                                self.colorButton)
            # self.colorDialog.colorSelected.connect(
            #     lambda color:
            #
            self.setColor(getColor(self.model().mooseObject.path + '/info')[1])
        except:
            pass
        print('Created view with %s' % (mobject))
Beispiel #29
0
    def onContext(self, pos):
        index = self.listWidget.indexAt(pos)

        if not index.isValid():
            return

        item = self.listWidget.itemAt(pos)
        name = item.text()

        menu = QtGui.QMenu(self)

        removeAction = menu.addAction("Remove")
        colorAction = menu.addAction("Change Color")
        renameAction = menu.addAction("Change Name")
        clearAction = menu.addAction("Clear Label")

        action = menu.exec_(QtGui.QCursor.pos())
        if action == removeAction:
            if QtGui.QMessageBox.question(self, "Remove label", "Really remove label" + self.volumeLabelDescriptions[index.row()].name + "?", buttons = QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok)  != QtGui.QMessageBox.Cancel:
                self.removeLabel(item,  index)
        elif action == renameAction:
            newName, ok = QtGui.QInputDialog.getText(self, "Enter Labelname", "Labelname:", text = item.text())
            if ok:
                item.setText(newName)
                result = self.labelMgr.changeLabelName(index.row(),str(newName))
                #print result
        elif action == clearAction:
            if QtGui.QMessageBox.question(self, "Clear label", "Really clear label" + self.volumeLabelDescriptions[index.row()].name + "?", buttons = QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ok)  != QtGui.QMessageBox.Cancel:
                number = self.volumeLabelDescriptions[index.row()].number
                self.labelMgr.clearLabel(number)                

            
            
        elif action == colorAction:
            color = QtGui.QColorDialog().getColor()
            item.setColor(color)
            self.volumeLabelDescriptions[index.row()].color = color.rgba()
            
#            self.emit(QtCore.SIGNAL("labelPropertiesChanged()"))
            if self.labelPropertiesChanged_callback is not None:
                self.labelPropertiesChanged_callback()
            self.buildColorTab()
            self.volumeEditor.repaint()
 def set_color(self, col, row):
     if self.checkboxs[col].isChecked():
         dlg = QtGui.QColorDialog(self)
         current_pixel = self.cfg.Palettes[
             self.current_palette].Columns[col].Pixels[row]
         dlg.setCurrentColor(
             QtGui.QColor(current_pixel["R"], current_pixel["G"],
                          current_pixel["B"]))
         if dlg.exec_():
             color = dlg.selectedColor()
             self.changes = True
             pixel = {
                 "R": color.red(),
                 "G": color.green(),
                 "B": color.blue()
             }
             self.cfg.Palettes[
                 self.current_palette].Columns[col].Pixels[row] = pixel
             self.update_pixel_color(col, row, pixel)