Skip to content

Commit 354d2c5

Browse files
Change CustomKeyboard to MposKeyboard
1 parent b062aa0 commit 354d2c5

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

internal_filesystem/builtin/apps/com.micropythonos.settings/assets/settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from mpos.apps import Activity, Intent
22
from mpos.activity_navigator import ActivityNavigator
33

4+
from mpos.ui.keyboard import MposKeyboard
45
from mpos import PackageManager
56
import mpos.config
67
import mpos.ui
@@ -202,10 +203,9 @@ def onCreate(self):
202203
self.textarea.add_event_cb(lambda *args: mpos.ui.anim.smooth_show(self.keyboard), lv.EVENT.CLICKED, None) # it might be focused, but keyboard hidden (because ready/cancel clicked)
203204
self.textarea.add_event_cb(lambda *args: mpos.ui.anim.smooth_hide(self.keyboard), lv.EVENT.DEFOCUSED, None)
204205
# Initialize keyboard (hidden initially)
205-
self.keyboard = lv.keyboard(lv.layer_sys())
206+
self.keyboard = MposKeyboard(settings_screen_detail)
206207
self.keyboard.align(lv.ALIGN.BOTTOM_MID, 0, 0)
207-
self.keyboard.set_style_min_height(150, 0)
208-
mpos.ui.theme.fix_keyboard_button_style(self.keyboard) # Fix button visibility in light mode
208+
self.keyboard.set_style_min_height(165, 0)
209209
self.keyboard.add_flag(lv.obj.FLAG.HIDDEN)
210210
self.keyboard.add_event_cb(lambda *args: mpos.ui.anim.smooth_hide(self.keyboard), lv.EVENT.READY, None)
211211
self.keyboard.add_event_cb(lambda *args: mpos.ui.anim.smooth_hide(self.keyboard), lv.EVENT.CANCEL, None)

internal_filesystem/builtin/apps/com.micropythonos.wifi/assets/wifi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import _thread
66

77
from mpos.apps import Activity, Intent
8+
from mpos.ui.keyboard import MposKeyboard
89

910
import mpos.config
1011
import mpos.ui.anim
@@ -229,13 +230,13 @@ def onCreate(self):
229230
password_page=lv.obj()
230231
print(f"show_password_page: Creating label for SSID: {self.selected_ssid}")
231232
label=lv.label(password_page)
232-
label.set_text(f"Password for {self.selected_ssid}")
233-
label.align(lv.ALIGN.TOP_MID,0,5)
233+
label.set_text(f"Password for: {self.selected_ssid}")
234+
label.align(lv.ALIGN.TOP_MID,0,10)
234235
print("PasswordPage: Creating password textarea")
235236
self.password_ta=lv.textarea(password_page)
236237
self.password_ta.set_width(lv.pct(90))
237238
self.password_ta.set_one_line(True)
238-
self.password_ta.align_to(label, lv.ALIGN.OUT_BOTTOM_MID, 0, 0)
239+
self.password_ta.align_to(label, lv.ALIGN.OUT_BOTTOM_MID, 0, 10)
239240
self.password_ta.add_event_cb(lambda *args: self.show_keyboard(), lv.EVENT.CLICKED, None)
240241
print("PasswordPage: Creating Connect button")
241242
self.connect_button=lv.button(password_page)
@@ -258,11 +259,10 @@ def onCreate(self):
258259
self.password_ta.set_text(pwd)
259260
self.password_ta.set_placeholder_text("Password")
260261
print("PasswordPage: Creating keyboard (hidden by default)")
261-
self.keyboard=lv.keyboard(password_page)
262+
self.keyboard=MposKeyboard(password_page)
262263
self.keyboard.align(lv.ALIGN.BOTTOM_MID,0,0)
263264
self.keyboard.set_textarea(self.password_ta)
264-
self.keyboard.set_style_min_height(160, 0)
265-
mpos.ui.theme.fix_keyboard_button_style(self.keyboard) # Fix button visibility in light mode
265+
self.keyboard.set_style_min_height(165, 0)
266266
self.keyboard.add_event_cb(lambda *args: self.hide_keyboard(), lv.EVENT.READY, None)
267267
self.keyboard.add_event_cb(lambda *args: self.hide_keyboard(), lv.EVENT.CANCEL, None)
268268
self.keyboard.add_flag(lv.obj.FLAG.HIDDEN)

internal_filesystem/lib/mpos/ui/keyboard.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
to the default LVGL keyboard.
77
88
Usage:
9-
from mpos.ui.keyboard import CustomKeyboard
9+
from mpos.ui.keyboard import MposKeyboard
1010
1111
# Create keyboard
12-
keyboard = CustomKeyboard(parent_obj)
12+
keyboard = MposKeyboard(parent_obj)
1313
keyboard.set_textarea(my_textarea)
1414
keyboard.align(lv.ALIGN.BOTTOM_MID, 0, 0)
1515
@@ -22,7 +22,7 @@
2222
import mpos.ui.theme
2323

2424

25-
class CustomKeyboard:
25+
class MposKeyboard:
2626
"""
2727
Enhanced keyboard widget with multiple layouts and emoticons.
2828
@@ -186,9 +186,9 @@ def __getattr__(self, name):
186186
"""
187187
Forward any undefined method/attribute to the underlying LVGL keyboard.
188188
189-
This allows CustomKeyboard to support ALL lv.keyboard methods automatically
189+
This allows MposKeyboard to support ALL lv.keyboard methods automatically
190190
without needing to manually wrap each one. Any method not defined on
191-
CustomKeyboard will be forwarded to self._keyboard.
191+
MposKeyboard will be forwarded to self._keyboard.
192192
193193
Examples:
194194
keyboard.set_textarea(ta) # Works
@@ -218,10 +218,10 @@ def create_keyboard(parent, custom=False):
218218
219219
Args:
220220
parent: Parent LVGL object
221-
custom: If True, create CustomKeyboard; if False, create standard lv.keyboard
221+
custom: If True, create MposKeyboard; if False, create standard lv.keyboard
222222
223223
Returns:
224-
CustomKeyboard instance or lv.keyboard instance
224+
MposKeyboard instance or lv.keyboard instance
225225
226226
Example:
227227
# Use custom keyboard
@@ -231,7 +231,7 @@ def create_keyboard(parent, custom=False):
231231
keyboard = create_keyboard(screen, custom=False)
232232
"""
233233
if custom:
234-
return CustomKeyboard(parent)
234+
return MposKeyboard(parent)
235235
else:
236236
keyboard = lv.keyboard(parent)
237237
mpos.ui.theme.fix_keyboard_button_style(keyboard)

0 commit comments

Comments
 (0)