Skip to content
Snippets Groups Projects

load assets from bundle path

2 files
+ 2
16
Compare changes
  • Side-by-side
  • Inline

Files

+ 1
15
@@ -9,21 +9,7 @@ import sys
class MOiN(Application):
def __init__(self, app_ctx: ApplicationContext) -> None:
super().__init__(app_ctx)
self.image_path = ""
paths = [path for path in sys.path if path.startswith("/")]
app_names = ["MOiN", "technotroll-MOiN"]
for path in paths:
for app_name in app_names:
self.image_path = path + "/apps/" + app_name + "/moin.png"
# Try to load image from known paths and use first result
try:
os.stat(self.image_path)
break
except OSError:
pass
self.image_path = f"{self.app_ctx.bundle_path}/moin.png"
def draw(self, ctx: Context) -> None:
# Paint the background black
Loading