예제 #1
0
    def __init__(self, client, command):
        self.client = client
        self.command = command

        if not self.command:
            renameProcess('pyLoadCli')
            self.getch = Getch()
            self.input = ""
            self.inputline = 0
            self.lastLowestLine = 0
            self.menuline = 0

            self.lock = Lock()

            #processor funcions, these will be changed dynamically depending on control flow
            self.headerHandler = self   #the download status
            self.bodyHandler = self    #the menu section
            self.inputHandler = self

            os.system("clear")
            println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface")))
            println(2, "")

            self.thread = RefreshThread(self)
            self.thread.start()

            self.start()
        else:
            self.processCommand()
예제 #2
0
파일: Cli.py 프로젝트: ASCIIteapot/pyload
    def __init__(self, client, command):
        self.client = client
        self.command = command

        if not self.command:
            renameProcess('pyLoadCli')
            self.getch = Getch()
            self.input = ""
            self.inputline = 0
            self.lastLowestLine = 0
            self.menuline = 0

            self.lock = Lock()

            #processor funcions, these will be changed dynamically depending on control flow
            self.headerHandler = self   #the download status
            self.bodyHandler = self    #the menu section
            self.inputHandler = self

            os.system("clear")
            println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface")))
            println(2, "")

            self.thread = RefreshThread(self)
            self.thread.start()

            self.start()
        else:
            self.processCommand()
예제 #3
0
파일: Cli.py 프로젝트: Kagenoshin/pyload
class Cli:
    def __init__(self, client, command):
        self.client = client
        self.command = command

        if not self.command:
            renameProcess('pyLoadCli')
            self.getch = Getch()
            self.input = ""
            self.inputline = 0
            self.lastLowestLine = 0
            self.menuline = 0

            self.lock = Lock()

            #processor funcions, these will be changed dynamically depending on control flow
            self.headerHandler = self  #the download status
            self.bodyHandler = self  #the menu section
            self.inputHandler = self

            os.system("clear")
            println(
                1,
                blue("py") + yellow("Load") +
                white(_(" Command Line Interface")))
            println(2, "")

            self.thread = RefreshThread(self)
            self.thread.start()

            self.start()
        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:
            #inp = raw_input()
            inp = self.getch.impl()
            if ord(inp) == 3:
                os.system("clear")
                sys.exit()  # ctrl + c
            elif ord(inp) == 13:  #enter
                try:
                    self.lock.acquire()
                    self.inputHandler.onEnter(self.input)

                except Exception, e:
                    println(2, red(e))
                finally:
                    self.lock.release()
예제 #4
0
파일: Cli.py 프로젝트: ASCIIteapot/pyload
class Cli:
    def __init__(self, client, command):
        self.client = client
        self.command = command

        if not self.command:
            renameProcess('pyLoadCli')
            self.getch = Getch()
            self.input = ""
            self.inputline = 0
            self.lastLowestLine = 0
            self.menuline = 0

            self.lock = Lock()

            #processor funcions, these will be changed dynamically depending on control flow
            self.headerHandler = self   #the download status
            self.bodyHandler = self    #the menu section
            self.inputHandler = self

            os.system("clear")
            println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface")))
            println(2, "")

            self.thread = RefreshThread(self)
            self.thread.start()

            self.start()
        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:
            #inp = raw_input()
            inp = self.getch.impl()
            if ord(inp) == 3:
                os.system("clear")
                sys.exit() # ctrl + c
            elif ord(inp) == 13: #enter
                try:
                    self.lock.acquire()
                    self.inputHandler.onEnter(self.input)

                except Exception, e:
                    println(2, red(e))
                finally:
                    self.lock.release()