easycoder 250508.1__tar.gz → 250517.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.

Potentially problematic release.


This version of easycoder might be problematic. Click here for more details.

Files changed (191) hide show
  1. {easycoder-250508.1 → easycoder-250517.1}/PKG-INFO +2 -1
  2. {easycoder-250508.1 → easycoder-250517.1}/easycoder/__init__.py +1 -1
  3. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_core.py +3 -3
  4. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_pyside.py +27 -3
  5. easycoder-250517.1/plugins/rbr_ui.py +82 -0
  6. {easycoder-250508.1 → easycoder-250517.1}/pyproject.toml +1 -0
  7. easycoder-250517.1/rbr_ui.code-workspace +3 -0
  8. easycoder-250517.1/rbrconf.code-workspace +3 -0
  9. {easycoder-250508.1 → easycoder-250517.1}/scripts/config.ecg +1 -1
  10. easycoder-250517.1/scripts/rbr_ui.ecs +24 -0
  11. easycoder-250508.1/test.py → easycoder-250517.1/scripts/rbr_ui.py +1 -1
  12. {easycoder-250508.1 → easycoder-250517.1/scripts}/rbrconf.ecs +38 -15
  13. easycoder-250517.1/test.py +3 -0
  14. easycoder-250517.1/testrc.py +3 -0
  15. easycoder-250517.1/ui.py +84 -0
  16. easycoder-250508.1/plugins/keyboards/4-function.json +0 -62
  17. easycoder-250508.1/plugins/keyboards/4-function.png +0 -0
  18. easycoder-250508.1/plugins/keyboards/qwerty-0.json +0 -179
  19. easycoder-250508.1/plugins/keyboards/qwerty-0.png +0 -0
  20. easycoder-250508.1/plugins/keyboards/qwerty-1.json +0 -179
  21. easycoder-250508.1/plugins/keyboards/qwerty-1.png +0 -0
  22. easycoder-250508.1/plugins/keyboards/qwerty-2.json +0 -179
  23. easycoder-250508.1/plugins/keyboards/qwerty-2.png +0 -0
  24. easycoder-250508.1/plugins/keyboards/qwerty-3.json +0 -180
  25. easycoder-250508.1/plugins/keyboards/qwerty-3.png +0 -0
  26. easycoder-250508.1/q1.py +0 -50
  27. easycoder-250508.1/q2.py +0 -70
  28. easycoder-250508.1/rbrconf.py +0 -3
  29. easycoder-250508.1/test.ecs +0 -63
  30. easycoder-250508.1/test.txt +0 -2
  31. {easycoder-250508.1 → easycoder-250517.1}/.gitignore +0 -0
  32. {easycoder-250508.1 → easycoder-250517.1}/LICENSE +0 -0
  33. {easycoder-250508.1 → easycoder-250517.1}/README.md +0 -0
  34. {easycoder-250508.1 → easycoder-250517.1}/doc/README.md +0 -0
  35. {easycoder-250508.1 → easycoder-250517.1}/doc/core/README.md +0 -0
  36. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/boolean.md +0 -0
  37. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/empty.md +0 -0
  38. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/ends.md +0 -0
  39. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/even.md +0 -0
  40. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/exists.md +0 -0
  41. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/greater.md +0 -0
  42. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/hasProperty.md +0 -0
  43. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/includes.md +0 -0
  44. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/is.md +0 -0
  45. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/less.md +0 -0
  46. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/list.md +0 -0
  47. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/none.md +0 -0
  48. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/not.md +0 -0
  49. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/numeric.md +0 -0
  50. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/object.md +0 -0
  51. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/odd.md +0 -0
  52. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/starts.md +0 -0
  53. {easycoder-250508.1 → easycoder-250517.1}/doc/core/conditions/string.md +0 -0
  54. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/add.md +0 -0
  55. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/append.md +0 -0
  56. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/assert.md +0 -0
  57. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/begin.md +0 -0
  58. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/clear.md +0 -0
  59. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/close.md +0 -0
  60. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/create.md +0 -0
  61. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/debug.md +0 -0
  62. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/decrement.md +0 -0
  63. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/delete.md +0 -0
  64. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/divide.md +0 -0
  65. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/exit.md +0 -0
  66. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/file.md +0 -0
  67. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/fork.md +0 -0
  68. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/get.md +0 -0
  69. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/go.md +0 -0
  70. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/gosub.md +0 -0
  71. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/if.md +0 -0
  72. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/import.md +0 -0
  73. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/increment.md +0 -0
  74. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/index.md +0 -0
  75. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/init.md +0 -0
  76. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/input.md +0 -0
  77. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/load.md +0 -0
  78. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/lock.md +0 -0
  79. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/log.md +0 -0
  80. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/module.md +0 -0
  81. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/multiply.md +0 -0
  82. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/negate.md +0 -0
  83. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/open.md +0 -0
  84. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/pop.md +0 -0
  85. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/post.md +0 -0
  86. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/print.md +0 -0
  87. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/push.md +0 -0
  88. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/put.md +0 -0
  89. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/read.md +0 -0
  90. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/release.md +0 -0
  91. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/replace.md +0 -0
  92. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/return.md +0 -0
  93. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/run.md +0 -0
  94. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/save.md +0 -0
  95. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/script.md +0 -0
  96. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/set.md +0 -0
  97. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/split.md +0 -0
  98. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/stack.md +0 -0
  99. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/stop.md +0 -0
  100. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/system.md +0 -0
  101. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/take.md +0 -0
  102. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/toggle.md +0 -0
  103. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/truncate.md +0 -0
  104. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/unlock.md +0 -0
  105. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/variable.md +0 -0
  106. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/wait.md +0 -0
  107. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/while.md +0 -0
  108. {easycoder-250508.1 → easycoder-250517.1}/doc/core/keywords/write.md +0 -0
  109. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/arg.md +0 -0
  110. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/args.md +0 -0
  111. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/cos.md +0 -0
  112. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/datime.md +0 -0
  113. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/decode.md +0 -0
  114. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/element.md +0 -0
  115. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/elements.md +0 -0
  116. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/empty.md +0 -0
  117. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/encode.md +0 -0
  118. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/error.md +0 -0
  119. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/files.md +0 -0
  120. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/float.md +0 -0
  121. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/from.md +0 -0
  122. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/hash.md +0 -0
  123. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/index.md +0 -0
  124. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/integer.md +0 -0
  125. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/json.md +0 -0
  126. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/keys.md +0 -0
  127. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/left.md +0 -0
  128. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/length.md +0 -0
  129. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/lowercase.md +0 -0
  130. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/memory.md +0 -0
  131. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/modification.md +0 -0
  132. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/modulo.md +0 -0
  133. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/newline.md +0 -0
  134. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/now.md +0 -0
  135. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/position.md +0 -0
  136. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/property.md +0 -0
  137. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/random.md +0 -0
  138. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/right.md +0 -0
  139. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/sin.md +0 -0
  140. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/stringify.md +0 -0
  141. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/tab.md +0 -0
  142. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/tan.md +0 -0
  143. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/timestamp.md +0 -0
  144. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/today.md +0 -0
  145. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/trim.md +0 -0
  146. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/type.md +0 -0
  147. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/uppercase.md +0 -0
  148. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/value.md +0 -0
  149. {easycoder-250508.1 → easycoder-250517.1}/doc/core/values/weekday.md +0 -0
  150. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/README.md +0 -0
  151. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/attach.md +0 -0
  152. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/close.md +0 -0
  153. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/create.md +0 -0
  154. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/ellipse.md +0 -0
  155. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/image.md +0 -0
  156. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/move.md +0 -0
  157. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/on.md +0 -0
  158. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/rectangle.md +0 -0
  159. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/render.md +0 -0
  160. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/run.md +0 -0
  161. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/set.md +0 -0
  162. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/keywords/text.md +0 -0
  163. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/values/attribute.md +0 -0
  164. {easycoder-250508.1 → easycoder-250517.1}/doc/graphics/values/window.md +0 -0
  165. {easycoder-250508.1 → easycoder-250517.1}/easycoder/README.md +0 -0
  166. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_classes.py +0 -0
  167. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_compiler.py +0 -0
  168. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_condition.py +0 -0
  169. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_graphics.py +0 -0
  170. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_gutils.py +0 -0
  171. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_handler.py +0 -0
  172. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_program.py +0 -0
  173. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_timestamp.py +0 -0
  174. {easycoder-250508.1 → easycoder-250517.1}/easycoder/ec_value.py +0 -0
  175. {easycoder-250508.1 → easycoder-250517.1}/images/Semoigo Dawn.jpg +0 -0
  176. {easycoder-250508.1 → easycoder-250517.1}/json/graphics-demo.json +0 -0
  177. {easycoder-250508.1 → easycoder-250517.1}/plugins/ec_keyboard.py +0 -0
  178. {easycoder-250508.1 → easycoder-250517.1}/plugins/ec_p100.py +0 -0
  179. {easycoder-250508.1 → easycoder-250517.1}/plugins/ec_pyside6.py +0 -0
  180. {easycoder-250508.1 → easycoder-250517.1}/plugins/points.py +0 -0
  181. {easycoder-250508.1 → easycoder-250517.1}/scripts/README.md +0 -0
  182. {easycoder-250508.1 → easycoder-250517.1}/scripts/benchmark.ecs +0 -0
  183. {easycoder-250508.1 → easycoder-250517.1}/scripts/connect.ecg +0 -0
  184. {easycoder-250508.1 → easycoder-250517.1}/scripts/ec_keyboard.py +0 -0
  185. {easycoder-250508.1 → easycoder-250517.1}/scripts/findxr.ecs +0 -0
  186. {easycoder-250508.1 → easycoder-250517.1}/scripts/fizzbuzz.ecs +0 -0
  187. {easycoder-250508.1 → easycoder-250517.1}/scripts/hello.ecs +0 -0
  188. {easycoder-250508.1 → easycoder-250517.1}/scripts/points.ecs +0 -0
  189. {easycoder-250508.1 → easycoder-250517.1}/scripts/test.ecs +0 -0
  190. {easycoder-250508.1 → easycoder-250517.1}/scripts/testg.ecg +0 -0
  191. {easycoder-250508.1 → easycoder-250517.1}/scripts/tests.ecs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easycoder
3
- Version: 250508.1
3
+ Version: 250517.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>
@@ -8,6 +8,7 @@ Description-Content-Type: text/markdown
8
8
  Classifier: License :: OSI Approved :: MIT License
9
9
  License-File: LICENSE
10
10
  Requires-Dist: pytz
11
+ Requires-Dist: requests
11
12
  Requires-Dist: pyside6
12
13
  Project-URL: Home, https://github.com/easycoder/easycoder-py
13
14
 
@@ -9,4 +9,4 @@ from .ec_program import *
9
9
  from .ec_timestamp import *
10
10
  from .ec_value import *
11
11
 
12
- __version__ = "250508.1"
12
+ __version__ = "250517.1"
@@ -1,6 +1,6 @@
1
- import json, math, hashlib, threading, os, subprocess, sys, requests, time, numbers, base64, binascii, random
1
+ import json, math, hashlib, threading, os, subprocess, sys, time, numbers, base64, binascii, random, requests
2
2
  from psutil import Process
3
- from datetime import datetime, timezone
3
+ from datetime import datetime
4
4
  from random import randrange
5
5
  from .ec_classes import FatalError, RuntimeWarning, RuntimeError, AssertionError, NoValueError, NoValueRuntimeError, Condition, Object
6
6
  from .ec_handler import Handler
@@ -381,7 +381,7 @@ class Core(Handler):
381
381
 
382
382
  def r_exit(self, command):
383
383
  if self.program.graphics != None:
384
- self.program.graphics.force_exit()
384
+ self.program.graphics.force_exit(None)
385
385
  return -1
386
386
 
387
387
  # Declare a file variable
@@ -386,9 +386,13 @@ class Graphics(Handler):
386
386
  if y == None: y = (self.screenHeight - h) / 2
387
387
  else: y = self.getRuntimeValue(x)
388
388
  window.setGeometry(x, y, w, h)
389
- container = QWidget()
390
- container.setLayout(self.getVariable(command['layout'])['widget'])
391
- window.setCentralWidget(container)
389
+ # content = self.getVariable(command['layout'])['widget']
390
+ # if isinstance(content, QWidget):
391
+ # container = content
392
+ # else:
393
+ # container = QWidget()
394
+ # container.setLayout(content)
395
+ # window.setCentralWidget(container)
392
396
  record['window'] = window
393
397
  return self.nextPC()
394
398
 
@@ -712,6 +716,7 @@ class Graphics(Handler):
712
716
  return self.nextPC()
713
717
 
714
718
  # set [the] width/height [of] {widget} [to] {value}
719
+ # set [the] layout of {window} to {layout}
715
720
  # set [the] text [of] {label}/{button}/{lineinput} [to] {text}
716
721
  # set [the] color [of] {label}/{button}/{lineinput} [to] {color}
717
722
  # set [the] state [of] {checkbox} [to] {color}
@@ -730,6 +735,18 @@ class Graphics(Handler):
730
735
  command['value'] = self.nextValue()
731
736
  self.add(command)
732
737
  return True
738
+ elif token == 'layout':
739
+ self.skip('of')
740
+ if self.nextIsSymbol():
741
+ record = self.getSymbolRecord()
742
+ if record['keyword'] == 'window':
743
+ command['name'] = record['name']
744
+ self.skip('to')
745
+ if self.nextIsSymbol():
746
+ record = self.getSymbolRecord()
747
+ command['layout'] = record['name']
748
+ self.add(command)
749
+ return True
733
750
  elif token == 'text':
734
751
  self.skip('of')
735
752
  if self.nextIsSymbol():
@@ -790,6 +807,13 @@ class Graphics(Handler):
790
807
  elif what == 'width':
791
808
  widget = self.getVariable(command['name'])['widget']
792
809
  widget.setFixedWidth(self.getRuntimeValue(command['value']))
810
+ elif what == 'layout':
811
+ window = self.getVariable(command['name'])['window']
812
+ layout = self.getVariable(command['layout'])
813
+ content = self.getVariable(command['layout'])['widget']
814
+ container = QWidget()
815
+ container.setLayout(content)
816
+ window.setCentralWidget(container)
793
817
  elif what == 'text':
794
818
  record = self.getVariable(command['name'])
795
819
  widget = self.getVariable(command['name'])['widget']
@@ -0,0 +1,82 @@
1
+ from easycoder import Handler, FatalError, RuntimeError
2
+ from PySide6.QtWidgets import (
3
+ QApplication, QMainWindow, QVBoxLayout, QLabel, QPushButton, QWidget, QHBoxLayout, QSpacerItem, QSizePolicy
4
+ )
5
+ from PySide6.QtGui import QPixmap, QFont, QPalette, QBrush
6
+ from PySide6.QtCore import Qt
7
+
8
+ # This is the package that handles the RBR user interface.
9
+
10
+ class RBR_UI(Handler):
11
+
12
+ def __init__(self, compiler):
13
+ Handler.__init__(self, compiler)
14
+
15
+ def getName(self):
16
+ return 'points'
17
+
18
+ #############################################################################
19
+ # Keyword handlers
20
+
21
+ def k_rbr_ui(self, command):
22
+ return self.compileVariable(command, False)
23
+
24
+ def r_rbr_ui(self, command):
25
+ return self.nextPC()
26
+
27
+ # create the main UI
28
+ def k_create(self, command):
29
+ if self.nextIsSymbol():
30
+ record = self.getSymbolRecord()
31
+ if record['keyword'] == 'rbr_ui':
32
+ command['name'] = record['name']
33
+ self.skip('in')
34
+ if self.nextIsSymbol():
35
+ record = self.getSymbolRecord()
36
+ if record['keyword'] == 'window':
37
+ command['window'] = record['name']
38
+ self.addCommand(command)
39
+ return True
40
+ return False
41
+
42
+ def r_create(self, command):
43
+ record = self.getVariable(command['name'])
44
+ window = self.getVariable(command['window'])['window']
45
+ # Set the background image
46
+ palette = QPalette()
47
+ background_pixmap = QPixmap("/home/graham/dev/rbr/ui/main/backdrop.jpg")
48
+ palette.setBrush(QPalette.Window, QBrush(background_pixmap))
49
+ window.setPalette(palette)
50
+
51
+ # Main layout
52
+ main_widget = QWidget()
53
+ main_layout = QVBoxLayout(main_widget)
54
+ main_layout.setSpacing(10) # Set spacing between rows to 10
55
+
56
+ record['layout'] = main_widget
57
+ return self.nextPC()
58
+
59
+ #############################################################################
60
+ # Compile a value in this domain
61
+ def compileValue(self):
62
+ return None
63
+
64
+ #############################################################################
65
+ # Modify a value or leave it unchanged.
66
+ def modifyValue(self, value):
67
+ return value
68
+
69
+ #############################################################################
70
+ # Value handlers
71
+
72
+ def v_none(self, v):
73
+ return None
74
+
75
+ #############################################################################
76
+ # Compile a condition
77
+ def compileCondition(self):
78
+ condition = {}
79
+ return condition
80
+
81
+ #############################################################################
82
+ # Condition handlers
@@ -13,6 +13,7 @@ keywords = ["compiler", "scripting", "prototyping", "programming", "coding", "py
13
13
  dynamic = ["version"]
14
14
  dependencies = [
15
15
  "pytz",
16
+ "requests",
16
17
  "pyside6"
17
18
  ]
18
19
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "folders": []
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "folders": []
3
+ }
@@ -98,7 +98,7 @@
98
98
  add Row to Layout
99
99
 
100
100
  create Window `RBR XR Config`
101
- layout Layout
101
+ set the layout of Window to Layout
102
102
 
103
103
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
104
104
  ! Event handlers for the main window
@@ -0,0 +1,24 @@
1
+
2
+ ! rbr-ui.ecs
3
+
4
+ script RBR_UI
5
+
6
+ use graphics
7
+
8
+ import plugin RBR_UI from plugins/rbr_ui.py
9
+
10
+ window Window
11
+ rbr_ui MainPanel
12
+
13
+ debug step
14
+
15
+ init graphics
16
+
17
+ create Window title `Room By Room` size 600 1024
18
+
19
+ create MainPanel in Window
20
+ ! set the layout of Window to MainPanel
21
+ show Window
22
+
23
+ start graphics
24
+ stop
@@ -1,3 +1,3 @@
1
1
  from easycoder import Program
2
2
 
3
- Program('test.ecs').start()
3
+ Program('rbr-ui.ecs').start()
@@ -160,8 +160,6 @@
160
160
  add Label to Layout
161
161
  create UptimeLabel text `0`
162
162
  add UptimeLabel to Layout
163
- create Label text `sec`
164
- add Label to Layout
165
163
  add stretch to Layout
166
164
 
167
165
  create Layout type QHBoxLayout
@@ -220,7 +218,8 @@
220
218
  gosub to OK
221
219
  add StatusLabel to RightPanel
222
220
 
223
- create Window title `RBR-Now configurator` size 700 500 layout MainPanel
221
+ create Window title `RBR-Now configurator` size 700 500
222
+ set the layout of Window to MainPanel
224
223
  show Window
225
224
 
226
225
  start graphics
@@ -631,9 +630,9 @@ GetFirmware:
631
630
  ScanForDevicesClick:
632
631
  gosub to SetBusy
633
632
  put `Scanning for new devices...` into StatusMessage
634
- log StatusMessage
635
633
  gosub to Working
636
634
  put system `nmcli device wifi list` into SystemCallResult
635
+ log SystemCallResult
637
636
  split SystemCallResult
638
637
  put json `[]` into List
639
638
  put 1 into N
@@ -674,7 +673,7 @@ ScanForDevicesClick:
674
673
  SFDC2:
675
674
  increment N
676
675
  end
677
- ! log `SSIDs: ` cat List
676
+ log `SSIDs: ` cat List
678
677
  if the count of List is 0
679
678
  begin
680
679
  put `No new devices were found` into StatusMessage
@@ -736,7 +735,8 @@ SelectSSIDFromList:
736
735
  end
737
736
  add CancelButton to HLayout
738
737
  add HLayout to Layout
739
- create Dialog title Title layout Layout size 250 200
738
+ create Dialog title Title size 250 200
739
+ set the layout of Dialog to Layout
740
740
  center Dialog on Window
741
741
  show Dialog
742
742
  stop
@@ -896,7 +896,8 @@ PopulateSystemInfo:
896
896
  create MessageBox on Window
897
897
  style question
898
898
  title `Move system`
899
- message `Shall I move the system to the current host (` cat HostSSID cat `)?`
899
+ message `Shall I move system ` cat SystemName cat ` to the current host (` cat HostSSID cat `)?` cat newline
900
+ cat `(If 'No' I will attempt to connect to ` cat SystemHostSSID cat `)`
900
901
  show MessageBox giving Value
901
902
  if Value is `Yes`
902
903
  begin
@@ -909,6 +910,7 @@ PopulateSystemInfo:
909
910
  begin
910
911
  put SystemHostSSID into HostSSID
911
912
  put Password into HostPassword
913
+ system `nmcli connection delete ` cat HostSSID
912
914
  put system `nmcli dev wifi connect ` cat HostSSID cat ` password ` cat HostPassword into SystemCallResult
913
915
  split SystemCallResult on ` `
914
916
  if the elements of SystemCallResult is greater than 2
@@ -1103,7 +1105,8 @@ GetRequestedText:
1103
1105
  return
1104
1106
  end
1105
1107
  add CancelButton to HLayout
1106
- create Dialog title Title layout VLayout size 300 80
1108
+ create Dialog title Title size 300 80
1109
+ set the layout of Dialog to VLayout
1107
1110
  center Dialog on Window
1108
1111
  show Dialog
1109
1112
  stop
@@ -1148,6 +1151,7 @@ GetAccessPoints:
1148
1151
  ConnectToHost:
1149
1152
  put `Connect to host ` cat HostSSID cat ` with password ` cat HostPassword into StatusMessage
1150
1153
  gosub to Working
1154
+ system `nmcli connection delete ` cat HostSSID
1151
1155
  put system `nmcli dev wifi connect ` cat HostSSID cat ` password ` cat HostPassword into SystemCallResult
1152
1156
  split SystemCallResult on ` `
1153
1157
  if the elements of SystemCallResult is greater than 2
@@ -1184,6 +1188,7 @@ FailedToConnect:
1184
1188
  ConnectToDevice:
1185
1189
  put `Connect to device ` cat SSID cat ` with password 00000000` into StatusMessage
1186
1190
  gosub to Working
1191
+ system `nmcli connection delete ` cat SSID
1187
1192
  put system `nmcli dev wifi connect ` cat SSID cat ` password 00000000` into SystemCallResult
1188
1193
  put SystemCallResult into Value
1189
1194
  split Value on ` `
@@ -1310,7 +1315,8 @@ SendFileToDevice:
1310
1315
  put the length of Segment into Length
1311
1316
  add Length to Total
1312
1317
  put encode Segment into Segment
1313
- put `Send ` cat FileName cat `, part ` cat Sequence cat ` (attempt ` cat Attempt cat `)` into StatusMessage
1318
+ put `Send ` cat FileName cat `, part ` cat Sequence into StatusMessage
1319
+ if Attempt is not 1 put StatusMessage cat ` (attempt ` cat Attempt cat `)` into StatusMessage
1314
1320
  gosub to Working
1315
1321
  put `part:` cat Sequence cat `,text:` cat Segment into Message
1316
1322
  gosub to SendMessageToDevice
@@ -1407,8 +1413,13 @@ CheckDevice:
1407
1413
 
1408
1414
  CheckDevice2:
1409
1415
  put the position of ` ` in Uptime into P
1410
- if P is greater than 0 put left P of Uptime into Uptime
1411
- log Name cat ` uptime: ` cat Uptime
1416
+ if P is greater than 0
1417
+ begin
1418
+ put left P of Uptime into Uptime
1419
+ put Uptime cat ` sec` into Uptime
1420
+ end
1421
+ else put `Unknown` into Uptime
1422
+ ! log Name cat ` uptime: ` cat Uptime
1412
1423
  set the text of UptimeLabel to Uptime
1413
1424
  go to OK
1414
1425
 
@@ -1427,6 +1438,7 @@ RelayOffClick:
1427
1438
  end
1428
1439
  begin
1429
1440
  put from 3 of Response into Uptime
1441
+ put Uptime cat ` sec` into Uptime
1430
1442
  set the text of RelayStateLabel to `OFF`
1431
1443
  end
1432
1444
  gosub to CheckDevice2
@@ -1448,6 +1460,7 @@ RelayOnClick:
1448
1460
  else
1449
1461
  begin
1450
1462
  put from 3 of Response into Uptime
1463
+ put Uptime cat ` sec` into Uptime
1451
1464
  set the text of RelayStateLabel to `ON`
1452
1465
  end
1453
1466
  gosub to CheckDevice2
@@ -1496,6 +1509,7 @@ SendMessageToDevice:
1496
1509
  put Path into MAC
1497
1510
  end
1498
1511
  end
1512
+ put empty into Response
1499
1513
  put `http://` cat MasterIPAddr cat `/?mac=` cat MAC cat `&msg=` cat Message2 into URL
1500
1514
  ! log URL
1501
1515
  get Response from url URL
@@ -1508,7 +1522,6 @@ SendMessageToDevice:
1508
1522
  set property `path` of Device to empty
1509
1523
  go to SendMessageToDevice
1510
1524
  end
1511
- put empty into Response
1512
1525
  return
1513
1526
  end
1514
1527
  ! log URL cat ` - ` cat Response
@@ -1559,13 +1572,23 @@ UpdateConfig:
1559
1572
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1560
1573
  ! Pause the system controller
1561
1574
  PauseSystemController:
1562
- if SystemIPAddr is not empty get Response from url `http://` cat SystemIPAddr cat `:17348/cgi-bin/pause.py`
1575
+ if SystemIPAddr is not empty
1576
+ get Response from url `http://` cat SystemIPAddr cat `:17348/cgi-bin/pause.py`
1577
+ or begin
1578
+ put `Unable to contact server at ` cat IPAddr into StatusMessage
1579
+ goto Working
1580
+ end
1563
1581
  return
1564
1582
 
1565
1583
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1566
- ! PaResumeuse the system controller
1584
+ ! Resume the system controller
1567
1585
  ResumeSystemController:
1568
- if SystemIPAddr is not empty get Response from url `http://` cat SystemIPAddr cat `:17348/cgi-bin/resume.py`
1586
+ if SystemIPAddr is not empty
1587
+ get Response from url `http://` cat SystemIPAddr cat `:17348/cgi-bin/resume.py`
1588
+ or begin
1589
+ put `Unable to contact server at ` cat IPAddr into StatusMessage
1590
+ goto Working
1591
+ end
1569
1592
  return
1570
1593
 
1571
1594
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -0,0 +1,3 @@
1
+ from easycoder import Program
2
+
3
+ Program('scripts/rbr_ui.ecs').start()
@@ -0,0 +1,3 @@
1
+ from easycoder import Program
2
+
3
+ Program('scripts/rbrconf.ecs').start()
@@ -0,0 +1,84 @@
1
+ from PySide6.QtWidgets import (
2
+ QApplication, QMainWindow, QVBoxLayout, QLabel, QPushButton, QWidget, QHBoxLayout, QSpacerItem, QSizePolicy
3
+ )
4
+ from PySide6.QtGui import QPixmap, QFont, QPalette, QBrush
5
+ from PySide6.QtCore import Qt
6
+ import sys
7
+
8
+ class MainWindow(QMainWindow):
9
+ def __init__(self):
10
+ super().__init__()
11
+ self.setWindowTitle("Custom UI")
12
+ self.setFixedSize(600, 1024) # Set the window size to 600x1024
13
+
14
+ # Set the background image
15
+ palette = QPalette()
16
+ background_pixmap = QPixmap("/home/graham/dev/rbr/ui/main/backdrop.jpg")
17
+ palette.setBrush(QPalette.Window, QBrush(background_pixmap))
18
+ self.setPalette(palette)
19
+
20
+ # Main layout
21
+ main_widget = QWidget()
22
+ main_layout = QVBoxLayout(main_widget)
23
+ main_layout.setSpacing(10) # Set spacing between rows to 10
24
+
25
+ # Create 5 rows
26
+ for _ in range(5):
27
+ row = self.create_row()
28
+ main_layout.addWidget(row)
29
+
30
+ # Add a stretch below the last row
31
+ main_layout.addSpacerItem(QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding))
32
+
33
+ self.setCentralWidget(main_widget)
34
+
35
+ def create_row(self):
36
+ """Create a single row with the specified elements."""
37
+ row_widget = QWidget()
38
+ row_widget.setFixedHeight(1024 // 12) # Each row is 1/12 the height of the window
39
+ row_widget.setStyleSheet("background-color: #ffffcc; border: 2px solid gray;") # Set background and border
40
+
41
+ row_layout = QHBoxLayout(row_widget)
42
+ row_layout.setContentsMargins(10, 0, 10, 0) # Add margins for spacing
43
+ row_layout.setSpacing(10) # Add spacing between elements
44
+
45
+ # Icon 1: Clock
46
+ clock_icon = QLabel()
47
+ clock_pixmap = QPixmap("/home/graham/dev/rbr/ui/main/clock.png").scaled(1024 // 12 * 3 // 4, 1024 // 12 * 3 // 4, Qt.KeepAspectRatio, Qt.SmoothTransformation)
48
+ clock_icon.setPixmap(clock_pixmap)
49
+ clock_icon.setStyleSheet("border-left: none; border-right: none;")
50
+
51
+ # Name label
52
+ name_label = QLabel("Room Name")
53
+ name_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
54
+ name_label.setStyleSheet("background-color: transparent; border: none;") # Transparent background
55
+ font = QFont()
56
+ font.setPointSize(16) # Adjust font size to fit at least 20 characters
57
+ font.setBold(True) # Make the font bold
58
+ name_label.setFont(font)
59
+
60
+ # Button with white text and blue background
61
+ button = QPushButton("20.0°C")
62
+ button.setStyleSheet("color: white; background-color: blue; border: none;")
63
+ button.setFixedSize(80, 40) # Adjust button size
64
+ button.setFont(font) # Use the same font as the label
65
+
66
+ # Icon 2: Edit
67
+ edit_icon = QLabel()
68
+ edit_pixmap = QPixmap("/home/graham/dev/rbr/ui/main/edit.png").scaled(1024 // 12 * 3 // 4, 1024 // 12 * 3 // 4, Qt.KeepAspectRatio, Qt.SmoothTransformation)
69
+ edit_icon.setPixmap(edit_pixmap)
70
+ edit_icon.setStyleSheet("border-left: none; border-right: none;")
71
+
72
+ # Add elements to the row layout
73
+ row_layout.addWidget(clock_icon)
74
+ row_layout.addWidget(name_label, 1) # Expand the name label to use all spare space
75
+ row_layout.addWidget(button)
76
+ row_layout.addWidget(edit_icon)
77
+
78
+ return row_widget
79
+
80
+ if __name__ == "__main__":
81
+ app = QApplication(sys.argv)
82
+ window = MainWindow()
83
+ window.show()
84
+ sys.exit(app.exec())
@@ -1,62 +0,0 @@
1
- {
2
- "face": "plugins/keyboards/4-function.png",
3
- "rows":
4
- [
5
- [
6
- {
7
- "id": "1"
8
- },
9
- {
10
- "id": "2"
11
- },
12
- {
13
- "id": "3"
14
- },
15
- {
16
- "id": "+"
17
- }
18
- ],
19
- [
20
- {
21
- "id": "4"
22
- },
23
- {
24
- "id": "5"
25
- },
26
- {
27
- "id": "6"
28
- },
29
- {
30
- "id": "-"
31
- }
32
- ],
33
- [
34
- {
35
- "id": "7"
36
- },
37
- {
38
- "id": "8"
39
- },
40
- {
41
- "id": "9"
42
- },
43
- {
44
- "id": "*"
45
- }
46
- ],
47
- [
48
- {
49
- "id": "0"
50
- },
51
- {
52
- "id": "C"
53
- },
54
- {
55
- "id": "="
56
- },
57
- {
58
- "id": "/"
59
- }
60
- ]
61
- ]
62
- }