Exemple #1
0
    def __init__(self, configurationOptions):

        wx.Frame.__init__(self,
                          None,
                          -1,
                          '',
                          size=(1, 1),
                          style=wx.FRAME_NO_TASKBAR
                          | wx.NO_FULL_REPAINT_ON_RESIZE)
        self.buildIsBrokenStatus = "unknown"
        self.configurationOptions = configurationOptions
        if self.configurationOptions.shouldShowStatusChangeDialog:
            self.dlg = None
        else:
            self.dlg = "don't show the status change dialog please"
        self.lastBuildChecked = "something"
        self.tbicon = wx.TaskBarIcon()
        self.CheckBuild("whatever")

        wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarLeftDClick)
        wx.EVT_TASKBAR_RIGHT_DCLICK(self.tbicon, self.OnTaskBarRightDClick)
        self.tbicon.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.OnTaskBarMenu)
        self.tbicon.Bind(wx.EVT_MENU,
                         self.OnTaskBarActivate,
                         id=self.TBMENU_CONFIG)
        self.tbicon.Bind(wx.EVT_MENU,
                         self.OnTaskBarRightDClick,
                         id=self.TBMENU_CLOSE)
        self.tbicon.Bind(wx.EVT_MENU, self.CheckBuild, id=self.TBMENU_REFRESH)
        self.tbicon.Bind(wx.EVT_MENU, self.OnInfo, id=self.TBMENU_INFO)
        self.SetIconTimer()
        self.Show(True)
Exemple #2
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, pos=(100, 100))

        self.tbicon = wx.TaskBarIcon()
        ##self.tbicon.SetIcon(res.cs_icon.GetIcon(), "Earth Wallpaper")
        self.tbicon.SetIcon(
            wx.Icon('graphics/monitor-wallpaper.png', wx.BITMAP_TYPE_PNG),
            "Earth Wallpaper")

        # Bind some events to it
        wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnMenuCheck)  # left click
        wx.EVT_TASKBAR_RIGHT_UP(self.tbicon,
                                self.ShowMenu)  # single left click
        wx.EVT_CLOSE(
            self, self.OnClose
        )  # triggered when the app is closed, which deletes the icon from tray

        # build the menu that we'll show when someone right-clicks
        self.menu = wx.Menu()  # the menu object

        self.menu.Append(103, 'About...')  # About
        wx.EVT_MENU(self, 103,
                    self.OnMenuShowAboutBox)  # Bind a function to it

        self.menu.Append(104, 'Close')  # Close
        wx.EVT_MENU(self, 104, self.OnMenuClose)  # Bind a function to it

        self.quotes = get_mqotd()

        cfg = None
        configFile = os.path.abspath('settings.cfg')
        if not os.path.exists(configFile):
            f = file("configFile", 'wb')
            f.close()
            cfg = wx.FileConfig(localFilename=configFile,
                                style=wx.CONFIG_USE_LOCAL_FILE)
            cfg.Write("PHOTO_PATH", "['']")
        else:
            cfg = wx.FileConfig(localFilename=configFile,
                                style=wx.CONFIG_USE_LOCAL_FILE)
        PHOTO_PATH = readPyValFromConfig(cfg, "PHOTO_PATH")
        DATE_FORMAT = cfg.Read("DATE_FORMAT", '%d/%m/%Y %H:%M')
        print PHOTO_PATH
        self.filelist = []
        for base in PHOTO_PATH:
            if base != '':
                srcpath = path.path(base)
                for thispath in srcpath.walkfiles():
                    thatpath = srcpath.relpathto(thispath)
                    ext = thatpath.lower()[-4:]
                    if ext in ['.jpg']:
                        self.filelist.append(os.path.join(base, thatpath))

        self.timer = wx.Timer(self, -1)
        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
        self.timer.Start(600 * 1000)
        self.OnTimer(evt=True)
Exemple #3
0
    def registerMinimizeToTray(self):
        self.tbIcon = wx.TaskBarIcon()
        icon = wx.Icon("images/task.ico", wx.BITMAP_TYPE_ICO)
        self.tbIcon.SetIcon(icon, "Tasks")

        wx.EVT_TASKBAR_LEFT_DCLICK(self.tbIcon, self.ToggleShow)  # left click
        wx.EVT_TASKBAR_LEFT_UP(self.tbIcon,
                               self.ToggleShow)  # double left click
        wx.EVT_TASKBAR_RIGHT_UP(self.tbIcon,
                                self.ToggleShow)  # single left click

        self.Bind(wx.EVT_ICONIZE, self.onMinimize)  # binding for minimizing
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, pos=(100, 100))

        self.tbicon = wx.TaskBarIcon()
        self.tbicon.SetIcon(self.GetIcon(wx.ART_CROSS_MARK),
                            "Python Web Server")

        # Bind some events to it
        wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnToggle)  # left click
        wx.EVT_TASKBAR_RIGHT_UP(self.tbicon,
                                self.ShowMenu)  # single left click
        wx.EVT_CLOSE(
            self, self.OnClose
        )  # triggered when the app is closed, which deletes the icon from tray

        # build the menu that we'll show when someone right-clicks
        self.menu = wx.Menu()  # the menu object

        self.menu.Append(101, 'Start')  # Start
        wx.EVT_MENU(self, 101, self.OnMenuStart)  # Bind a function to it

        self.menu.Append(102, 'Stop')  # Stop
        wx.EVT_MENU(self, 102, self.OnMenuStop)  # Bind a function to it

        if 1:
            self.menu.Append(103, 'Show log...')  # Show log
            wx.EVT_MENU(self, 103, self.OnMenuShowLog)  # Bind a function to it

        self.menu.Append(104, 'Close')  # Close
        wx.EVT_MENU(self, 104, self.OnMenuClose)  # Bind a function to it

        if 1:
            self.log = wx.TextCtrl(self,
                                   -1,
                                   size=(500, 400),
                                   style=wx.TE_MULTILINE | wx.TE_READONLY
                                   | wx.HSCROLL)
            sys.stdout = RedirectText(self.log)
            sys.stderr = RedirectText(self.log)
            sizer = wx.BoxSizer(wx.HORIZONTAL)
            sizer.Add(self.log, 1, wx.EXPAND)
            self.SetSizer(sizer)
            self.Layout()

        else:
            self.log = self.dummylog
        self.httpd = None
Exemple #5
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, pos=(100, 100))

        self.tbicon = wx.TaskBarIcon()
        self.tbicon.SetIcon(res.cs_icon.GetIcon(), "CS Notifier")

        # Bind some events to it
        wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnMenuCheck)  # left click
        wx.EVT_TASKBAR_RIGHT_UP(self.tbicon,
                                self.ShowMenu)  # single left click
        wx.EVT_CLOSE(
            self, self.OnClose
        )  # triggered when the app is closed, which deletes the icon from tray

        # build the menu that we'll show when someone right-clicks
        self.menu = wx.Menu()  # the menu object

        self.menu.Append(101, 'Check now...')  # Check
        wx.EVT_MENU(self, 101, self.OnMenuCheck)  # Bind a function to it

        self.menu.AppendSeparator()  # Separator

        if settings.DEBUG:
            self.menu.Append(102, 'Show log...')  # Show log
            wx.EVT_MENU(self, 102, self.OnMenuShowLog)  # Bind a function to it

        if settings.AUTOUPDATE:
            self.menu.Append(105, 'Check for updates')  # AutoUpdate
            wx.EVT_MENU(self, 105, self.OnUpdate)  # Bind a function to it

        self.menu.Append(103, 'About...')  # About
        wx.EVT_MENU(self, 103,
                    self.OnMenuShowAboutBox)  # Bind a function to it

        self.menu.Append(104, 'Close')  # Close
        wx.EVT_MENU(self, 104, self.OnMenuClose)  # Bind a function to it

        if settings.DEBUG:
            self.log = Log(self)
            sys.stdout = RedirectStdOut(self.log)
            sys.stderr = RedirectStdErr(self.log)

            log = self.log
            sizer = wx.BoxSizer(wx.HORIZONTAL)
            sizer.Add(log, 1, wx.EXPAND)
            self.SetSizer(sizer)
            self.Layout()
            log('CouchSurfing Notifier 1.0.0 (beta) started...', 'blue')

        else:
            self.log = self.dummylog

        self.cs = cslib.cslib(self.log)

        self.posts = []
        if os.path.exists('current.dat'):
            f = file('current.dat', 'rb')
            self.posts = json.loads(f.read())
            f.close()
        else:
            self.posts.append({'postid': ''})

        self.messages_unread = 0

        self.timer = wx.Timer(self, -1)
        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
        self.timer.Start(settings.CHECK_INTERVAL * 1000)
        self.OnTimer(evt=True)
    def __init__(self):
        wx.TaskBarIcon.__init__(self)

        self.options = Options(None, -1, u'Desktop Recorder Options')

        self.icons = {
            u'continue': GetBitmap(u'continue'),
            u'logo': GetBitmap(u'logo', 16, 16),
            u'pause': GetBitmap(u'pause'),
            u'record': GetBitmap(u'record'),
            u'stop': GetBitmap(u'stop'),
        }

        self.menu = Menu()

        mi_rec = wx.MenuItem(self.menu, ID.REC, u'Record')
        mi_pause = wx.MenuItem(self.menu, ID.PAUSE, u'Pause')
        mi_stop = wx.MenuItem(self.menu, ID.STOP, u'Stop')
        mi_options = wx.MenuItem(self.menu, ID.OPT, u'Show/Hide Options')
        mi_about = wx.MenuItem(self.menu, ID.ABOUT, u'About')
        mi_exit = wx.MenuItem(self.menu, ID.EXIT, u'Quit')

        mi_rec.SetBitmap(self.icons[u'record'])
        mi_pause.SetBitmap(self.icons[u'pause'])
        mi_stop.SetBitmap(self.icons[u'stop'])
        mi_options.SetBitmap(self.icons[u'logo'])

        self.menu.AppendItem(mi_rec)
        self.menu.AppendItem(mi_pause)
        self.menu.AppendItem(mi_stop)
        self.menu.AppendSeparator()
        self.menu.AppendItem(mi_options)
        self.menu.AppendItem(mi_about)
        self.menu.AppendSeparator()
        self.menu.AppendItem(mi_exit)

        self.menu.Enable(ID.PAUSE, False)
        self.menu.Enable(ID.STOP, False)

        # *** Recording state *** #

        self.recording = False
        self.paused = False

        # --- Processes for ffmpeg
        self.P1 = None
        self.P2 = None

        # *** Actions *** #

        self.current_icon = None
        # FIXME: Icon looks ugly in wx 2.8
        self.SetIcon(u'logo', u'Desktop Recorder')

        # *** Event handlers *** #

        wx.EVT_MENU(self.menu, ID.REC, self.OnRecord)
        wx.EVT_MENU(self.menu, ID.PAUSE, self.OnPause)
        wx.EVT_MENU(self.menu, ID.STOP, self.OnStop)
        wx.EVT_MENU(self.menu, ID.OPT, self.ToggleOptions)
        wx.EVT_MENU(self.menu, ID.ABOUT, self.ShowInfo)
        wx.EVT_MENU(self.menu, ID.EXIT, self.OnExit)

        wx.EVT_TASKBAR_LEFT_DOWN(self, self.OnClick)
        wx.EVT_TASKBAR_RIGHT_DOWN(self, self.OnClick)

        # This does not seem to work with wxGtk
        wx.EVT_TASKBAR_LEFT_DCLICK(self, self.ToggleOptions)