Пример #1
0
    def __init__(self, *args, **kwds):
        tivuGUI.MainFrame.__init__(self, *args, **kwds)
        self.ser = None
        self.speed = 9600

        self.pcl = pclparse.pclparse()
        self.streaming = False
        
        ## Thread specific variables
        self.thread = None
        self.alive = threading.Event()

        ## Bind residual events
        self.Bind(EVT_SERIALRX, self.OnSerialRead)
        self.Bind(wx.EVT_CLOSE, self.OnQuit)

        self.gauge = 0
        self.gaugemeter = None
Пример #2
0
    def OnOpen(self, event):
        dlg = wx.FileDialog(None, 'Select file to read in')
        modal = dlg.ShowModal()
        filename = dlg.GetPath()
        dlg.Destroy()
        if modal != wx.ID_OK:
            return
        
        ## Create a parser and run the file thru it
        pcl = pclparse.pclparse()
        fd = open(filename, 'rb')
        while True:
            data = fd.read(100)
            if len(data) == 0:
                break
            pcl.parse(data)
        fd.close()

        ## Blit the parsed data to the bit window
        self.BitWindow.SetData(pcl.data)