Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken on kivy-ios #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions libs/uix/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)
Window.bind(on_keyboard=self._handle_keyboard)
# get screen data from screens.json
with open(utils.abs_path("screens.json")) as f:
self.screens_data = json.load(f)
try:
with open(utils.abs_path("YourApp/screens.json")) as f:
self.screens_data = json.load(f)
except:
with open(utils.abs_path("screens.json")) as f:
self.screens_data = json.load(f)

def _handle_keyboard(self, instance, key, *args):
if key == 27:
Expand All @@ -33,9 +37,14 @@ def load_screen(self, screen_name):

# checks if the screen is already added to the screen-manager
if not self.has_screen(screen_name):

screen = self.screens_data[screen_name]
print (screen["kv"],'what the actual fuck')
# load the kv file (libs/uix/kv/screen_kv_file.kv)
Builder.load_file(utils.abs_path(screen["kv"]))
try:
Builder.load_file(utils.abs_path(screen["kv"]))
except:
Builder.load_file("YourApp/"+(screen["kv"]))
# import screen class dynamically
# (from libs.uix.baseclass.screen_py_file import ScreenObjectName)
exec(screen["import"])
Expand Down