omnipython-apps 0.1.4.dev9__py3-none-any.whl → 0.1.4.dev10__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.
apps/desktop.py CHANGED
@@ -20,6 +20,7 @@ import os
20
20
  import subprocess
21
21
  import sys
22
22
  import sysconfig
23
+ import traceback
23
24
  from pathlib import Path
24
25
 
25
26
  #: The command the shortcut starts: the one with no terminal window.
@@ -150,8 +151,43 @@ def remove_shortcut() -> Path:
150
151
  return shortcut
151
152
 
152
153
 
154
+ def no_terminal() -> bool:
155
+ """True under Windows' ``omnipython-apps``, which runs with no terminal to print to."""
156
+ return sys.platform == "win32" and sys.stderr is None
157
+
158
+
159
+ def show_error(text: str) -> None:
160
+ """Show *text* in a Windows message box, the one place a run with no terminal can report."""
161
+ import ctypes
162
+
163
+ mb_iconerror = 0x10
164
+ mb_setforeground = 0x10000
165
+ ctypes.windll.user32.MessageBoxW(None, text, "OmniPython Apps", mb_iconerror | mb_setforeground)
166
+
167
+
153
168
  def main(argv: list[str] | None = None) -> int:
154
- """Run Home, or one app, or add or remove the Start menu shortcut."""
169
+ """Run Home, or one app, or add or remove the Start menu shortcut.
170
+
171
+ With no terminal to print to, an error that stops it is shown in a message
172
+ box, rather than lost with the window that never opened.
173
+ """
174
+ if not no_terminal():
175
+ return _main(argv)
176
+ try:
177
+ return _main(argv)
178
+ except SystemExit as exc:
179
+ if exc.code is None or isinstance(exc.code, int):
180
+ raise
181
+ show_error(str(exc.code))
182
+ return 1
183
+ except Exception as exc:
184
+ # The error itself first: the traceback under it can run long.
185
+ error = "".join(traceback.format_exception_only(type(exc), exc)).strip()
186
+ show_error(f"Home couldn't start:\n\n{error}\n\n{traceback.format_exc()}")
187
+ return 1
188
+
189
+
190
+ def _main(argv: list[str] | None) -> int:
155
191
  parser = argparse.ArgumentParser(prog=GUI_COMMAND, description="Start Home, with every app installed.")
156
192
  parser.add_argument("app", nargs="?", help="run this app on its own, without Home")
157
193
  shortcut = parser.add_mutually_exclusive_group()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omnipython-apps
3
- Version: 0.1.4.dev9
3
+ Version: 0.1.4.dev10
4
4
  Summary: Every app for Home, with everything the apps need
5
5
  Author: Brad Barnett
6
6
  License: MIT
@@ -8,14 +8,14 @@ Description-Content-Type: text/markdown
8
8
  Requires-Dist: numpy
9
9
  Requires-Dist: omnipython-audioeffects
10
10
  Requires-Dist: omnipython-audioinstruments
11
- Requires-Dist: omnipython-desktop>=0.8.2.dev12
11
+ Requires-Dist: omnipython-desktop>=0.8.2.dev13
12
12
  Requires-Dist: omnipython-lvgl
13
13
  Requires-Dist: omnipython-palettes
14
14
  Requires-Dist: omnipython-pygraphics
15
15
  Requires-Dist: omnipython>=0.8.1.dev10
16
16
  Requires-Dist: requests
17
17
  Requires-Dist: scipy
18
- Requires-Dist: omnipython-applibs==0.1.4.dev9
18
+ Requires-Dist: omnipython-applibs==0.1.4.dev10
19
19
 
20
20
  # omnipython-apps
21
21
 
@@ -1,5 +1,5 @@
1
1
  apps/__init__.py,sha256=lrxXBVt0CEmuZeZFyxrNRZaK-4iR9ZhOZainQ43e9mQ,155
2
- apps/desktop.py,sha256=b34yGBIgVWgBJie__lDmZkSNWBUXHc186PPfoGnZhDI,6471
2
+ apps/desktop.py,sha256=Mtxu44ylu3v-cV20Fl3TP9AsMq1RJoWGhQxhQ-Qb90I,7693
3
3
  apps/manifest.py,sha256=ExufWnlxnY6jpYOHexOVUKLbmp5BwtlcI2nJFPwCY8w,2560
4
4
  apps/omnipython-apps.ico,sha256=__o2-2FUq3x2_IRhqg42i7FueZDuY0JcUyDtZTLxEx4,32211
5
5
  apps/about/__init__.py,sha256=DWxumTyHXrDP4ot1ElwIYx3X7nW8QXM-lXtXnArA7i4,9049
@@ -214,8 +214,8 @@ apps/weather/app.json,sha256=r46LeVRGD2bWNzL52P3b_NUD2ZlEcHfl98RJYpbvFus,115
214
214
  apps/weather/icons.py,sha256=DSGtZ9GtsnFDGqvxjy_ONkEet7nsbARh79OU0nZTJxE,4842
215
215
  apps/weather/sizing.py,sha256=V5a7cavJOuhBc7is47BapmbD4_TiNUvS1xLDjHAlp2k,2658
216
216
  apps/weather/zippad.py,sha256=Zaw-DfWGXkHs0pu8wF_JPfsbnQakZemKSYzGF6z_Q2Y,6750
217
- omnipython_apps-0.1.4.dev9.dist-info/METADATA,sha256=yHioJbH_jqWTHloiq-KzJWvrmuPhttB8BTuUZVLvcXA,1370
218
- omnipython_apps-0.1.4.dev9.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
219
- omnipython_apps-0.1.4.dev9.dist-info/entry_points.txt,sha256=_FyMC9xyAlIOsHMa6OHFSUiEkrJy2kDTtxrZzs-78hw,114
220
- omnipython_apps-0.1.4.dev9.dist-info/top_level.txt,sha256=tDgFUeDjw0_X74xMPXr2TmKPB7BjXkoRZOavLez_SgE,5
221
- omnipython_apps-0.1.4.dev9.dist-info/RECORD,,
217
+ omnipython_apps-0.1.4.dev10.dist-info/METADATA,sha256=WT81qXSJSOmGJvMBeyFiHGe6a_wtNoQj-jPDENKkHlU,1372
218
+ omnipython_apps-0.1.4.dev10.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
219
+ omnipython_apps-0.1.4.dev10.dist-info/entry_points.txt,sha256=_FyMC9xyAlIOsHMa6OHFSUiEkrJy2kDTtxrZzs-78hw,114
220
+ omnipython_apps-0.1.4.dev10.dist-info/top_level.txt,sha256=tDgFUeDjw0_X74xMPXr2TmKPB7BjXkoRZOavLez_SgE,5
221
+ omnipython_apps-0.1.4.dev10.dist-info/RECORD,,