Kodi Community Forum

Full Version: Pyxmbct - Update gprs data into addon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am looking for advise to incorporate the gprs (speed) data into a textbox in xbmc/osmc. I set up a simple program to gather time data from my gps but every second it opens a new dialog window. How can simply import the nema data (speed) into the textbox without a window opening every second?
print "check" was only added for debugging

Code:
class MyAddon(AddonDialogWindow):

    def __init__(self, title=''):
        super(MyAddon, self).__init__(title)
        self.setGeometry(1200, 750, 10, 3)
        self.gps_ada()
        self.time_stamp()
        
        # Connect a key action (Backspace) to close the window.
        self.connect(ACTION_NAV_BACK, self.close)
        print "check 1"
    def gps_ada(self):
        label_center = Label ('TIME')
        self.placeControl(label_center, 1,1)
        print "check 2"

    def time_stamp(self):
        self.textbox = TextBox(textColor='0xFFFFFFFF')
        self.placeControl(self.textbox, 3,1, rowspan=3, columnspan=1)
        self.textbox.setVisible(True)
        print "check 3"
        session = gps.gps("localhost", "2947")
        session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)
        print "check 4"
        while True:
            try:
        
                report = session.next()
                # Wait for a 'TPV' report and display the current time
                # To see all report data, uncomment the line below
                # print report
                if report['class'] == 'TPV':
                    if hasattr(report, 'time'):
                        print "check 5"
                        print report.time

                        line1 = report.time

                        xbmcgui.Dialog().ok(_addon_path, line1)

                        print "check6"
                        pass
                    
            except KeyError:
                pass
            except KeyboardInterrupt:
                quit()
            except StopIteration:
                session = None
                print "GPSD has terminated"