class AppWrapper(wx.App): def __init__(self, redirectstderrout = False): self.bgapp = None self.systray = None wx.App.__init__(self, redirectstderrout) def OnExit(self): if self.systray is not None: self.systray.RemoveIcon() self.systray.Destroy() if self.bgapp is not None: self.bgapp.OnExit() def set_bgapp(self, bgapp): self.bgapp = bgapp iconpath = bgapp.iconpath self.systray = PlayerTaskBarIcon(self, self.bgapp, iconpath) def set_icon_tooltip(self, txt): if self.systray is not None: self.systray.set_icon_tooltip(txt) def on_error(self, errmsg, exit = False): if self.bgapp is None: title = 'Error' else: title = self.bgapp.appname + ' Error' dlg = wx.MessageDialog(None, errmsg, title, wx.OK | wx.ICON_ERROR | wx.STAY_ON_TOP) result = dlg.ShowModal() dlg.Destroy() if exit: self.ExitMainLoop()
def set_bgapp(self, bgapp): self.bgapp = bgapp iconpath = bgapp.iconpath self.systray = PlayerTaskBarIcon(self, self.bgapp, iconpath)