Skip to content

Commit 900e78c

Browse files
committed
Animated titles: Use ColorPicker
1 parent b2c121a commit 900e78c

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/windows/views/blender_listview.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
Qt, QObject, pyqtSlot, pyqtSignal, QThread, QTimer, QSize,
4545
)
4646
from PyQt5.QtWidgets import (
47-
QApplication, QListView, QMessageBox, QColorDialog,
47+
QApplication, QListView, QMessageBox,
4848
QComboBox, QDoubleSpinBox, QLabel, QPushButton, QLineEdit, QPlainTextEdit,
4949
)
5050
from PyQt5.QtGui import QColor, QImage, QPixmap
@@ -54,7 +54,9 @@
5454
from classes import settings
5555
from classes.query import File
5656
from classes.app import get_app
57+
5758
from windows.models.blender_model import BlenderModel
59+
from windows.color_picker import ColorPicker
5860

5961

6062
class BlenderListView(QListView):
@@ -228,24 +230,13 @@ def color_button_clicked(self, widget, param, index):
228230
currentColor.setRgbF(color_value[0], color_value[1], color_value[2])
229231
# Store our arguments for the callback to pick up again
230232
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)
243234

244235
@pyqtSlot(QColor)
245236
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"""
247238
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")
249240
return
250241
(widget, param) = self._color_scratchpad
251242
if not newColor or not newColor.isValid():
@@ -673,7 +664,6 @@ def __init__(self, parent, *args):
673664
self.selected = None
674665
self.deselected = None
675666
self._color_scratchpad = None
676-
self.newColorDialog = None
677667
self.selected_template = ""
678668
self.final_render = False
679669

0 commit comments

Comments
 (0)