From e84f1f12b814e294a8aa0e730909b5db5b63f0ba Mon Sep 17 00:00:00 2001 From: outdoorbits Date: Sun, 19 Nov 2023 23:52:48 +0100 Subject: [PATCH] bugfix: display menu was broken --- scripts/display.py | 29 ++--------------------------- scripts/displaymenu.py | 1 + scripts/lib_display.py | 27 ++++++++++++++++++++++++++- scripts/lib_storage.py | 3 +-- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/scripts/display.py b/scripts/display.py index 838410e2..e02ea7e2 100644 --- a/scripts/display.py +++ b/scripts/display.py @@ -58,6 +58,7 @@ from PIL import Image, ImageFont import displaymenu +from lib_display import display_content_files WORKING_DIR = os.path.dirname(__file__) @@ -65,7 +66,7 @@ class DISPLAY(object): def __init__(self): # objects - self.__setup = lib_setup.setup() + self.__setup = lib_setup.setup() self.__display_content_files = display_content_files(self.__setup) # setup @@ -377,32 +378,6 @@ def main(self): time.sleep(frame_time) -class display_content_files(object): - - def __init__(self, setup): - self.const_DISPLAY_CONTENT_FOLDER = setup.get_val('const_DISPLAY_CONTENT_FOLDER') - - def get_ContentFilesList(self): - - # read ContentFilesList from folder - try: - ContentFilesList = os.listdir(self.const_DISPLAY_CONTENT_FOLDER) - except: - ContentFilesList = [] - - # keep files only in ContentFilesList - ContentFilesList = [f"{self.const_DISPLAY_CONTENT_FOLDER}/{filename}" for filename in ContentFilesList if os.path.isfile(f"{self.const_DISPLAY_CONTENT_FOLDER}/{filename}")] - - ContentFilesList.sort() - - return(ContentFilesList) - - def get_next_file_name(self): - ContentFilesList = self.get_ContentFilesList() - - if ContentFilesList: - return(ContentFilesList[0]) - if __name__ == "__main__": display = DISPLAY() display.main() diff --git a/scripts/displaymenu.py b/scripts/displaymenu.py index 5f985910..9d7daeee 100644 --- a/scripts/displaymenu.py +++ b/scripts/displaymenu.py @@ -466,6 +466,7 @@ def move_right(self,channel): self.display(channel) def move_left(self,channel): + print('left xxx',file=sys.stderr) if not self.bouncing(channel): if self.MENU_LEVEL > 0: self.MENU_LEVEL += -1 diff --git a/scripts/lib_display.py b/scripts/lib_display.py index 2d52a2c6..b5a70eeb 100644 --- a/scripts/lib_display.py +++ b/scripts/lib_display.py @@ -17,7 +17,6 @@ # along with this program. If not, see . ####################################################################### -from display import display_content_files import lib_log import lib_setup import lib_system @@ -117,6 +116,32 @@ def wait_for_empty_stack(self): self.__start_display() time.sleep(self.conf_DISP_FRAME_TIME / 2) +class display_content_files(object): + + def __init__(self, setup): + self.const_DISPLAY_CONTENT_FOLDER = setup.get_val('const_DISPLAY_CONTENT_FOLDER') + + def get_ContentFilesList(self): + + # read ContentFilesList from folder + try: + ContentFilesList = os.listdir(self.const_DISPLAY_CONTENT_FOLDER) + except: + ContentFilesList = [] + + # keep files only in ContentFilesList + ContentFilesList = [f"{self.const_DISPLAY_CONTENT_FOLDER}/{filename}" for filename in ContentFilesList if os.path.isfile(f"{self.const_DISPLAY_CONTENT_FOLDER}/{filename}")] + + ContentFilesList.sort() + + return(ContentFilesList) + + def get_next_file_name(self): + ContentFilesList = self.get_ContentFilesList() + + if ContentFilesList: + return(ContentFilesList[0]) + if __name__ == "__main__": #catch all arguments as lines to display disp = display() diff --git a/scripts/lib_storage.py b/scripts/lib_storage.py index aa92fb4d..952999f3 100644 --- a/scripts/lib_storage.py +++ b/scripts/lib_storage.py @@ -594,8 +594,7 @@ def mounted(self,MountPoint=''): if self.StorageType == 'camera': return(self.__camera_connected) - ## - # define MountPointSearch + # define relevant MountPoint if MountPoint: pass elif self.MountPoint: