heres the deal.
i am working on a threading gui. pygtk
in one class (main) is all the gui stuff,
but in another class that is a thread, i am reading serial input.
what i want to be able to do is take what read in the thread and
print it in a textview in the gui class.
here is what i have:
class Serial1(threadi ng.Thread):
def __init__(self):
threading.Threa d.__init__(self )
def run(self):
ser = serial.Serial('/dev/ttyS15', 2400, timeout=None)
loopy = 1
while loopy < 5:
for x in range(5):
Input1Data = 'buncha data and timestamp\n'
gobject.idle_ad d(self.buffer_a dd, Input1Data)
def buffer_add(self , Input1Data):
Input1Iter = self.Input1Buff er.get_end_iter ()
self.Input1Buff er.insert(Input 1Iter, Input1Data)
class Main(SimpleGlad eApp):
def __init__(self, path="pivcontro lcenter.glade",
root="Main",
domain=app_name , **kwargs):
path = os.path.join(gl ade_dir, path)
SimpleGladeApp. __init__(self, path, root, domain, **kwargs)
self.MessageBuf fer = self.MessageVie w.get_buffer()
def on_StartEngines Button_clicked( self, widget, *args):
Input1Iter = self.MessageBuf fer.get_end_ite r()
Input1Data = 'Reading Serial device ttyS14 \n'
self.Input1Buff er.insert(Input 1Iter, Input1Data)
time.sleep(1)
S1 = Serial1()
S1.start()
basically, i need a way to pass data, actually the control of the
textview wiget
in and out of a class.
is this possible?