qpuiq 0.23__py3-none-any.whl

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 (104) hide show
  1. PUI/PySide6/__init__.py +49 -0
  2. PUI/PySide6/application.py +58 -0
  3. PUI/PySide6/base.py +285 -0
  4. PUI/PySide6/button.py +21 -0
  5. PUI/PySide6/canvas.py +345 -0
  6. PUI/PySide6/checkbox.py +32 -0
  7. PUI/PySide6/combobox.py +85 -0
  8. PUI/PySide6/dialog.py +72 -0
  9. PUI/PySide6/divider.py +23 -0
  10. PUI/PySide6/image.py +48 -0
  11. PUI/PySide6/label.py +33 -0
  12. PUI/PySide6/layout.py +141 -0
  13. PUI/PySide6/matplotlib.py +23 -0
  14. PUI/PySide6/mdi.py +33 -0
  15. PUI/PySide6/menu.py +85 -0
  16. PUI/PySide6/modal.py +132 -0
  17. PUI/PySide6/progressbar.py +17 -0
  18. PUI/PySide6/radiobutton.py +29 -0
  19. PUI/PySide6/scroll.py +155 -0
  20. PUI/PySide6/splitter.py +25 -0
  21. PUI/PySide6/tab.py +39 -0
  22. PUI/PySide6/table.py +147 -0
  23. PUI/PySide6/text.py +35 -0
  24. PUI/PySide6/textfield.py +62 -0
  25. PUI/PySide6/toolbar.py +57 -0
  26. PUI/PySide6/tree.py +290 -0
  27. PUI/PySide6/window.py +82 -0
  28. PUI/__init__.py +46 -0
  29. PUI/common.py +26 -0
  30. PUI/decorator.py +20 -0
  31. PUI/dom.py +263 -0
  32. PUI/flet/__init__.py +22 -0
  33. PUI/flet/application.py +42 -0
  34. PUI/flet/base.py +37 -0
  35. PUI/flet/button.py +20 -0
  36. PUI/flet/canvas.py +86 -0
  37. PUI/flet/checkbox.py +23 -0
  38. PUI/flet/divider.py +14 -0
  39. PUI/flet/label.py +27 -0
  40. PUI/flet/layout.py +50 -0
  41. PUI/flet/progressbar.py +21 -0
  42. PUI/flet/radiobutton.py +27 -0
  43. PUI/flet/scroll.py +83 -0
  44. PUI/flet/tab.py +42 -0
  45. PUI/flet/text.py +55 -0
  46. PUI/flet/textfield.py +58 -0
  47. PUI/flet/window.py +25 -0
  48. PUI/interfaces.py +97 -0
  49. PUI/node.py +432 -0
  50. PUI/state.py +711 -0
  51. PUI/textual/__init__.py +35 -0
  52. PUI/textual/application.py +82 -0
  53. PUI/textual/base.py +148 -0
  54. PUI/textual/button.py +17 -0
  55. PUI/textual/checkbox.py +21 -0
  56. PUI/textual/label.py +36 -0
  57. PUI/textual/layout.py +52 -0
  58. PUI/textual/progressbar.py +17 -0
  59. PUI/textual/radiobutton.py +24 -0
  60. PUI/textual/scroll.py +74 -0
  61. PUI/textual/tab.py +75 -0
  62. PUI/textual/text.py +32 -0
  63. PUI/textual/textfield.py +55 -0
  64. PUI/textual/window.py +7 -0
  65. PUI/timeline.py +36 -0
  66. PUI/tkinter/__init__.py +43 -0
  67. PUI/tkinter/application.py +49 -0
  68. PUI/tkinter/base.py +68 -0
  69. PUI/tkinter/button.py +15 -0
  70. PUI/tkinter/canvas.py +52 -0
  71. PUI/tkinter/checkbox.py +27 -0
  72. PUI/tkinter/label.py +17 -0
  73. PUI/tkinter/layout.py +114 -0
  74. PUI/tkinter/progressbar.py +17 -0
  75. PUI/tkinter/radiobutton.py +26 -0
  76. PUI/tkinter/scroll.py +201 -0
  77. PUI/tkinter/tab.py +52 -0
  78. PUI/tkinter/text.py +20 -0
  79. PUI/tkinter/textfield.py +53 -0
  80. PUI/tkinter/window.py +51 -0
  81. PUI/utils.py +15 -0
  82. PUI/view.py +161 -0
  83. PUI/wx/__init__.py +19 -0
  84. PUI/wx/application.py +44 -0
  85. PUI/wx/base.py +246 -0
  86. PUI/wx/button.py +16 -0
  87. PUI/wx/canvas.py +255 -0
  88. PUI/wx/checkbox.py +25 -0
  89. PUI/wx/combobox.py +81 -0
  90. PUI/wx/dialog.py +66 -0
  91. PUI/wx/divider.py +19 -0
  92. PUI/wx/label.py +18 -0
  93. PUI/wx/layout.py +52 -0
  94. PUI/wx/progressbar.py +19 -0
  95. PUI/wx/radiobutton.py +27 -0
  96. PUI/wx/scroll.py +55 -0
  97. PUI/wx/text.py +23 -0
  98. PUI/wx/textfield.py +66 -0
  99. PUI/wx/window.py +64 -0
  100. qpuiq-0.23.dist-info/LICENSE.txt +21 -0
  101. qpuiq-0.23.dist-info/METADATA +234 -0
  102. qpuiq-0.23.dist-info/RECORD +104 -0
  103. qpuiq-0.23.dist-info/WHEEL +5 -0
  104. qpuiq-0.23.dist-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ from .. import *
2
+ from .base import *
3
+
4
+ class ProgressBar(FBase):
5
+ def __init__(self, progress, maximum=1):
6
+ super().__init__()
7
+ self.progress = progress
8
+ self.maximum = maximum
9
+
10
+ def update(self, prev):
11
+ if prev and prev.ui:
12
+ self.ui = prev.ui
13
+ else:
14
+ self.ui = ft.ProgressBar(width=300) # XXX
15
+ self.ui.value = max(self.progress / self.maximum, 0)
16
+ self.ui.expand = self.layout_weight
17
+ try:
18
+ self.ui.update()
19
+ except:
20
+ pass
21
+ super().update(prev)
@@ -0,0 +1,27 @@
1
+ from .. import *
2
+ from .base import *
3
+
4
+ class RadioButton(FBase):
5
+ def __init__(self, text, value, model):
6
+ super().__init__()
7
+ self.text = text
8
+ self.value = value
9
+ self.model = model
10
+
11
+ def update(self, prev):
12
+ if prev and prev.ui:
13
+ self.radio = prev.radio
14
+ self.ui = prev.ui
15
+ self.radio.value = self.value
16
+ self.ui.value = self.model.value
17
+ self.ui.on_change = self._changed
18
+ self.ui.update()
19
+ else:
20
+ self.radio = ft.Radio(value=self.value, label=self.text)
21
+ self.ui = ft.RadioGroup(content=self.radio, on_change=self._changed)
22
+ super().update(prev)
23
+
24
+ def _changed(self, event):
25
+ node = self.get_node()
26
+ if event.control.value:
27
+ self.model.value = node.value
PUI/flet/scroll.py ADDED
@@ -0,0 +1,83 @@
1
+ from .. import *
2
+ from .base import *
3
+ import math
4
+
5
+ class Scroll(FBase):
6
+ END = -0.0
7
+
8
+ def __init__(self, vertical=None, horizontal=False):
9
+ self.vertical = vertical
10
+ self.horizontal = horizontal
11
+ self.align_x = 0
12
+ self.align_y = 0
13
+ self.widget = None
14
+ super().__init__()
15
+ self.layout_weight = 1
16
+
17
+ def update(self, prev):
18
+ if prev and hasattr(prev, "hframe"):
19
+ self.vframe = prev.vframe
20
+ self.hframe = prev.hframe
21
+ else:
22
+ self.vframe = ft.Column() # outer
23
+ self.hframe = ft.Row() # inner
24
+ self.vframe.controls.append(self.hframe)
25
+ self.vframe.expand = self.layout_weight
26
+ if self.vertical is None:
27
+ self.vframe.scroll = ft.ScrollMode.AUTO
28
+ elif self.vertical:
29
+ self.vframe.scroll = ft.ScrollMode.ADAPTIVE
30
+ else:
31
+ self.vframe.scroll = None
32
+ if self.horizontal is None:
33
+ self.hframe.scroll = ft.ScrollMode.AUTO
34
+ elif self.horizontal:
35
+ self.hframe.scroll = ft.ScrollMode.ADAPTIVE
36
+ else:
37
+ self.hframe.scroll = None
38
+ try:
39
+ self.vframe.update()
40
+ except:
41
+ pass
42
+ super().update(prev)
43
+
44
+ def addChild(self, idx, child):
45
+ if idx != 0:
46
+ return
47
+ self.hframe.controls.insert(idx, child.outer)
48
+ try:
49
+ self.hframe.update()
50
+ except:
51
+ pass
52
+
53
+ def removeChild(self, idx, child):
54
+ if idx != 0:
55
+ return
56
+ self.hframe.controls.pop(idx)
57
+ self.hframe.update()
58
+
59
+ @property
60
+ def outer(self):
61
+ return self.vframe
62
+
63
+ @property
64
+ def inner(self):
65
+ return self.hframe
66
+
67
+ def scrollX(self, pos=0):
68
+ if math.copysign(1, pos) >= 0:
69
+ self.align_x = 0
70
+ self.hsb_offset = pos
71
+ else:
72
+ self.align_x = 1
73
+ self.hsb_offset = abs(pos)
74
+ return self
75
+
76
+ def scrollY(self, pos=0):
77
+ if math.copysign(1, pos) >= 0:
78
+ self.align_y = 0
79
+ self.vsb_offset = pos
80
+ else:
81
+ self.align_y = 1
82
+ self.vsb_offset = abs(pos)
83
+ return self
PUI/flet/tab.py ADDED
@@ -0,0 +1,42 @@
1
+ from .. import *
2
+ from .base import *
3
+
4
+ class Tabs(FBase):
5
+ NORTH = "n"
6
+ SOUTH = "s"
7
+ EAST = "e"
8
+ WEST = "w"
9
+ pui_terminal = False
10
+ def __init__(self, tabposition=NORTH):
11
+ super().__init__()
12
+ self.tabposition = tabposition
13
+
14
+ def update(self, prev):
15
+ if prev and prev.ui:
16
+ self.ui = prev.ui
17
+ else:
18
+ self.ui = ft.Tabs(tabs=[], expand=1)
19
+ super().update(prev)
20
+
21
+ def addChild(self, idx, child):
22
+ tab = ft.Tab(text=child.parent.label, content=child.outer)
23
+ self.ui.tabs.insert(idx, tab)
24
+
25
+ def removeChild(self, idx, child):
26
+ self.ui.tabs.pop(idx)
27
+
28
+ def postSync(self):
29
+ for i,c in enumerate(self.children):
30
+ self.ui.tabs[i].text = c.label
31
+ try:
32
+ self.ui.update()
33
+ except:
34
+ pass
35
+ return super().postSync()
36
+
37
+
38
+ class Tab(PUINode):
39
+ pui_virtual = True
40
+ def __init__(self, label):
41
+ super().__init__()
42
+ self.label = label
PUI/flet/text.py ADDED
@@ -0,0 +1,55 @@
1
+ from .. import *
2
+ from .base import *
3
+
4
+ class Text(FBase):
5
+ def __init__(self, text, selectable=False):
6
+ super().__init__()
7
+ self.text = text
8
+
9
+ def update(self, prev):
10
+ if prev and prev.ui:
11
+ self.ui = prev.ui
12
+ self.ui.value = self.text
13
+ try:
14
+ self.ui.update()
15
+ except:
16
+ pass
17
+ else:
18
+ self.ui = ft.Text(self.text, expand=self.layout_weight)
19
+ super().update(prev)
20
+
21
+ class Html(FBase):
22
+ pui_supported = False
23
+ def __init__(self, text, **kwargs):
24
+ super().__init__(**kwargs)
25
+ self.text = text
26
+
27
+ def update(self, prev):
28
+ if prev and prev.ui:
29
+ self.ui = prev.ui
30
+ self.ui.value = self.text
31
+ try:
32
+ self.ui.update()
33
+ except:
34
+ pass
35
+ else:
36
+ self.ui = ft.Text(self.text, expand=self.layout_weight)
37
+ super().update(prev)
38
+
39
+ class MarkDown(FBase):
40
+ pui_supported = False
41
+ def __init__(self, text, **kwargs):
42
+ super().__init__(**kwargs)
43
+ self.text = text
44
+
45
+ def update(self, prev):
46
+ if prev and prev.ui:
47
+ self.ui = prev.ui
48
+ self.ui.value = self.text
49
+ try:
50
+ self.ui.update()
51
+ except:
52
+ pass
53
+ else:
54
+ self.ui = ft.Markdown(self.text, expand=self.layout_weight, auto_follow_links=True)
55
+ super().update(prev)
PUI/flet/textfield.py ADDED
@@ -0,0 +1,58 @@
1
+ from .. import *
2
+ from .base import *
3
+
4
+ class TextField(FBase):
5
+ def __init__(self, model, edit_model=None, label="", **kwargs):
6
+ super().__init__(**kwargs)
7
+ self.model = model
8
+ self.label = label
9
+ self.edit_model = edit_model
10
+ self.editing = False
11
+
12
+ def update(self, prev):
13
+ model_value = str(self.model.value)
14
+ if prev and prev.ui:
15
+ self.editing = prev.editing
16
+ self.ui = prev.ui
17
+ self.curr_value = prev.curr_value
18
+ if self.curr_value.set(model_value):
19
+ self.ui.value = model_value
20
+ try:
21
+ self.ui.update()
22
+ except:
23
+ pass
24
+ else:
25
+ self.curr_value = Prop(model_value)
26
+ self.ui = ft.TextField(label=self.label, value=model_value, on_change=self.on_textbox_changed, on_blur=self.on_blur, on_submit=self.on_submit, expand=self.layout_weight)
27
+
28
+ if self.edit_model and not self.editing:
29
+ self.edit_model.value = model_value
30
+
31
+ super().update(prev)
32
+
33
+ def on_textbox_changed(self, e): # editing
34
+ node = self.get_node()
35
+ node.editing = True
36
+ value = e.control.value
37
+ if node.edit_model:
38
+ node.edit_model.value = value
39
+ e = PUIEvent()
40
+ e.value = value
41
+ self._input(e)
42
+
43
+ def on_change(self, e): # finish editing
44
+ node = self.get_node()
45
+ node.editing = False
46
+ value = e.control.value
47
+ node.model.value = value
48
+ if node.edit_model:
49
+ node.edit_model.value = value
50
+ e = PUIEvent()
51
+ e.value = value
52
+ self._change(e)
53
+
54
+ def on_blur(self, e):
55
+ self.on_change(e)
56
+
57
+ def on_submit(self, e):
58
+ self.on_change(e)
PUI/flet/window.py ADDED
@@ -0,0 +1,25 @@
1
+ from .. import *
2
+ from .base import *
3
+
4
+ class Window(FBase):
5
+ def __init__(self, title=None, size=None, maximize=None, fullscreen=None):
6
+ super().__init__()
7
+ self.title = title
8
+ self.size = size
9
+ self.maximize = maximize
10
+ self.fullscreen = fullscreen
11
+ self.child_weight = 1
12
+
13
+ def update(self, prev=None):
14
+ self.inner.title = self.title
15
+ super().update(prev)
16
+
17
+ def addChild(self, idx, child):
18
+ if idx != 0:
19
+ return
20
+ self.inner.add(child.outer)
21
+
22
+ def removeChild(self, idx, child):
23
+ if idx != 0:
24
+ return
25
+ self.inner.remove(child.outer)
PUI/interfaces.py ADDED
@@ -0,0 +1,97 @@
1
+ class BaseTableAdapter():
2
+ def data(self, row, col):
3
+ """
4
+ Return cell content
5
+ """
6
+ raise NotImplementedError("data() must be implemented")
7
+
8
+ def editData(self, row, col):
9
+ """
10
+ Return data to be edited
11
+ """
12
+ return self.data(row, col)
13
+
14
+ def setData(self, row, col, value):
15
+ """
16
+ Accepts the edited value
17
+ """
18
+ pass
19
+
20
+ def editable(self, row, col):
21
+ """
22
+ Return whether the cell is editable
23
+ """
24
+ return False
25
+
26
+ def columnHeader(self, col):
27
+ """
28
+ Return column header, set to None to hide column header
29
+ """
30
+ return f"Col {col}"
31
+
32
+ def rowHeader(self, row):
33
+ """
34
+ Return row header, set to None to hide row header
35
+ """
36
+ return f"Row {row}"
37
+
38
+ def rowCount(self):
39
+ """
40
+ Return number of rows
41
+ """
42
+ raise NotImplementedError("rowCount() must be implemented")
43
+
44
+ def columnCount(self):
45
+ """
46
+ Return number of columns
47
+ """
48
+ raise NotImplementedError("columnCount() must be implemented")
49
+
50
+ class BaseTreeAdapter():
51
+ def parent(self, node):
52
+ """
53
+ Return parent node
54
+ """
55
+ raise NotImplementedError("parent() must be implemented")
56
+
57
+ def child(self, parent, index):
58
+ """
59
+ Return child node
60
+ """
61
+ raise NotImplementedError("child() must be implemented")
62
+
63
+ def data(self, node):
64
+ """
65
+ Return node data
66
+ """
67
+ raise NotImplementedError("data() must be implemented")
68
+
69
+ def rowCount(self, parent):
70
+ """
71
+ Return number of rows
72
+ """
73
+ raise NotImplementedError("rowCount() must be implemented")
74
+
75
+ def clicked(self, node):
76
+ """
77
+ Called when a node is clicked
78
+ """
79
+ pass
80
+
81
+ def dblclicked(self, node):
82
+ """
83
+ Called when a node is double clicked
84
+ """
85
+ pass
86
+
87
+ def expanded(self, node):
88
+ """
89
+ Called when a node is expanded
90
+ """
91
+ pass
92
+
93
+ def collapsed(self, node):
94
+ """
95
+ Called when a node is collapsed
96
+ """
97
+ pass