salabim 25.0.9__py3-none-any.whl → 25.0.9.post1__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.
- salabim/salabim.py +33 -20
- {salabim-25.0.9.dist-info → salabim-25.0.9.post1.dist-info}/METADATA +1 -1
- salabim-25.0.9.post1.dist-info/RECORD +10 -0
- {salabim-25.0.9.dist-info → salabim-25.0.9.post1.dist-info}/WHEEL +1 -1
- salabim-25.0.9.dist-info/RECORD +0 -10
- {salabim-25.0.9.dist-info → salabim-25.0.9.post1.dist-info}/top_level.txt +0 -0
salabim/salabim.py
CHANGED
@@ -57,8 +57,9 @@ Windows = sys.platform.startswith("win")
|
|
57
57
|
PyDroid = sys.platform == "linux" and any("pydroid" in v for v in os.environ.values())
|
58
58
|
PyPy = platform.python_implementation() == "PyPy"
|
59
59
|
Chromebook = "penguin" in platform.uname()
|
60
|
-
|
61
|
-
|
60
|
+
#Xlwings="xlwings" in sys.modules
|
61
|
+
XlWings=sys.platform=="emscripten"
|
62
|
+
Embedded = False # (not ("__file__" in globals())) or ((sys.platform == "emscripten") and not Xlwings) # Python In Excel or pyoide (AnacondaCode or xlwings lite)
|
62
63
|
|
63
64
|
_color_name_to_ANSI = dict(
|
64
65
|
dark_black="\033[0;30m",
|
@@ -115,7 +116,7 @@ def a_log(*args):
|
|
115
116
|
class g: ...
|
116
117
|
|
117
118
|
|
118
|
-
if
|
119
|
+
if Embedded:
|
119
120
|
_pie_result = []
|
120
121
|
|
121
122
|
def pie_result():
|
@@ -190,7 +191,7 @@ if Pythonista:
|
|
190
191
|
inf = float("inf")
|
191
192
|
nan = float("nan")
|
192
193
|
|
193
|
-
if Pythonista or
|
194
|
+
if Pythonista or Embedded or Xlwings:
|
194
195
|
_yieldless = False
|
195
196
|
else:
|
196
197
|
_yieldless = True
|
@@ -228,6 +229,13 @@ def yieldless(value: bool = None) -> bool:
|
|
228
229
|
|
229
230
|
global _yieldless
|
230
231
|
if value is not None:
|
232
|
+
if value:
|
233
|
+
if Pythonista:
|
234
|
+
raise ValueError('yiedless mode is not allowed under Pythonista')
|
235
|
+
if Embedded:
|
236
|
+
raise ValueError('yiedless mode is not allowed under Python in Excel or Anaconda Code')
|
237
|
+
if Xlwings:
|
238
|
+
raise ValueError('yiedless mode is not allowed under xlwings lite')
|
231
239
|
_yieldless = value
|
232
240
|
return _yieldless
|
233
241
|
|
@@ -10551,7 +10559,7 @@ class Environment:
|
|
10551
10559
|
isdefault_env: bool = True,
|
10552
10560
|
retina: bool = False,
|
10553
10561
|
do_reset: bool = None,
|
10554
|
-
blind_animation: bool =
|
10562
|
+
blind_animation: bool = None,
|
10555
10563
|
yieldless: bool = None,
|
10556
10564
|
**kwargs,
|
10557
10565
|
):
|
@@ -10648,10 +10656,15 @@ class Environment:
|
|
10648
10656
|
self.stopped = False
|
10649
10657
|
self._paused = False
|
10650
10658
|
self.last_s0 = ""
|
10651
|
-
if
|
10652
|
-
|
10659
|
+
if Embedded or Xlwings:
|
10660
|
+
if blind_animation is None:
|
10661
|
+
blind_animation=True
|
10662
|
+
if not blind_animation:
|
10663
|
+
raise ValueError("blind_animation may not be False under xlwings lite")
|
10653
10664
|
else:
|
10654
|
-
|
10665
|
+
if blind_animation is None:
|
10666
|
+
blind_animation=False
|
10667
|
+
self._blind_animation = blind_animation
|
10655
10668
|
|
10656
10669
|
if self._blind_animation:
|
10657
10670
|
with self.suppress_trace():
|
@@ -11945,7 +11958,7 @@ class Environment:
|
|
11945
11958
|
if self._video_pingpong:
|
11946
11959
|
self._images.extend(self._images[::-1])
|
11947
11960
|
if self._video_repeat == 1: # in case of repeat == 1, loop should not be specified (otherwise, it might show twice)
|
11948
|
-
if
|
11961
|
+
if Embedded:
|
11949
11962
|
with b64_file_handler(self._video_name, mode="b", result=_pie_result) as f:
|
11950
11963
|
self._images[0].save(
|
11951
11964
|
f,
|
@@ -11972,7 +11985,7 @@ class Environment:
|
|
11972
11985
|
self._images = [image.convert("RGB") for image in self._images]
|
11973
11986
|
|
11974
11987
|
else:
|
11975
|
-
if
|
11988
|
+
if Embedded:
|
11976
11989
|
with b64_file_handler(self._video_name, mode="b", result=_pie_result) as f:
|
11977
11990
|
self._images[0].save(
|
11978
11991
|
f,
|
@@ -13589,7 +13602,7 @@ class Environment:
|
|
13589
13602
|
mode = "RGB"
|
13590
13603
|
else:
|
13591
13604
|
raise ValueError("extension " + extension + " not supported")
|
13592
|
-
if
|
13605
|
+
if Embedded:
|
13593
13606
|
with b64_file_handler(str(filename), mode="b", result=_pie_result) as f:
|
13594
13607
|
format = "jpeg" if extension == ".jpg" else extension[1:]
|
13595
13608
|
self._capture_image(mode, video_mode).save(f, format=format)
|
@@ -14606,15 +14619,15 @@ class Environment:
|
|
14606
14619
|
note that the header is only printed if trace=True
|
14607
14620
|
"""
|
14608
14621
|
len_s1 = len(self.time_to_str(0))
|
14609
|
-
self.print_trace((len_s1 - 4) * " " + "time", "current component", "action", "information", "" if (
|
14610
|
-
self.print_trace(len_s1 * "-", 20 * "-", 35 * "-", 48 * "-", "" if (
|
14622
|
+
self.print_trace((len_s1 - 4) * " " + "time", "current component", "action", "information", "" if (Embedded) else "line#")
|
14623
|
+
self.print_trace(len_s1 * "-", 20 * "-", 35 * "-", 48 * "-", "" if (Embedded) else 6 * "-")
|
14611
14624
|
for ref in range(len(self._source_files)):
|
14612
14625
|
for fullfilename, iref in self._source_files.items():
|
14613
14626
|
if ref == iref:
|
14614
14627
|
self._print_legend(iref)
|
14615
14628
|
|
14616
14629
|
def _print_legend(self, ref):
|
14617
|
-
if
|
14630
|
+
if Embedded:
|
14618
14631
|
return
|
14619
14632
|
if ref:
|
14620
14633
|
s = "line numbers prefixed by " + chr(ord("A") + ref - 1) + " refer to"
|
@@ -14632,7 +14645,7 @@ class Environment:
|
|
14632
14645
|
return self.filename_lineno_to_str(frameinfo.filename, frameinfo.lineno)
|
14633
14646
|
|
14634
14647
|
def filename_lineno_to_str(self, filename, lineno):
|
14635
|
-
if
|
14648
|
+
if Embedded:
|
14636
14649
|
return "n/a"
|
14637
14650
|
if Path(filename).name == Path(__file__).name: # internal salabim address
|
14638
14651
|
return "n/a"
|
@@ -25137,7 +25150,7 @@ def _check_overlapping_parameters(obj, method_name0, method_name1,process=None):
|
|
25137
25150
|
|
25138
25151
|
@functools.lru_cache()
|
25139
25152
|
def _screen_dimensions():
|
25140
|
-
if
|
25153
|
+
if Embedded or Xlwings:
|
25141
25154
|
return 1024, 768
|
25142
25155
|
if Pythonista:
|
25143
25156
|
screen_width, screen_height = ui.get_screen_size()
|
@@ -27165,7 +27178,7 @@ def _std_fonts():
|
|
27165
27178
|
|
27166
27179
|
|
27167
27180
|
def fonts():
|
27168
|
-
if
|
27181
|
+
if Embedded or Xlwings:
|
27169
27182
|
return []
|
27170
27183
|
if not hasattr(fonts, "font_list"):
|
27171
27184
|
fonts.font_list = []
|
@@ -27438,7 +27451,7 @@ def can_animate(try_only: bool = True) -> bool:
|
|
27438
27451
|
except ImportError:
|
27439
27452
|
ImageGrab = None
|
27440
27453
|
|
27441
|
-
if not Pythonista and not (
|
27454
|
+
if not Pythonista and not (Embedded or Xlwings):
|
27442
27455
|
from PIL import ImageTk
|
27443
27456
|
except ImportError:
|
27444
27457
|
if try_only:
|
@@ -27447,7 +27460,7 @@ def can_animate(try_only: bool = True) -> bool:
|
|
27447
27460
|
|
27448
27461
|
g.dummy_image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
|
27449
27462
|
|
27450
|
-
if not Pythonista and not (
|
27463
|
+
if not Pythonista and not (Embedded or Xlwings):
|
27451
27464
|
if PyDroid:
|
27452
27465
|
if not g.tkinter_loaded:
|
27453
27466
|
if try_only:
|
@@ -27951,7 +27964,7 @@ def captured_stdout_as_file(file: Union[str, Path, "file"], mode: str = None):
|
|
27951
27964
|
file.write(captured_stdout_as_str())
|
27952
27965
|
|
27953
27966
|
|
27954
|
-
def captured_stdout_as_list(
|
27967
|
+
def captured_stdout_as_list() -> list:
|
27955
27968
|
"""
|
27956
27969
|
returns the captured stdout as a list of strings
|
27957
27970
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
salabim/DejaVuSansMono.ttf,sha256=Z_oIXp5yp1Zaw2y2p3vaxwHhjHpG0MFbmwhxSh4aIEI,335068
|
2
|
+
salabim/LICENSE.txt,sha256=eTPlcDJz4G0096Qv-wfMjm1Wxbd4ilDlsYg5rN4HjWQ,1106
|
3
|
+
salabim/__init__.py,sha256=r7qPLvlmX0dkZDyjuTo8Jo3ex3sD1L4pmK6K5ib9vyw,56
|
4
|
+
salabim/calibri.ttf,sha256=RWpf8Uo31RfvGGNaSt9-2sXSuN87AVE_NFMRsV3LhBk,1330156
|
5
|
+
salabim/mplus-1m-regular.ttf,sha256=EuFHr90BJjuAn_r5MleJFN-WfkeWJ4tf7DweI5zr8tU,289812
|
6
|
+
salabim/salabim.py,sha256=NqBc-nHOhBooYA8CPsVMhGaXCgSnyP4bdMpZfgFiSrE,1125989
|
7
|
+
salabim-25.0.9.post1.dist-info/METADATA,sha256=DhaAY8DEfPtIcM6l7yrKKrAQ_rPj7AiBdH_B0hyCxy8,3405
|
8
|
+
salabim-25.0.9.post1.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
9
|
+
salabim-25.0.9.post1.dist-info/top_level.txt,sha256=UE6zVlbi3F6T5ma1a_5TrojMaF21GYKDt9svvm0U4cQ,8
|
10
|
+
salabim-25.0.9.post1.dist-info/RECORD,,
|
salabim-25.0.9.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
salabim/DejaVuSansMono.ttf,sha256=Z_oIXp5yp1Zaw2y2p3vaxwHhjHpG0MFbmwhxSh4aIEI,335068
|
2
|
-
salabim/LICENSE.txt,sha256=eTPlcDJz4G0096Qv-wfMjm1Wxbd4ilDlsYg5rN4HjWQ,1106
|
3
|
-
salabim/__init__.py,sha256=r7qPLvlmX0dkZDyjuTo8Jo3ex3sD1L4pmK6K5ib9vyw,56
|
4
|
-
salabim/calibri.ttf,sha256=RWpf8Uo31RfvGGNaSt9-2sXSuN87AVE_NFMRsV3LhBk,1330156
|
5
|
-
salabim/mplus-1m-regular.ttf,sha256=EuFHr90BJjuAn_r5MleJFN-WfkeWJ4tf7DweI5zr8tU,289812
|
6
|
-
salabim/salabim.py,sha256=vSMVcWlHrZKShotu15QJ_THLqTUbheGw5gsLnoDhca0,1125470
|
7
|
-
salabim-25.0.9.dist-info/METADATA,sha256=cJClhCPVdf31-iu49ZJwLmP1u43l6MFBUZBesLrf92s,3399
|
8
|
-
salabim-25.0.9.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
9
|
-
salabim-25.0.9.dist-info/top_level.txt,sha256=UE6zVlbi3F6T5ma1a_5TrojMaF21GYKDt9svvm0U4cQ,8
|
10
|
-
salabim-25.0.9.dist-info/RECORD,,
|
File without changes
|