def change_preview_background(self): qcolor = QColorDialog().getColor(QColor(self.preview_bg), self.window) if qcolor.isValid(): self.preview_bg = qcolor.name() self.update_player_preview()
def on_bTest_clicked(self): """ Private method to test the selected options. """ if self.rColor.isChecked(): if not self.eColor.currentText(): QColorDialog.getColor() else: coStr = self.eColor.currentText() if coStr.startswith("#"): coStr = "QColor('{0}')".format(coStr) else: coStr = "QColor({0})".format(coStr) try: exec( "from PyQt5.QtCore import Qt;" ' QColorDialog.getColor({0}, None, "{1}")'.format(coStr, self.eTitle.text()) ) except: E5MessageBox.critical( self, self.tr("QColorDialog Wizard Error"), self.tr("""<p>The colour <b>{0}</b> is not valid.</p>""").format(coStr), ) elif self.rRGBA.isChecked(): QColorDialog.getColor( QColor(self.sRed.value(), self.sGreen.value(), self.sBlue.value(), self.sAlpha.value()), None, self.eTitle.text(), QColorDialog.ColorDialogOptions(QColorDialog.ShowAlphaChannel), )
def changeColor(self): # try: if self.sender() == self.colormode.ui.comboBoxFGColor: color_str = self.colormode.ui.comboBoxFGColor.currentText() if color_str == 'CUSTOM': color = _QColorDialog.getColor().getRgb() color = [round(color[0]/255,2), round(color[1]/255,2), round(color[2]/255,2)] self.data.colormap = color else: self.data.colormap = _mpl.colors.colorConverter.to_rgb(_mpl.colors.cnames[color_str]) elif self.sender() == self.colormode.ui.comboBoxBGColor: bgcolor_str = self.colormode.ui.comboBoxBGColor.currentText() if bgcolor_str == 'CUSTOM': bgcolor = _QColorDialog.getColor().getRgb() bgcolor = [round(bgcolor[0]/255,2), round(bgcolor[1]/255,2), round(bgcolor[2]/255,2)] self.data.bgcolor = bgcolor else: self.data.bgcolor = _mpl.colors.colorConverter.to_rgb(_mpl.colors.cnames[bgcolor_str]) self.createImg(img = self.data.image, xunits = self.data.xunits, yunits = self.data.yunits, extent = self.data.winextent) self.mpl.draw()
def tableWidgetCellDoubleClicked(self, row, column): if column==1: self.selected_row = row selected_item = self.tableWidget.item(self.selected_row, 1) color_dialog = QColorDialog(selected_item.data(Qt.BackgroundRole), self) color_dialog.currentColorChanged.connect(self.currentColorChanged) color_dialog.open()
def edit_color(self): row = self.ui.colors.currentRow() column = self.ui.colors.currentColumn() old_color = self.ui.colors.currentItem().text() qcolor = QColorDialog().getColor(QColor("#"+old_color), self.dialog) if qcolor.isValid(): new_color = qcolor.name()[1:].lower() self.ui.colors.setItem(row, column, ColorItem(new_color))
def _show_color_dialog(current_color, parent): dialog = QColorDialog() for idx, color in enumerate(DEFAULT_COLORS): dialog.setCustomColor(idx, color) current_color = dialog.getColor(current_color, parent, 'Select line color') if current_color.isValid(): return current_color
def pickColor(self): if self._readOnly: return dialog = QColorDialog(self._color) dialog.setOptions(QColorDialog.ShowAlphaChannel) ok = dialog.exec_() if ok: self.setColor(dialog.currentColor()) self.colorChanged.emit()
def mouseDoubleClickEvent(self, event): if self._readOnly: return dialog = QColorDialog(self._color) dialog.setOptions(QColorDialog.ShowAlphaChannel) ok = dialog.exec_() if ok: self.setColor(dialog.currentColor()) self.colorChanged.emit()
def mouseDoubleClickEvent(self, event): event.accept() if self._readOnly: return dialog = QColorDialog() ok = dialog.exec_() if ok: self.setColor(dialog.currentColor()) self.colorChanged.emit()
def ColorDialog_getColor(self, color=None, parent=None, name=None): from PyQt5.QtWidgets import QColorDialog from PyQt5.QtGui import QColor if color is None: color = QColor.black() if isinstance(color, str): color = QColor() cL = QColorDialog(color, parent) return cL.getColor()
def on_bgcolor_click(self): initial = self.input_bgcolor.text() color = QColorDialog.getColor(QColor(initial), self, "Choose background color") if color.isValid(): self.input_bgcolor.setText(color.name()) self.update_colors(fg_override=self.input_fgcolor.text(), bg_override=color.name())
def savePointDistanceStyle(self): if self.sender().objectName() == 'btnFontColor': self.sender().fontColor = QColorDialog.getColor() self.setPointDistanceStyle() self.saveSettings('markerLabelFont', self.cmbFonts.currentText()) self.saveSettings('markerLabelColor', self.btnFontColor.fontColor.name()) self.saveSettings('markerLabelSize', self.cmbFontSizes.currentText())
def showDialog(self): col = QColorDialog.getColor() if col.isValid(): self.frm.setStyleSheet("QWidget { background-color: %s }" % col.name())
def _bbTableDoubleClicked(self, row, col): """ This overrides the callback for table's double click set in the CustomWidget object. Apparently if there is an exception it falls back to the original callback... Not sure why this behaviour. NOTE: This is kind of nasty. :return: None """ it = self.table.item(row, col).text() try: idx = int(it) # decimal bb_path = self.ba.cache.bb_paths[idx] col = QColorDialog.getColor() if col.isValid(): # IDA works with BGR (annoying) ida_color = misc.pyside_to_ida_color(col.name()) misc.paint_basic_blocks(bb_path, ida_color) else: print '[x] Invalid QColor' return except IndexError: # Address value (does not contain [A-F]) is interpreted as index return except ValueError: # Address value (containing [A-F]) f***s up int() return
def changeFColor(self): initial = QColor(*map(int, re.findall('\d{1,3}', self.fColor))) color = QColorDialog.getColor(initial, parent=self) if(color.isValid()): self.fColor = 'rgb' + str(color.getRgb()) self.updatePreview()
def actionSetMoveLineColorSlot(self) -> None: # Inspector doesn't understand Qt's static methods # noinspection PyCallByClass,PyTypeChecker color = QColorDialog.getColor(self.moveLineColor, self, 'Select new move line color') if QColor.isValid(color): self.moveLineColor = color
def doubleClicked(self, model_index): """Double click handler for the property table""" # Get data model and selection model = self.clip_properties_model.model row = model_index.row() selected_label = model.item(row, 0) self.selected_item = model.item(row, 1) if selected_label: property = selected_label.data() property_type = property[1]["type"] if property_type == "color": # Get current value of color red = property[1]["red"]["value"] green = property[1]["green"]["value"] blue = property[1]["blue"]["value"] # Show color dialog currentColor = QColor(red, green, blue) newColor = QColorDialog.getColor(currentColor) # Set the new color keyframe self.clip_properties_model.color_update(self.selected_item, newColor)
def bgColorDialog(self): """Open color dialog to pick a color. """ color = QColorDialog.getColor() if color.isValid(): self.bgColor = color common.setPickerColor(color, self.bgColorPicker)
def chooseBestColor(self): self.bestColor = QColorDialog.getColor(self.bestColor) self.setBestColorButton(self.bestColor) if self.tag != None: self.taggedTextWidget.showDataNoWait(self.tag) self.taggedDocumentWidget.showDateNoWaitDetails(self.tag) self.update_colorbar()
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()
def choseEditorBackgroundColor(self): color = settings.textEditor["background"] self.colorDialog = QColorDialog(QColor(color), self) color = self.colorDialog.getColor(QColor(color)) if color.isValid(): settings.textEditor["background"] = color.name() self.setButtonColor(self.btnEditorBackgroundColor, color.name()) self.updateEditorSettings()
def changeRulerColor(self, color): if color == len(self.colors) - 1: self.colors= deepcopy(self.defaultColors) else: co= QColorDialog.getColor(self.colors[color][0][1], self) if co.isValid(): self.colors[color][0][1]= co self.repaint()
def change_color(self): self.color = QColorDialog.getColor() self.color_changer.setStyleSheet("background: %s" % self.color.name()) self.top_y = 0 self.left_x = 0 self.width = self.size_w self.height = self.size_h self.repaint(self.left_x, self.top_y, self.width, self.height)
def colorDialog(self): """Open color dialog to pick a color. """ color = QColorDialog.getColor() if color.isValid(): self.backgroundColor = color self.setPickerColor(color, self.colorPicker)
def set_color_picker_value(self): color = self.color_temp r, g, b = Color.from_factor_to_rgb(color[0], color[1], color[2]) q_color = QColor(r, g, b) new_color = QColorDialog.getColor(q_color) button = self.ui.pushButton_colorPicker self.color_temp = Color.from_rgb_to_factor(new_color.red(), new_color.green(), new_color.blue()) button.setStyleSheet("background-color: rgb({},{},{})".format(new_color.red(), new_color.green(), new_color.blue()))
def getThemeColor(self, key): color = self._themeData[key] self.colorDialog = QColorDialog(QColor(color), self) color = self.colorDialog.getColor(QColor(color)) if color.isValid(): self._themeData[key] = color.name() self.updateUIFromTheme() self.updatePreview()
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())
def colorDialog(self): """Open color dialog to pick a color. """ color = QColorDialog.getColor() if color.isValid(): common.setPickerColor(color, self.colorPicker) self.updateClassifierParameters(color=color)
def colorSelected(self): color = QColorDialog.getColor(Qt.white, self) if not color.name() == "#000000": settings().setValue("Subtitle/color", color) settings().sync() self.color_button.setStyleSheet("QPushButton {border: 1px solid black; border-radius: 3px; \ background-color: %s; }"%color.name()) self.parent.settingsChanged.emit()
def setCorkColor(self): color = QColor(settings.corkBackground["color"]) self.colorDialog = QColorDialog(color, self) color = self.colorDialog.getColor(color) if color.isValid(): settings.corkBackground["color"] = color.name() self.updateCorkColor() # Update Cork view self.mw.mainEditor.updateCorkBackground()
def setBrushColor(self, item): # 函数模板 color = item.brush().color() color = QColorDialog.getColor(color, self, "选择填充颜色") if color.isValid(): item.setBrush(QBrush(color))
def colorClick(self): col = QColorDialog.getColor() if col.isValid(): self.colorButton.setStyleSheet('QWidget {background-color:%s}' % col.name()) self.colorData[self.color_comboBox.currentText()] = col.name()
def showColorDialog(self): # 弹出一个`QColorDialog`对话框。 col = QColorDialog.getColor() if col.isValid(): self.frm.setStyleSheet("QWidget { background-color: %s }" % col.name())
def on_actSeries_BaseColor_triggered(self): color=self.series.baseColor() color=QColorDialog.getColor(color) if color.isValid(): self.series.setBaseColor(color)
def cambiar_color(self): color_dialog = QColorDialog() color = color_dialog.getColor(options=QColorDialog.ShowAlphaChannel) if color.isValid(): color = color.getRgb() self.color = tuple([i / 255 for i in color])
def _pick_color(self): """Ask the user for a Color""" choosed_color = QColorDialog.getColor() if choosed_color.isValid(): self._notification_choosed_color = choosed_color.name()
def openDialog(self): """Called when clicked, opens a dialog to change the color.""" color = self._color if self._color.isValid() else QColor(Qt.white) color = QColorDialog.getColor(color, self) if color.isValid(): self.setColor(color)
def setBckColor(self): nuColor = QColorDialog.getColor() self.viewer.setBackgroundBrush(nuColor)
def edit_color(self): self.brushColor = QColorDialog.getColor()
def get_color(self): self.color = QColorDialog.getColor() #returns a color object print(color)
def showDialog(self): col = QColorDialog.getColor() if col.isValid(): self.frm.setStyleSheet('QWidget { background-color: %s }' % col.name())
def color_picker(self): color = QColorDialog.getColor() self.styleChoice.setStyleSheet('QWidget{background-color: %s}' % color.name())
def fontBackground(self): backgroundColor = QColorDialog.getColor() self.currentEdit().setTextBackgroundColor(backgroundColor)
def fontColorSelect(self): color = QColorDialog.getColor() self.currentEdit().setTextColor(color)
def seleccionarColor(self): color = QColorDialog.getColor() if color.isValid(): return color.name() else: return "#545454"
def open_color_dialog(self, attr_name, mouse_event): d = QColorDialog(self) d.setCurrentColor(getattr(self, attr_name)) f = partial(self.set_color, attr_name) d.colorSelected.connect(f) # d.open(f) doesn't pass color for some reason d.open()
def getColor4(self): self.color4 = QColorDialog.getColor() self.setColor(self.btn_col4, self.color4)
def getColor1(self): self.color1 = QColorDialog.getColor() self.setColor(self.btn_col1, self.color1)
def getColor3(self): self.color3 = QColorDialog.getColor() self.setColor(self.btn_col3, self.color3)
def ChangeBackgroundColor(self): color = QColorDialog.getColor(QColor('#888844')) gameBoard.setBackgroundColor(color)
def getColor2(self): self.color2 = QColorDialog.getColor() self.setColor(self.btn_col2, self.color2)
def penColor(self): newColor = QColorDialog.getColor(self.drawingArea.penColor()) if newColor.isValid(): self.drawingArea.setPenColor(newColor)
def changeColor(self): col = QColorDialog.getColor() if col.isValid(): self.lc = col.name() self.showLine()
def ChangeForegroundColor(self): color = QColorDialog.getColor() gameBoard.setForegroundColor(color)
def color_func(self): if self.empty(): return color = QColorDialog.getColor() if color.isValid(): self.mdiArea.activeSubWindow().widget().setTextColor(color)
def pickColor(self): self.color = QColorDialog.getColor()
def btn_send_color(): sel_col = QColorDialog.getColor() color = sel_col.name().replace('#', '') self.ui.send_color_ph.setText(color) self.ui.send_color_ph.setStyleSheet("QWidget {color: %s}" % sel_col.name())
def setColor(): # options = QColorDialog.ColorDialogOptions(QFlag.QFlag(colorDialogOptionsWidget.value())) color = QColorDialog.getColor(Qt.green, self, "Select Color") if color.isValid(): return color
def buscarColor(self): color = QColorDialog.getColor(Qt.red, self) if color.isValid(): self.setPalette(QPalette(color))
def mainloop(self): # サイズ更新 sgm = getScreenGeomtry() if sgm != self.targetScreenGeometry: self.dpWindow.setGeometry(sgm) self.canvas.setCanvas(sgm.size()) self.dpMenu.setPositionPercent(self.dpMenu.myPositionPercent[0], self.dpMenu.myPositionPercent[1]) self.targetScreenGeometry = sgm # キー情報 actionKey[0] - 押しているか? actionKey[1] - 直後か? if self.actionKey[1] == True: self.actionKey = (self.actionKey[0], False) if (is_pressed("ctrl") and not self.actionKey[0]): self.actionKey = (True, True) elif (not is_pressed("ctrl") and self.actionKey[0]): self.actionKey = (False, True) # 表示扱いで非表示なら表示 または 逆 if self.isVisible and not self.dpWindow.isVisible(): self.dpWindow.show() elif not self.isVisible and self.dpWindow.isVisible(): self.dpWindow.hide() # dplabel更新 self.dpMenu.getFocusLabel() flp = self.dpMenu.prevFocusLabel if flp[0] != flp[1]: if flp[0] != 0: flp[0].changeStyleSheet("background-color", "rgba(0,100,100,100)") if flp[1] != 0: flp[1].changeStyleSheet("background-color", "rgba(0,0,0,50)") if self.actionKey == (True, True): # キーを押したとき if flp[0] != 0: None else: None self.pushedLabel = flp[0] elif self.actionKey == (False, True): # キーを離したとき if flp[0] != 0: # dpLabelなら if self.pushedLabel == self.dpMenu.labelList[0] and flp[ 0] == self.dpMenu.labelList[0]: self.dpMenu.togleLayout() if self.pushedLabel == self.dpMenu.labelList[1] and flp[ 0] == self.dpMenu.labelList[1]: sys.exit() if self.pushedLabel == self.dpMenu.labelList[2] and flp[ 0] == self.dpMenu.labelList[2]: if not self.isPenActive: self.isPenActive = not self.isPenActive flp[0].changeStyleSheet("color", "rgba(255,255,0,200)") else: self.isPenActive = not self.isPenActive flp[0].changeStyleSheet("color", "rgba(255,255,255,200)") if self.pushedLabel == self.dpMenu.labelList[3] and flp[ 0] == self.dpMenu.labelList[3]: color = QColorDialog().getColor(self.penColor, self.dpWindow, "色を選択") self.penColor = color flp[0].changeStyleSheet( "color", f"rgb({color.red()},{color.green()},{color.blue()})") if self.pushedLabel == self.dpMenu.labelList[4] and flp[ 0] == self.dpMenu.labelList[4]: self.canvas.setCanvas(self.dpWindow.size()) else: #label以外 if self.pushedLabel == self.dpMenu.labelList[0]: pos = self.dpWindow.mapFromGlobal(QCursor.pos()) xp = int(100 * pos.x() / self.dpWindow.width()) yp = int(100 * pos.y() / self.dpWindow.height()) self.dpMenu.setPositionPercent(xp, yp) self.pushedLabel = 0 if self.actionKey[0] == True: if flp[0] != 0: None else: if self.canvas.isCursorOnMe() and self.isPenActive: self.canvas.drawLine( self.canvas.mapFromGlobal(self.prevCursorPos), self.canvas.mapFromGlobal(QCursor().pos()), 5, self.penColor) # cursorバッファ更新 self.prevCursorPos = QCursor().pos() # ループ用タイマー self.dpTimer.start()