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 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()