easycoder 250422.2__tar.gz → 250423.1__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 (184) hide show
  1. {easycoder-250422.2 → easycoder-250423.1}/PKG-INFO +2 -1
  2. {easycoder-250422.2 → easycoder-250423.1}/config.ecs +40 -11
  3. {easycoder-250422.2 → easycoder-250423.1}/easycoder/__init__.py +1 -1
  4. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_pyside6.py +254 -52
  5. {easycoder-250422.2 → easycoder-250423.1}/pyproject.toml +2 -1
  6. {easycoder-250422.2 → easycoder-250423.1}/.gitignore +0 -0
  7. {easycoder-250422.2 → easycoder-250423.1}/LICENSE +0 -0
  8. {easycoder-250422.2 → easycoder-250423.1}/README.md +0 -0
  9. {easycoder-250422.2 → easycoder-250423.1}/config.py +0 -0
  10. {easycoder-250422.2 → easycoder-250423.1}/doc/README.md +0 -0
  11. {easycoder-250422.2 → easycoder-250423.1}/doc/core/README.md +0 -0
  12. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/boolean.md +0 -0
  13. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/empty.md +0 -0
  14. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/ends.md +0 -0
  15. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/even.md +0 -0
  16. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/exists.md +0 -0
  17. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/greater.md +0 -0
  18. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/hasProperty.md +0 -0
  19. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/includes.md +0 -0
  20. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/is.md +0 -0
  21. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/less.md +0 -0
  22. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/list.md +0 -0
  23. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/none.md +0 -0
  24. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/not.md +0 -0
  25. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/numeric.md +0 -0
  26. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/object.md +0 -0
  27. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/odd.md +0 -0
  28. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/starts.md +0 -0
  29. {easycoder-250422.2 → easycoder-250423.1}/doc/core/conditions/string.md +0 -0
  30. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/add.md +0 -0
  31. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/append.md +0 -0
  32. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/assert.md +0 -0
  33. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/begin.md +0 -0
  34. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/clear.md +0 -0
  35. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/close.md +0 -0
  36. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/create.md +0 -0
  37. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/debug.md +0 -0
  38. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/decrement.md +0 -0
  39. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/delete.md +0 -0
  40. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/divide.md +0 -0
  41. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/exit.md +0 -0
  42. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/file.md +0 -0
  43. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/fork.md +0 -0
  44. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/get.md +0 -0
  45. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/go.md +0 -0
  46. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/gosub.md +0 -0
  47. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/if.md +0 -0
  48. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/import.md +0 -0
  49. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/increment.md +0 -0
  50. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/index.md +0 -0
  51. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/init.md +0 -0
  52. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/input.md +0 -0
  53. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/load.md +0 -0
  54. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/lock.md +0 -0
  55. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/log.md +0 -0
  56. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/module.md +0 -0
  57. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/multiply.md +0 -0
  58. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/negate.md +0 -0
  59. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/open.md +0 -0
  60. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/pop.md +0 -0
  61. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/post.md +0 -0
  62. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/print.md +0 -0
  63. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/push.md +0 -0
  64. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/put.md +0 -0
  65. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/read.md +0 -0
  66. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/release.md +0 -0
  67. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/replace.md +0 -0
  68. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/return.md +0 -0
  69. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/run.md +0 -0
  70. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/save.md +0 -0
  71. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/script.md +0 -0
  72. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/set.md +0 -0
  73. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/split.md +0 -0
  74. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/stack.md +0 -0
  75. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/stop.md +0 -0
  76. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/system.md +0 -0
  77. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/take.md +0 -0
  78. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/toggle.md +0 -0
  79. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/truncate.md +0 -0
  80. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/unlock.md +0 -0
  81. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/variable.md +0 -0
  82. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/wait.md +0 -0
  83. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/while.md +0 -0
  84. {easycoder-250422.2 → easycoder-250423.1}/doc/core/keywords/write.md +0 -0
  85. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/arg.md +0 -0
  86. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/args.md +0 -0
  87. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/cos.md +0 -0
  88. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/datime.md +0 -0
  89. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/decode.md +0 -0
  90. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/element.md +0 -0
  91. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/elements.md +0 -0
  92. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/empty.md +0 -0
  93. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/encode.md +0 -0
  94. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/error.md +0 -0
  95. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/files.md +0 -0
  96. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/float.md +0 -0
  97. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/from.md +0 -0
  98. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/hash.md +0 -0
  99. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/index.md +0 -0
  100. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/integer.md +0 -0
  101. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/json.md +0 -0
  102. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/keys.md +0 -0
  103. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/left.md +0 -0
  104. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/length.md +0 -0
  105. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/lowercase.md +0 -0
  106. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/memory.md +0 -0
  107. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/modification.md +0 -0
  108. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/modulo.md +0 -0
  109. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/newline.md +0 -0
  110. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/now.md +0 -0
  111. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/position.md +0 -0
  112. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/property.md +0 -0
  113. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/random.md +0 -0
  114. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/right.md +0 -0
  115. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/sin.md +0 -0
  116. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/stringify.md +0 -0
  117. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/tab.md +0 -0
  118. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/tan.md +0 -0
  119. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/timestamp.md +0 -0
  120. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/today.md +0 -0
  121. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/trim.md +0 -0
  122. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/type.md +0 -0
  123. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/uppercase.md +0 -0
  124. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/value.md +0 -0
  125. {easycoder-250422.2 → easycoder-250423.1}/doc/core/values/weekday.md +0 -0
  126. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/README.md +0 -0
  127. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/attach.md +0 -0
  128. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/close.md +0 -0
  129. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/create.md +0 -0
  130. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/ellipse.md +0 -0
  131. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/image.md +0 -0
  132. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/move.md +0 -0
  133. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/on.md +0 -0
  134. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/rectangle.md +0 -0
  135. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/render.md +0 -0
  136. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/run.md +0 -0
  137. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/set.md +0 -0
  138. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/keywords/text.md +0 -0
  139. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/values/attribute.md +0 -0
  140. {easycoder-250422.2 → easycoder-250423.1}/doc/graphics/values/window.md +0 -0
  141. {easycoder-250422.2 → easycoder-250423.1}/easycoder/README.md +0 -0
  142. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_classes.py +0 -0
  143. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_compiler.py +0 -0
  144. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_condition.py +0 -0
  145. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_core.py +0 -0
  146. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_graphics.py +0 -0
  147. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_gutils.py +0 -0
  148. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_handler.py +0 -0
  149. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_program.py +0 -0
  150. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_timestamp.py +0 -0
  151. {easycoder-250422.2 → easycoder-250423.1}/easycoder/ec_value.py +0 -0
  152. {easycoder-250422.2 → easycoder-250423.1}/group.py +0 -0
  153. {easycoder-250422.2 → easycoder-250423.1}/images/Semoigo Dawn.jpg +0 -0
  154. {easycoder-250422.2 → easycoder-250423.1}/json/graphics-demo.json +0 -0
  155. {easycoder-250422.2 → easycoder-250423.1}/plugins/ec_keyboard.py +0 -0
  156. {easycoder-250422.2 → easycoder-250423.1}/plugins/ec_p100.py +0 -0
  157. {easycoder-250422.2 → easycoder-250423.1}/plugins/ec_pyside6.py +0 -0
  158. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/4-function.json +0 -0
  159. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/4-function.png +0 -0
  160. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-0.json +0 -0
  161. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-0.png +0 -0
  162. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-1.json +0 -0
  163. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-1.png +0 -0
  164. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-2.json +0 -0
  165. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-2.png +0 -0
  166. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-3.json +0 -0
  167. {easycoder-250422.2 → easycoder-250423.1}/plugins/keyboards/qwerty-3.png +0 -0
  168. {easycoder-250422.2 → easycoder-250423.1}/plugins/points.py +0 -0
  169. {easycoder-250422.2 → easycoder-250423.1}/scripts/README.md +0 -0
  170. {easycoder-250422.2 → easycoder-250423.1}/scripts/benchmark.ecs +0 -0
  171. {easycoder-250422.2 → easycoder-250423.1}/scripts/config.ecg +0 -0
  172. {easycoder-250422.2 → easycoder-250423.1}/scripts/connect.ecg +0 -0
  173. {easycoder-250422.2 → easycoder-250423.1}/scripts/ec_keyboard.py +0 -0
  174. {easycoder-250422.2 → easycoder-250423.1}/scripts/findxr.ecs +0 -0
  175. {easycoder-250422.2 → easycoder-250423.1}/scripts/fizzbuzz.ecs +0 -0
  176. {easycoder-250422.2 → easycoder-250423.1}/scripts/hello.ecs +0 -0
  177. {easycoder-250422.2 → easycoder-250423.1}/scripts/points.ecs +0 -0
  178. {easycoder-250422.2 → easycoder-250423.1}/scripts/test.ecs +0 -0
  179. {easycoder-250422.2 → easycoder-250423.1}/scripts/testg.ecg +0 -0
  180. {easycoder-250422.2 → easycoder-250423.1}/scripts/tests.ecs +0 -0
  181. {easycoder-250422.2 → easycoder-250423.1}/test.ecg +0 -0
  182. {easycoder-250422.2 → easycoder-250423.1}/test.ecs +0 -0
  183. {easycoder-250422.2 → easycoder-250423.1}/test.json +0 -0
  184. {easycoder-250422.2 → easycoder-250423.1}/test.py +0 -0
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: easycoder
3
- Version: 250422.2
3
+ Version: 250423.1
4
4
  Summary: Rapid scripting in English
5
5
  Keywords: compiler,scripting,prototyping,programming,coding,python,low code,hypertalk,computer language,learn to code
6
6
  Author-email: Graham Trott <gtanyware@gmail.com>
7
7
  Description-Content-Type: text/markdown
8
8
  Classifier: License :: OSI Approved :: MIT License
9
9
  Requires-Dist: pytz
10
+ Requires-Dist: pyside6
10
11
  Project-URL: Home, https://github.com/easycoder/easycoder-py
11
12
 
12
13
  # Introduction
@@ -24,7 +24,8 @@
24
24
  pushbutton UpdateSlaveButton
25
25
  pushbutton DeleteFileButton
26
26
  pushbutton ExitButton
27
- pushbutton SelectSystemButton
27
+ pushbutton AddSystemButton
28
+ pushbutton RemoveSystemButton
28
29
  pushbutton SaveHostButton
29
30
  pushbutton RelayOffButton
30
31
  pushbutton RelayOnButton
@@ -38,8 +39,13 @@
38
39
  lineinput DHT22PinInput
39
40
  lineinput PathInput
40
41
  listbox SlaveList
42
+ combobox SystemsCombo
41
43
  checkbox LEDInvertCheckbox
42
44
  checkbox RelayInvertCheckbox
45
+ dialog Dialog
46
+ messagebox MessageBox
47
+ variable Name
48
+ variable Value
43
49
 
44
50
  ! debug step
45
51
 
@@ -48,6 +54,8 @@
48
54
  create Window title `RBR-Now configurator` size 700 500
49
55
  create MainPanel type QHBoxLayout
50
56
 
57
+ ! Do the left-hand panel
58
+
51
59
  create LeftPanel type QVBoxLayout
52
60
  add LeftPanel to MainPanel
53
61
  create ResetConfigButton text `Reset config`
@@ -84,20 +92,28 @@
84
92
  add ExitButton to LeftPanel
85
93
  on click ExitButton go to Exit
86
94
 
95
+ ! Now do the right-hand panel
96
+
87
97
  create RightPanel type QVBoxLayout
88
98
  add stretch RightPanel to MainPanel
89
99
 
90
100
  ! Create the system name group
91
- create Group title `System name`
101
+ create Group title `Systems`
92
102
  set the height of Group to 50
93
103
  add Group to RightPanel
94
104
  create Layout type QHBoxLayout
95
105
  add Layout to Group
96
- create Label text `(none)`
97
- add stretch Label to Layout
98
- create SelectSystemButton text `Select system`
99
- on click SelectSystemButton go to SelectSystem
100
- add SelectSystemButton to Layout
106
+ create SystemsCombo
107
+ add `System 1` to SystemsCombo
108
+ add `System 2` to SystemsCombo
109
+ add `System 3` to SystemsCombo
110
+ add stretch SystemsCombo to Layout
111
+ create AddSystemButton text `Add`
112
+ on click AddSystemButton go to AddSystem
113
+ add AddSystemButton to Layout
114
+ create RemoveSystemButton text `Remove`
115
+ on click RemoveSystemButton go to RemoveSystem
116
+ add RemoveSystemButton to Layout
101
117
 
102
118
  ! Create the host access group
103
119
  create Group title `Host`
@@ -209,7 +225,7 @@
209
225
  on click SaveWidgetDataButton go to SaveWidgetData
210
226
  add SaveWidgetDataButton to Layout
211
227
 
212
- create StatusLabel text `<font color="#00ff00">OK</font>`
228
+ create StatusLabel text `<font color="#008000">OK</font>`
213
229
  add StatusLabel to RightPanel
214
230
 
215
231
  add stretch to RightPanel
@@ -249,12 +265,25 @@ DeleteSlave:
249
265
  stop
250
266
 
251
267
  Exit:
252
- log `Exit the configuator`
268
+ log `Exit the configurator`
253
269
  close Window
254
270
  exit
255
271
 
256
- SelectSystem:
257
- log `Select the system`
272
+ AddSystem:
273
+ log `Add a system`
274
+ create Dialog title `Select system`
275
+ show Dialog
276
+ stop
277
+
278
+ RemoveSystem:
279
+ log `Remove this system?`
280
+ put SystemsCombo into Name
281
+ create MessageBox on Window
282
+ style question
283
+ title `Remove system`
284
+ message `Are you sure you want to remove ` cat Name cat `?`
285
+ show MessageBox giving Value
286
+ log Value
258
287
  stop
259
288
 
260
289
  SaveHostInfo:
@@ -9,4 +9,4 @@ from .ec_program import *
9
9
  from .ec_timestamp import *
10
10
  from .ec_value import *
11
11
 
12
- __version__ = "250422.2"
12
+ __version__ = "250423.1"
@@ -28,7 +28,9 @@ from PySide6.QtWidgets import (
28
28
  QGroupBox,
29
29
  QWidget,
30
30
  QSpacerItem,
31
- QSizePolicy
31
+ QSizePolicy,
32
+ QDialog,
33
+ QMessageBox
32
34
  )
33
35
 
34
36
  class Graphics(Handler):
@@ -42,7 +44,7 @@ class Graphics(Handler):
42
44
  Handler.__init__(self, compiler)
43
45
 
44
46
  def getName(self):
45
- return 'pyside6'
47
+ return 'graphics'
46
48
 
47
49
  def closeEvent(self):
48
50
  print('window closed')
@@ -50,54 +52,84 @@ class Graphics(Handler):
50
52
  #############################################################################
51
53
  # Keyword handlers
52
54
 
53
- # Add a widget to a layout
54
- # add [stretch] {widget} to {layout}
55
- # add stretch to {layout}
55
+ # (1) add {value} to {widget}
56
+ # (2) add {widget} to {layout}
57
+ # (3) add stretch {widget} to {layout}
58
+ # (4) add stretch to {layout}
56
59
  def k_add(self, command):
60
+ def addToLayout():
61
+ if self.nextIsSymbol():
62
+ record = self.getSymbolRecord()
63
+ command['layout'] = record['name']
64
+ self.add(command)
65
+ return True
66
+ return False
67
+
57
68
  command['stretch'] = False
58
69
  if self.nextIs('stretch'):
59
- if self.peek() == 'to':
70
+ # It's either (3) or (4)
71
+ self.nextToken()
72
+ if self.tokenIs('to'):
73
+ # (4)
60
74
  command['widget'] = 'stretch'
61
- elif self.nextIsSymbol():
75
+ return addToLayout()
76
+ # (3)
77
+ if self.isSymbol():
62
78
  record = self.getSymbolRecord()
63
79
  command['widget'] = record['name']
64
80
  command['stretch'] = True
65
- else: return False
81
+ if self.nextIs('to'):
82
+ return addToLayout()
83
+ return False
84
+
85
+ # Here it's either (1) or (2)
66
86
  elif self.isSymbol():
67
- record = self.getSymbolRecord()
68
- command['widget'] = record['name']
69
- else: return False
70
- if self.nextIs('to'):
71
- if self.nextIsSymbol():
87
+ if self.peek() == 'to':
88
+ # (2)
72
89
  record = self.getSymbolRecord()
73
- command['layout'] = record['name']
74
- self.add(command)
75
- return True
90
+ command['widget'] = record['name']
91
+ self.nextToken()
92
+ return addToLayout()
93
+ else:
94
+ # (1)
95
+ command['value'] = self.getValue()
96
+ if self.nextIs('to'):
97
+ if self.nextIsSymbol():
98
+ record = self.getSymbolRecord()
99
+ command['widget'] = record['name']
100
+ self.add(command)
101
+ return True
76
102
  return False
77
103
 
78
104
  def r_add(self, command):
79
- layoutRecord = self.getVariable(command['layout'])
80
- widget = command['widget']
81
- if widget == 'stretch':
82
- layoutRecord['widget'].addStretch()
105
+ if 'value' in command:
106
+ value = self.getRuntimeValue(command['value'])
107
+ widget = self.getVariable(command['widget'])
108
+ if widget['keyword'] == 'combobox':
109
+ widget['widget'].addItem(value)
83
110
  else:
84
- widgetRecord = self.getVariable(widget)
85
111
  layoutRecord = self.getVariable(command['layout'])
86
- widget = widgetRecord['widget']
87
- layout = layoutRecord['widget']
88
- stretch = command['stretch']
89
- if widgetRecord['keyword'] == 'layout':
90
- if layoutRecord['keyword'] == 'groupbox':
91
- if widgetRecord['keyword'] == 'layout':
92
- layout.setLayout(widget)
112
+ widget = command['widget']
113
+ if widget == 'stretch':
114
+ layoutRecord['widget'].addStretch()
115
+ else:
116
+ widgetRecord = self.getVariable(widget)
117
+ layoutRecord = self.getVariable(command['layout'])
118
+ widget = widgetRecord['widget']
119
+ layout = layoutRecord['widget']
120
+ stretch = command['stretch']
121
+ if widgetRecord['keyword'] == 'layout':
122
+ if layoutRecord['keyword'] == 'groupbox':
123
+ if widgetRecord['keyword'] == 'layout':
124
+ layout.setLayout(widget)
125
+ else:
126
+ RuntimeError(self.program, 'Can only add a layout to a groupbox')
93
127
  else:
94
- RuntimeError(self.program, 'Can only add a layout to a groupbox')
128
+ if stretch: layout.addLayout(widget, stretch=1)
129
+ else: layout.addLayout(widget)
95
130
  else:
96
- if stretch: layout.addLayout(widget, stretch=1)
97
- else: layout.addLayout(widget)
98
- else:
99
- if stretch: layout.addWidget(widget, stretch=1)
100
- else: layout.addWidget(widget)
131
+ if stretch: layout.addWidget(widget, stretch=1)
132
+ else: layout.addWidget(widget)
101
133
  return self.nextPC()
102
134
 
103
135
  # Declare a checkbox variable
@@ -121,25 +153,36 @@ class Graphics(Handler):
121
153
  self.getVariable(command['name'])['window'].close()
122
154
  return self.nextPC()
123
155
 
156
+ # Declare a combobox variable
157
+ def k_combobox(self, command):
158
+ return self.compileVariable(command, False)
159
+
160
+ def r_combobox(self, command):
161
+ return self.nextPC()
162
+
124
163
  # Create a window
125
164
  def k_createWindow(self, command):
126
165
  command['title'] = 'Default'
127
- command['x'] = self.compileConstant(100)
128
- command['y'] = self.compileConstant(100)
129
- command['w'] = self.compileConstant(640)
130
- command['h'] = self.compileConstant(480)
166
+ x = None
167
+ y = None
168
+ w = 640
169
+ h = 480
131
170
  while True:
132
171
  token = self.peek()
133
172
  if token in ['title', 'at', 'size']:
134
173
  self.nextToken()
135
174
  if token == 'title': command['title'] = self.nextValue()
136
175
  elif token == 'at':
137
- command['x'] = self.nextValue()
138
- command['y'] = self.nextValue()
176
+ x = self.nextValue()
177
+ y = self.nextValue()
139
178
  elif token == 'size':
140
179
  command['w'] = self.nextValue()
141
180
  command['h'] = self.nextValue()
142
181
  else: break
182
+ command['w'] = self.compileConstant(w)
183
+ command['h'] = self.compileConstant(h)
184
+ command['x'] = x
185
+ command['y'] = y
143
186
  self.add(command)
144
187
  return True
145
188
 
@@ -212,6 +255,44 @@ class Graphics(Handler):
212
255
  self.add(command)
213
256
  return True
214
257
 
258
+ def k_createComboBox(self, command):
259
+ self.add(command)
260
+ return True
261
+
262
+ def k_createDialog(self, command):
263
+ if self.peek() == 'title':
264
+ self.nextToken()
265
+ title = self.nextValue()
266
+ else: title = ''
267
+ command['title'] = title
268
+ self.add(command)
269
+ return True
270
+
271
+ def k_createMessageBox(self, command):
272
+ if self.nextIs('on'):
273
+ if self.nextIsSymbol():
274
+ command['window'] = self.getSymbolRecord()['name']
275
+ style = 'question'
276
+ title = ''
277
+ message = ''
278
+ while True:
279
+ if self.peek() == 'style':
280
+ self.nextToken()
281
+ style = self.nextToken()
282
+ elif self.peek() == 'title':
283
+ self.nextToken()
284
+ title = self.nextValue()
285
+ elif self.peek() == 'message':
286
+ self.nextToken()
287
+ message = self.nextValue()
288
+ else: break
289
+ command['style'] = style
290
+ command['title'] = title
291
+ command['message'] = message
292
+ self.add(command)
293
+ return True
294
+ return False
295
+
215
296
  def k_create(self, command):
216
297
  if self.nextIsSymbol():
217
298
  record = self.getSymbolRecord()
@@ -225,15 +306,22 @@ class Graphics(Handler):
225
306
  elif keyword == 'checkbox': return self.k_createCheckBox(command)
226
307
  elif keyword == 'lineinput': return self.k_createLineEdit(command)
227
308
  elif keyword == 'listbox': return self.k_createListWidget(command)
309
+ elif keyword == 'combobox': return self.k_createComboBox(command)
310
+ elif keyword == 'dialog': return self.k_createDialog(command)
311
+ elif keyword == 'messagebox': return self.k_createMessageBox(command)
228
312
  return False
229
313
 
230
314
  def r_createWindow(self, command, record):
231
315
  window = self.MainWindow()
232
316
  window.setWindowTitle(self.getRuntimeValue(command['title']))
233
- x = self.getRuntimeValue(command['x'])
234
- y = self.getRuntimeValue(command['y'])
235
317
  w = self.getRuntimeValue(command['w'])
236
318
  h = self.getRuntimeValue(command['h'])
319
+ x = command['x']
320
+ y = command['y']
321
+ if x == None: x = (self.screenWidth - w) / 2
322
+ else: x = self.getRuntimeValue(x)
323
+ if y == None: y = (self.screenHeight - h) / 2
324
+ else: y = self.getRuntimeValue(x)
237
325
  window.setGeometry(x, y, w, h)
238
326
  record['window'] = window
239
327
  return self.nextPC()
@@ -292,6 +380,26 @@ class Graphics(Handler):
292
380
  def r_createListWidget(self, command, record):
293
381
  record['widget'] = QListWidget()
294
382
  return self.nextPC()
383
+
384
+ def r_createComboBox(self, command, record):
385
+ record['widget'] = QComboBox()
386
+ return self.nextPC()
387
+
388
+ def r_createDialog(self, command, record):
389
+ dialog = QDialog()
390
+ dialog.setWindowTitle(self.getRuntimeValue(command['title']))
391
+ record['dialog'] = dialog
392
+ return self.nextPC()
393
+
394
+ # Creates a message box but doesn'r run it
395
+ def r_createMessageBox(self, command, record):
396
+ data = {}
397
+ data['window'] = command['window']
398
+ data['style'] = command['style']
399
+ data['title'] = self.getRuntimeValue(command['title'])
400
+ data['message'] = self.getRuntimeValue(command['message'])
401
+ record['data'] = data
402
+ return self.nextPC()
295
403
 
296
404
  def r_create(self, command):
297
405
  record = self.getVariable(command['name'])
@@ -304,8 +412,18 @@ class Graphics(Handler):
304
412
  elif keyword == 'checkbox': return self.r_createCheckBox(command, record)
305
413
  elif keyword == 'lineinput': return self.r_createLineEdit(command, record)
306
414
  elif keyword == 'listbox': return self.r_createListWidget(command, record)
415
+ elif keyword == 'combobox': return self.r_createComboBox(command, record)
416
+ elif keyword == 'dialog': return self.r_createDialog(command, record)
417
+ elif keyword == 'messagebox': return self.r_createMessageBox(command, record)
307
418
  return None
308
419
 
420
+ # Declare a dialog variable
421
+ def k_dialog(self, command):
422
+ return self.compileVariable(command, False)
423
+
424
+ def r_dialog(self, command):
425
+ return self.nextPC()
426
+
309
427
  # Create a group box
310
428
  def k_groupbox(self, command):
311
429
  return self.compileVariable(command, False)
@@ -322,6 +440,10 @@ class Graphics(Handler):
322
440
 
323
441
  def r_init(self, command):
324
442
  self.app = QApplication(sys.argv)
443
+ screen = QApplication.screens()[0].size().toTuple()
444
+ self.screenWidth = screen[0]
445
+ self.screenHeight = screen[1]
446
+ print(f'Screen: {self.screenWidth}x{self.screenHeight}')
325
447
  return self.nextPC()
326
448
 
327
449
  # Declare a label variable
@@ -352,6 +474,13 @@ class Graphics(Handler):
352
474
  def r_listbox(self, command):
353
475
  return self.nextPC()
354
476
 
477
+ # Declare a messagebox variable
478
+ def k_messagebox(self, command):
479
+ return self.compileVariable(command, False)
480
+
481
+ def r_messagebox(self, command):
482
+ return self.nextPC()
483
+
355
484
  # Handle events
356
485
  def k_on(self, command):
357
486
  if self.nextIs('click'):
@@ -434,12 +563,14 @@ class Graphics(Handler):
434
563
  groupbox.setFixedHeight(self.getRuntimeValue(command['value']))
435
564
  return self.nextPC()
436
565
 
437
- # Show a window with a specified layout
566
+ # Show something
438
567
  # show {name} in {window}}
568
+ # show {dialog}/{messagebox}
439
569
  def k_show(self, command):
440
570
  if self.nextIsSymbol():
441
571
  record = self.getSymbolRecord()
442
- if record['keyword'] == 'layout':
572
+ keyword = record['keyword']
573
+ if keyword == 'layout':
443
574
  command['layout'] = record['name']
444
575
  if self.nextIs('in'):
445
576
  if self.nextIsSymbol():
@@ -448,16 +579,54 @@ class Graphics(Handler):
448
579
  command['window'] = record['name']
449
580
  self.add(command)
450
581
  return True
582
+ elif keyword == 'dialog':
583
+ command['dialog'] = record['name']
584
+ self.add(command)
585
+ return True
586
+ elif keyword == 'messagebox':
587
+ command['messagebox'] = record['name']
588
+ if self.nextIs('giving'):
589
+ if self.nextIsSymbol():
590
+ command['result'] = self.getSymbolRecord()['name']
591
+ self.add(command)
592
+ return True
451
593
  return False
452
594
 
453
595
  def r_show(self, command):
454
- layoutRecord = self.getVariable(command['layout'])
455
- windowRecord = self.getVariable(command['window'])
456
- window = windowRecord['window']
457
- container = QWidget()
458
- container.setLayout(layoutRecord['widget'])
459
- window.setCentralWidget(container)
460
- window.show()
596
+ if 'dialog' in command:
597
+ dialog = self.getVariable(command['dialog'])['dialog']
598
+ b1 = QPushButton("ok",dialog)
599
+ b1.move(50,50)
600
+ dialog.setWindowModality(Qt.ApplicationModal)
601
+ dialog.exec_()
602
+ elif 'messagebox' in command:
603
+ data = self.getVariable(command['messagebox'])['data']
604
+ symbolRecord = self.getVariable(command['result'])
605
+ window = self.getVariable(data['window'])['window']
606
+ style = data['style']
607
+ title = data['title']
608
+ message = data['message']
609
+ if style == 'question':
610
+ button = QMessageBox.question(window, title, message)
611
+ if button == QMessageBox.Yes: result = 'Yes'
612
+ else: result = 'No'
613
+ elif style == 'warning':
614
+ button = QMessageBox.warning(window, title, message)
615
+ if button == QMessageBox.Ok: result = 'OK'
616
+ else: result = ''
617
+ else: result = 'Cancel'
618
+ v = {}
619
+ v['type'] = 'text'
620
+ v['content'] = result
621
+ self.putSymbolValue(symbolRecord, v)
622
+ else:
623
+ layoutRecord = self.getVariable(command['layout'])
624
+ windowRecord = self.getVariable(command['window'])
625
+ window = windowRecord['window']
626
+ container = QWidget()
627
+ container.setLayout(layoutRecord['widget'])
628
+ window.setCentralWidget(container)
629
+ window.show()
461
630
  return self.nextPC()
462
631
 
463
632
  # Start the graphics
@@ -486,7 +655,13 @@ class Graphics(Handler):
486
655
  # Compile a value in this domain
487
656
  def compileValue(self):
488
657
  value = {}
489
- value['domain'] = 'rbr'
658
+ value['domain'] = self.getName()
659
+ token = self.getToken()
660
+ if self.isSymbol():
661
+ value['name'] = token
662
+ value['type'] = 'symbol'
663
+ return value
664
+
490
665
  if self.tokenIs('the'):
491
666
  self.nextToken()
492
667
  token = self.getToken()
@@ -503,6 +678,33 @@ class Graphics(Handler):
503
678
  #############################################################################
504
679
  # Value handlers
505
680
 
681
+ # This is used by the expression evaluator to get the value of a symbol
682
+ def v_symbol(self, symbolRecord):
683
+ symbolRecord = self.getVariable(symbolRecord['name'])
684
+ keyword = symbolRecord['keyword']
685
+ if keyword == 'messagebox':
686
+ data = symbolRecord['data']
687
+ window = self.getVariable(data['window'])['window']
688
+ style = data['style']
689
+ title = data['title']
690
+ message = data['message']
691
+ if style == 'question':
692
+ button = QMessageBox.question(window, title, message)
693
+ elif style == 'warning':
694
+ button = QMessageBox.warning(window, title, message)
695
+ content = True if button == QMessageBox.Ok else False
696
+ v = {}
697
+ v['type'] = 'bool'
698
+ v['content'] = content
699
+ return v
700
+ elif keyword == 'combobox':
701
+ combobox = symbolRecord['widget']
702
+ v = {}
703
+ v['type'] = 'text'
704
+ v['content'] = combobox.currentText()
705
+ return v
706
+ return None
707
+
506
708
  def v_xxxxx(self, v):
507
709
  value = {}
508
710
  return value
@@ -12,7 +12,8 @@ classifiers = ["License :: OSI Approved :: MIT License"]
12
12
  keywords = ["compiler", "scripting", "prototyping", "programming", "coding", "python", "low code", "hypertalk", "computer language", "learn to code"]
13
13
  dynamic = ["version"]
14
14
  dependencies = [
15
- "pytz"
15
+ "pytz",
16
+ "pyside6"
16
17
  ]
17
18
 
18
19
  [project.scripts]
File without changes
File without changes
File without changes
File without changes
File without changes