Ejemplo n.º 1
0
class Thread_Manager(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.val = ""
        self.ser = serial
        self.mess1 = "hello"
        self.mess2 = "World!"
        self.ser = serial.Serial("/dev/ttyUSB0", 500000, timeout=0)
        self.ctx = ScreenContext("/dev/ttyUSB0")
        self.ctx.sleep(6).reset_lcd().set_rotation(1)
        self.counter = 0
        #print "rows", ctx.get_rows(), 320/ctx.get_rows()
        #print "columns", ctx.get_columns()
        self.row = 21 * 2 * 8
        print "Start LCD"
  
  
    def run(self):
        while True:
            header = Header()
            header.render_header(self.ctx,0,"HeaderName")
            self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak()
            self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak()
            self.ctx.fg_color(Screen.BLUE).write(self.mess2)
            #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress())
            self.ctx.set_cursor_pos(self.row * 3,0)
            self.counter += 1

    #def update_screen(self):
    #    self.ctx.sleep(6).reset_lcd().set_rotation(1)
    #    header = Header()
    #    header.render_header(self.ctx,0,"Rouge")
    #    self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak()
    #    self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak()
    #    self.ctx.fg_color(Screen.BLUE).write(self.mess2)
    #    #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress())
    #    self.ctx.set_cursor_pos(self.row * 3,0)
    #    self.counter += 1  

    def update_message(self, mess1, mess2):
        self.mess1 = mess1
        self.mess2 = mess2
        return True
Ejemplo n.º 2
0
class Thread_Manager(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.val = ""
        self.ser = serial
        self.mess1 = "hello"
        self.mess2 = "World!"
        self.ser = serial.Serial("/dev/ttyUSB0", 500000, timeout=0)
        self.ctx = ScreenContext("/dev/ttyUSB0")
        self.ctx.sleep(6).reset_lcd().set_rotation(1)
        self.counter = 0
        #print "rows", ctx.get_rows(), 320/ctx.get_rows()
        #print "columns", ctx.get_columns()
        self.row = 21 * 2 * 8
        print "Start LCD"

    def run(self):
        while True:
            header = Header()
            header.render_header(self.ctx, 0, "HeaderName")
            self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak()
            self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak()
            self.ctx.fg_color(Screen.BLUE).write(self.mess2)
            #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress())
            self.ctx.set_cursor_pos(self.row * 3, 0)
            self.counter += 1

    #def update_screen(self):
    #    self.ctx.sleep(6).reset_lcd().set_rotation(1)
    #    header = Header()
    #    header.render_header(self.ctx,0,"Rouge")
    #    self.ctx.fg_color(Screen.RED).write(self.mess1).linebreak()
    #    self.ctx.fg_color(Screen.RED).write(str(self.counter)).linebreak()
    #    self.ctx.fg_color(Screen.BLUE).write(self.mess2)
    #    #ctx.fg_color(Screen.BLUE).write(ReadThread.returnPress())
    #    self.ctx.set_cursor_pos(self.row * 3,0)
    #    self.counter += 1

    def update_message(self, mess1, mess2):
        self.mess1 = mess1
        self.mess2 = mess2
        return True
Ejemplo n.º 3
0
    default="/dev/ttyUSB0")
args = parser.parse_args()

# Apply the arguments
default_tab = args.tab - 1
tab_change_interval = args.time

tabs = config.tabs
current_tab = default_tab

ctx = ScreenContext(args.port)

atexit.register(ctx.cleanup)

# Wait 6 seconds for the screen to boot up before we start uploading anything
ctx.sleep(6).reset_lcd().set_rotation(0)

# Header
header = Header()

print "Started"

time_since_tab_change = 0
last_time = time.time()

while True:
    header.render_header(ctx, current_tab, tabs[current_tab].title, len(tabs))
    tabs[current_tab].render_tab(ctx)

    time_since_tab_change += time.time() - last_time
    last_time = time.time()
Ejemplo n.º 4
0
                    type=str, default="/dev/ttyUSB0")
args = parser.parse_args()

# Apply the arguments
default_tab = args.tab - 1
tab_change_interval = args.time

tabs = config.tabs
current_tab = default_tab

ctx = ScreenContext(args.port)

atexit.register(ctx.cleanup)

# Wait 6 seconds for the screen to boot up before we start uploading anything
ctx.sleep(6).reset_lcd().set_rotation(0)

# Header
header = Header()

print "Started"

time_since_tab_change = 0
last_time = time.time()

while True:
    header.render_header(ctx, current_tab, tabs[current_tab].title, len(tabs))
    tabs[current_tab].render_tab(ctx)
    
    time_since_tab_change += time.time() - last_time
    last_time = time.time()