easycoder 251104.1__py2.py3-none-any.whl → 251105.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.
easycoder/__init__.py CHANGED
@@ -12,4 +12,4 @@ from .ec_pyside import *
12
12
  from .ec_timestamp import *
13
13
  from .ec_value import *
14
14
 
15
- __version__ = "251104.1"
15
+ __version__ = "251105.1"
easycoder/ec_border.py CHANGED
@@ -9,34 +9,38 @@ class Border(QWidget):
9
9
 
10
10
  def __init__(self):
11
11
  super().__init__()
12
- self.size = 40
13
- self.setFixedHeight(self.size)
12
+ self._size = 40
13
+ self.setFixedHeight(self._size)
14
14
  self._drag_active = False
15
15
  self._drag_start_pos = None
16
+ self._tick: QPixmap = QPixmap()
17
+ self._close_icon: QPixmap = QPixmap()
16
18
 
17
19
  def paintEvent(self, event):
18
20
  painter = QPainter(self)
19
- painter.setRenderHint(QPainter.Antialiasing)
21
+ painter.setRenderHint(QPainter.RenderHint.Antialiasing)
20
22
  # Draw the tick icon
21
- self.tick = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/tick.png').scaled(self.size, self.size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
23
+ self._tick = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/icons/tick.png').scaled(
24
+ self._size, self._size, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation)
22
25
  x = 0
23
26
  y = 0
24
- painter.drawPixmap(x, y, self.tick)
27
+ painter.drawPixmap(x, y, self._tick)
25
28
  # Draw the close icon
26
- self.close = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/close.png').scaled(self.size, self.size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
27
- x = self.width() - self.close.width()
29
+ self._close_icon = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/icons/close.png').scaled(
30
+ self._size, self._size, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation)
31
+ x = self.width() - self._close_icon.width()
28
32
  y = 0
29
- painter.drawPixmap(x, y, self.close)
33
+ painter.drawPixmap(x, y, self._close_icon)
30
34
 
31
35
  def mousePressEvent(self, event):
32
36
  # Tick icon
33
37
  x = 0
34
38
  y = 0
35
- tickRect = self.tick.rect().translated(x, y)
39
+ tickRect = self._tick.rect().translated(x, y)
36
40
  # Close icon
37
- x = self.width() - self.close.width()
41
+ x = self.width() - self._close_icon.width()
38
42
  y = 0
39
- closeRect = self.close.rect().translated(x, y)
43
+ closeRect = self._close_icon.rect().translated(x, y)
40
44
  if tickRect.contains(event.pos()):
41
45
  self.tickClicked.emit()
42
46
  if closeRect.contains(event.pos()):
easycoder/ec_classes.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import sys
2
2
 
3
- class FatalError:
3
+ class FatalError(BaseException):
4
4
  def __init__(self, compiler, message):
5
5
  compiler.showWarnings()
6
6
  lino = compiler.tokens[compiler.index].lino
@@ -58,4 +58,9 @@ class Token:
58
58
  self.token = token
59
59
 
60
60
  class Object():
61
- pass
61
+ """Dynamic object that allows arbitrary attribute assignment"""
62
+ def __setattr__(self, name: str, value) -> None:
63
+ self.__dict__[name] = value
64
+
65
+ def __getattr__(self, name: str):
66
+ return self.__dict__.get(name)
easycoder/ec_compiler.py CHANGED
@@ -85,6 +85,7 @@ class Compiler:
85
85
 
86
86
  # Add a command to the code list
87
87
  def addCommand(self, command):
88
+ command['bp'] = False
88
89
  self.code.append(command)
89
90
 
90
91
  # Test if the current token is a symbol
@@ -191,7 +192,7 @@ class Compiler:
191
192
  if not token:
192
193
  return False
193
194
  if len(self.code) == 0:
194
- if self.program.parent == None and hasattr(self.program, 'usingGraphics'):
195
+ if self.program.parent == None and self.program.usingGraphics:
195
196
  cmd = {'domain': 'graphics', 'keyword': 'init', 'debug': False}
196
197
  self.code.append(cmd)
197
198
  mark = self.getIndex()
easycoder/ec_core.py CHANGED
@@ -1771,15 +1771,8 @@ class Core(Handler):
1771
1771
  return False
1772
1772
  else:
1773
1773
  token = self.nextToken()
1774
- if token in ['graphics', 'debugger']:
1775
- if not hasattr(self.program, 'usingGraphics'):
1776
- print('Loading graphics module')
1777
- from .ec_pyside import Graphics
1778
- self.program.graphics = Graphics
1779
- self.program.useClass(Graphics)
1780
- self.program.usingGraphics = True
1781
- if token == 'debugger': self.program.debugging = True
1782
- return True
1774
+ if token == 'graphics':
1775
+ return self.program.useGraphics()
1783
1776
  return False
1784
1777
 
1785
1778
  # Declare a general-purpose variable