easycoder 250116.3__tar.gz → 250118.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 (173) hide show
  1. {easycoder-250116.3 → easycoder-250118.1}/PKG-INFO +1 -1
  2. {easycoder-250116.3 → easycoder-250118.1}/easycoder/__init__.py +1 -1
  3. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_core.py +23 -8
  4. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_graphics.py +84 -44
  5. easycoder-250118.1/easycoder/ec_gutils.py +84 -0
  6. easycoder-250118.1/scripts/config.ecg +190 -0
  7. {easycoder-250116.3 → easycoder-250118.1}/scripts/points.ecs +1 -1
  8. {easycoder-250116.3 → easycoder-250118.1}/scripts/testg.ecg +7 -7
  9. easycoder-250118.1/test.ecs +3 -0
  10. easycoder-250116.3/easycoder/ec_gutils.py +0 -52
  11. {easycoder-250116.3 → easycoder-250118.1}/LICENSE +0 -0
  12. {easycoder-250116.3 → easycoder-250118.1}/README.md +0 -0
  13. {easycoder-250116.3 → easycoder-250118.1}/doc/README.md +0 -0
  14. {easycoder-250116.3 → easycoder-250118.1}/doc/core/README.md +0 -0
  15. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/boolean.md +0 -0
  16. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/empty.md +0 -0
  17. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/ends.md +0 -0
  18. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/even.md +0 -0
  19. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/exists.md +0 -0
  20. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/greater.md +0 -0
  21. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/hasProperty.md +0 -0
  22. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/includes.md +0 -0
  23. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/is.md +0 -0
  24. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/less.md +0 -0
  25. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/list.md +0 -0
  26. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/none.md +0 -0
  27. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/not.md +0 -0
  28. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/numeric.md +0 -0
  29. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/object.md +0 -0
  30. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/odd.md +0 -0
  31. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/starts.md +0 -0
  32. {easycoder-250116.3 → easycoder-250118.1}/doc/core/conditions/string.md +0 -0
  33. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/add.md +0 -0
  34. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/append.md +0 -0
  35. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/assert.md +0 -0
  36. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/begin.md +0 -0
  37. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/clear.md +0 -0
  38. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/close.md +0 -0
  39. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/create.md +0 -0
  40. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/debug.md +0 -0
  41. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/decrement.md +0 -0
  42. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/delete.md +0 -0
  43. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/divide.md +0 -0
  44. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/exit.md +0 -0
  45. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/file.md +0 -0
  46. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/fork.md +0 -0
  47. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/get.md +0 -0
  48. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/go.md +0 -0
  49. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/gosub.md +0 -0
  50. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/if.md +0 -0
  51. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/import.md +0 -0
  52. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/increment.md +0 -0
  53. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/index.md +0 -0
  54. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/init.md +0 -0
  55. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/input.md +0 -0
  56. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/load.md +0 -0
  57. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/lock.md +0 -0
  58. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/module.md +0 -0
  59. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/multiply.md +0 -0
  60. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/negate.md +0 -0
  61. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/open.md +0 -0
  62. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/pop.md +0 -0
  63. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/post.md +0 -0
  64. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/print.md +0 -0
  65. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/push.md +0 -0
  66. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/put.md +0 -0
  67. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/read.md +0 -0
  68. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/release.md +0 -0
  69. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/replace.md +0 -0
  70. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/return.md +0 -0
  71. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/run.md +0 -0
  72. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/save.md +0 -0
  73. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/script.md +0 -0
  74. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/set.md +0 -0
  75. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/split.md +0 -0
  76. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/stack.md +0 -0
  77. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/stop.md +0 -0
  78. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/system.md +0 -0
  79. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/take.md +0 -0
  80. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/toggle.md +0 -0
  81. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/truncate.md +0 -0
  82. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/unlock.md +0 -0
  83. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/variable.md +0 -0
  84. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/wait.md +0 -0
  85. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/while.md +0 -0
  86. {easycoder-250116.3 → easycoder-250118.1}/doc/core/keywords/write.md +0 -0
  87. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/arg.md +0 -0
  88. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/args.md +0 -0
  89. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/cos.md +0 -0
  90. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/datime.md +0 -0
  91. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/decode.md +0 -0
  92. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/element.md +0 -0
  93. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/elements.md +0 -0
  94. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/empty.md +0 -0
  95. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/encode.md +0 -0
  96. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/error.md +0 -0
  97. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/files.md +0 -0
  98. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/float.md +0 -0
  99. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/from.md +0 -0
  100. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/hash.md +0 -0
  101. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/index.md +0 -0
  102. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/integer.md +0 -0
  103. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/json.md +0 -0
  104. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/keys.md +0 -0
  105. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/left.md +0 -0
  106. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/length.md +0 -0
  107. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/lowercase.md +0 -0
  108. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/memory.md +0 -0
  109. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/modification.md +0 -0
  110. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/modulo.md +0 -0
  111. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/newline.md +0 -0
  112. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/now.md +0 -0
  113. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/position.md +0 -0
  114. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/property.md +0 -0
  115. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/random.md +0 -0
  116. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/right.md +0 -0
  117. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/sin.md +0 -0
  118. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/stringify.md +0 -0
  119. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/tab.md +0 -0
  120. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/tan.md +0 -0
  121. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/timestamp.md +0 -0
  122. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/today.md +0 -0
  123. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/trim.md +0 -0
  124. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/type.md +0 -0
  125. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/uppercase.md +0 -0
  126. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/value.md +0 -0
  127. {easycoder-250116.3 → easycoder-250118.1}/doc/core/values/weekday.md +0 -0
  128. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/README.md +0 -0
  129. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/attach.md +0 -0
  130. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/close.md +0 -0
  131. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/create.md +0 -0
  132. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/ellipse.md +0 -0
  133. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/image.md +0 -0
  134. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/move.md +0 -0
  135. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/on.md +0 -0
  136. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/rectangle.md +0 -0
  137. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/render.md +0 -0
  138. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/run.md +0 -0
  139. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/set.md +0 -0
  140. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/keywords/text.md +0 -0
  141. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/values/attribute.md +0 -0
  142. {easycoder-250116.3 → easycoder-250118.1}/doc/graphics/values/window.md +0 -0
  143. {easycoder-250116.3 → easycoder-250118.1}/easycoder/README.md +0 -0
  144. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_classes.py +0 -0
  145. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_compiler.py +0 -0
  146. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_condition.py +0 -0
  147. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_handler.py +0 -0
  148. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_program.py +0 -0
  149. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_timestamp.py +0 -0
  150. {easycoder-250116.3 → easycoder-250118.1}/easycoder/ec_value.py +0 -0
  151. {easycoder-250116.3 → easycoder-250118.1}/images/Semoigo Dawn.jpg +0 -0
  152. {easycoder-250116.3 → easycoder-250118.1}/json/graphics-demo.json +0 -0
  153. {easycoder-250116.3 → easycoder-250118.1}/plugins/ec_keyboard.py +0 -0
  154. {easycoder-250116.3 → easycoder-250118.1}/plugins/ec_p100.py +0 -0
  155. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/4-function.json +0 -0
  156. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/4-function.png +0 -0
  157. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-0.json +0 -0
  158. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-0.png +0 -0
  159. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-1.json +0 -0
  160. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-1.png +0 -0
  161. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-2.json +0 -0
  162. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-2.png +0 -0
  163. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-3.json +0 -0
  164. {easycoder-250116.3 → easycoder-250118.1}/plugins/keyboards/qwerty-3.png +0 -0
  165. /easycoder-250116.3/plugins/example.py → /easycoder-250118.1/plugins/points.py +0 -0
  166. {easycoder-250116.3 → easycoder-250118.1}/pyproject.toml +0 -0
  167. {easycoder-250116.3 → easycoder-250118.1}/scripts/README.md +0 -0
  168. {easycoder-250116.3 → easycoder-250118.1}/scripts/benchmark.ecs +0 -0
  169. {easycoder-250116.3 → easycoder-250118.1}/scripts/ec_keyboard.py +0 -0
  170. {easycoder-250116.3 → easycoder-250118.1}/scripts/fizzbuzz.ecs +0 -0
  171. {easycoder-250116.3 → easycoder-250118.1}/scripts/hello.ecs +0 -0
  172. {easycoder-250116.3 → easycoder-250118.1}/scripts/test.ecs +0 -0
  173. {easycoder-250116.3 → easycoder-250118.1}/scripts/tests.ecs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easycoder
3
- Version: 250116.3
3
+ Version: 250118.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>
@@ -9,4 +9,4 @@ from .ec_program import *
9
9
  from .ec_timestamp import *
10
10
  from .ec_value import *
11
11
 
12
- __version__ = "250116.3"
12
+ __version__ = "250118.1"
@@ -1427,7 +1427,6 @@ class Core(Handler):
1427
1427
 
1428
1428
  def r_system(self, command):
1429
1429
  value = self.getRuntimeValue(command['value'])
1430
- background = command['background']
1431
1430
  if value != None:
1432
1431
  if command['background']:
1433
1432
  subprocess.Popen(["sh",value,"&"])
@@ -1735,6 +1734,9 @@ class Core(Handler):
1735
1734
  if symbolRecord['valueHolder']:
1736
1735
  value['target'] = symbolRecord['name']
1737
1736
  return value
1737
+ else:
1738
+ value['value'] = self.getValue()
1739
+ return value
1738
1740
  self.warning(f'Core.compileValue: Token \'{self.getToken()}\' does not hold a value')
1739
1741
  return None
1740
1742
 
@@ -1900,6 +1902,10 @@ class Core(Handler):
1900
1902
  return value
1901
1903
  return None
1902
1904
 
1905
+ if token == 'system':
1906
+ value['command'] = self.nextValue()
1907
+ return value
1908
+
1903
1909
  return None
1904
1910
 
1905
1911
  #############################################################################
@@ -2199,13 +2205,16 @@ class Core(Handler):
2199
2205
 
2200
2206
  def v_property(self, v):
2201
2207
  propertyValue = self.getRuntimeValue(v['name'])
2202
- targetName = v['target']
2203
- target = self.getVariable(targetName)
2204
- targetValue = self.getRuntimeValue(target)
2208
+ if 'target' in v:
2209
+ targetName = v['target']
2210
+ target = self.getVariable(targetName)
2211
+ targetValue = self.getRuntimeValue(target)
2212
+ else:
2213
+ targetValue = self.getRuntimeValue(v['value'])
2205
2214
  try:
2206
2215
  val = targetValue[propertyValue]
2207
2216
  except:
2208
- RuntimeError(self.program, f'{targetName} does not have the property \'{propertyValue}\'')
2217
+ RuntimeError(self.program, f'This value does not have the property \'{propertyValue}\'')
2209
2218
  return None
2210
2219
  value = {}
2211
2220
  value['content'] = val
@@ -2247,13 +2256,19 @@ class Core(Handler):
2247
2256
 
2248
2257
  # This is used by the expression evaluator to get the value of a symbol
2249
2258
  def v_symbol(self, symbolRecord):
2250
- result = {}
2251
2259
  if symbolRecord['keyword'] == 'variable':
2252
- symbolValue = self.getSymbolValue(symbolRecord)
2253
- return symbolValue
2260
+ return self.getSymbolValue(symbolRecord)
2254
2261
  else:
2255
2262
  return None
2256
2263
 
2264
+ def v_system(self, v):
2265
+ command = self.getRuntimeValue(v['command'])
2266
+ result = os.popen(command).read()
2267
+ value = {}
2268
+ value['type'] = 'text'
2269
+ value['content'] = result
2270
+ return value
2271
+
2257
2272
  def v_tab(self, v):
2258
2273
  value = {}
2259
2274
  value['type'] = 'text'
@@ -9,7 +9,6 @@ class Graphics(Handler):
9
9
  def __init__(self, compiler):
10
10
  Handler.__init__(self, compiler)
11
11
  self.utils = GUtils()
12
- self.eventHandlers = {}
13
12
 
14
13
  def getName(self):
15
14
  return 'graphics'
@@ -18,23 +17,27 @@ class Graphics(Handler):
18
17
  # Keyword handlers
19
18
 
20
19
  def k_add(self, command):
21
- elements = []
22
20
  token = self.nextToken()
23
21
  if self.isSymbol():
24
22
  symbolRecord = self.getSymbolRecord()
25
23
  name = symbolRecord['name']
26
- if symbolRecord['keyword'] == 'layout':
27
- elements.append(name)
24
+ keyword = symbolRecord['keyword']
25
+ if keyword == 'layout':
28
26
  command['args'] = name
29
- else: FatalError(self.compiler.program, f'\'{name}\' is not a layout')
30
- elif token[0:2] == 'g_':
27
+ elif keyword in ['column', 'frame', 'tab']:
28
+ command['name'] = name
29
+ command['type'] = token
30
+ if self.peek() == 'to':
31
+ command['args'] = []
32
+ else:
33
+ command['args'] = self.utils.getArgs(self)
34
+ else:
31
35
  command['type'] = token
32
36
  command['args'] = self.utils.getArgs(self)
33
- else: return False
34
37
  if self.nextIs('to'):
35
38
  if self.nextIsSymbol():
36
39
  symbolRecord = self.getSymbolRecord()
37
- if symbolRecord['keyword'] == 'layout':
40
+ if symbolRecord['keyword'] in ['column', 'frame', 'layout', 'tab']:
38
41
  command['target'] = symbolRecord['name']
39
42
  self.addCommand(command)
40
43
  return True
@@ -44,14 +47,19 @@ class Graphics(Handler):
44
47
  target = self.getVariable(command['target'])
45
48
  type = command['type']
46
49
  args = command['args']
50
+ param= None
47
51
  if not 'layout' in target:
48
52
  target['layout'] = []
49
53
  if args[0] == '{':
54
+ if type in ['Column', 'Frame', 'Tab']:
55
+ record = self.getVariable(command['name'])
56
+ param = record['layout']
50
57
  layout = json.loads(self.getRuntimeValue(json.loads(args)))
51
58
  default = self.utils.getDefaultArgs(type)
52
59
  for n in range(0, len(layout)):
53
60
  args = self.utils.decode(default, layout[n])
54
- target['layout'].append(self.utils.createElement(type, args))
61
+ item = self.utils.createElement(type, param, args)
62
+ target['layout'].append(item)
55
63
  else:
56
64
  v = self.getVariable(args)
57
65
  target['layout'].append(v['layout'])
@@ -86,6 +94,12 @@ class Graphics(Handler):
86
94
  target['window'].close()
87
95
  return self.nextPC()
88
96
 
97
+ def k_column(self, command):
98
+ return self.compileVariable(command)
99
+
100
+ def r_column(self, command):
101
+ return self.nextPC()
102
+
89
103
  # create {window} layout {layout}
90
104
  # create {element} {args...}
91
105
  def k_create(self, command):
@@ -111,14 +125,30 @@ class Graphics(Handler):
111
125
  if type == 'window':
112
126
  layout = self.getVariable(command['layout'])
113
127
  title = self.getRuntimeValue(command['title'])
114
- self.program.window = psg.Window(title, layout['layout'], finalize=True)
128
+ record['window'] = psg.Window(title, layout['layout'], finalize=True)
129
+ record['eventHandlers'] = {}
130
+ self.program.windowRecord = record
115
131
  self.program.run(self.nextPC())
116
132
  self.mainLoop()
117
- self.program.kill()
133
+ # self.program.kill()
118
134
  return 0
119
135
  else:
120
136
  RuntimeError(self.program, 'Variable is not a window or an element')
121
137
 
138
+ def k_init(self, command):
139
+ if self.nextIsSymbol():
140
+ symbolRecord = self.getSymbolRecord()
141
+ if symbolRecord['keyword'] in ['column', 'frame', 'layout', 'tab']:
142
+ command['target'] = symbolRecord['name']
143
+ self.add(command)
144
+ return True
145
+ return False
146
+
147
+ def r_init(self, command):
148
+ target = self.getVariable(command['target'])
149
+ target['layout'] = []
150
+ return self.nextPC()
151
+
122
152
  def k_layout(self, command):
123
153
  return self.compileVariable(command)
124
154
 
@@ -129,33 +159,38 @@ class Graphics(Handler):
129
159
  token = self.nextToken()
130
160
  if token == 'event':
131
161
  command['key'] = self.nextValue()
132
- command['goto'] = self.getPC() + 2
133
- self.add(command)
134
- self.nextToken()
135
- pcNext = self.getPC()
136
- cmd = {}
137
- cmd['domain'] = 'core'
138
- cmd['lino'] = command['lino']
139
- cmd['keyword'] = 'gotoPC'
140
- cmd['goto'] = 0
141
- cmd['debug'] = False
142
- self.addCommand(cmd)
143
- self.compileOne()
144
- cmd = {}
145
- cmd['domain'] = 'core'
146
- cmd['lino'] = command['lino']
147
- cmd['keyword'] = 'stop'
148
- cmd['debug'] = False
149
- self.addCommand(cmd)
150
- # Fixup the link
151
- self.getCommandAt(pcNext)['goto'] = self.getPC()
152
- return True
162
+ if self.nextIs('in'):
163
+ if self.nextIsSymbol():
164
+ record = self.getSymbolRecord()
165
+ if record['keyword'] == 'window':
166
+ command['window'] = record['name']
167
+ command['goto'] = self.getPC() + 2
168
+ self.add(command)
169
+ self.nextToken()
170
+ pcNext = self.getPC()
171
+ cmd = {}
172
+ cmd['domain'] = 'core'
173
+ cmd['lino'] = command['lino']
174
+ cmd['keyword'] = 'gotoPC'
175
+ cmd['goto'] = 0
176
+ cmd['debug'] = False
177
+ self.addCommand(cmd)
178
+ self.compileOne()
179
+ cmd = {}
180
+ cmd['domain'] = 'core'
181
+ cmd['lino'] = command['lino']
182
+ cmd['keyword'] = 'stop'
183
+ cmd['debug'] = False
184
+ self.addCommand(cmd)
185
+ # Fixup the link
186
+ self.getCommandAt(pcNext)['goto'] = self.getPC()
187
+ return True
153
188
  return False
154
189
 
155
190
  def r_on(self, command):
156
191
  key = self.getRuntimeValue(command['key'])
157
- pc = command['goto']
158
- self.eventHandlers[key] = lambda: self.run(pc)
192
+ window = self.getVariable(command['window'])
193
+ window['eventHandlers'][key] = lambda: self.run(command['goto'])
159
194
  return self.nextPC()
160
195
 
161
196
  def k_popup(self, command):
@@ -222,13 +257,14 @@ class Graphics(Handler):
222
257
  return value
223
258
  return None
224
259
 
260
+ if self.getToken() == 'the':
261
+ self.nextToken()
262
+
263
+ token = self.getToken()
225
264
  value['type'] = token
226
265
 
227
- if token == 'test':
228
- value = {}
229
- value['type'] = 'text'
230
- value['content'] = 'test'
231
- return value
266
+ if token == 'event':
267
+ return value
232
268
 
233
269
  return None
234
270
 
@@ -247,7 +283,9 @@ class Graphics(Handler):
247
283
  else:
248
284
  return None
249
285
 
250
- def v_test(self, v):
286
+ def v_event(self, v):
287
+ v['type'] = 'text'
288
+ v['content'] = self.eventValues
251
289
  return v
252
290
 
253
291
  #############################################################################
@@ -262,13 +300,15 @@ class Graphics(Handler):
262
300
  #############################################################################
263
301
  # The main loop
264
302
  def mainLoop(self):
303
+ windowRecord = self.program.windowRecord
304
+ window = windowRecord['window']
305
+ eventHandlers = windowRecord['eventHandlers']
265
306
  while True:
266
- event, values = self.program.window.Read(timeout=100)
307
+ event, values = window.Read(timeout=100)
267
308
  if event == psg.WINDOW_CLOSED or event == "EXIT":
268
309
  break
269
310
  if event == '__TIMEOUT__': self.program.flushCB()
270
311
  else:
271
- if event in self.eventHandlers:
312
+ if event in eventHandlers:
272
313
  self.eventValues = values
273
- self.eventHandlers[event]()
274
-
314
+ eventHandlers[event]()
@@ -0,0 +1,84 @@
1
+ import PySimpleGUI as psg
2
+ import json
3
+
4
+ class GUtils:
5
+
6
+ # Parse a set of compile-time arguments
7
+ def getArgs(self, handler):
8
+ args = []
9
+ while True:
10
+ key = handler.nextToken()
11
+ value = json.dumps(handler.nextValue())
12
+ args.append(f'{key}={value}')
13
+ if handler.peek() == 'and':
14
+ handler.nextToken()
15
+ else: break
16
+ v = {}
17
+ v['type'] = 'text'
18
+ v['content'] = json.dumps(args)
19
+ return json.dumps(v)
20
+
21
+ # Get the default args for a graphic element
22
+ def getDefaultArgs(self, type):
23
+ args = {}
24
+ if type == 'Button':
25
+ args['button_text'] = '(empty)'
26
+ args['size'] = (None, None)
27
+ if type == 'Checkbox':
28
+ args['text'] = ''
29
+ args['key'] = None
30
+ args['size'] = (None, None)
31
+ args['expand_x'] = False
32
+ elif type == 'Column':
33
+ args['expand_x'] = False
34
+ args['pad'] = (0, 0)
35
+ elif type == 'Input':
36
+ args['key'] = None
37
+ args['size'] = (None, None)
38
+ elif type == 'Multiline':
39
+ args['default_text'] = ''
40
+ args['key'] = None
41
+ args['size'] = (None, None)
42
+ elif type == 'Text':
43
+ args['text'] = '(empty)'
44
+ args['size'] = (None, None)
45
+ args['expand_x'] = False
46
+ return args
47
+
48
+ # Decode an argument at runtime
49
+ def decode(self, args, text):
50
+ p = text.find('=')
51
+ if p > 0:
52
+ key = text[0:p]
53
+ value = json.loads(text[p+1:])['content']
54
+ args[key] = value
55
+ return args
56
+ return None
57
+
58
+ # Create an element
59
+ def createElement(self, type, param, args):
60
+ if type == 'Button':
61
+ size = self.getSize(args)
62
+ return psg.Button(button_text=args['button_text'], size=size)
63
+ if type == 'Checkbox':
64
+ size = self.getSize(args)
65
+ return psg.Checkbox(args['text'], key=args['key'], expand_x=args['expand_x'], size=size)
66
+ if type == 'Column':
67
+ return psg.Column(param, expand_x=args['expand_x'], pad=args['pad'])
68
+ elif type == 'Input':
69
+ size = self.getSize(args)
70
+ return psg.Input(key=args['key'], size=size)
71
+ elif type == 'Multiline':
72
+ size = self.getSize(args)
73
+ return psg.Multiline(default_text=args['default_text'], key=args['key'], size=size)
74
+ elif type == 'Text':
75
+ size = self.getSize(args)
76
+ return psg.Text(text=args['text'], size=size, expand_x=args['expand_x'])
77
+ else: return None
78
+
79
+ def getSize(self, args):
80
+ size = args['size']
81
+ if size == (None, None):
82
+ return size
83
+ size = size.split()
84
+ return (size[0], size[1])
@@ -0,0 +1,190 @@
1
+ ! RBR XR Configurator
2
+
3
+ script Config
4
+
5
+ layout MainLayout
6
+ layout SecondLayout
7
+ layout Row
8
+ column Column
9
+ window MainWindow
10
+ window SecondWindow
11
+ variable SSID
12
+ variable Value
13
+ variable Content
14
+ variable IPAddr
15
+ variable N
16
+
17
+ ! debug step
18
+
19
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
20
+ ! Create the main window
21
+ init MainLayout
22
+
23
+ ! The top row is the room name
24
+ init Row
25
+ add Text text `Room Name` and expand_x true to Row
26
+ add Input key `-NAME-` and size `40 1` to Row
27
+ add Button button_text `Set Name` and size `20 1` to Row
28
+ add Row to MainLayout
29
+
30
+ ! The second row is the host SSID
31
+ init Row
32
+ add Text text `Host SSID` and expand_x true to Row
33
+ add Input key `-SSID-` and size `40 1` to Row
34
+ add Button button_text `Set Host SSID` and size `20 1` to Row
35
+ add Row to MainLayout
36
+
37
+ ! The third row is the host password
38
+ init Row
39
+ add Text text `Host Password` and expand_x true to Row
40
+ add Input key `-HPASS-` and size `40 1` to Row
41
+ add Button button_text `Set Host Password` and size `20 1` to Row
42
+ add Row to MainLayout
43
+
44
+ ! The fourth row is the device password
45
+ init Row
46
+ add Text text `Device Password` and expand_x true to Row
47
+ add Input key `-DPASS-` and size `40 1` to Row
48
+ add Button button_text `Set Device Password` and size `20 1` to Row
49
+ add Row to MainLayout
50
+
51
+ ! The fifth row deals with the LED
52
+ init Column
53
+ init Row
54
+ add Text text `Pin #` to Row
55
+ add Input key `-LED_PIN-` and size `4 1` to Row
56
+ add Text text ` ` to Row
57
+ add Checkbox text `Invert the pin logic` and key `-LED_INVERT-` to Row
58
+ add Text text ` ` to Row
59
+ add Row to Column
60
+ init Row
61
+ add Text text `LED` and size `40 1` and expand_x true to Row
62
+ add Column expand_x true to Row
63
+ add Button button_text `Set LED Params` and size `20 1` to Row
64
+ add Row to MainLayout
65
+
66
+ ! The sixth row deals with the relay
67
+ init Column
68
+ init Row
69
+ add Text text `Pin #` to Row
70
+ add Input key `-RELAY_PIN-` and size `4 1` to Row
71
+ add Text text ` ` to Row
72
+ add Checkbox text `Invert the pin logic` and key `-RELAY_INVERT-` to Row
73
+ add Text text ` ` to Row
74
+ add Row to Column
75
+ init Row
76
+ add Text text `Relay` and size `40 1` and expand_x true to Row
77
+ add Column expand_x true to Row
78
+ add Button button_text `Set Relay Params` and size `20 1` to Row
79
+ add Row to MainLayout
80
+
81
+ ! The final row is the various buttons
82
+ init Row
83
+ add Button button_text `Connect` to Row
84
+ add Button button_text `Set All` to Row
85
+ add Button button_text `Exit` to Row
86
+ add Row to MainLayout
87
+
88
+ create MainWindow `RBR XR Config`
89
+ layout MainLayout
90
+
91
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
92
+ ! Event handlers for the main window
93
+
94
+ on event `Set Name` in MainWindow go to SetName
95
+ on event `Set Host SSID` in MainWindow go to SetHostSSID
96
+ on event `Set Host Password` in MainWindow go to SetHostPassword
97
+ on event `Set Device Password` in MainWindow go to SetDevicePassword
98
+ on event `Set LED Params` in MainWindow go to SetLEDParams
99
+ on event `Set Relay Params` in MainWindow go to SetRelayParams
100
+ on event `Connect` in MainWindow go to Connect
101
+ on event `Set All` in MainWindow go to SetAll
102
+ on event `Exit` in MainWindow
103
+ begin
104
+ close MainWindow
105
+ exit
106
+ end
107
+ stop
108
+
109
+ SetName:
110
+ put property `-NAME-` of the event into Value
111
+ print `Name: ` cat Value
112
+ stop
113
+
114
+ SetHostSSID:
115
+ put property `-SSID-` of the event into Value
116
+ print `Host SSID: ` cat Value
117
+ stop
118
+
119
+ SetHostPassword:
120
+ put property `-HPASS-` of the event into Value
121
+ print `Host Password: ` cat Value
122
+ stop
123
+
124
+ SetDevicePassword:
125
+ put property `-DPASS-` of the event into Value
126
+ print `Device Password: ` cat Value
127
+ stop
128
+
129
+ SetLEDParams:
130
+ put property `-LED_PIN-` of the event into Value
131
+ print `LED Pin: ` cat Value
132
+ put property `-LED_INVERT-` of the event into Value
133
+ print `LED Invert: ` cat Value
134
+ stop
135
+
136
+ SetRelayParams:
137
+ put property `-RELAY_PIN-` of the event into Value
138
+ print `Relay Pin: ` cat Value
139
+ put property `-RELAY_INVERT-` of the event into Value
140
+ print `Relay Invert: ` cat Value
141
+ stop
142
+
143
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
144
+ ! Set all parameters
145
+ SetAll:
146
+ fork to SetName
147
+ fork to SetHostSSID
148
+ fork to SetHostPassword
149
+ fork to SetDevicePassword
150
+ fork to SetLEDParams
151
+ fork to SetRelayParams
152
+ stop
153
+
154
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
155
+ ! Specify an access point
156
+ Connect:
157
+ init SecondLayout
158
+
159
+ init Row
160
+ add Text text `Device SSID` and expand_x true to Row
161
+ add Input key `-SSID-` and size `20 1` to Row
162
+ add Row to SecondLayout
163
+
164
+ init Row
165
+ add Button button_text `Connect` to Row
166
+ add Row to SecondLayout
167
+
168
+ create SecondWindow `Connect`
169
+ layout SecondLayout
170
+
171
+ on event `Connect` in SecondWindow
172
+ begin
173
+ put property `-SSID-` of the event into SSID
174
+ go to OpenConnection
175
+ end
176
+ stop
177
+
178
+
179
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
180
+ ! Connect to the access point
181
+ OpenConnection:
182
+ system `nmcli dev wifi connect ` cat SSID cat ` password 00000000`
183
+ put system `hostname -I` into IPAddr
184
+ put the position of the last `.` in IPAddr into N
185
+ increment N
186
+ put left N of IPAddr into IPAddr
187
+ put IPAddr cat `1` into IPAddr
188
+ print `Connected to ` cat IPAddr
189
+ close SecondWindow
190
+ stop
@@ -2,7 +2,7 @@
2
2
 
3
3
  script Points
4
4
 
5
- import plugin Points from plugins/example.py
5
+ import plugin Points from plugins/points.py
6
6
 
7
7
  point Point1
8
8
  point Point2
@@ -11,19 +11,19 @@
11
11
  popup `Hello!`
12
12
  ! debug step
13
13
 
14
- set Row to g_text text `Date (YYYY-MM-DD):` and expand_x true
15
- add g_input key `-DATE-` and size `20 1` to Row
14
+ set Row to Text text `Date (YYYY-MM-DD):` and expand_x true
15
+ add Input key `-DATE-` and size `20 1` to Row
16
16
  add Row to Layout
17
17
 
18
- set Row to g_text text `Time (HH:MM):` and expand_x true
19
- add g_input key `-TIME-` and size `20 1` to Row
18
+ set Row to Text text `Time (HH:MM):` and expand_x true
19
+ add Input key `-TIME-` and size `20 1` to Row
20
20
  add Row to Layout
21
21
 
22
- set Row to g_text text `Your name:` and expand_x true
23
- add g_input key `-NAME-` and size `20 1` to Row
22
+ set Row to Text text `Your name:` and expand_x true
23
+ add Input key `-NAME-` and size `20 1` to Row
24
24
  add Row to Layout
25
25
 
26
- set Row to g_button button_text `Click me`
26
+ set Row to Button button_text `Click me`
27
27
  add Row to Layout
28
28
 
29
29
  create Window `Graphics Test`
@@ -0,0 +1,3 @@
1
+ variable X
2
+ print X
3
+
@@ -1,52 +0,0 @@
1
- import PySimpleGUI as psg
2
- import json
3
-
4
- class GUtils:
5
-
6
- # Parse a set of compile-time arguments
7
- def getArgs(self, handler):
8
- args = []
9
- while True:
10
- key = handler.nextToken()
11
- value = json.dumps(handler.nextValue())
12
- args.append(f'{key}={value}')
13
- if handler.peek() == 'and':
14
- handler.nextToken()
15
- else: break
16
- v = {}
17
- v['type'] = 'text'
18
- v['content'] = json.dumps(args)
19
- return json.dumps(v)
20
-
21
- # Get the default args for a graphic element
22
- def getDefaultArgs(self, type):
23
- args = {}
24
- if type == 'g_text':
25
- args['text'] = '(empty)'
26
- args['expand_x'] = False
27
- elif type == 'g_input':
28
- args['key'] = None
29
- args['size'] = (None, None)
30
- elif type == 'g_button':
31
- args['button_text'] = '(empty)'
32
- return args
33
-
34
- # Decode an argument at runtime
35
- def decode(self, args, text):
36
- p = text.find('=')
37
- if p > 0:
38
- key = text[0:p]
39
- value = json.loads(text[p+1:])['content']
40
- args[key] = value
41
- return args
42
- return None
43
-
44
- # Create an element
45
- def createElement(self, type, args):
46
- if type == 'g_text': return psg.Text(text=args['text'], expand_x=args['expand_x'])
47
- elif type == 'g_input':
48
- size = args['size'].split()
49
- size = (size[0], size[1])
50
- return psg.Input(key=args['key'], size=size)
51
- elif type == 'g_button': return psg.Button(button_text=args['button_text'])
52
- else: return None
File without changes
File without changes