def on_deleteButton_clicked(self, *args): if self.currentSnp is not None: if self.snpman.is_standalone_snapshot(self.currentSnp): message = _("Deleting the selected snapshot `%s` will remove your backup for this particular point in time. You cannot undo this operation.\n\nAre you sure that you want to remove the snapshot permanently?")\ % self.currentSnp dialog = misc.msgdialog( message_str=message, msgtype=Gtk.MessageType.QUESTION, parent=self.top_window, buttons=Gtk.ButtonsType.YES_NO, headline_str=_("Do you really want to remove snapshot?")) response = dialog.run() dialog.destroy() if response == Gtk.RESPONSE_YES: try: self.logger.debug("Trying to remove snapshot '%s'" % self.currentSnp.getName()) self.snpman.removeSnapshot(self.currentSnp) except exceptions.SBackupError as error: self.logger.exception( "Error while delete snapshot: %s" % error) _message_str = _("While attempting to delete snapshot the following error occurred:\n%s")\ % error _boxtitle = _("Simple Backup error") _headline_str = _("Unable to delete snapshot") GObject.idle_add(self._show_errmessage, _message_str, _boxtitle, _headline_str) self.snpman.get_snapshots_allformats_ro(force_reload=True) self.on_calendar_day_selected() else: message = _("The selected snapshot '%s' is referenced by more recent snapshots as base snapshot.\n\nRemove all of these child snapshots in order to delete this snapshot.")\ % self.currentSnp misc.show_infodialog( message_str=message, parent=self.top_window, headline_str=_("Unable to remove snapshot"))
def test_simple(self): _msg = "Test with <content>: '*****@*****.**' & '*****@*****.**'" _mtype = gtk.MESSAGE_ERROR _par = None _dialog = misc.msgdialog(message_str=_msg, msgtype=_mtype, parent=_par) self.assertTrue(isinstance(_dialog, gtk.MessageDialog))
def test_simple_ampersand(self): _msg = "Test with ampersand: 'user & xy.com'" _mtype = gtk.MESSAGE_ERROR _par = None _dialog = misc.msgdialog(message_str=_msg, msgtype=_mtype, parent=_par) self.assertTrue(isinstance(_dialog, gtk.MessageDialog))
def test_simple_greater(self): _msg = "Test with <content>: 'user xy.com'" _mtype = Gtk.MessageType.ERROR _par = None _dialog = misc.msgdialog(message_str=_msg, msgtype=_mtype, parent=_par) self.assertTrue(isinstance(_dialog, Gtk.MessageDialog))