Skip to content

Commit

Permalink
Fixed minor issues with UI and top application
Browse files Browse the repository at this point in the history
  • Loading branch information
Overdrivr committed Oct 23, 2015
1 parent ff01887 commit 0914eba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion UI/COM_Frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def start_com(self):
def stop_com(self):
self.parent.disconnect()

def com_connected(self,port,**kwargs):
def com_connected(self,**kwargs):
self.txt_connected.config(text="CONNECTED",fg='green')
self.parent.update_idletasks()

Expand Down
2 changes: 1 addition & 1 deletion UI/VariableTable_Frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import tkinter as Tk
import tkinter.ttk as ttk
from DistantIO.UI.Plot2D_Frame import Plot2D_Frame
from UI.Plot2D_Frame import Plot2D_Frame
import logging
from distantio.Utils import ValuesXY

Expand Down
16 changes: 13 additions & 3 deletions application.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(self,parent,**kwargs):
self.com_ports = COM_Frame(self,self.model,relief=Tk.GROOVE)
self.com_ports.grid(column=0,row=0,sticky='NSEW',pady=2,padx=5)


# Init table frame
self.var_table = VariableTable_Frame(self,self.model,relief=Tk.GROOVE)
self.var_table.grid(column=0,row=1,sticky='NSEW',pady=2,padx=5)
Expand All @@ -43,12 +42,14 @@ def __init__(self,parent,**kwargs):

self.com_ports.refresh_COM_ports()
self.update()
self.refresh_ports()

def disconnect(self):
self.serial.close()
self.model.export_data()

def connect(self,port,baudrate):

self.serial.connect(port,baudrate)

def stop(self):
Expand All @@ -58,10 +59,19 @@ def stop(self):
logging.info('Model terminated.')

def update(self):
# Decode 100 instructions max
self.model.update(10)
# Decode instructions
for i in range(20):
self.model.update()

self.root.after(10,self.update)

def refresh_ports(self):
if self.serial.connected():
self.com_ports.com_connected()
else:
self.com_ports.com_disconnected()
self.root.after(500,self.refresh_ports)

def available_ports(self):
return self.serial.get_ports()

Expand Down

0 comments on commit 0914eba

Please sign in to comment.