difonlib 0.4.1__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {difonlib-0.4.1 → difonlib-0.4.2}/PKG-INFO +1 -1
  2. {difonlib-0.4.1 → difonlib-0.4.2}/pyproject.toml +1 -1
  3. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/ng_lib.py +28 -1
  4. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/ng_lib_test3.py +6 -1
  5. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/tuya_devs.py +1 -1
  6. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib.egg-info/PKG-INFO +1 -1
  7. {difonlib-0.4.1 → difonlib-0.4.2}/README.md +0 -0
  8. {difonlib-0.4.1 → difonlib-0.4.2}/setup.cfg +0 -0
  9. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/__init__.py +0 -0
  10. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/bt_scanner.py +0 -0
  11. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/bt_utils.py +0 -0
  12. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/conn_kbd_devs.py +0 -0
  13. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/docker-android/get_tuya_preferences.py +0 -0
  14. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/input_devs.py +0 -0
  15. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/py.typed +0 -0
  16. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/remctrl.py +0 -0
  17. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib/utils.py +0 -0
  18. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib.egg-info/SOURCES.txt +0 -0
  19. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib.egg-info/dependency_links.txt +0 -0
  20. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib.egg-info/requires.txt +0 -0
  21. {difonlib-0.4.1 → difonlib-0.4.2}/src/difonlib.egg-info/top_level.txt +0 -0
  22. {difonlib-0.4.1 → difonlib-0.4.2}/tests/test_bt_utils.py +0 -0
  23. {difonlib-0.4.1 → difonlib-0.4.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: difonlib
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: python libraries
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "difonlib"
3
- version = "0.4.1"
3
+ version = "0.4.2"
4
4
  description = "python libraries"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -65,14 +65,17 @@ class DialogBox:
65
65
  async def dialog_input(
66
66
  self,
67
67
  text: str,
68
+ input_prefix: str = "",
69
+ **kwrds: Any,
68
70
  ) -> ui.dialog:
69
71
  with ui.dialog().props("persistent") as dialog, ui.card():
70
72
  ui.label(text=text)
71
73
  with ui.row():
72
- inp: ui.input = ui.input(label="IR button").on(
74
+ inp: ui.input = ui.input(value=input_prefix, **kwrds).on(
73
75
  "keydown.enter", lambda: dialog.submit(inp.value)
74
76
  )
75
77
  ui.button(text="Enter", on_click=lambda: dialog.submit(inp.value))
78
+ ui.button(text="Cancel", on_click=dialog.close)
76
79
  return await dialog
77
80
 
78
81
 
@@ -96,6 +99,8 @@ class CardTable:
96
99
 
97
100
  with ui.card().classes("p-4 shadow-lg") as self.card:
98
101
  with ui.row().classes("items-center justify-between w-full mb-2"):
102
+ with ui.row().classes("gap-2") as self.left_table:
103
+ pass
99
104
  ui.label(f"📋 {title}").classes("text-green-700 text-lg font-bold")
100
105
  with ui.row().classes("gap-2") as self.top_table:
101
106
  pass
@@ -201,6 +206,28 @@ class CardTable:
201
206
  self.table.rows = self.enum_data(rows)
202
207
  self.table.update()
203
208
 
209
+ def add_checkbox(
210
+ self,
211
+ chbox_txt: str,
212
+ on_change: Callable,
213
+ default_enable: bool = False,
214
+ ) -> ui.checkbox:
215
+ """
216
+ card_table.add_checkbox(chbox_txt="Used Only", on_change=lambda v: ui.notify(v))
217
+ """
218
+ with self.top_table:
219
+ chbox = ui.checkbox(chbox_txt, value=default_enable).classes("font-bold")
220
+
221
+ async def handle_change(e: Any) -> None:
222
+ if inspect.iscoroutinefunction(on_change):
223
+ await on_change(e.sender.value)
224
+ else:
225
+ on_change(e.sender.value)
226
+
227
+ chbox.on("click", handle_change)
228
+ setattr(self, f"chbox{chbox_txt.replace(' ', '_')}", chbox)
229
+ return chbox
230
+
204
231
  def add_button(
205
232
  self,
206
233
  btn_txt: str,
@@ -30,8 +30,13 @@ def main() -> None:
30
30
  found = card_table.mark_row(id="123456", mark=True)
31
31
  print(f"card_table.table.rows:{card_table.table.rows}") # //Dima
32
32
  found = card_table.mark_row(id="123456", name="ANNNNN", mark=False)
33
+ found = card_table.mark_row(id="129956")
33
34
  print(f" ==> found: {found}") # //Dima
34
35
 
36
+ print(f"card_table.table.rows: {card_table.table.rows}")
37
+
38
+ card_table.add_checkbox(chbox_txt="Used Only", on_change=lambda v: ui.notify(v))
39
+
35
40
  dialog_box = DialogBox()
36
41
 
37
42
  def btnok() -> None:
@@ -60,7 +65,7 @@ def main() -> None:
60
65
  )
61
66
 
62
67
  async def dialog_input() -> None:
63
- inp = await dialog_box.dialog_input("Input IR_KEY_NAME")
68
+ inp = await dialog_box.dialog_input("Input IR_KEY_NAME", input_prefix="IR_KEY_")
64
69
  ui.notify(f"Your input: {inp}")
65
70
 
66
71
  card_table.add_button(
@@ -125,7 +125,7 @@ class TuyaDevs:
125
125
  # ]
126
126
  # return con_devs
127
127
 
128
- def dev_is_connected(self, dev_id: str, timeout: int = 8, rescan: bool = False) -> bool | None:
128
+ def dev_is_connected(self, dev_id: str, timeout: int = 8, rescan: bool = False) -> bool:
129
129
  if rescan:
130
130
  # update self.devs_online
131
131
  self.scan(timeout=timeout)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: difonlib
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: python libraries
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
File without changes
File without changes
File without changes
File without changes
File without changes