From 33e83a65995a0c2227612b2e7c0b1585a2ce0c0d Mon Sep 17 00:00:00 2001 From: Brady James Garvin <bgarvin@cse.unl.edu> Date: Wed, 13 Feb 2019 08:41:27 -0600 Subject: [PATCH] Updated code for new Python 3 support in Kivy and to show proper handling of **kwargs. --- .buildozer | 1 + .gitignore | 1 - buildozer.spec | 21 +++++++++++++++------ main.py | 8 ++++---- override.py | 3 +-- 5 files changed, 21 insertions(+), 13 deletions(-) create mode 120000 .buildozer diff --git a/.buildozer b/.buildozer new file mode 120000 index 0000000..50ad1b4 --- /dev/null +++ b/.buildozer @@ -0,0 +1 @@ +/home/cse/.buildozer_share \ No newline at end of file diff --git a/.gitignore b/.gitignore index 992a27a..cd4671c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ *.pyo .idea -.buildozer bin diff --git a/buildozer.spec b/buildozer.spec index 4b2cfe2..df1b89f 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -36,7 +36,7 @@ version = 1.0 # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy -requirements = kivy +requirements = python3,kivy # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes @@ -88,16 +88,16 @@ fullscreen = 0 #android.permissions = INTERNET # (int) Android API to use -#android.api = 19 +android.api = 21 # (int) Minimum API required -#android.minapi = 9 +android.minapi = 21 # (int) Android SDK version to use #android.sdk = 20 # (str) Android NDK version to use -#android.ndk = 9c +android.ndk = 17c # (bool) Use --private data storage (True) or --dir public storage (False) #android.private_storage = True @@ -146,8 +146,11 @@ fullscreen = 0 # bootstrap) #android.gradle_dependencies = +# (list) Java classes to add as activities to the manifest. +#android.add_activites = com.example.ExampleActivity + # (str) python-for-android branch to use, defaults to stable -#p4a.branch = stable +p4a.branch = master # (str) OUYA Console category. Should be one of GAME or APP # If you leave this blank, OUYA support will not be enabled @@ -159,6 +162,9 @@ fullscreen = 0 # (str) XML file to include as an intent filters in <activity> tag #android.manifest.intent_filters = +# (str) launchMode to set for the main activity +#android.manifest.launch_mode = standard + # (list) Android additional libraries to copy into libs/armeabi #android.add_libs_armeabi = libs/android/*.so #android.add_libs_armeabi_v7a = libs/android-v7/*.so @@ -201,6 +207,9 @@ android.arch = armeabi-v7a # (str) Bootstrap to use for android builds # p4a.bootstrap = sdl2 +# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask) +#p4a.port = + # # iOS specific @@ -220,7 +229,7 @@ android.arch = armeabi-v7a [buildozer] # (int) Log level (0 = error only, 1 = info, 2 = debug (with command output)) -log_level = 2 +log_level = 1 # (int) Display warning if buildozer is run as root (0 = False, 1 = True) warn_on_root = 1 diff --git a/main.py b/main.py index 11b5e31..bfb5197 100644 --- a/main.py +++ b/main.py @@ -7,8 +7,8 @@ class OneTimeButton(Button): count = 0 index = NumericProperty() - def __init__(self): - super().__init__() + def __init__(self, **kwargs): + super().__init__(**kwargs) self.index = OneTimeButton.count OneTimeButton.count += 1 @@ -20,8 +20,8 @@ class OneTimeButton(Button): class GuessingButton(Button): hidden_text = StringProperty('') - def __init__(self, hidden_text): - super().__init__() + def __init__(self, hidden_text, **kwargs): + super().__init__(**kwargs) self.hidden_text = hidden_text def on_press(self): diff --git a/override.py b/override.py index b07f965..783f288 100644 --- a/override.py +++ b/override.py @@ -5,8 +5,7 @@ class Person(object): class Patient(Person): def __str__(self): - text = super().__str__() - return 'Patient, a specialization of {text}'.format(text=text) + return f'Patient, a specialization of {super().__str__()}' if __name__ == '__main__': -- GitLab