|
44 | 44 | Qt, QObject, pyqtSlot, pyqtSignal, QThread, QTimer, QSize,
|
45 | 45 | )
|
46 | 46 | from PyQt5.QtWidgets import (
|
47 |
| - QApplication, QListView, QMessageBox, QColorDialog, |
| 47 | + QApplication, QListView, QMessageBox, |
48 | 48 | QComboBox, QDoubleSpinBox, QLabel, QPushButton, QLineEdit, QPlainTextEdit,
|
49 | 49 | )
|
50 | 50 | from PyQt5.QtGui import QColor, QImage, QPixmap
|
|
54 | 54 | from classes import settings
|
55 | 55 | from classes.query import File
|
56 | 56 | from classes.app import get_app
|
| 57 | + |
57 | 58 | from windows.models.blender_model import BlenderModel
|
| 59 | +from windows.color_picker import ColorPicker |
58 | 60 |
|
59 | 61 |
|
60 | 62 | class BlenderListView(QListView):
|
@@ -228,24 +230,13 @@ def color_button_clicked(self, widget, param, index):
|
228 | 230 | currentColor.setRgbF(color_value[0], color_value[1], color_value[2])
|
229 | 231 | # Store our arguments for the callback to pick up again
|
230 | 232 | self._color_scratchpad = (widget, param)
|
231 |
| - |
232 |
| - # Set up non-modal color dialog (to avoid blocking the eyedropper) |
233 |
| - self.newColorDialog = QColorDialog(currentColor, self.win) |
234 |
| - self.newColorDialog.setWindowTitle(_("Select a Color")) |
235 |
| - self.newColorDialog.setWindowFlags(Qt.Tool) |
236 |
| - self.newColorDialog.setOptions(QColorDialog.DontUseNativeDialog) |
237 |
| - # Avoid signal loops |
238 |
| - self.newColorDialog.blockSignals(True) |
239 |
| - self.newColorDialog.colorSelected.connect(self.color_selected) |
240 |
| - self.newColorDialog.finished.connect(self.newColorDialog.deleteLater) |
241 |
| - self.newColorDialog.blockSignals(False) |
242 |
| - self.newColorDialog.open() |
| 233 | + ColorPicker(currentColor, callback=self.color_selected, parent=self.win) |
243 | 234 |
|
244 | 235 | @pyqtSlot(QColor)
|
245 | 236 | def color_selected(self, newColor):
|
246 |
| - """QColorDialog callback when the user chooses a color""" |
| 237 | + """Callback when the user chooses a color in the dialog""" |
247 | 238 | if not self._color_scratchpad:
|
248 |
| - log.warning("QColorDialog callback called without parameter to set") |
| 239 | + log.warning("ColorPicker callback called without parameter to set") |
249 | 240 | return
|
250 | 241 | (widget, param) = self._color_scratchpad
|
251 | 242 | if not newColor or not newColor.isValid():
|
@@ -673,7 +664,6 @@ def __init__(self, parent, *args):
|
673 | 664 | self.selected = None
|
674 | 665 | self.deselected = None
|
675 | 666 | self._color_scratchpad = None
|
676 |
| - self.newColorDialog = None |
677 | 667 | self.selected_template = ""
|
678 | 668 | self.final_render = False
|
679 | 669 |
|
|
0 commit comments