def remove_map_cb (self, mobj, a): map = MapList.get_by_window(mobj) if map: MapList.delete(map) self.view.emit ('cursor-changed') return raise "Cant remove map of window %s" % mobj
def delete_clicked (self, button): map = self.get_selected_map () if not map: raise "You clicked on delete but had no map selected" error_message = "" if map.window: error_message = _("The map cannot be deleted right now. Is it open?") elif not map.filename: error_message = _("The map has no associated filename.") if error_message: dialog = Gtk.MessageDialog (self, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK, _("Cannot delete this map")) dialog.format_secondary_text (error_message) dialog.run () dialog.hide () del (dialog) return dialog = Gtk.MessageDialog (self, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO, _("Do you really want to delete this Map?")) resp = dialog.run () dialog.hide () del (dialog) if resp != Gtk.ResponseType.YES: return MapList.delete (map) self.view.emit ('cursor-changed')
def remove_map_cb (self, mobj, a): map = MapList.get_by_window(mobj) if map: MapList.delete(map) self.view.emit ('cursor-changed') return raise ValueError("Cant remove map of window %s" % mobj)
def delete_clicked (self, button): map = self.get_selected_map () if not map: raise ValueError("You clicked on delete but had no map selected") error_message = "" if map.window: error_message = _("The map cannot be deleted right now. Is it open?") elif not map.filename: error_message = _("The map has no associated filename.") if error_message: dialog = gtk.MessageDialog (self, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, _("Cannot delete this map")) dialog.format_secondary_text (error_message) dialog.run () dialog.hide () del (dialog) return dialog = gtk.MessageDialog (self, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO, _("Do you really want to delete this Map?")) resp = dialog.run () dialog.hide () del (dialog) if resp != gtk.RESPONSE_YES: return MapList.delete (map) self.view.emit ('cursor-changed')
def delete_clicked (self, button): map = self.get_selected_map () if not map: raise ValueError("You clicked on delete but had no map selected") error_message = "" if map.window: error_message = _("The map cannot be deleted right now. Is it open?") elif not map.filename: error_message = _("The map has no associated filename.") if error_message: dialog = gtk.MessageDialog (self, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, _("Cannot delete this map")) dialog.format_secondary_text (error_message) dialog.run () dialog.hide () del (dialog) return dialog = gtk.MessageDialog (self, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO, _("Do you really want to delete this Map?")) resp = dialog.run () dialog.hide () del (dialog) if resp != gtk.RESPONSE_YES: return MapList.delete (map) self.view.emit ('cursor-changed')