Skip to content

Commit

Permalink
QComboBox encoder implementation finalised.
Browse files Browse the repository at this point in the history
  • Loading branch information
samyarsadat committed Nov 12, 2024
1 parent 718ad35 commit 43e456c
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@ def _enc_btn_press(self) -> None:
next_index = (current_index + 1) % focused_widget.count()
focused_widget.setCurrentIndex(next_index)
elif isinstance(focused_widget, QComboBox):
if not focused_widget.view().isVisible():
focused_widget.showPopup()
if not self._widget_selected:
self._widget_selected = True
self._selected_widget_name = focused_widget.objectName()
if not focused_widget.view().isVisible(): focused_widget.showPopup()
else:
focused_widget.hidePopup()
self._widget_selected = False
self._selected_widget_name = ""
if focused_widget.view().isVisible(): focused_widget.hidePopup()
elif isinstance(focused_widget, QSlider):
if not self._widget_selected:
self._widget_selected = True
Expand All @@ -96,7 +100,7 @@ def _enc_rotate(self, direction: bool) -> None:
focused_widget = QApplication.focusWidget()
self._check_selection_state(focused_widget)

if isinstance(focused_widget, QComboBox) and focused_widget.view().isVisible():
if isinstance(focused_widget, QComboBox) and self._widget_selected:
current_index = focused_widget.currentIndex()

if direction:
Expand All @@ -105,7 +109,7 @@ def _enc_rotate(self, direction: bool) -> None:
next_index = (current_index - 1) % focused_widget.count()
focused_widget.setCurrentIndex(next_index)
elif isinstance(focused_widget, QSlider) and self._widget_selected:
new_value = focused_widget.value() + (1 if direction else -1)
new_value = focused_widget.value() + (10 if direction else -10)
focused_widget.setValue(new_value)
else:
if direction:
Expand Down

0 comments on commit 43e456c

Please sign in to comment.