easycoder 250205.1__py2.py3-none-any.whl → 250209.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

easycoder/__init__.py CHANGED
@@ -9,4 +9,4 @@ from .ec_program import *
9
9
  from .ec_timestamp import *
10
10
  from .ec_value import *
11
11
 
12
- __version__ = "250205.1"
12
+ __version__ = "250209.1"
easycoder/ec_core.py CHANGED
@@ -706,9 +706,12 @@ class Core(Handler):
706
706
  def r_load(self, command):
707
707
  target = self.getVariable(command['target'])
708
708
  file = self.getRuntimeValue(command['file'])
709
- f = open(file, 'r')
710
- content = f.read()
711
- f.close()
709
+ try:
710
+ with open(file, 'r') as f:
711
+ content = f.read()
712
+ except:
713
+ content=None
714
+ if content != None and file.endswith('.json'): content = json.loads(content)
712
715
  value = {}
713
716
  value['type'] = 'text'
714
717
  value['content'] = content
@@ -1217,9 +1220,9 @@ class Core(Handler):
1217
1220
  def r_save(self, command):
1218
1221
  content = self.getRuntimeValue(command['content'])
1219
1222
  file = self.getRuntimeValue(command['file'])
1220
- f = open(file, 'w')
1221
- f.write(content)
1222
- f.close()
1223
+ if file.endswith('.json'): content = json.dumps(content)
1224
+ with open(file, 'w') as f:
1225
+ f.write(content)
1223
1226
  return self.nextPC()
1224
1227
 
1225
1228
  # Send a message to a module
@@ -2400,22 +2403,11 @@ class Core(Handler):
2400
2403
  if self.nextToken() == 'with':
2401
2404
  condition.value2 = self.nextValue()
2402
2405
  return condition
2403
- return None
2404
2406
 
2405
2407
  if token == 'includes':
2406
2408
  condition.value2 = self.nextValue()
2407
2409
  return condition
2408
2410
 
2409
- if token == 'does':
2410
- self.nextToken()
2411
- if self.nextIs('not'):
2412
- if self.nextIs('include'):
2413
- condition.value2 = self.nextValue()
2414
- condition.type = 'includes'
2415
- condition.negate = True
2416
- return condition
2417
- return None
2418
-
2419
2411
  if token == 'is':
2420
2412
  token = self.nextToken()
2421
2413
  if self.peek() == 'not':
@@ -2503,8 +2495,7 @@ class Core(Handler):
2503
2495
  def c_includes(self, condition):
2504
2496
  value1 = self.getRuntimeValue(condition.value1)
2505
2497
  value2 = self.getRuntimeValue(condition.value2)
2506
- test = value2 in value1
2507
- return not test if condition.negate else test
2498
+ return value2 in value1
2508
2499
 
2509
2500
  def c_is(self, condition):
2510
2501
  comparison = self.program.compare(condition.value1, condition.value2)
easycoder/ec_graphics.py CHANGED
@@ -29,7 +29,7 @@ class Graphics(Handler):
29
29
  command['name'] = name
30
30
  command['type'] = token
31
31
  if self.peek() == 'to':
32
- command['args'] = []
32
+ command['args'] = name
33
33
  else:
34
34
  command['args'] = self.utils.getArgs(self)
35
35
  else:
@@ -45,28 +45,37 @@ class Graphics(Handler):
45
45
  return False
46
46
 
47
47
  def r_add(self, command):
48
+ def create(type, layout, args2, target):
49
+ args = self.utils.getDefaultArgs(type)
50
+ for n in range(0, len(args2)):
51
+ try:
52
+ self.utils.decode(self, args, args2[n])
53
+ except Exception as e:
54
+ RuntimeError(self.program, e)
55
+ item = self.utils.createWidget(type, layout, args)
56
+ target['layout'].append(item)
57
+
48
58
  target = self.getVariable(command['target'])
49
59
  type = command['type']
50
60
  args = command['args']
51
- param= None
52
61
  if not 'layout' in target:
53
62
  target['layout'] = []
54
- if args[0] == '{':
63
+ if len(args) > 0 and args[0] == '{':
64
+ args = json.loads(self.getRuntimeValue(json.loads(args)))
55
65
  if type in ['Column', 'Frame', 'Tab']:
56
66
  record = self.getVariable(command['name'])
57
- param = record['layout']
58
- layout = json.loads(self.getRuntimeValue(json.loads(args)))
59
- default = self.utils.getDefaultArgs(type)
60
- for n in range(0, len(layout)):
61
- try:
62
- args = self.utils.decode(self, default, layout[n])
63
- except Exception as e:
64
- RuntimeError(self.program, e)
65
- item = self.utils.createWidget(type, param, args)
66
- target['layout'].append(item)
67
+ layout = record['layout']
68
+ create(type, layout, args, target)
69
+ else:
70
+ create(type, None, args, target)
67
71
  else:
68
- v = self.getVariable(args)
69
- target['layout'].append(v['layout'])
72
+ if type in ['Column', 'Frame', 'Tab']:
73
+ record = self.getVariable(command['name'])
74
+ layout = record['layout']
75
+ create(type, layout, args, target)
76
+ else:
77
+ v = self.getVariable(args)
78
+ target['layout'].append(v['layout'])
70
79
  return self.nextPC()
71
80
 
72
81
  def k_close(self, command):
easycoder/ec_gutils.py CHANGED
@@ -44,8 +44,6 @@ class GUtils:
44
44
  if value != None: value = value['content']
45
45
  else: raise Exception('Variable has no value')
46
46
  args[key] = value
47
- return args
48
- return None
49
47
 
50
48
  # Reduce the event properties to a list of strings
51
49
  def getEventProperties(self, window, values):
@@ -59,14 +57,14 @@ class GUtils:
59
57
  values[key] = v
60
58
 
61
59
  # Create a widget
62
- def createWidget(self, type, param, args):
63
- if type == 'Button': return self.createButton(param, args)
64
- elif type == 'Checkbox': return self.createCheckbox(param, args)
65
- elif type == 'Column': return self.createColumn(param, args)
66
- elif type == 'Input': return self.createInput(param, args)
67
- elif type == 'Listbox': return self.createListbox(param, args)
68
- elif type == 'Multiline': return self.createMultiline(param, args)
69
- elif type == 'Text': return self.createText(param, args)
60
+ def createWidget(self, type, layout, args):
61
+ if type == 'Button': return self.createButton(layout, args)
62
+ elif type == 'Checkbox': return self.createCheckbox(layout, args)
63
+ elif type == 'Column': return self.createColumn(layout, args)
64
+ elif type == 'Input': return self.createInput(layout, args)
65
+ elif type == 'Listbox': return self.createListbox(layout, args)
66
+ elif type == 'Multiline': return self.createMultiline(layout, args)
67
+ elif type == 'Text': return self.createText(layout, args)
70
68
  else: return None
71
69
 
72
70
  # Get the current value of a widget
@@ -97,6 +95,13 @@ class GUtils:
97
95
  elif property == 'values':
98
96
  element.update(values=value)
99
97
 
98
+ def getPad(self, args):
99
+ pad = args['pad']
100
+ if pad == (None, None):
101
+ return pad
102
+ pad = pad.split()
103
+ return (pad[0], pad[1])
104
+
100
105
  def getSize(self, args):
101
106
  size = args['size']
102
107
  if size == (None, None):
@@ -109,7 +114,7 @@ class GUtils:
109
114
  args['disabled'] = False
110
115
  args['size'] = (None, None)
111
116
 
112
- def createButton(self, param, args):
117
+ def createButton(self, layout, args):
113
118
  return psg.Button(button_text=args['button_text'], disabled=args['disabled'], size=self.getSize(args))
114
119
 
115
120
  def getDefaultCheckbox(self, args):
@@ -118,39 +123,40 @@ class GUtils:
118
123
  args['size'] = (None, None)
119
124
  args['expand_x'] = False
120
125
 
121
- def createCheckbox(self, param, args):
126
+ def createCheckbox(self, layout, args):
122
127
  return psg.Checkbox(args['text'], key=args['key'], expand_x=args['expand_x'], size=self.getSize(args))
123
128
 
124
129
  def getDefaultColumn(self, args):
125
130
  args['expand_x'] = False
126
- args['pad'] = (0, 0)
131
+ args['pad'] = (None, None)
127
132
 
128
- def createColumn(self, param, args):
129
- return psg.Column(param, expand_x=args['expand_x'], pad=args['pad'])
133
+ def createColumn(self, layout, args):
134
+ return psg.Column(layout, expand_x=args['expand_x'], pad=self.getPad(args))
130
135
 
131
136
  def getDefaultInput(self, args):
132
137
  args['default_text'] = ''
133
138
  args['key'] = None
134
139
  args['size'] = (None, None)
135
140
 
136
- def createInput(self, param, args):
141
+ def createInput(self, layout, args):
137
142
  return psg.Input(default_text=args['default_text'], key=args['key'], size=self.getSize(args))
138
143
 
139
144
  def getDefaultListbox(self, args):
140
145
  args['list'] = []
141
146
  args['key'] = [None]
142
147
  args['size'] = '10 2'
148
+ args['pad'] = (None, None)
143
149
  args['select_mode'] = None
144
150
 
145
- def createListbox(self, param, args):
146
- return psg.Listbox([], key=args['key'], size=self.getSize(args))
151
+ def createListbox(self, layout, args):
152
+ return psg.Listbox([], key=args['key'], pad=self.getPad(args), size=self.getSize(args))
147
153
 
148
154
  def getDefaultMultiline(self, args):
149
155
  args['default_text'] = ''
150
156
  args['key'] = None
151
157
  args['size'] = (None, None)
152
158
 
153
- def createMultiline(self, param, args):
159
+ def createMultiline(self, layout, args):
154
160
  return psg.Multiline(default_text=args['default_text'], key=args['key'], size=self.getSize(args))
155
161
 
156
162
  def getDefaultText(self, args):
@@ -159,6 +165,6 @@ class GUtils:
159
165
  args['size'] = (None, None)
160
166
  args['expand_x'] = False
161
167
 
162
- def createText(self, param, args):
168
+ def createText(self, layouts, args):
163
169
  return psg.Text(text=args['text'], expand_x=args['expand_x'], key=args['key'], size=self.getSize(args))
164
170
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easycoder
3
- Version: 250205.1
3
+ Version: 250209.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>
@@ -1,17 +1,17 @@
1
1
  easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
2
- easycoder/__init__.py,sha256=Y3LsOHjBOTK-wrREfqMN4Sq_ejIOx0eWV2xlP_-4Fa0,262
2
+ easycoder/__init__.py,sha256=ThnKzPLXjQ6pK6rxAGX10BuDnVxM5LyWwr38WrzSGmw,262
3
3
  easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
4
4
  easycoder/ec_compiler.py,sha256=dFJEA_uOhD-HeSiAdBzmmA6q3LHThUVoJpSETanmSHs,4800
5
5
  easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
6
- easycoder/ec_core.py,sha256=Z47ByZY8CrEv-Qy_x4jrOz1fKZ47qlmjWIhPmPPP5kc,87584
7
- easycoder/ec_graphics.py,sha256=I5C4YYzdaCjL7_Vc7cNalABV18PL8QOqDbJQnQB6lrY,13000
8
- easycoder/ec_gutils.py,sha256=Pfz3u5KQieXm-F7qsB9gy6IUGDi-oJaX9xdiM9ZeO6s,5885
6
+ easycoder/ec_core.py,sha256=qx-4xxzqmpiv_Mny3PUCLHo9Dog1FVjL5RxRbQXrzAQ,87359
7
+ easycoder/ec_graphics.py,sha256=K44SbPb81KBGCe4wpl6VR4lt93AAGOZysFO2tkUuilY,13380
8
+ easycoder/ec_gutils.py,sha256=BHDsRgXR5XTO2nYhdBbC4OQW-9xU0czyFyee0tZ595E,6096
9
9
  easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
10
10
  easycoder/ec_program.py,sha256=R8zMukA-pfRsOpcy9WqTw7fE_190dQfrMt2la23Yrs4,9904
11
11
  easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
12
12
  easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
13
- easycoder-250205.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
14
- easycoder-250205.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
- easycoder-250205.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
16
- easycoder-250205.1.dist-info/METADATA,sha256=0xFEU997MjQw1hTZokP-NIQXxcLhEz35wTIbNDW4UQE,6162
17
- easycoder-250205.1.dist-info/RECORD,,
13
+ easycoder-250209.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
14
+ easycoder-250209.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
15
+ easycoder-250209.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
16
+ easycoder-250209.1.dist-info/METADATA,sha256=lkwTOwGfCo-S5bcD8OJOJkUt66UrVXlzYYvBklfgzVU,6162
17
+ easycoder-250209.1.dist-info/RECORD,,