Skip to content

Commit

Permalink
bugfix: display menu was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
outdoorbits committed Nov 19, 2023
1 parent 8c41661 commit e84f1f1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
29 changes: 2 additions & 27 deletions scripts/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@
from PIL import Image, ImageFont

import displaymenu
from lib_display import display_content_files

WORKING_DIR = os.path.dirname(__file__)

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
Expand Down Expand Up @@ -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()
1 change: 1 addition & 0 deletions scripts/displaymenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 26 additions & 1 deletion scripts/lib_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#######################################################################

from display import display_content_files
import lib_log
import lib_setup
import lib_system
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions scripts/lib_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e84f1f1

Please sign in to comment.