-
-
Notifications
You must be signed in to change notification settings - Fork 349
/
pursuedpybear.py
71 lines (51 loc) · 1.89 KB
/
pursuedpybear.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from briefcase.plugins.frameworks.base import BaseGuiPlugin
class PursuedPyBearGuiPlugin(BaseGuiPlugin):
name = "PursuedPyBear"
def app_source(self):
return """
import os
import sys
try:
from importlib import metadata as importlib_metadata
except ImportError:
# Backwards compatibility - importlib.metadata was added in Python 3.8
import importlib_metadata
import ppb
class {{ cookiecutter.class_name }}(ppb.Scene):
def __init__(self, **props):
super().__init__(**props)
self.add(ppb.Sprite(
image=ppb.Image('{{ cookiecutter.module_name }}/resources/{{ cookiecutter.app_name }}.png'),
))
def main():
# Linux desktop environments use app's .desktop file to integrate the app
# to their application menus. The .desktop file of this app will include
# StartupWMClass key, set to app's formal name, which helps associate
# app's windows to its menu item.
#
# For association to work any windows of the app must have WMCLASS
# property set to match the value set in app's desktop file. For PPB this
# is set using environment variable.
# Find the name of the module that was used to start the app
app_module = sys.modules['__main__'].__package__
# Retrieve the app's metadata
metadata = importlib_metadata.metadata(app_module)
os.environ['SDL_VIDEO_X11_WMCLASS'] = metadata['Formal-Name']
ppb.run(
starting_scene={{ cookiecutter.class_name }},
title=metadata['Formal-Name'],
)
"""
def requires(self):
return """
"ppb~=1.1",
"""
def linux_appimage_manylinux(self):
return "manylinux2014"
def linux_flatpak_runtime(self):
return "org.freedesktop.Platform"
def linux_flatpak_runtime_version(self):
return "22.08"
def linux_flatpak_sdk(self):
return "org.freedesktop.Sdk"
plugin = PursuedPyBearGuiPlugin