kopia lustrzana https://github.com/peterhinch/micropython-micro-gui
Fix bug in encoder-only mode.
rodzic
11b9ab655e
commit
a5cdc85562
18
README.md
18
README.md
|
@ -312,17 +312,17 @@ runtime. A disabled `active` widget is shown "greyed-out" and cannot accept the
|
|||
|
||||
### 1.4.1 Encoder only mode
|
||||
|
||||
This uses a rotary encoder with a pushbutton as the sole means of navigation, a
|
||||
mode suggested by @eudoxos. By default, turning the dial moves the currency
|
||||
between widgets. Clicking the button selects a widget; the widget with the
|
||||
focus has a white border. Supporting widgets such as sliders and dropdown lists
|
||||
enter "adjust" mode such that turning the dial adjusts the widget.
|
||||
This uses a rotary encoder with a built-in pushbutton as the sole means of
|
||||
navigation, a mode suggested by @eudoxos. By default, turning the dial moves
|
||||
the currency between widgets; the widget with the focus has a white border.
|
||||
Widgets for numeric entry such as sliders and scales may be put into "adjust"
|
||||
mode with a double click. In that mode turning the dial adjusts the widget.
|
||||
[Floating Point Widgets](./README.md#112-floating-point-widgets) can enter
|
||||
precision adjustment mode with a long press of the button. "Adjust" mode is
|
||||
cleared with a short button press.
|
||||
"precision" adjustment mode with a long press of the button. "Adjust" and
|
||||
"precision" modes are cleared with a short button press.
|
||||
|
||||
This mode works well and its use is quite intuitive. The rapid navigation makes
|
||||
it particularly useful when a screen has a large number of widgets.
|
||||
This mode works well and its use is quite intuitive. Navigation by turning a
|
||||
dial makes it particularly useful when a screen has a large number of widgets.
|
||||
|
||||
###### [Contents](./README.md#0-contents)
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ class InputEnc:
|
|||
self._sel = Pushbutton(sel, suppress=True)
|
||||
self._sel.release_func(self.release) # Widgets are selected on release.
|
||||
self._sel.long_func(self.precision, (True,)) # Long press -> precision mode
|
||||
self._sel.double_func(self.adj_mode, (True,)) # Double press -> adjust mode
|
||||
|
||||
# Screen.adjust: adjust the value of a widget. In this case 1st button arg
|
||||
# is an int (discarded), val is the delta. (With button interface 1st arg
|
||||
|
@ -143,7 +144,7 @@ class InputEnc:
|
|||
Screen.ctrl_move(_NEXT if delta > 0 else _PREV)
|
||||
|
||||
def release(self):
|
||||
self.adj_mode() #False) # Cancel adjust and precision
|
||||
self.adj_mode(False) # Cancel adjust and precision
|
||||
Screen.sel_ctrl()
|
||||
|
||||
def precision(self, val): # Also called by Screen.ctrl_move to cancel mode
|
||||
|
|
Ładowanie…
Reference in New Issue