예제 #1
0
    def __init__(self, menu):

        wx.TaskBarIcon.__init__(self)

        # menu options
        self.menu = menu

        # event handlers
        self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.click)
        self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self.click)
        self.Bind(wx.EVT_MENU, self.select)

        # icon state
        self.states = {
            "on": wx.Icon(file("dat/reader_new.png", "p"), wx.BITMAP_TYPE_PNG),
            "off": wx.Icon(file("dat/reader_empty.png", "p"), wx.BITMAP_TYPE_PNG)
        }
        self.setStatus("off")
예제 #2
0
    def __init__(self, menu):

        wx.TaskBarIcon.__init__(self)

        # menu options
        self.menu = menu

        # event handlers
        self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.click)
        self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self.click)
        self.Bind(wx.EVT_MENU, self.select)

        # icon state
        self.states = {
            "on": wx.Icon(file("dat/reader_new.png", "p"), wx.BITMAP_TYPE_PNG),
            "off": wx.Icon(file("dat/reader_empty.png", "p"), wx.BITMAP_TYPE_PNG)
        }
        self.setStatus("off")
예제 #3
0
    def __init__(self):

        wx.Frame.__init__(self, None, -1, style=wx.NO_BORDER|wx.FRAME_NO_TASKBAR)
        self.padding = 12 # padding between edge, icon and text
        self.popped = 0 # the time popup was opened
        self.delay = 4 # time to leave the popup opened

        # platform specific hacks
        lines = 2
        lineHeight = wx.MemoryDC().GetTextExtent(" ")[1]
        if wx.Platform == "__WXGTK__":
            # use the popup window widget on gtk as the
            # frame widget can't animate outside the screen
            self.popup = wx.PopupWindow(self, -1)
        elif wx.Platform == "__WXMSW__":
            # decrement line height on windows as the text calc below is off otherwise
            self.popup = self
            lineHeight -= 3
        elif wx.Platform == "__WXMAC__":
            # untested
            self.popup = self

        self.popup.SetSize((250, (lineHeight * (lines + 1)) + (self.padding * 2)))
        self.panel = wx.Panel(self.popup, -1, size=self.popup.GetSize())

        # popup's click handler
        self.panel.Bind(wx.EVT_LEFT_DOWN, self.click)

        # popup's logo
        self.logo = wx.Bitmap(file("dat/reader_large.png", "p"))
        wx.StaticBitmap(self.panel, -1, pos=(self.padding, self.padding)).SetBitmap(self.logo)

        # main timer routine
        self.timer = wx.Timer(self, -1)
        self.Bind(wx.EVT_TIMER, self.main, self.timer)
        self.timer.Start(500)
예제 #4
0
    def __init__(self):

        wx.Frame.__init__(self, None, -1, style=wx.NO_BORDER|wx.FRAME_NO_TASKBAR)
        self.padding = 12 # padding between edge, icon and text
        self.popped = 0 # the time popup was opened
        self.delay = 4 # time to leave the popup opened

        # platform specific hacks
        lines = 2
        lineHeight = wx.MemoryDC().GetTextExtent(" ")[1]
        if wx.Platform == "__WXGTK__":
            # use the popup window widget on gtk as the
            # frame widget can't animate outside the screen
            self.popup = wx.PopupWindow(self, -1)
        elif wx.Platform == "__WXMSW__":
            # decrement line height on windows as the text calc below is off otherwise
            self.popup = self
            lineHeight -= 3
        elif wx.Platform == "__WXMAC__":
            # untested
            self.popup = self

        self.popup.SetSize((250, (lineHeight * (lines + 1)) + (self.padding * 2)))
        self.panel = wx.Panel(self.popup, -1, size=self.popup.GetSize())

        # popup's click handler
        self.panel.Bind(wx.EVT_LEFT_DOWN, self.click)

        # popup's logo
        self.logo = wx.Bitmap(file("dat/reader_large.png", "p"))
        wx.StaticBitmap(self.panel, -1, pos=(self.padding, self.padding)).SetBitmap(self.logo)

        # main timer routine
        self.timer = wx.Timer(self, -1)
        self.Bind(wx.EVT_TIMER, self.main, self.timer)
        self.timer.Start(500)