def __init__(self, icon, tooltip, frame, app): TaskBarIcon.__init__(self) self.app = app self.SetIcon(icon, tooltip) self.frame = frame self.quitting = False threading.Thread(target=self.notifier_loop).start()
def __init__(self, frame): wxTaskBarIcon.__init__(self) self.frame = frame self.SetIcon(GetMondrianIcon()) self.Bind(EVT_TASKBAR_LEFT_DCLICK, self.OnTaskBarLeftDClick) self.Bind(wx.EVT_MENU, self.OnAbout, id=self.ID_About) self.Bind(wx.EVT_MENU, self.OnCloseshow, id=self.ID_Closeshow)
def __init__(self, main_syncing_thread, sites=None): TaskBarIcon.__init__(self) if sites is not None: self.sites = sites else: self.sites = [] # The purpose of this 'frame' is to keep the mainloop of wx alive # (which checks for living wx thingies) self.frame = Gui(None, main_syncing_thread.waitevent, main_syncing_thread) self.frame.Show(False) self._main_syncing_thread = main_syncing_thread # menu items self.item_start_gui = None self.item_sync = None self.item_sync_stop = None self.item_del = None self.item_close = None # Set the image self.taskbar_icon = wx.Icon(gui_utils.iconpath()) self.SetIcon(self.taskbar_icon, gui_utils.MAIN_TITLE) # bind some events self.Bind(EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarClick) self.Bind(EVT_TASKBAR_RIGHT_DOWN, self.OnTaskBarClick)
def __init__(self, main_syncing_thread, sites=None, observers=None): TaskBarIcon.__init__(self) if sites is not None: self.sites = sites else: self.sites = [] if observers is not None: self.observers = observers else: self.observers = [] # The purpose of this 'frame' is to keep the mainloop of wx alive # (which checks for living wx thingies) self.frame = Gui(None, main_syncing_thread.waitevent, main_syncing_thread) self.frame.Show(True) self._main_syncing_thread = main_syncing_thread self.gui_notif = GuiNotifs(self) self.gui_notif.start() # menu items self.item_start_gui = None self.item_sync = None self.item_sync_stop = None self.item_del = None self.item_close = None # Set the image self.taskbar_icon = wx.Icon(gui_utils.iconpath()) self.SetIcon(self.taskbar_icon, gui_utils.MAIN_TITLE) # bind some events self.Bind(EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarClick) self.Bind(EVT_TASKBAR_RIGHT_DOWN, self.OnTaskBarClick) self.Bind(EVT_NewPopup, self.OnNewGuiNotifs) self.Bind(EVT_NewHeartbeat, self.on_new_gui_heartbeat) self.Bind(EVT_NewOpenfileCtrl, self.on_new_openfile_ctrl)
def __init__(self, icon, tooltip, frame): TaskBarIcon.__init__(self) self.SetIcon(icon, tooltip) self.frame = frame self.Bind(EVT_TASKBAR_LEFT_DOWN, self.on_left_click)
def __init__(self, parent=None): self.tbicon = TaskBarIcon()
class CustomTaskBarIcon(): def __init__(self, parent=None): self.tbicon = TaskBarIcon() # Binds # wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick) # wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarRightClick) def Cacher(self): try: self.tbicon.RemoveIcon() except: pass def Detruire(self): try: self.tbicon.Destroy() except: pass def Connecthys(self, nbre=None, texte=""): if nbre not in (None, 0): chemin_logo = Chemins.GetStaticPath("Images/16x16/Nomadhys.png") bmp = wx.Bitmap(chemin_logo, wx.BITMAP_TYPE_ANY) bmp = self.AjouteTexteImage(bmp, str(nbre), taille_police=6) self.SetIcone(bmp=bmp, texte=texte) else: self.Cacher() def SetIcone(self, bmp=None, texte=""): icon = wx.EmptyIcon() icon.CopyFromBitmap(bmp) self.tbicon.SetIcon(icon, texte) def AjouteTexteImage(self, image=None, texte="", alignement="droite-bas", padding=0, taille_police=9): """ Ajoute un texte sur une image bitmap """ # Création du bitmap largeurImage, hauteurImage = image.GetSize() bmp = wx.EmptyBitmap(largeurImage, hauteurImage) mdc = wx.MemoryDC(bmp) dc = wx.GCDC(mdc) mdc.SetBackground(wx.Brush("black")) mdc.Clear() # Paramètres dc.SetBrush(wx.Brush(wx.RED)) dc.SetPen(wx.TRANSPARENT_PEN) dc.SetFont( wx.Font(taille_police, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) dc.SetTextForeground(wx.WHITE) # Calculs largeurTexte, hauteurTexte = dc.GetTextExtent(texte) # Image mdc.DrawBitmap(image, 0, 0) # Rond rouge hauteurRond = hauteurTexte + padding * 2 largeurRond = largeurTexte + padding * 2 + hauteurRond / 2.0 if largeurRond < hauteurRond: largeurRond = hauteurRond if "gauche" in alignement: xRond = 1 if "droite" in alignement: xRond = largeurImage - largeurRond - 1 if "haut" in alignement: yRond = 1 if "bas" in alignement: yRond = hauteurImage - hauteurRond - 1 dc.DrawRoundedRectangleRect( wx.Rect(xRond, yRond, largeurRond, hauteurRond), hauteurRond / 2.0) # Texte xTexte = xRond + largeurRond / 2.0 - largeurTexte / 2.0 yTexte = yRond + hauteurRond / 2.0 - hauteurTexte / 2.0 - 1 dc.DrawText(texte, xTexte, yTexte) mdc.SelectObject(wx.NullBitmap) bmp.SetMaskColour("black") return bmp