salabim 24.0.10.post4__py3-none-any.whl → 24.0.10.post7__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 CHANGED
@@ -59,7 +59,8 @@ Windows = sys.platform.startswith("win")
59
59
  PyDroid = sys.platform == "linux" and any("pydroid" in v for v in os.environ.values())
60
60
  PyPy = platform.python_implementation() == "PyPy"
61
61
  Chromebook = "penguin" in platform.uname()
62
- PythonInExcel = not ("__file__" in globals()) or ("REF" in globals()) # REF is for AnacondaCode
62
+ PythonInExcel = not ("__file__" in globals())
63
+ AnacondaCode="pyscript" in sys.modules
63
64
 
64
65
  my_globals=globals()
65
66
 
@@ -76,7 +77,7 @@ def a_log(*args):
76
77
  class g: ...
77
78
 
78
79
 
79
- if PythonInExcel:
80
+ if (PythonInExcel or AnacondaCode):
80
81
  _pie_result = []
81
82
 
82
83
  def pie_result():
@@ -10208,7 +10209,7 @@ class Environment:
10208
10209
  self.stopped = False
10209
10210
  self._paused = False
10210
10211
  self.last_s0 = ""
10211
- if PythonInExcel:
10212
+ if (PythonInExcel or AnacondaCode):
10212
10213
  self._blind_animation = True
10213
10214
  else:
10214
10215
  self._blind_animation = blind_animation
@@ -11503,7 +11504,7 @@ class Environment:
11503
11504
  if self._video_pingpong:
11504
11505
  self._images.extend(self._images[::-1])
11505
11506
  if self._video_repeat == 1: # in case of repeat == 1, loop should not be specified (otherwise, it might show twice)
11506
- if PythonInExcel: # ***
11507
+ if (PythonInExcel or AnacondaCode): # ***
11507
11508
  with b64_file_handler(self._video_name, mode="b", result=_pie_result) as f:
11508
11509
  self._images[0].save(
11509
11510
  f,
@@ -11524,7 +11525,7 @@ class Environment:
11524
11525
  optimize=False,
11525
11526
  )
11526
11527
  else:
11527
- if PythonInExcel: # ***
11528
+ if (PythonInExcel or AnacondaCode): # ***
11528
11529
  with b64_file_handler(self._video_name, mode="b", result=_pie_result) as f:
11529
11530
  self._images[0].save(
11530
11531
  f,
@@ -13113,7 +13114,7 @@ class Environment:
13113
13114
  mode = "RGB"
13114
13115
  else:
13115
13116
  raise ValueError("extension " + extension + " not supported")
13116
- if PythonInExcel:
13117
+ if (PythonInExcel or AnacondaCode):
13117
13118
  with b64_file_handler(str(filename), mode="b", result=_pie_result) as f:
13118
13119
  format = "jpeg" if extension == ".jpg" else extension[1:]
13119
13120
  self._capture_image(mode, video_mode).save(f, format=format)
@@ -14130,15 +14131,15 @@ class Environment:
14130
14131
  note that the header is only printed if trace=True
14131
14132
  """
14132
14133
  len_s1 = len(self.time_to_str(0))
14133
- self.print_trace((len_s1 - 4) * " " + "time", "current component", "action", "information", "" if PythonInExcel else "line#")
14134
- self.print_trace(len_s1 * "-", 20 * "-", 35 * "-", 48 * "-", "" if PythonInExcel else 6 * "-")
14134
+ self.print_trace((len_s1 - 4) * " " + "time", "current component", "action", "information", "" if (PythonInExcel or AnacondaCode) else "line#")
14135
+ self.print_trace(len_s1 * "-", 20 * "-", 35 * "-", 48 * "-", "" if (PythonInExcel or AnacondaCode) else 6 * "-")
14135
14136
  for ref in range(len(self._source_files)):
14136
14137
  for fullfilename, iref in self._source_files.items():
14137
14138
  if ref == iref:
14138
14139
  self._print_legend(iref)
14139
14140
 
14140
14141
  def _print_legend(self, ref):
14141
- if PythonInExcel:
14142
+ if (PythonInExcel or AnacondaCode):
14142
14143
  return
14143
14144
  if ref:
14144
14145
  s = "line numbers prefixed by " + chr(ord("A") + ref - 1) + " refer to"
@@ -14156,7 +14157,7 @@ class Environment:
14156
14157
  return self.filename_lineno_to_str(frameinfo.filename, frameinfo.lineno)
14157
14158
 
14158
14159
  def filename_lineno_to_str(self, filename, lineno):
14159
- if PythonInExcel:
14160
+ if (PythonInExcel or AnacondaCode):
14160
14161
  return "n/a"
14161
14162
  if Path(filename).name == Path(__file__).name: # internal salabim address
14162
14163
  return "n/a"
@@ -24263,7 +24264,7 @@ def _set_name(name, _nameserialize, object):
24263
24264
 
24264
24265
  @functools.lru_cache()
24265
24266
  def _screen_dimensions():
24266
- if PythonInExcel:
24267
+ if (PythonInExcel or AnacondaCode):
24267
24268
  return 1024, 768
24268
24269
  if Pythonista:
24269
24270
  screen_width, screen_height = ui.get_screen_size()
@@ -26279,7 +26280,7 @@ def _std_fonts():
26279
26280
 
26280
26281
 
26281
26282
  def fonts():
26282
- if PythonInExcel:
26283
+ if (PythonInExcel or AnacondaCode):
26283
26284
  return []
26284
26285
  if not hasattr(fonts, "font_list"):
26285
26286
  fonts.font_list = []
@@ -26552,7 +26553,7 @@ def can_animate(try_only: bool = True) -> bool:
26552
26553
  except ImportError:
26553
26554
  ImageGrab = None
26554
26555
 
26555
- if not Pythonista and not PythonInExcel:
26556
+ if not Pythonista and not (PythonInExcel or AnacondaCode):
26556
26557
  from PIL import ImageTk
26557
26558
  except ImportError:
26558
26559
  if try_only:
@@ -26561,7 +26562,7 @@ def can_animate(try_only: bool = True) -> bool:
26561
26562
 
26562
26563
  g.dummy_image = Image.new("RGBA", (1, 1), (0, 0, 0, 0))
26563
26564
 
26564
- if not Pythonista and not PythonInExcel:
26565
+ if not Pythonista and not (PythonInExcel or AnacondaCode):
26565
26566
  if PyDroid:
26566
26567
  if not g.tkinter_loaded:
26567
26568
  if try_only:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: salabim
3
- Version: 24.0.10.post4
3
+ Version: 24.0.10.post7
4
4
  Summary: salabim - discrete event simulation in Python
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://salabim.org
@@ -3,8 +3,8 @@ salabim/LICENSE.txt,sha256=qHlBa-POyexatCxDTjSKMlYtkBFQDn9lu-YV_1L6V0U,1106
3
3
  salabim/__init__.py,sha256=r7qPLvlmX0dkZDyjuTo8Jo3ex3sD1L4pmK6K5ib9vyw,56
4
4
  salabim/calibri.ttf,sha256=RWpf8Uo31RfvGGNaSt9-2sXSuN87AVE_NFMRsV3LhBk,1330156
5
5
  salabim/mplus-1m-regular.ttf,sha256=EuFHr90BJjuAn_r5MleJFN-WfkeWJ4tf7DweI5zr8tU,289812
6
- salabim/salabim.py,sha256=7nfMVUUYY0hdAF9Ad7m_vveakfTeOfuFdQyLB7j9Mko,1097162
7
- salabim-24.0.10.post4.dist-info/METADATA,sha256=g7afDySuJ2GQ9eohILH_lgrn_SvtHj8kRD7loKwvfK8,3456
8
- salabim-24.0.10.post4.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
9
- salabim-24.0.10.post4.dist-info/top_level.txt,sha256=UE6zVlbi3F6T5ma1a_5TrojMaF21GYKDt9svvm0U4cQ,8
10
- salabim-24.0.10.post4.dist-info/RECORD,,
6
+ salabim/salabim.py,sha256=yyyM6mbz3x8EQ6AEnUR02aIIZUmbYQJZAsl7CdaFX2Y,1097385
7
+ salabim-24.0.10.post7.dist-info/METADATA,sha256=Gq2zYDUNDEGm0bGsKCjL5e6eeZ_nBGtgBZ4RwuiUx7A,3456
8
+ salabim-24.0.10.post7.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
9
+ salabim-24.0.10.post7.dist-info/top_level.txt,sha256=UE6zVlbi3F6T5ma1a_5TrojMaF21GYKDt9svvm0U4cQ,8
10
+ salabim-24.0.10.post7.dist-info/RECORD,,