Update actions.py

i think its the same pretty much as you had it , just wanted to show what i was thinking - (i havnt tested this btw so might not work exactly) but yeah havnt had time to test these yet coz im travelling but will merge in your changes as soon as i get the chance :)
This commit is contained in:
langolierz
2018-10-24 11:35:06 -04:00
committed by GitHub
parent fffd96293f
commit 6a792e7f91

View File

@@ -113,24 +113,16 @@ class Actions(object):
self.video_driver.next_player.toggle_show() self.video_driver.next_player.toggle_show()
def increase_seek_time(self): def increase_seek_time(self):
for index, i in enumerate(self.data.settings['sampler']['SEEK_TIME']['options']): options = self.data.settings['sampler']['SEEK_TIME']['options']
if (i == self.data.settings['sampler']['SEEK_TIME']['value']) and ((index + 1) != len(self.data.settings['sampler']['SEEK_TIME']['options'])): current_index = [index for index, item in enumerate(options) if item == self.data.settings['sampler']['SEEK_TIME']['value'] ][0]
self.data.settings['sampler']['SEEK_TIME']['value'] = self.data.settings['sampler']['SEEK_TIME']['options'][(index + 1)] self.data.settings['sampler']['SEEK_TIME']['value'] = options + 1 % len(options)
break
if (index >= (len(self.data.settings['sampler']['SEEK_TIME']['options']) - 1)):
index = 0
self.data.settings['sampler']['SEEK_TIME']['value'] = self.data.settings['sampler']['SEEK_TIME']['options'][index]
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's') self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's')
def decrease_seek_time(self): def decrease_seek_time(self):
for index, i in enumerate(self.data.settings['sampler']['SEEK_TIME']['options']): options = self.data.settings['sampler']['SEEK_TIME']['options']
if (i == self.data.settings['sampler']['SEEK_TIME']['value']) and (index != 0): current_index = [index for index, item in enumerate(options) if item == self.data.settings['sampler']['SEEK_TIME']['value'] ][0]
self.data.settings['sampler']['SEEK_TIME']['value'] = self.data.settings['sampler']['SEEK_TIME']['options'][(index - 1)] self.data.settings['sampler']['SEEK_TIME']['value'] = options - 1 % len(options)
break
if self.data.settings['sampler']['SEEK_TIME']['value'] == self.data.settings['sampler']['SEEK_TIME']['options'][0]:
index = len(self.data.settings['sampler']['SEEK_TIME']['options']) - 1
self.data.settings['sampler']['SEEK_TIME']['value'] = self.data.settings['sampler']['SEEK_TIME']['options'][index]
self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's') self.message_handler.set_message('INFO', 'The Seek Time is now ' + str(self.data.settings['sampler']['SEEK_TIME']['value']) + 's')