From e94b38e014f13f995f14908be023e91d425ae075 Mon Sep 17 00:00:00 2001 From: janis Date: Wed, 24 Aug 2022 12:00:07 +0200 Subject: [PATCH] added fullscreen showcase screen (currently in development and still buggy --- bin/gui/gui.kv | 53 ++++++++++++++++++++++++++++++++++++++++------- data/settings.ini | 10 ++++++++- data/songtemp.csv | 4 ++-- data/temp.csv | 2 +- musicplayer.py | 47 ++++++++++++++++++++++++++++++++--------- 5 files changed, 94 insertions(+), 22 deletions(-) diff --git a/bin/gui/gui.kv b/bin/gui/gui.kv index 08b3da2..0749dfc 100644 --- a/bin/gui/gui.kv +++ b/bin/gui/gui.kv @@ -6,6 +6,28 @@ RootScreen: ########### # POPUPS ########### +: + title: "BiogasControllerApp" + font_size: 50 + size_hint: 0.5, 0.4 + auto_dismiss: False + GridLayout: + cols:1 + Label: + text: "Are you sure you want to leave?" + font_size: 20 + GridLayout: + cols:2 + Button: + text: "Yes" + font_size: 15 + on_release: + app.stop() + Button: + text: "No" + font_size: 15 + on_press: + root.dismiss() : title: "NOTICE!" @@ -95,20 +117,33 @@ RootScreen: text: "" on_text: root.autocomplete() + on_text_validate: + root.change_screen() Label: text: "" pos_hint: {"x": 0.2, "y":1} size_hint: 0.6, 0.3 text_size: self.size id: cmd_output - Button: - text: "Start" - color: app.theme_cls.primary_color - font_size: 30 - bold: True - background_color: (0.5, 0.5, 0.5, 1) - on_release: - root.change_screen() + GridLayout: + cols: 2 + Button: + text: "Start" + color: app.theme_cls.primary_color + font_size: 30 + bold: True + background_color: app.theme_cls.accent_dark + on_release: + root.change_screen() + Button: + text: "Quit" + color: app.theme_cls.primary_color + font_size: 30 + bold: True + background_color: app.theme_cls.accent_dark + on_release: + root.quitapp() +
: on_pre_enter: root.initialize() @@ -171,6 +206,7 @@ RootScreen: root.manager.transition.direction = "left" : + on_leave: root.disablefullscreen() name: "Showcase" md_bg_color: (0, 0, 0, 1) FloatLayout: @@ -229,6 +265,7 @@ RootScreen: text: "Designed and developed by Janis Hutz" font_size: 7 pos_hint: {"y": -0.48} + : name: "Settings" md_bg_color: app.theme_cls.accent_color diff --git a/data/settings.ini b/data/settings.ini index 047caa6..96a3105 100644 --- a/data/settings.ini +++ b/data/settings.ini @@ -3,9 +3,17 @@ # (lower = more up to date but higher resource usage) showcaseRefreshRate = 0.5 +[Display] +width = 800 +height = 600 +launchMaximized = True + [Playback] loopPlayback = 1 [Info] version = V1.1 -subVersion = \ No newline at end of file +subVersion = + +[Dev Settings] +verbose = True \ No newline at end of file diff --git a/data/songtemp.csv b/data/songtemp.csv index c292bb3..147a51a 100644 --- a/data/songtemp.csv +++ b/data/songtemp.csv @@ -1,3 +1,3 @@ 0 -Ancient.mp3,Arm_Candy.mp3,Beach_Disco.mp3,Beach_Walk.mp3,Bird_Therapist.mp3,Carol_of_the_Bells.mp3,Castlevania.mp3,Cats_Searching_for_the_Truth.mp3,Classique.mp3,Cloud_Chaser.mp3,Dragonfly.mp3,Easy_Seas.mp3,Entire.mp3,Eyes_of_Glory.mp3,Finding_Me.mp3,Forgiveness.mp3,Fun_in_the_Sun.mp3,Half_Measures.mp3,Happy_Sixth.mp3,Hear_the_Noise.mp3,Hi_Q.mp3,Hot_Coffee.mp3,How_it_Began.mp3,I_ll_Follow_You.mp3,If_I_Had_a_Chicken.mp3,Jal_Edge_of_Water.mp3,Juno_In_The_Space_Maze.mp3,Ladybug.mp3,Late_Night_Drive.mp3,Meteor.mp3,Modern_Situations.mp3,Move_Out.mp3,Official_National_Anthem.mp3,Plenty_Step.mp3,Point_Green_Getdown.mp3,Retrograde.mp3,Right_Here_Beside_You.mp3,Safety_Net.mp3,Same_Time.mp3,Static.mp3,Stranger_Danger.mp3,Subharmonic_Bliss.mp3,Sun_Machine_One.mp3,The_Computer_Has_Feelings.mp3,Thinking_Of_Us.mp3,This_is_Not_IDM.mp3,This_is_Not_Jazz.mp3,This_is_Not_a_Ballad.mp3,Time_s_Up.mp3,Triumph.mp3,Unstoppable.mp3,Western_Spaghetti.mp3,Zameen_Movement_of_Earth.mp3,bensound-clearday.mp3,bensound-endlessmotion.mp3,bensound-energy.mp3,bensound-happyrock.mp3 -161.23936462402344 +The Day You Went Away.mp3,sha la la.mp3 +221.12362670898438 diff --git a/data/temp.csv b/data/temp.csv index 588b767..6b71cc6 100644 --- a/data/temp.csv +++ b/data/temp.csv @@ -1 +1 @@ -/mnt/DATA/Music/Videos/Songs/ +/mnt/DATA/Music/ diff --git a/musicplayer.py b/musicplayer.py index f0573d1..9d73a5a 100644 --- a/musicplayer.py +++ b/musicplayer.py @@ -1,7 +1,17 @@ -import multiprocessing import os +import configparser + +config = configparser.ConfigParser() +config.read('./data/settings.ini') +co = config['Dev Settings']['verbose'] + +if co == "True": + pass +else: + os.environ["KIVY_NO_CONSOLELOG"] = "1" + import signal -os.environ["KIVY_NO_CONSOLELOG"] = "1" +import multiprocessing from kivy.core.window import Window, Config from kivy.uix.screenmanager import ScreenManager from kivymd.uix.screen import MDScreen @@ -14,12 +24,6 @@ import bin.filepathanalysis import bin.player import math import bin.autocomplete -import configparser - - -config = configparser.ConfigParser() -config.read('./data/settings.ini') -version_app = f"Music Player {config['Info']['version']}{config['Info']['subVersion']}" pl = bin.player.Player() @@ -27,6 +31,7 @@ pa = bin.filepathanalysis.PathAnalysis() cvr = bin.csv_parsers.CsvRead() cvw = bin.csv_parsers.CsvWrite() ac = bin.autocomplete.AutoComplete() +version_app = f"Music Player {config['Info']['version']}{config['Info']['subVersion']}" ########### @@ -34,6 +39,10 @@ ac = bin.autocomplete.AutoComplete() ########### +class QuitPU(Popup): + pass + + class PathMissingPU(Popup): pass @@ -107,6 +116,9 @@ class Home(MDScreen): def reloadf(self, dt): self.ids.filepath.text = self.output + def quitapp(self): + QuitPU().open() + class Main(MDScreen): def __init__(self, **kwargs): @@ -137,6 +149,12 @@ class Main(MDScreen): self.manager.transition.direction = "left" else: pass + elif self.key == "f" and self.manager.current == "Showcase": + if Window.fullscreen == 'auto': + Window.fullscreen = False + else: + Window.fullscreen = 'auto' + Window.maximize() else: pass @@ -255,7 +273,8 @@ class Main(MDScreen): class ShowcaseS(MDScreen): - pass + def disablefullscreen(self): + Window.fullscreen = False class RootScreen(ScreenManager): @@ -277,12 +296,20 @@ class MusicPlayer(MDApp): if __name__ == "__main__": + if config['Display']['launchMaximized'] == "True": + Window.maximize() + else: + pass + try: + Window.size = (int(config['Display']['width']), int(config['Display']['height'])) + except Exception as e: + print("Unvalid config string found for in Display settings") + Config.set('graphics', 'width', '800') Config.set('graphics', 'height', '600') Config.set('graphics', 'resizable', True) Config.set('kivy', 'exit_on_escape', '0') Config.set('input', 'mouse', 'mouse,multitouch_on_demand') Config.set('graphics', 'window_state', 'normal') - Config.set('graphics', 'fullscreen', False) Config.write() MusicPlayer().run()