diff --git a/.buildozer b/.buildozer new file mode 120000 index 0000000000000000000000000000000000000000..50ad1b4c8846dd0c4ab7ec34444fd35bfbab2448 --- /dev/null +++ b/.buildozer @@ -0,0 +1 @@ +/home/cse/.buildozer_share \ No newline at end of file diff --git a/.gitignore b/.gitignore index 992a27a3655d7bf345eb414cab412c0e3183ffb8..cd4671cc426262b4805a15c8dbc6ca97b9217b44 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ *.pyo .idea -.buildozer bin diff --git a/buildozer.spec b/buildozer.spec index 718cbe49228751ecdcff71f3e5b89d33c839926e..dff44564897715aa539237920ac27d3506d3252a 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -35,8 +35,8 @@ version = 0.1 # version.filename = %(source.dir)s/main.py # (list) Application requirements -# comma seperated e.g. requirements = sqlite3,kivy -requirements = kivy,mysql_connector==2.1.4,sqlalchemy +# comma separated e.g. requirements = sqlite3,kivy +requirements = python3,kivy,mysql_connector==2.1.4,sqlalchemy # (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 @@ android.permissions = INTERNET # 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,7 +162,10 @@ android.permissions = INTERNET # (str) XML file to include as an intent filters in <activity> tag #android.manifest.intent_filters = -# (list) Android additionnal libraries to copy into libs/armeabi +# (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 #android.add_libs_x86 = libs/android-x86/*.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 6ead64ce948b59ef356cfcbb23bccd77bf6e477a..0548d875a6d4a907a1fc242a2198a284228b1570 100644 --- a/main.py +++ b/main.py @@ -1,12 +1,10 @@ -from __future__ import print_function - from sys import stderr +from kivy.app import App + from sqlalchemy.exc import SQLAlchemyError from movies import MovieDatabase, Movie, Genre -from kivy.app import App - class MoviesApp(App): def __init__(self, **kwargs): @@ -31,8 +29,9 @@ def main(): app.run() except SQLAlchemyError as exception: print('Initial database connection failed!', file=stderr) - print('Cause: {exception}'.format(exception=exception), file=stderr) + print(f'Cause: {exception}', file=stderr) exit(1) + if __name__ == '__main__': main() diff --git a/movies.kv b/movies.kv index 8fafcdc96391461d868d30297b3b64a553b5d404..f51c2460aed2adb0d921afc5056046fc3cef05fe 100644 --- a/movies.kv +++ b/movies.kv @@ -11,14 +11,14 @@ ScreenManager: Widget: Label: text: 'Movie Title:' - size_hint: (1, None) + size_hint: (1.0, None) height: sp(32) Widget: TextInput: id: title multiline: False write_tab: False - size_hint: (4, None) + size_hint: (4.0, None) height: sp(32) Widget: BoxLayout: @@ -31,7 +31,7 @@ ScreenManager: Label: id: action_label text: 'Action' - size_hint: (None, 1) + size_hint: (None, 1.0) size: self.texture_size Widget: BoxLayout: @@ -44,7 +44,7 @@ ScreenManager: Label: id: adventure_label text: 'Adventure' - size_hint: (None, 1) + size_hint: (None, 1.0) size: self.texture_size Widget: BoxLayout: @@ -57,7 +57,7 @@ ScreenManager: Label: id: sci_fi_label text: 'SciFi' - size_hint: (None, 1) + size_hint: (None, 1.0) size: self.texture_size Widget: BoxLayout: @@ -65,15 +65,15 @@ ScreenManager: Widget: Button: text: 'Create' - size_hint: (4, 1) + size_hint: (4.0, 1.0) on_press: app.create_movie(title.text, action.active, adventure.active, sci_fi.active) Button: text: 'Update' - size_hint: (4, 1) + size_hint: (4.0, 1.0) on_press: app.update_movie(title.text, action.active, adventure.active, sci_fi.active) Button: text: 'Delete' - size_hint: (4, 1) + size_hint: (4.0, 1.0) on_press: app.delete_movie(title.text) Widget: BoxLayout: @@ -82,7 +82,7 @@ ScreenManager: Label: id: message text: '' - size_hint: (None, 1) + size_hint: (None, 1.0) size: self.texture_size Widget: @@ -90,25 +90,25 @@ ScreenManager: <Screen>: canvas.before: Color: - rgba: (1, 1, 1, 1) + rgba: (1.0, 1.0, 1.0, 1.0) Rectangle: pos: self.pos size: self.size # All labels are blue. <Label>: - color: (0, 0, 0.75, 1) + color: (0.0, 0.0, 0.75, 1.0) # All checkboxes are blue. <CheckBox>: canvas: Color: - rgba: (0, 0, 0.75, 1) + rgba: (0.0, 0.0, 0.75, 1.0) Rectangle: - source: 'atlas://data/images/defaulttheme/checkbox{radio}{disabled}{on}'.format(radio=('_radio' if self.group else ''), disabled=('_disabled' if self.disabled else ''), on=('_on' if self.active else '_off')) + source: f'atlas://data/images/defaulttheme/checkbox{"_radio" if self.group else ""}{"_disabled" if self.disabled else ""}{"_on" if self.active else "_off"}' size: sp(32), sp(32) pos: int(self.center_x - sp(16)), int(self.center_y - sp(16)) # All buttons have white text. <Button>: - color: (1, 1, 1, 1) + color: (1.0, 1.0, 1.0, 1.0) diff --git a/movies.py b/movies.py index 4084e69555901052793485fdd46d31680ef5fd04..2d22120cde3e8a31425c4df400a2c470bd1c9354 100644 --- a/movies.py +++ b/movies.py @@ -43,8 +43,7 @@ class MovieGenre(Persisted): class MovieDatabase(object): @staticmethod def construct_mysql_url(authority, port, database, username, password): - return 'mysql+mysqlconnector://{username}:{password}@{authority}:{port}/{database}' \ - .format(authority=authority, port=port, database=database, username=username, password=password) + return f'mysql+mysqlconnector://{username}:{password}@{authority}:{port}/{database}' @staticmethod def construct_in_memory_url(): diff --git a/movies_installer.py b/movies_installer.py index 404a0a50a87965d401ee37cd93deb24c571eb4fb..fb3d41cef69a123319e7edbe59a71ae490763a97 100644 --- a/movies_installer.py +++ b/movies_installer.py @@ -1,7 +1,3 @@ -# -*- coding: utf-8; -*- - -from __future__ import print_function - from sys import stderr from datetime import date @@ -29,7 +25,7 @@ def add_starter_data(session): # 2016 October 15 # Budget: $25,000,000 # Gross Revenue: $206,000,000 - # Sample review from IMBD: + # Sample review from IMDB: # "★★★★★★★★★☆ In the opinion of this reviewer, an extraordinary achievement." hidden_figures = Movie(title='Hidden Figures', budget=25000000, gross_revenue=206000000, opening_date=date(2016, 10, 15), genres=[biography, drama, history]) @@ -38,22 +34,23 @@ def add_starter_data(session): comments='In the opinion of this reviewer, an extraordinary achievement.') session.add(extraordinary_achievement) - # Rogue One (Action, Adventure, SciFi) - # 2016 December 16 - # Budget: $200,000,000 - # Gross Revenue: $1,016,000,000 + # Avengers: Infinity War (Action, Adventure) + # 2018 April 27 + # Budget: $300,000,000 + # Gross Revenue: $2,048,000,000 # Sample reviews from IMDB: - # "★★★★★★★★★☆ I feel like the void left in my heart by Episode VII has been filled now." - # "★★★★★☆☆☆☆☆ Ultimately underwhelming." - rogue_one = Movie(title='Rogue One', budget=200000000, gross_revenue=1016000000, - opening_date=date(2016, 12, 16), genres=[action, adventure, sci_fi]) - session.add(rogue_one) - void_filled = Review(movie=rogue_one, score=9, - comments='I feel like the void left in my heart by Episode VII has been filled now.') - ultimately_underwhelming = Review(movie=rogue_one, score=5, - comments='Ultimately underwhelming.') - session.add(void_filled) - session.add(ultimately_underwhelming) + # "★★★★★★★★★★ A summer film that IS even better than the hype." + # "★★★★★★☆☆☆☆ Bordering on a comedy, "Infinity War" is overhyped, lacked direction, but at times impressed." + infinity_war = Movie(title='Avengers: Infinity War', budget=300000000, gross_revenue=2048000000, + opening_date=date(2018, 4, 27), genres=[action, adventure]) + session.add(infinity_war) + better_than_hype = Review(movie=infinity_war, score=10, + comments='A summer film that IS even better than the hype.') + bordering_on_comedy = Review(movie=infinity_war, score=6, + comments='Bordering on a comedy, "Infinity War" is overhyped, lacked direction, but ' + 'at times impressed.') + session.add(better_than_hype) + session.add(bordering_on_comedy) def main(): @@ -68,8 +65,9 @@ def main(): print('Records created.') except SQLAlchemyError as exception: print('Database setup failed!', file=stderr) - print('Cause: {exception}'.format(exception=exception), file=stderr) + print(f'Cause: {exception}', file=stderr) exit(1) + if __name__ == '__main__': main()