MCPcopy
hub / github.com/pyload/pyload / start

Method start

pyLoadCli.py:90–127  ·  view source on GitHub ↗

main loop. handle input

(self)

Source from the content-addressed store, hash-verified

88 self.headerHandler = self.bodyHandler = self.inputHandler = self
89
90 def start(self):
91 """ main loop. handle input """
92 while True:
93 #inp = raw_input()
94 inp = self.getch.impl()
95 if ord(inp) == 3:
96 os.system("clear")
97 sys.exit() # ctrl + c
98 elif ord(inp) == 13: #enter
99 try:
100 self.lock.acquire()
101 self.inputHandler.onEnter(self.input)
102
103 except Exception, e:
104 println(2, red(e))
105 finally:
106 self.lock.release()
107
108 elif ord(inp) == 127:
109 self.input = self.input[:-1] #backspace
110 try:
111 self.lock.acquire()
112 self.inputHandler.onBackSpace()
113 finally:
114 self.lock.release()
115
116 elif ord(inp) == 27: #ugly symbol
117 pass
118 else:
119 self.input += inp
120 try:
121 self.lock.acquire()
122 self.inputHandler.onChar(inp)
123 finally:
124 self.lock.release()
125
126 self.inputline = self.bodyHandler.renderBody(self.menuline)
127 self.renderFooter(self.inputline)
128
129
130 def refresh(self):

Callers 1

__init__Method · 0.95

Calls 10

renderFooterMethod · 0.95
printlnFunction · 0.85
redFunction · 0.85
acquireMethod · 0.80
exitMethod · 0.45
onEnterMethod · 0.45
releaseMethod · 0.45
onBackSpaceMethod · 0.45
onCharMethod · 0.45
renderBodyMethod · 0.45

Tested by

no test coverage detected