Beispiel #1
0
 def OnInternetDown(self, event):
     if event.data == 1:
         self.sb.SetStatusText("Network is down")
         if self.sync_model.GetUseSystemNotifSetting():
             if wxgtk4:
                 nmsg = wx.adv.NotificationMessage(
                     title="GoSync", message="Network has gone down!")
                 nmsg.SetFlags(wx.ICON_WARNING)
                 nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
             else:
                 nmsg = wx.NotificationMessage("GoSync",
                                               "Network has gone down!")
                 nmsg.SetFlags(wx.ICON_WARNING)
                 nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
     else:
         self.sb.SetStatusText("Network is up!")
         if self.sync_model.GetUseSystemNotifSetting():
             if wxgtk4:
                 nmsg = wx.adv.NotificationMessage(title="GoSync",
                                                   message="Network is up!")
                 nmsg.SetFlags(wx.ICON_INFORMATION)
                 nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
             else:
                 nmsg = wx.NotificationMessage("GoSync", "Network is up!")
                 nmsg.SetFlags(wx.ICON_INFORMATION)
                 nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
Beispiel #2
0
 def OnSyncDone(self, event):
     if not event.data:
         if self.sync_model.GetUseSystemNotifSetting():
             if wxgtk4:
                 nmsg = wx.adv.NotificationMessage(
                     title="GoSync", message="Sync Completed!")
                 nmsg.SetFlags(wx.ICON_INFORMATION)
                 nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
             else:
                 nmsg = wx.NotificationMessage("GoSync", "Sync Completed!")
                 nmsg.SetFlags(wx.ICON_INFORMATION)
                 nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
         self.sb.SetStatusText("Sync completed.")
     else:
         if self.sync_model.GetUseSystemNotifSetting():
             if wxgtk4:
                 nmsg = wx.adv.NotificationMessage(
                     title="GoSync",
                     message=
                     "Sync Completed with errors!\nPlease check ~/GoSync.log"
                 )
                 nmsg.SetFlags(wx.ICON_ERROR)
                 nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
             else:
                 nmsg = wx.NotificationMessage(
                     "GoSync",
                     "Sync Completed with errors!\nPlease check ~/GoSync.log"
                 )
                 nmsg.SetFlags(wx.ICON_ERROR)
                 nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
         self.sb.SetStatusText("Sync failed. Please check the logs.")
     self.sync_now_mitem.Enable(True)
     self.rcu.Enable(True)
Beispiel #3
0
 def OnSyncDone(self, event):
     if not event.data:
         if wxgtk4:
             nmsg = wx.adv.NotificationMessage(title="GoSync",
                                               message="Sync Completed!")
             nmsg.SetFlags(wx.ICON_INFORMATION)
             nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
         else:
             nmsg = wx.NotificationMessage(title="GoSync",
                                           message="Sync Completed!")
             nmsg.SetFlags(wx.ICON_INFORMATION)
             nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
         self.sb.SetStatusText("Sync completed.")
     else:
         if wxgtk4:
             nmsg = wx.adv.NotificationMessage(
                 title="GoSync",
                 message=
                 "Sync Completed with errors!\nPlease check ~/GoSync.log")
             nmsg.SetFlags(wx.ICON_ERROR)
             nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
         else:
             nmsg = wx.NotificationMessage(
                 title="GoSync",
                 message=
                 "Sync Completed with errors!\nPlease check ~/GoSync.log")
             nmsg.SetFlags(wx.ICON_ERROR)
             nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
         self.sb.SetStatusText("Sync failed. Please check the logs.")
Beispiel #4
0
    def __init__(self, status_frame):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Quack Backup", (-1, -1), wx.Size(300, 150))
        self.statusFrame = status_frame
        self.icon = wx.EmptyIcon()
        self.icon.CopyFromBitmap(wx.Bitmap("quack.ico", wx.BITMAP_TYPE_ANY))
        self.SetIcon(self.icon)
        
        panel = wx.Panel(self, wx.ID_ANY)
        self.tbIcon = CustomTaskBarIcon(self, status_frame)
        
        bSizer1 = wx.BoxSizer( wx.VERTICAL )
        bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
        bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
        
        self.m_srcLabel = wx.StaticText(panel, wx.ID_ANY, u"Source Directory", wx.DefaultPosition, wx.DefaultSize)
        bSizer2.Add( self.m_srcLabel, 0, wx.EXPAND|wx.ALL, 1 )
        self.m_srcDir = wx.TextCtrl(panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize)
        bSizer2.Add( self.m_srcDir, 0, wx.ALL, 1 )
        self.m_srcDirSelect = wx.Button(panel, wx.ID_ANY, u"...", wx.DefaultPosition, wx.DefaultSize)
        bSizer2.Add( self.m_srcDirSelect, 0, wx.ALL, 1 )
        bSizer1.Add( bSizer2, 0, wx.ALL, 1)
        
        self.m_destLabel = wx.StaticText(panel, wx.ID_ANY, u"Destination Directory", wx.DefaultPosition, wx.DefaultSize)
        bSizer3.Add( self.m_destLabel, 0, wx.EXPAND|wx.ALL, 1 )
        self.m_destDir = wx.TextCtrl(panel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize)
        bSizer3.Add( self.m_destDir, 0, wx.ALL, 1 )
        self.m_destDirSelect = wx.Button(panel, wx.ID_ANY, u"...", wx.DefaultPosition, wx.DefaultSize)
        bSizer3.Add( self.m_destDirSelect, 0, wx.ALL, 1 )
        bSizer1.Add( bSizer3, 0, wx.ALL, 1)
        
        self.m_processBackupButton = wx.Button( panel, wx.ID_ANY, u"Start Backup", wx.DefaultPosition, wx.DefaultSize)
        bSizer1.Add( self.m_processBackupButton, 0, wx.ALL, 1 )
        
        panel.SetSizer( bSizer1 )
        panel.Layout()
 
        self.Bind(wx.EVT_ICONIZE, self.onMinimize)
        self.Bind(wx.EVT_CLOSE, self.onClose)
        self.m_processBackupButton.Bind( wx.EVT_BUTTON, self.processBackup )
        self.m_srcDirSelect.Bind( wx.EVT_BUTTON, self.selectSrcDir )
        self.m_destDirSelect.Bind( wx.EVT_BUTTON, self.selectDestDir )
        
        self.stop_backup_notify = wx.NotificationMessage(u"Quack Backup", u"Stopped", self)
        self.start_backup_notify = wx.NotificationMessage(u"Quack Backup", u"Running", self)
        
        self.running = False
        
        self.config_parser = ConfigParser()
        self.config_parser.read("QuackBackup.cfg")
        self.m_srcDir.SetValue(self.config_parser.get('PATHS', 'last_src'))
        self.m_destDir.SetValue(self.config_parser.get('PATHS', 'last_dest'))

        self.Show()
Beispiel #5
0
 def notify(self, title, text):
     try:
         self.notification = wx.adv.NotificationMessage(title,
                                                        text,
                                                        parent=self)
     except AttributeError:
         self.notification = wx.NotificationMessage(title, text)
     self.notification.Show()
Beispiel #6
0
 def __init__(self, frame):
     self.frame = frame
     super(TaskBarIcon, self).__init__()
     self.set_icon(TRAY_ICON)
     self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.on_left_down)
     self.timer = wx.Timer(self)
     self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
     self.timer.Start(15000)  # start timer after a delay
     if (not WIN):
         self.note = wx.NotificationMessage("Pilnuj", "")
Beispiel #7
0
 def OnSyncStarted(self, event):
     if wxgtk4:
         nmsg = wx.adv.NotificationMessage(title="GoSync",
                                           message="Sync Started")
         nmsg.SetFlags(wx.ICON_INFORMATION)
         nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
     else:
         nmsg = wx.NotificationMessage(title="GoSync",
                                       message="Sync Started")
         nmsg.SetFlags(wx.ICON_INFORMATION)
         nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
     self.sb.SetStatusText("Sync started...")
Beispiel #8
0
def _notify(level, message):
    nm = wx.NotificationMessage()
    nm.SetTitle(__software_name__.capitalize())
    nm.SetMessage(message)
    if level <= log.INFO:
        flags = wx.ICON_INFORMATION
    elif level <= log.WARNING:
        flags = wx.ICON_WARNING
    else:
        flags = wx.ICON_ERROR
    nm.SetFlags(flags)
    nm.Show()
Beispiel #9
0
 def OnSyncInvalidFolder(self, event):
     if self.sync_model.GetUseSystemNotifSetting():
         if wxgtk4:
             nmsg = wx.adv.NotificationMessage(
                 title="GoSync",
                 message=
                 "Invalid sync settings detected.\nPlease check the logs.")
             nmsg.SetFlags(wx.ICON_ERROR)
             nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
         else:
             nmsg = wx.NotificationMessage(
                 "GoSync",
                 "Invalid sync settings detected.\nPlease check the logs.")
             nmsg.SetFlags(wx.ICON_ERROR)
             nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
Beispiel #10
0
    def OnSyncStarted(self, event):
        if self.sync_model.GetUseSystemNotifSetting():
            if wxgtk4:
                nmsg = wx.adv.NotificationMessage(title="GoSync",
                                                  message="Sync Started")
                nmsg.SetFlags(wx.ICON_INFORMATION)
                nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
            else:
                nmsg = wx.NotificationMessage("GoSync", "Sync Started")
                nmsg.SetFlags(wx.ICON_INFORMATION)
                nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)

        self.sb.SetStatusText("Sync started...")
        self.sb.SetStatusText("Running", 1)
        self.sync_now_mitem.Enable(False)
        self.rcu.Enable(False)
        self.pr_item.SetItemLabel("Pause Sync")
Beispiel #11
0
    def __init__(self):
        wx.TaskBarIcon.__init__(self)
        # create a test icon
        bmp = wx.EmptyBitmap(16, 16)
        dc = wx.MemoryDC(bmp)
        dc.SetBrush(wx.RED_BRUSH)
        dc.Clear()
        dc.SelectObject(wx.NullBitmap)

        testicon = wx.EmptyIcon()
        testicon.CopyFromBitmap(bmp)

        self.SetIcon(testicon)
        self.Bind(wx.EVT_TASKBAR_LEFT_UP, lambda e:
                  (self.RemoveIcon(), sys.exit()))

        wx.NotificationMessage("", "Hello world!").Show()
Beispiel #12
0
 def on_note(self, event):
     if (WIN):
         self.ShowBalloon("Pilnuj", "Hello world!", msec=3000)
     else:
         wx.NotificationMessage("Pilnuj", "Hello world!").Show()
Beispiel #13
0
 def notify(self, title, text):
     wx.NotificationMessage(title, text).Show()