added coloured background options

This commit is contained in:
langolierz
2018-05-02 22:06:27 +00:00
parent 8141073fc1
commit b1cf071e1b
3 changed files with 36 additions and 5 deletions

View File

@@ -231,6 +231,25 @@ class Data(object):
else: else:
return False return False
def get_background_colour(self):
colour_name = self.settings['video']['BACKGROUND_COLOUR']['value']
colour_argb = (255,0,0,0)
if colour_name == "black":
colour_argb = (255,0,0,0)
elif colour_name == "white":
colour_argb = (255,255,255,255)
elif colour_name == "green":
colour_argb = (255,0,255,0)
elif colour_name == "blue":
colour_argb = (255,0,0,255)
elif colour_name == "pink":
colour_argb = (255,255,0,255)
elif colour_name == "none":
colour_argb = (0,0,0,0)
colour_hex = '%02x%02x%02x%02x' % colour_argb
print(colour_hex)
return colour_hex
@staticmethod @staticmethod
def _get_mb_free_diskspace(path): def _get_mb_free_diskspace(path):
st = os.statvfs(path) st = os.statvfs(path)

View File

@@ -93,7 +93,7 @@
"on", "on",
"off" "off"
], ],
"value": "off" "value": "on"
}, },
"QUIT": { "QUIT": {
"action": "quit_the_program", "action": "quit_the_program",
@@ -121,7 +121,7 @@
"on", "on",
"off" "off"
], ],
"value": "on" "value": "off"
}, },
"LOAD_NEXT": { "LOAD_NEXT": {
"action": "update_video_settings", "action": "update_video_settings",
@@ -148,7 +148,7 @@
"nothing", "nothing",
"switch" "switch"
], ],
"value": "switch" "value": "nothing"
}, },
"ON_LOAD": { "ON_LOAD": {
"action": "update_video_settings", "action": "update_video_settings",
@@ -156,7 +156,7 @@
"hide", "hide",
"show" "show"
], ],
"value": "show" "value": "hide"
}, },
"ON_START": { "ON_START": {
"action": "update_video_settings", "action": "update_video_settings",
@@ -178,6 +178,18 @@
} }
}, },
"video": { "video": {
"BACKGROUND_COLOUR": {
"action": null,
"options": [
"pink",
"blue",
"black",
"white",
"green",
"none"
],
"value": "none"
},
"COMPOSITE_PROGRESSIVE": { "COMPOSITE_PROGRESSIVE": {
"action": "change_composite_setting", "action": "change_composite_setting",
"options": [ "options": [

View File

@@ -41,7 +41,7 @@ class VideoPlayer:
is_dev_mode, first_screen_arg, second_screen_arg = self.set_screen_size_for_dev_mode() is_dev_mode, first_screen_arg, second_screen_arg = self.set_screen_size_for_dev_mode()
arguments = ['--no-osd', '--layer', str(layer), '--adev', 'local', '--alpha', '0', first_screen_arg, second_screen_arg] arguments = ['--no-osd', '--layer', str(layer), '--adev', 'local', '--alpha', '0', first_screen_arg, second_screen_arg]
if not is_dev_mode: if not is_dev_mode:
arguments.append('-b') ##=0x000000FF') arguments.append('--blank=0x{}'.format(self.data.get_background_colour()))
self.status = 'LOADING' self.status = 'LOADING'
print('the location is {}'.format(self.location)) print('the location is {}'.format(self.location))
self.omx_player = OMXPlayer(self.location, args=arguments, dbus_name=self.name) self.omx_player = OMXPlayer(self.location, args=arguments, dbus_name=self.name)