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(threading.Thread):
    def __init__(self):
        threading.Thread.__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_add(self.buffer_add,  Input1Data)

    def buffer_add(self,  Input1Data):
        Input1Iter = self.Input1Buffer.get_end_iter()
        self.Input1Buffer.insert(Input1Iter, Input1Data)


class Main(SimpleGladeApp):
    def __init__(self, path="pivcontrolcenter.glade",
                 root="Main",
                 domain=app_name, **kwargs):
        path = os.path.join(glade_dir, path)
        SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
        self.MessageBuffer = self.MessageView.get_buffer()

    def on_StartEnginesButton_clicked(self, widget, *args):
        Input1Iter = self.MessageBuffer.get_end_iter()
        Input1Data = 'Reading Serial device ttyS14 \n'
        self.Input1Buffer.insert(Input1Iter, 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?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to