Skip to content

Commit

Permalink
Fixed gamut click bug
Browse files Browse the repository at this point in the history
- GUIDesign was passing image array (color array was expected)
  • Loading branch information
bastian43 committed Aug 8, 2023
1 parent bdaf36b commit c132925
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ui/gui_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def __init__(
self.visWidget.update()
self.colorPush.clicked.connect(self.drawWidget.change_color)
# color indicator
self.drawWidget.update_color.connect(self.colorPush.setStyleSheet)
self.drawWidget.update_color_indicator.connect(self.colorPush.setStyleSheet)
# update result
self.drawWidget.update_result.connect(self.visWidget.update_result)
self.drawWidget.update_result.connect(self.gamutWidget.set_ab)
self.drawWidget.update_gamut.connect(self.gamutWidget.set_gamut)
self.visWidget.update_color.connect(self.colorPush.setStyleSheet)
self.gamutWidget.update_color.connect(self.drawWidget.set_color)
# update gamut
Expand Down
6 changes: 3 additions & 3 deletions ui/gui_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import warnings

class GUIDraw(QWidget):
update_color = pyqtSignal(QString)
update_color_indicator = pyqtSignal(QString)
update_gamut = pyqtSignal(np.float64)
suggest_colors = pyqtSignal(np.ndarray)
used_colors = pyqtSignal(np.ndarray)
Expand Down Expand Up @@ -134,7 +134,7 @@ def update_ui(self, move_point: bool = True) -> None:
is_predict = False
snap_qcolor = self.calibrate_color(self.user_color, self.pos)
self.color = snap_qcolor
self.update_color.emit(QString('background-color: %s' % self.color.name()))
self.update_color_indicator.emit(QString('background-color: %s' % self.color.name()))

if self.ui_mode == 'point':
if move_point:
Expand Down Expand Up @@ -226,7 +226,7 @@ def set_color(self, c_rgb: np.ndarray) -> None:
self.user_color = c
snap_qcolor = self.calibrate_color(c, self.pos)
self.color = snap_qcolor
self.update_color.emit(QString('background-color: %s' % self.color.name()))
self.update_color_indicator.emit(QString('background-color: %s' % self.color.name()))
self.uiControl.update_color(snap_qcolor, self.user_color)
self.compute_result()

Expand Down
2 changes: 1 addition & 1 deletion ui/gui_gamut.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def set_gamut(self, l_in: np.float64 = 50) -> None:
self.update()

def set_ab(self, color: np.ndarray) -> None:
assert color.shape == (3, ), "GUIGamut.set_ab(...) expects color of shape(3,)"
self.color = color
self.lab = lab_gamut.rgb2lab_1d(self.color)
x, y = self.ab_grid.ab2xy(self.lab[1], self.lab[2])
Expand Down Expand Up @@ -79,7 +80,6 @@ def paintEvent(self, event: QPaintEvent) -> None:

def mousePressEvent(self, event: QMouseEvent) -> None:
pos = event.pos()

if event.button() == Qt.LeftButton and self.is_valid_point(pos): # click the point
self.update_ui(pos)
self.mouseClicked = True
Expand Down

0 comments on commit c132925

Please sign in to comment.