예제 #1
0
    def __init__(self, conteneur=None):
        if conteneur is None: conteneur = self
        QWidget.__init__(conteneur)
        colorWindow.__init__(conteneur)
        self.setupUi(conteneur)

        self.colorDialog = QColorDialog(self)

        self.listColor = []
        self.changers = [u"Fond d'écran 3D", u"Arrière-plan"]
        self.changersVar = ["wallpaper", "background"]

        self.changedColor = []

        for a in self.changers:
            self.comboBox.addItem(a)
            self.listColor.append(QColor(255, 255, 255))
            self.changedColor.append(False)

        self.connect(self.toolButton, SIGNAL("released()"), self.chooseColor)
        self.connect(self.comboBox, SIGNAL("currentIndexChanged (int)"),
                     self.changeColor)
        self.connect(self.buttonBox, SIGNAL("accepted ()"), self.apply)
        self.connect(self.buttonBox, SIGNAL("rejected ()"), self.hide)

        self.connect(self.colorDialog, SIGNAL("colorSelected ()"),
                     self.finishChooseColor)

        self.changeColor()
 def openColorDialog(self, initcolor):
     colordialog = QColorDialog()
     selectedcolor = colordialog.getColor(initcolor, None, 'Please select a color')
     if selectedcolor.isValid():
         return selectedcolor
     else:
         return initcolor
예제 #3
0
 def onWhiteColorPicker(self):
     dlg = QColorDialog(self)
     if self.white_color:
         color_as_qcolor = QColor(self.white_color)
         dlg.setCurrentColor(color_as_qcolor)
     if dlg.exec_():
         self.setWhiteColor(dlg.currentColor().name())
예제 #4
0
 def onBlackColorPicker(self):
     dlg = QColorDialog(self)
     if self.black_color:
         color_as_qcolor = QColor(self.black_color)
         dlg.setCurrentColor(color_as_qcolor)
     if dlg.exec_():
         self.setBlackColor(dlg.currentColor().name())
예제 #5
0
def edit_layer_color(layer):
    """ Interactively edit a layer's color """
    dialog = QColorDialog()
    initial = mpl_to_qt4_color(layer.style.color)
    color = dialog.getColor(initial=initial)
    if color.isValid():
        layer.style.color = qt4_to_mpl_color(color)
예제 #6
0
def _interactive_color_dialog(callback):
    from PyQt4.QtGui import QColorDialog

    dialog = QColorDialog()

    dialog.currentColorChanged.connect(callback)
    dialog.show()
    return dialog
예제 #7
0
 def openColorDialog(self, initcolor):
     colordialog = QColorDialog()
     selectedcolor = colordialog.getColor(initcolor, None,
                                          'Please select a color')
     if selectedcolor.isValid():
         return selectedcolor
     else:
         return initcolor
예제 #8
0
def _interactive_color_dialog(callback):
    from PyQt4.QtGui import QColorDialog
    
    dialog = QColorDialog()
    
    dialog.currentColorChanged.connect(callback)
    dialog.show()
    return dialog
예제 #9
0
 def change_color(self, index):
     color = self.model().data(index, ColorRole)
     if color is None:
         return
     dlg = QColorDialog(QColor(*color))
     if dlg.exec():
         color = dlg.selectedColor()
         self.model().setData(index, color.getRgb(), ColorRole)
예제 #10
0
 def change_color(self, index):
     color = self.model().data(index, ColorRole)
     if color is None:
         return
     dlg = QColorDialog(QColor(*color))
     if dlg.exec():
         color = dlg.selectedColor()
         self.model().setData(index, color.getRgb(), ColorRole)
예제 #11
0
 def setColor(self):
     colorDialog = QColorDialog(self)
     colorDialog.setOption(QColorDialog.ShowAlphaChannel)
     self.color = colorDialog.getColor()
     self.color = self.color.name()
     self.label.setText(self.text+":"+self.color)
     self.setBtnColor()
     self.emit(SIGNAL("colorChange"),str(self.text),str(self.color))
예제 #12
0
파일: bar.py 프로젝트: pyros2097/SabelIDE
 def setColor(self):
     colorDialog = QColorDialog(self)
     colorDialog.setOption(QColorDialog.ShowAlphaChannel)
     #list = QColor().colorNames()
     #for i in list:
     #    print(i)
     color = colorDialog.getColor()
     self.lab3.setText("Background: "+color.name())
     self.parent.setBackgroundColor(color)
예제 #13
0
 def change_color(self, index):
     """Invoke palette editor and set the color"""
     color = self.model().data(index, ColorRole)
     if color is None:
         return
     dlg = QColorDialog(QColor(*color))
     if dlg.exec():
         color = dlg.selectedColor()
         self.model().setData(index, color.getRgb(), ColorRole)
예제 #14
0
 def on_cameraFrameToolButton_clicked(self):
     """
     Slot documentation goes here.
     """
     frameColorDialog = QColorDialog(self)
     if frameColorDialog.exec_() == QDialog.Accepted:
         frameColorName = str(frameColorDialog.selectedColor().name())
         self.cameraFrameColorWidget.setStyleSheet("QWidget { background-color: %s }" % frameColorName)
         self.svgbuild.setSingleOption('frame',  frameColorName)
예제 #15
0
 def on_lineToolButton_clicked(self):
     """
     Slot documentation goes here.
     """
     lineColorDialog = QColorDialog(self)
     if lineColorDialog.exec_() == QDialog.Accepted:
         self.lineColorName = str(lineColorDialog.selectedColor().name())
         self.lineColorWidget.setStyleSheet("QWidget { background-color: %s }" % self.lineColorName)
         self.svgbuild.setSingleOption('line',  self.lineColorName)
예제 #16
0
파일: owcolor.py 프로젝트: asenzh/orange3
 def change_color(self, index):
     """Invoke palette editor and set the color"""
     color = self.model().data(index, ColorRole)
     if color is None:
         return
     dlg = QColorDialog(QColor(*color))
     if dlg.exec():
         color = dlg.selectedColor()
         self.model().setData(index, color.getRgb(), ColorRole)
예제 #17
0
 def selectColour():
     colour = colourAttr.getInstance(self._currentScheme)
     currentColour = getattr(colour, colourType)
     colourDialog = QColorDialog(currentColour, self)
     if colourDialog.exec_():
         selected = colourDialog.selectedColor()
         if selected != currentColour:
             self._styleButton(button, selected)
             setattr(colour, colourType, selected)
예제 #18
0
 def on_backgroundToolButton_clicked(self):
     """
     Slot documentation goes here.
     """
     backgroundColorDialog = QColorDialog(self)
     if backgroundColorDialog.exec_() == QDialog.Accepted:
         backgroundColorName = str(backgroundColorDialog.selectedColor().name())
         self.backgroundColorWidget.setStyleSheet("QWidget { background-color: %s }" % backgroundColorName)
         self.svgbuild.setSingleOption('background',  backgroundColorName)
예제 #19
0
 def selectColour():
     colour = colourAttr.getInstance(self._currentScheme)
     currentColour = getattr(colour, colourType)
     colourDialog = QColorDialog(currentColour, self)
     if colourDialog.exec_():
         selected = colourDialog.selectedColor()
         if selected != currentColour:
             self._styleButton(button, selected)
             setattr(colour, colourType, selected)
 def on_push(self):
     """ When a subset color button is pushed, update the color """
     source = self.sender()
     for key in self.subset_widgets:
         button = self.subset_widgets[key]['widget']
         if button == source:
             dialog = QColorDialog()
             initial = mpl_to_qt4_color(key.style.color)
             color = dialog.getColor(initial = initial)
             key.style.color = qt4_to_mpl_color(color)
예제 #21
0
파일: tagedit.py 프로젝트: arxsys/dff-api
 def setColor(self):
     colorDialog = QColorDialog()
     if self.tag:
         color = self.tag.color()
         qcolor = colorDialog.getColor(QColor(color.r, color.g, color.b))
     else:
         qcolor = colorDialog.getColor()
     if qcolor.isValid():
         self.setEditColor(qcolor)
         self.tagColor = (qcolor.red(), qcolor.green(), qcolor.blue())
예제 #22
0
 def _select(self, nbr):
     col = QColorDialog()
     col = QtGui.QColorDialog.getColor()
     if col.isValid() and self._mem:
         logger.info(col.red())
         self._mem.leds[nbr].set(r=col.red(), g=col.green(), b=col.blue())
         self.sender().setStyleSheet(
             "background-color: rgb({},{},{})".format(
                 col.red(), col.green(), col.blue()))
         self._write_led_output()
 def changeFeatureColour(self, mapfeatureitem):
     colourdialog = QColorDialog()
     r, g, b = mapfeatureitem.colour
     qitemcolour = QColor()
     qitemcolour.setRgb(r, g, b)
     r, g, b, a = colourdialog.getColor(initial=qitemcolour).getRgb()
     mapfeatureitem.visible = not mapfeatureitem.visible
     self.ui.qimageviewer.changeMapFeatureColour(idstring = mapfeatureitem.idstring,
                                                 colour = [r, g, b])
     mapfeatureitem.colour = [r, g, b]
     mapfeatureitem.updateText()
예제 #24
0
 def _choosecolor(self, set_color=None):
     w = self.widgets
     def _onClicked(color):
         w.input.setTextColor(color)
         self.fgcolor_button_change_color(color)
     if not set_color:
         cdlg = QColorDialog(self)
         signal_connect(cdlg, SIGNAL("colorSelected(QColor)"), _onClicked)
         ret = cdlg.open()
     else:
         _onClicked(set_color)
예제 #25
0
    def onColorPicker(self):
        """
        Show color-picker dialog to select color.

        Qt will use the native dialog by default.

        """
        dlg = QColorDialog(self)
        if self._color:
            dlg.setCurrentColor(QColor(self._color))

        if dlg.exec_():
            self.setColor(dlg.currentColor().name())
 def _select(self, nbr):
     col = QColorDialog()
     col = QtGui.QColorDialog.getColor()
     if col.isValid() and self._mem:
         logger.info(col.red())
         self._mem.leds[nbr].set(r=col.red(), g=col.green(), b=col.blue())
         self.sender().setStyleSheet("background-color: rgb({},{},{})"
                                     .format(col.red(), col.green(),
                                             col.blue()))
         self._write_led_output()
예제 #27
0
 def selectColor(self):
     self.setChecked(True)
     color = QColorDialog.getColor(self._color)
     self.setChecked(False)
     if color != self._color:
         self.setColor(color)
         self.emit(SIGNAL("colorChanged()"))
예제 #28
0
 def showColorDialog(self, frame):
     col = QColorDialog.getColor()
     if col.isValid():
         frame.setStyleSheet("QWidget { background-color: %s }" %
                             col.name())
         self.DATA['colors'][unicode(frame.objectName())] = unicode(
             col.name())
예제 #29
0
 def selectColor(self):
     self.setChecked(True)
     color = QColorDialog.getColor(self._color)
     self.setChecked(False)
     if color != self._color:
         self.setColor(color)
         self.emit(SIGNAL("colorChanged()"))
    def action(self):
        qt_color_old = QColor(self.value)
        qt_color = QColorDialog.getColor(qt_color_old)

        if qt_color.isValid():
            self.value = qt_color.name()
            self.app.refresh()
예제 #31
0
    def __init__(self, conteneur=None):
        if conteneur is None : conteneur = self
        QWidget.__init__(conteneur)
        colorWindow.__init__(conteneur)
        self.setupUi(conteneur)

        self.colorDialog = QColorDialog(self)

        self.listColor = []
        self.changers = [u"Fond d'écran 3D",u"Arrière-plan"]
        self.changersVar = ["wallpaper","background"]

        self.changedColor = []

        for a in self.changers:
            self.comboBox.addItem(a)
            self.listColor.append(QColor(255,255,255))
            self.changedColor.append(False)

        self.connect(self.toolButton,  SIGNAL("released()"), self.chooseColor)
        self.connect(self.comboBox,  SIGNAL("currentIndexChanged (int)"), self.changeColor)
        self.connect(self.buttonBox, SIGNAL("accepted ()"), self.apply)
        self.connect(self.buttonBox, SIGNAL("rejected ()"), self.hide)

        self.connect(self.colorDialog, SIGNAL("colorSelected ()"), self.finishChooseColor)

        self.changeColor()
예제 #32
0
 def updateColor(self):
     """
     Update the color on the sampleModel
     modify to fit to the actual view
     
     """
     if not self.view.sampleTableView.selectedIndexes():#not self.acTree.selectedIndexes():
         return
     
     idx = self.view.sampleTableView.selectedIndexes()[0]
     sample = self.model.sample(idx.data().toString(), fullNameEntry=False)
     
     if sample is None:
         self.view.showErrorMessage('Error', 'Please choose only one file...')            
         return
     
     color = QColorDialog.getColor()
     if not color.isValid():
         return
         
     sample.color=color.getRgbF()[:-1]
     
     #make the gradient color here to
     color =QColor.fromRgbF(*(sample.color+(1.,)))
     colorr=QColor.fromRgbF(*(sample.color+(.5,)))
     gradient=QLinearGradient(-100, -100, 100, 100)
     gradient.setColorAt(0.7, colorr)
     gradient.setColorAt(1, color)
     
     #for m in (self.view.sampleModel, self.view.spectraModel, self.view.peakModel, 
     #          self.view.clusterModel):#self.view.chromaModel,
     for i in xrange(self.view.sampleModel.rowCount()):
         item=self.view.sampleModel.item(i,0)
         if item.text()== sample.shortName():
             item.setBackground(QBrush(gradient))
예제 #33
0
    def mouseReleaseEvent(self, QMouseEvent):
        color = QColorDialog.getColor(self._color, self, "Select color", QColorDialog.ShowAlphaChannel)

        if color.isValid():
            self._color = color
            self.update()
            self.colorChanged.emit(self._color)
 def _pick_color(self, lineedit, btn):
     """Pick a color name using lineedit and button data."""
     color = QColorDialog.getColor(QColor(lineedit.text()), self,
                                   translations.TR_EDITOR_SCHEME_PICK_COLOR)
     if color.isValid():
         lineedit.setText(str(color.name()))
         self.apply_button_style(btn, color.name())
예제 #35
0
 def slotBaseColor(self):
     """Slot function to update the basecolor if the color has been changed
     """
     self.ColorScheme.baseColor = QColorDialog.getColor(
         self.ColorScheme.baseColor, self, "ColorDialog")
     self.ColorScheme.generateScheme()
     self.setBackgroundColor(self.chipBaseColor, self.ColorScheme.baseColor)
예제 #36
0
 def getLabelColor(self):
     color = QColorDialog.getColor(QColor(self.label_color.text()))
     if not color.isValid():
         return
     if not color is None:
         self.label_color.setText(color.name())
         self.label_color_button.setStyleSheet("background:"+unicode(color.name()))
예제 #37
0
 def change_point_color(self, color=None):
     #blue 4279259391
     if color == None:
         color = QColorDialog.getColor(QColor(4279259391), None,
                                       'Point color',
                                       QColorDialog.ShowAlphaChannel)
     if color.isValid():
         self.curve.setSymbolBrush(color)
예제 #38
0
    def _onClicked(self):
        """Button has been clicked.
        Show dialog and update color
        """
        color = QColorDialog.getColor(self._color, self.window(), tr("Choose a color"), QColorDialog.ShowAlphaChannel)

        if color.isValid():
            self.setColor(color)
예제 #39
0
 def edit_cell(self, row, column):
     if column == 1:
         color_item = self.ui.compareList.item(row, column)
         color = QColor(color_item.text())
         result = QColorDialog.getColor(initial=color, parent=self)
         if result.isValid():
             color_item.setText(result.name())
             color_item.setBackgroundColor(result)
예제 #40
0
    def pickColor(self):
        """
        Prompts the user to select a color for this button.
        """
        color = QColorDialog.getColor(self.color(), self)

        if (color.isValid()):
            self.setColor(color)
예제 #41
0
 def changeHabColor(self):
     currRow = self.habTableWidget.currentRow()
     color_item = QTableWidgetItem()
     new_qcolor = QColorDialog.getColor(parent=self)
     if new_qcolor.isValid():
         color_item.setBackgroundColor(new_qcolor)
         color_item.setText(new_qcolor.name())
         self.habTableWidget.setItem(currRow, 2, color_item)
예제 #42
0
 def color_picker(self, a):
     self.cp = QColorDialog.getColor()
     if a == 0:
         self.colorPrimaryLbl.setText(self.cp.name())
         self.colorPrimaryLbl.setStyleSheet("background-color:"+self.cp.name() +"")
     elif a == 1:
         self.colorSecondaryLbl.setText(self.cp.name())
         self.colorSecondaryLbl.setStyleSheet("background-color:"+self.cp.name() +"")
예제 #43
0
파일: EkdWidgets.py 프로젝트: Ptaah/Ekd
 def updateColor(self):
     newcolor = QColorDialog.getColor(QColor.fromRgb(int("%d" % int(self.value, 16))), None )# Non supporté sous Jaunty ??
     if newcolor.isValid():
         self.value = str("%x" % newcolor.rgb())[2:]
         self.color.fill(QColor.fromRgb(int("%d" % int(self.value, 16))))
         self.boutton.setIcon(QIcon(self.color))
         self.line.setText(self.value)
         EkdConfig.set(self.section, self.id, self.value)
 def _pick_color(self, lineedit, btn):
     """Pick a color name using lineedit and button data."""
     color = QColorDialog.getColor(
         QColor(lineedit.text()), self,
         translations.TR_EDITOR_SCHEME_PICK_COLOR)
     if color.isValid():
         lineedit.setText(str(color.name()))
         self.apply_button_style(btn, color.name())
예제 #45
0
파일: qtutil.py 프로젝트: eteq/glue
def edit_layer_color(layer):
    """ Interactively edit a layer's color """
    initial = mpl_to_qt4_color(layer.style.color, alpha=layer.style.alpha)
    color = QColorDialog.getColor(initial, None, "Change layer color",
                                  options=QColorDialog.ShowAlphaChannel)
    if color.isValid():
        layer.style.color = qt4_to_mpl_color(color)
        layer.style.alpha = color.alpha() / 256.
예제 #46
0
 def change_line_color(self, color=None):
     #yellow 4294967040
     if color == None:
         color = QColorDialog.getColor(QColor(4294967040), None,
                                       'Line color',
                                       QColorDialog.ShowAlphaChannel)
     if color.isValid():
         self.curve.setPen(color)
예제 #47
0
    def createColorDialog(self):
        """
        Create a dialog box to select a color.
        """

        newColor = QColorDialog.getColor(self.getQColor(), self._app.ui.workspace, "Select Color", QColorDialog.ShowAlphaChannel)
        if newColor.isValid():
            self.setColor(newColor)
예제 #48
0
 def colordialog(self):
     col = QColorDialog.getColor()
     button = self.sender()  # 获取信号来源
     if col.isValid():
         button.setStyleSheet('QWidget{background-color:%s}' % col.name())
     for b in self.color_btn_list:
         if button is b:
             bindex = self.color_btn_list.index(b)
             self.setting_list[bindex][0] = col
예제 #49
0
 def getColorFromDialog(self):
     rgb, ok = QColorDialog.getRgba(self.lastSel.rgba(),
                                    self.parentWidget())
     if not ok:
         return
     col = QColor.fromRgba(rgb)
     self.insertColor(col, self.tr("Custom"), -1)
     self.lastSel = col
     self.emit(SIGNAL("selected(QColor)"), col)
예제 #50
0
    def onColorPicker(self):
        '''Show color-picker dialog to select color.'''

        dlg = QColorDialog(self)
        dlg.setStyleSheet("background-color: %s" % self.defaultColor)

        if self._color:
            dlg.setCurrentColor(QColor(self._color))

        if dlg.exec_():
            self.set_color(dlg.currentColor().name())
예제 #51
0
 def pickTextColor(self):
     """
     Prompts the user to select a text color.
     """
     clr = QColorDialog.getColor(self.textColor(),
                                 self.window(),
                                 'Pick Text Color')
     
     if clr.isValid():
         self.setTextColor(clr)
예제 #52
0
    def customized_color_button_pressed(self):
        """ 
        Deal with user requests to customize colors.
        """

        oldColor = self._synchronizer.get_active_widget().color
        color = QColorDialog.getColor(oldColor, None, "Select Custom Color")

        if color.isValid():
            self._synchronizer.change_active_color(color)
예제 #53
0
    def _onClicked(self):
        """Button has been clicked.
        Show dialog and update color
        """
        color = QColorDialog.getColor(self._color, self.window(),
                                      tr("Choose a color"),
                                      QColorDialog.ShowAlphaChannel)

        if color.isValid():
            self.setColor(color)
예제 #54
0
def ts_change_color():
    """
    Open color picker and set chosen color to text (in content)
    """
    global ts_color
    qcolor_old = QColor(ts_color)
    qcolor = QColorDialog.getColor(qcolor_old)
    if qcolor.isValid():
        ts_color = qcolor.name()
        execute_js("color = '" + ts_color + "'")
        ts_refresh()
예제 #55
0
    def change_color(self):
        """ Fire up a QColorDialog to let the user change the
        color of the lines marking a pattern repeat box.

        """

        color = QColorDialog.getColor(self.color, None,
                                      "Select Line Color")

        self.color = color
        self.set_button_color()
예제 #56
0
    def change_row_highlight_color(self):
        """ Fire up a QColorDialog to change the color for
        hightlighting odd rows.

        """

        color = self.settings.highlightRowsColor.value
        newColor = QColorDialog.getColor(QColor(color), None,
                                         "Select color for row highlighting")
        self.settings.highlightRowsColor.value = newColor.name()
        self._update_highlight_button_color()
        self.emit(SIGNAL("redraw_highlighted_rows"))
예제 #57
0
 def selectColor(self):
    item = self.table.currentItem()
    color = item and QColor(item.background()) or self.table.palette().base().color()
    color = QColorDialog.getColor(color, self)
    if not color.isValid():
       return
    selected = self.table.selectedItems()
    if not selected:
       return
    for i in selected:
       i and i.setBackground(color)
    self.updateColor(self.table.currentItem())
예제 #58
0
 def btnLabelColorClick(self):
     dlgColor = QColorDialog(self)
     dlgColor.setCurrentColor(self.selectedLabelItem.fontColor())
     result = dlgColor.exec_()
     if result == 1:
         self.labelColor = dlgColor.selectedColor()
         self.selectedLabelItem.setFontColor(self.labelColor)