summaryrefslogtreecommitdiffstats
path: root/pyload/cli/Cli.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-13 17:20:59 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-13 17:20:59 +0200
commite00ef98491f79ae8aa972ae1473dae4a7b78c07e (patch)
tree31be0c7cdcebb61525bcc387bcf15d265a1c494a /pyload/cli/Cli.py
parentFix except (diff)
downloadpyload-e00ef98491f79ae8aa972ae1473dae4a7b78c07e.tar.xz
Cleanup
Diffstat (limited to 'pyload/cli/Cli.py')
-rw-r--r--pyload/cli/Cli.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py
index d8c8602fc..855ef47cc 100644
--- a/pyload/cli/Cli.py
+++ b/pyload/cli/Cli.py
@@ -36,6 +36,7 @@ from Getch import Getch
from rename_process import renameProcess
class Cli(object):
+
def __init__(self, client, command):
self.client = client
self.command = command
@@ -66,11 +67,13 @@ class Cli(object):
else:
self.processCommand()
+
def reset(self):
""" reset to initial main menu """
self.input = ""
self.headerHandler = self.bodyHandler = self.inputHandler = self
+
def start(self):
""" main loop. handle input """
while True:
@@ -130,11 +133,13 @@ class Cli(object):
def setInput(self, string=""):
self.input = string
+
def setHandler(self, klass):
#create new handler with reference to cli
self.bodyHandler = self.inputHandler = klass(self)
self.input = ""
+
def renderHeader(self, line):
""" prints download status """
#print updated information
@@ -182,6 +187,7 @@ class Cli(object):
return line + 1
+
def renderBody(self, line):
""" prints initial menu """
println(line, white(_("Menu:")))
@@ -195,6 +201,7 @@ class Cli(object):
return line + 8
+
def renderFooter(self, line):
""" prints out the input line with input """
println(line, "")
@@ -212,6 +219,7 @@ class Cli(object):
#set cursor to position
print "\033[" + str(self.inputline) + ";0H"
+
def onChar(self, char):
""" default no special handling for single chars """
if char == "1":
@@ -232,12 +240,15 @@ class Cli(object):
os.system('clear')
sys.exit()
+
def onEnter(self, inp):
pass
+
def onBackSpace(self):
pass
+
def processCommand(self):
command = self.command[0]
args = []
@@ -339,6 +350,7 @@ class Cli(object):
else:
print_commands()
+
def printOnlineCheck(self, client, rid):
while True:
sleep(1)
@@ -354,11 +366,13 @@ class Cli(object):
class RefreshThread(Thread):
+
def __init__(self, cli):
Thread.__init__(self)
self.setDaemon(True)
self.cli = cli
+
def run(self):
while True:
sleep(1)