123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- #!/usr/bin/python3
-
- import sys
- import os
- import signal
- import subprocess
- import time
- import tty,termios
- import re
- import json
- from pathlib import Path
- import runner_lib as runner
-
-
-
- def action_help():
- global bindings
- print("\nKey\tAction\n--------------------------------------")
- for i in bindings:
- print(" {}\t{}".format(bindings[i],i))
- print("--------------------------------------\n")
-
-
-
- bindings={
- "Show playlist" : "l",
- "Launch [0-x] cmd" : "0-x",
- "Previous command" : "p",
- "Next command" : "o",
- "New command" : "a",
- "Edit command" : "e",
- "Delete command" : "d",
- "Load playlist" : "L",
- "Save playlist" : "S",
- "Save as new" : "A",
- "New playlist" : "N",
- "Command help" : "H",
- "Kill process Id" : "K",
- "Edit Laser Id" : "i",
- "Edit Laser Scene" : "s",
- "Information" : "I",
- "Help" : "h",
- "Quit" : "q",
-
- }
-
-
- ## Init user contact
-
-
-
- # Main Loop
- runner.action_info()
- action_help()
- print("\n\nLoad a playlist? [Y/n]: ")
- if "y" == runner.inkey() :
- runner.action_loadPlaylist()
-
- while True:
- # Fuck zombies
- runner._killBill()
- runner._ok("> Next Action?")
- k = runner.inkey()
-
- if bindings["Next command"] == k:
- runner.action_changeCommand( 1 )
- runner.action_runCommand()
- elif bindings["Previous command"] == k:
- runner.action_changeCommand( -1 )
- runner.action_runCommand()
- elif re.match( r'^\d+$',k):
- runner.action_match(k)
- runner.action_runCommand()
- elif bindings["New command"] == k:
- runner.action_newCommand()
- continue
- elif bindings["Show playlist"] == k:
- runner.action_listAll()
- continue
- elif bindings["Delete command"] == k:
- runner.action_deleteCommand()
- continue
- elif bindings["Edit command"] == k:
- runner.action_listAll()
- runner.action_edit()
- continue
- elif bindings["Load playlist"] == k:
- if runner.action_loadPlaylist():
- runner.action_listAll()
- continue
- elif bindings["Save playlist"] == k:
- runner.action_savePlaylist()
- continue
- elif bindings["Save as new"] == k:
- runner.action_savePlaylist()
- continue
- elif bindings["New playlist"] == k:
- runner.action_newPlaylist()
- continue
- elif bindings["Command help"] == k:
- runner.action_commandHelp()
- continue
- elif bindings["Edit Laser Id"] == k:
- runner.action_laserId()
- continue
- elif bindings["Edit Laser Scene"] == k:
- runner.action_laserScene()
- continue
- elif bindings["Kill process Id"] == k:
- runner.action_killPid()
- continue
- elif bindings["Help"] == k:
- action_help()
- continue
- elif bindings["Information"] == k:
- runner.action_info()
- continue
- elif bindings["Quit"] == k:
- runner.action_quit()
- else:
- runner._err("Unexpected key:{}".format(k))
- continue
-
-
-
|