예제 #1
0
    def cancall_opeartion(self, object, res):
        source = res.get_source_object()
        try:
            if isinstance(source, gio.Volume):
                summary = _("Mount Failed")
                body = _("Mount '%s' error.") % source.get_name()
                result = source.mount_finish(res)
            else:
                summary = _("Unmount Failed")
                #body = _("Unmount '%s' error.") % source.get_root().get_uri()
                body = _(
                    "Unmount '%s' error. Please unmount it in file manager"
                ) % source.get_root().get_uri()
                result = source.unmount_finish(res)
        except:
            result = False

        if not result:
            try:
                ntf = DbusNotify(
                    "deepin-system-settings",
                    "/usr/share/icons/Deepin/apps/48/mountmanager.png")
                ntf.set_summary(summary)
                ntf.set_body(body)
                ntf.notify()
            except:
                pass
    def cancall_opeartion(self, object, res):
        source = res.get_source_object()
        try:
            if isinstance(source, gio.Volume):
                summary = _("Mount Failed")
                body = _("Mount '%s' error.") % source.get_name()
                result = source.mount_finish(res)
            else:
                summary = _("Unmount Failed")
                #body = _("Unmount '%s' error.") % source.get_root().get_uri()
                body = _("Unmount '%s' error. Please unmount it in file manager") % source.get_root().get_uri()
                result = source.unmount_finish(res)
        except:
            result = False

        if not result:
            try:
                ntf = DbusNotify("deepin-system-settings", "/usr/share/icons/Deepin/apps/48/mountmanager.png")
                ntf.set_summary(summary)
                ntf.set_body(body)
                ntf.notify()
            except:
                pass
 def show_notify(self, message=None, timeout=None):
     notification = DbusNotify("deepin-software-center")
     notification.set_summary(_("Upgrade Info"))
     notification.set_body(message)
     notification.notify()
예제 #4
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-

from dtk.ui.dbus_notify import DbusNotify

ntf = DbusNotify("weibo-test")
ntf.set_summary("weibo send")
ntf.set_body("Sina Weibo Send Over")
ntf.notify()
예제 #5
0
 def check_for_warning(self, percentage):
     if percentage == self.percentage_low_threshhold or percentage == self.percentage_low or percentage == self.percentage_low_critical:
         ntf = DbusNotify("deepin-system-settings", "/usr/share/icons/Deepin/apps/48/preferences-power.png")
         ntf.set_summary(_("Low power(%s%%)" % percentage))
         ntf.set_body(_("Your battery is running low, please charge!"))
         ntf.notify()