lpcmanager

Parents 4b07f192cdc9
Children 6713d20d3011
LPCCommand : switch to wx.Timer instead of regular python timer for the rapidfire protection. With regular python timers, some refresh order could pile eventloop when interacting with the GUI while doing initial loading of signals.
  • +10 -5
    LPCCommand.py
  • --- a/LPCCommand.py Tue Feb 19 11:35:41 2019 +0100
    +++ b/LPCCommand.py Wed Feb 20 11:32:10 2019 +0100
    @@ -133,10 +133,15 @@
    return res
    def RestartTimer(self):
    - if self.RefreshTimer is not None:
    - self.RefreshTimer.cancel()
    - self.RefreshTimer = Timer(0.1, wx.CallAfter, args=[self.Refresh])
    - self.RefreshTimer.start()
    + if self.RefreshTimer is None:
    + if self.Launcher.frame is None:
    + return
    + self.RefreshTimer = wx.Timer(self.Launcher.frame, -1)
    + self.Launcher.frame.Bind(wx.EVT_TIMER,
    + self.Refresh,
    + self.RefreshTimer)
    + self.RefreshTimer.Stop()
    + self.RefreshTimer.Start(milliseconds=500, oneShot=True)
    def Exit(self):
    #self.Close()
    @@ -153,7 +158,7 @@
    """
    pass
    - def Refresh(self):
    + def Refresh(self, event=None):
    if self.Launcher.frame is not None:
    if self.restore_last_state:
    self.restore_last_state = False