Ejemplo n.º 1
0
 def _new_notification(self, notification):
     if not notification.is_bubble():
         return
     if AbstractOSIntegration.is_mac():
         if AbstractOSIntegration.os_version_above("10.8"):
             from nxdrive.osi.darwin.pyNotificationCenter import notify, NotificationDelegator
             if self._delegator is None:
                 self._delegator = NotificationDelegator.alloc().init()
                 self._delegator._manager = self.manager
             # Use notification center
             userInfo = dict()
             userInfo["uuid"] = notification.get_uid()
             return notify(notification.get_title(),
                           None,
                           notification.get_description(),
                           userInfo=userInfo)
     self.current_notification = notification
     icon = QtGui.QSystemTrayIcon.Information
     if (notification.get_level() == Notification.LEVEL_WARNING):
         icon = QtGui.QSystemTrayIcon.Warning
     elif (notification.get_level() == Notification.LEVEL_ERROR):
         icon = QtGui.QSystemTrayIcon.Critical
     self.show_message(notification.get_title(),
                       notification.get_description(),
                       icon=icon)
Ejemplo n.º 2
0
 def showMessage(self, title, message, icon=QtGui.QSystemTrayIcon.Information, timeout = 10000):
     if AbstractOSIntegration.is_mac():
         if AbstractOSIntegration.os_version_above("10.8"):
             from nxdrive.osi.darwin.pyNotificationCenter import notify
             # Use notification center
             return notify(title, None, message)
     return QtGui.QSystemTrayIcon.showMessage(self, title, message, icon, timeout)
Ejemplo n.º 3
0
 def showMessage(self, title, message, icon=QtGui.QSystemTrayIcon.Information, timeout = 10000):
     if AbstractOSIntegration.is_mac():
         if AbstractOSIntegration.os_version_above("10.8"):
             from nxdrive.osi.darwin.pyNotificationCenter import notify
             # Use notification center
             log.trace("Display systray message: %s | %s | %s", QtCore.QCoreApplication.applicationName(), title, message)
             return notify(title, None, message)
     return QtGui.QSystemTrayIcon.showMessage(self, title, message, icon, timeout)
Ejemplo n.º 4
0
    def __init__(self, manager, options, argv=()):
        super(Application, self).__init__(list(argv))
        self.setApplicationName(manager.get_appname())
        self.setQuitOnLastWindowClosed(False)
        self._delegator = None
        self.manager = manager
        from nxdrive.scripting import DriveUiScript
        self.manager.set_script_object(DriveUiScript(manager, self))
        self.options = options
        self.mainEngine = None
        self.filters_dlg = None
        self._conflicts_modals = dict()
        self.current_notification = None
        # Make dialog unique
        self.uniqueDialogs = dict()
        # Init translator
        self._init_translator()

        for _, engine in self.manager.get_engines().iteritems():
            self.mainEngine = engine
            break
        if self.mainEngine is not None and options.debug:
            from nxdrive.engine.engine import EngineLogger
            self.engineLogger = EngineLogger(self.mainEngine)
        self.engineWidget = None

        self.aboutToQuit.connect(self.manager.stop)
        self.manager.dropEngine.connect(self.dropped_engine)

        # Timer to spin the transferring icon
        self.icon_spin_timer = QtCore.QTimer()
        self.icon_spin_timer.timeout.connect(self.spin_transferring_icon)
        self.icon_spin_count = 0

        # Application update
        self.manager.get_updater().appUpdated.connect(self.app_updated)
        self.updated_version = None

        # This is a windowless application mostly using the system tray
        self.setQuitOnLastWindowClosed(False)

        self.setup_systray()

        # Direct Edit conflict
        self.manager.get_drive_edit().driveEditConflict.connect(self._direct_edit_conflict)

        # Check if actions is required, separate method so it can be override
        self.init_checks()
        self.engineWidget = None

        # Setup notification center for Mac
        if AbstractOSIntegration.is_mac():
            if AbstractOSIntegration.os_version_above("10.8"):
                self._setup_notification_center()
Ejemplo n.º 5
0
 def showMessage(self,
                 title,
                 message,
                 icon=QtGui.QSystemTrayIcon.Information,
                 timeout=10000):
     if AbstractOSIntegration.is_mac():
         if AbstractOSIntegration.os_version_above("10.8"):
             from nxdrive.osi.darwin.pyNotificationCenter import notify
             # Use notification center
             return notify(title, None, message)
     return QtGui.QSystemTrayIcon.showMessage(self, title, message, icon,
                                              timeout)
Ejemplo n.º 6
0
    def __init__(self, manager, options, argv=()):
        super(Application, self).__init__(manager, options, list(argv))
        self.setQuitOnLastWindowClosed(False)
        self._delegator = None
        from nxdrive.scripting import DriveUiScript
        self.manager.set_script_object(DriveUiScript(manager, self))
        self.mainEngine = None
        self.filters_dlg = None
        self._conflicts_modals = dict()
        self.current_notification = None
        # Make dialog unique
        self.uniqueDialogs = dict()

        for _, engine in self.manager.get_engines().iteritems():
            self.mainEngine = engine
            break
        if self.mainEngine is not None and options.debug:
            from nxdrive.engine.engine import EngineLogger
            self.engineLogger = EngineLogger(self.mainEngine)
        self.engineWidget = None

        self.aboutToQuit.connect(self.manager.stop)
        self.manager.dropEngine.connect(self.dropped_engine)

        # Timer to spin the transferring icon
        self.icon_spin_timer = QtCore.QTimer()
        self.icon_spin_timer.timeout.connect(self.spin_transferring_icon)
        self.icon_spin_count = 0

        # Application update
        self.manager.get_updater().appUpdated.connect(self.app_updated)
        self.updated_version = None

        # This is a windowless application mostly using the system tray
        self.setQuitOnLastWindowClosed(False)

        self.setup_systray()

        # Direct Edit conflict
        self.manager.get_drive_edit().driveEditConflict.connect(
            self._direct_edit_conflict)

        # Check if actions is required, separate method so it can be override
        self.init_checks()
        self.engineWidget = None

        # Setup notification center for Mac
        if AbstractOSIntegration.is_mac():
            if AbstractOSIntegration.os_version_above("10.8"):
                self._setup_notification_center()
Ejemplo n.º 7
0
    def __init__(self, manager, *args):
        super(Application, self).__init__(manager, *args)
        self.setQuitOnLastWindowClosed(False)
        self._delegator = None
        from nxdrive.scripting import DriveUiScript
        self.manager.set_script_object(DriveUiScript(manager, self))
        self.mainEngine = None
        self.filters_dlg = None
        self._conflicts_modals = dict()
        self.current_notification = None
        self.default_tooltip = self.manager.app_name

        for _, engine in self.manager.get_engines().iteritems():
            self.mainEngine = engine
            break
        if self.mainEngine is not None and Options.debug:
            from nxdrive.engine.engine import EngineLogger
            self.engineLogger = EngineLogger(self.mainEngine)
        self.engineWidget = None

        self.aboutToQuit.connect(self.manager.stop)
        self.manager.dropEngine.connect(self.dropped_engine)

        # Timer to spin the transferring icon
        self.icon_spin_timer = QtCore.QTimer()
        self.icon_spin_timer.timeout.connect(self.spin_transferring_icon)
        self.icon_spin_count = 0

        # Application update
        self.manager.get_updater().appUpdated.connect(self.app_updated)
        self.updated_version = None

        # This is a windowless application mostly using the system tray
        self.setQuitOnLastWindowClosed(False)

        self.setup_systray()

        # Direct Edit conflict
        self.manager.direct_edit.directEditConflict.connect(self._direct_edit_conflict)

        # Check if actions is required, separate method so it can be override
        self.init_checks()
        self.engineWidget = None

        # Setup notification center for macOS
        if (AbstractOSIntegration.is_mac()
                and AbstractOSIntegration.os_version_above('10.8')):
            self._setup_notification_center()
Ejemplo n.º 8
0
 def _new_notification(self, notification):
     if not notification.is_bubble():
         return
     if AbstractOSIntegration.is_mac():
         if AbstractOSIntegration.os_version_above("10.8"):
             from nxdrive.osi.darwin.pyNotificationCenter import notify, NotificationDelegator
             if self._delegator is None:
                 self._delegator = NotificationDelegator.alloc().init()
                 self._delegator._manager = self.manager
             # Use notification center
             userInfo = dict()
             userInfo["uuid"] = notification.get_uid()
             return notify(notification.get_title(), None, notification.get_description(), userInfo=userInfo)
     self.current_notification = notification
     icon = QtGui.QSystemTrayIcon.Information
     if (notification.get_level() == Notification.LEVEL_WARNING):
         icon = QtGui.QSystemTrayIcon.Warning
     elif (notification.get_level() == Notification.LEVEL_ERROR):
         icon =  QtGui.QSystemTrayIcon.Critical
     self.show_message(notification.get_title(), notification.get_description(), icon=icon)