class PyVerFrame(wx.Frame, IVersionInfoProvider): def __init__( self, app, parent, frameId=-1, title=wx.EmptyString, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name=wx.FrameNameStr, ): wx.Frame.__init__(self, parent, frameId, title, pos, size, style, name) self.app = app self.__initVersionMonitor() self.Bind(wx.EVT_CLOSE, self.OnVerFrameClose) ResultEvent.BIND_EVENT(self, IMessageDef.EVT_SHOW_FEATURE, self.OnShowVerFeature) ResultEvent.BIND_EVENT(self, IMessageDef.EVT_SHOW_BROADCAST_MSG, self.OnShowBroadcastMsg) ResultEvent.BIND_EVENT(self, IMessageDef.EVT_VER_FEATUREUI_MAINFRAME, self.OnVerFeatureUIMsg) def __initVersionMonitor(self): self.pyVerMonitor = PyVersionMonitor(self, self) self.pyVerMonitor.start() def OnVerFrameClose(self, event): self.OnClose(event) self.pyVerMonitor.stopThread() self.app.ExitMainLoop() event.Skip() def OnClose(self, event): pass def OnShowVerFeature(self, event): UpgradeUI(self, event.data) def OnShowBroadcastMsg(self, event): strMsg = event.data["broadcastMsg"]["msgInfo"] wx.MessageBox(strMsg, "From Version Service Notify.") def OnVerFeatureUIMsg(self, event): print "Event...." if event.data == "CLOSE": self.pyVerMonitor.setUIIsShow(False) elif event.data == "EXIT": self.Close()
def __initVersionMonitor(self): self.pyVerMonitor = PyVersionMonitor(self, self) self.pyVerMonitor.start()