|
|
@ -19,8 +19,6 @@ import os
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
import urllib2
|
|
|
|
import urllib2
|
|
|
|
import select
|
|
|
|
import select
|
|
|
|
import termios
|
|
|
|
|
|
|
|
import atexit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from display import Display
|
|
|
|
from display import Display
|
|
|
|
from thread import start_new_thread, allocate_lock
|
|
|
|
from thread import start_new_thread, allocate_lock
|
|
|
@ -460,25 +458,8 @@ def read_line(f, timeout, timeout_func):
|
|
|
|
return ''
|
|
|
|
return ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def enable_echo(fd, enabled):
|
|
|
|
|
|
|
|
(iflag, oflag, cflag, lflag, ispeed, ospeed, cc) = termios.tcgetattr(fd)
|
|
|
|
|
|
|
|
if enabled:
|
|
|
|
|
|
|
|
lflag |= termios.ECHO
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
lflag &= ~termios.ECHO
|
|
|
|
|
|
|
|
new_attr = [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]
|
|
|
|
|
|
|
|
termios.tcsetattr(fd, termios.TCSANOW, new_attr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
debugging = bool(os.environ.get('BARCODE_PLUGIN_DEBUG', False))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
colorama.init()
|
|
|
|
colorama.init()
|
|
|
|
|
|
|
|
|
|
|
|
if not debugging:
|
|
|
|
|
|
|
|
atexit.register(enable_echo, sys.stdin.fileno(), True)
|
|
|
|
|
|
|
|
enable_echo(sys.stdin.fileno(), False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status = Status()
|
|
|
|
status = Status()
|
|
|
|
global scroll_line1,scroll_line2
|
|
|
|
global scroll_line1,scroll_line2
|
|
|
|
global myDisplay
|
|
|
|
global myDisplay
|
|
|
@ -492,7 +473,6 @@ def main():
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
clear()
|
|
|
|
clear()
|
|
|
|
status.dump()
|
|
|
|
status.dump()
|
|
|
|
if debugging:
|
|
|
|
|
|
|
|
print_prompt()
|
|
|
|
print_prompt()
|
|
|
|
line = read_line(sys.stdin, timeout=3*60.0, timeout_func=status.logout)
|
|
|
|
line = read_line(sys.stdin, timeout=3*60.0, timeout_func=status.logout)
|
|
|
|
if line:
|
|
|
|
if line:
|
|
|
|