mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
The sounds tutorial is now sorted in alphabetical order.
This commit is contained in:
parent
141d8fa105
commit
21c6a999b4
11
src/extra/SoundsTutorial/reverse_sort.py
Normal file
11
src/extra/SoundsTutorial/reverse_sort.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#Reverse sort, by Bill Dengler <codeofdusk@gmail.com> for use in TWBlue http://twblue.es
|
||||||
|
def invert_tuples(t):
|
||||||
|
"Invert a list of tuples, so that the 0th element becomes the -1th, and the -1th becomes the 0th."
|
||||||
|
res=[]
|
||||||
|
for i in t:
|
||||||
|
res.append(i[::-1])
|
||||||
|
return res
|
||||||
|
|
||||||
|
def reverse_sort(t):
|
||||||
|
"Sorts a list of tuples/lists by their last elements, not their first."
|
||||||
|
return invert_tuples(sorted(invert_tuples(t)))
|
@ -4,6 +4,7 @@ import widgetUtils
|
|||||||
import os
|
import os
|
||||||
import paths
|
import paths
|
||||||
import logging
|
import logging
|
||||||
|
import reverse_sort
|
||||||
log = logging.getLogger("extra.SoundsTutorial.soundsTutorial")
|
log = logging.getLogger("extra.SoundsTutorial.soundsTutorial")
|
||||||
import soundsTutorial_constants
|
import soundsTutorial_constants
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
@ -22,6 +23,8 @@ class soundsTutorial(object):
|
|||||||
self.files = []
|
self.files = []
|
||||||
log.debug("Searching sound files...")
|
log.debug("Searching sound files...")
|
||||||
[self.files.append(i[0]) for i in soundsTutorial_constants.actions]
|
[self.files.append(i[0]) for i in soundsTutorial_constants.actions]
|
||||||
|
log.debug("Alphabetizing actions...")
|
||||||
|
actions=reverse_sort.reverse_sort(actions)
|
||||||
log.debug("Creating dialog...")
|
log.debug("Creating dialog...")
|
||||||
self.dialog = UI.soundsTutorialDialog(self.actions)
|
self.dialog = UI.soundsTutorialDialog(self.actions)
|
||||||
widgetUtils.connect_event(self.dialog.play, widgetUtils.BUTTON_PRESSED, self.on_play)
|
widgetUtils.connect_event(self.dialog.play, widgetUtils.BUTTON_PRESSED, self.on_play)
|
||||||
|
Loading…
Reference in New Issue
Block a user