本文整理汇总了Python中MapList.MapList.delete方法的典型用法代码示例。如果您正苦于以下问题:Python MapList.delete方法的具体用法?Python MapList.delete怎么用?Python MapList.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapList.MapList
的用法示例。
在下文中一共展示了MapList.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_clicked
# 需要导入模块: from MapList import MapList [as 别名]
# 或者: from MapList.MapList import delete [as 别名]
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')
示例2: remove_map_cb
# 需要导入模块: from MapList import MapList [as 别名]
# 或者: from MapList.MapList import delete [as 别名]
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
示例3: delete_clicked
# 需要导入模块: from MapList import MapList [as 别名]
# 或者: from MapList.MapList import delete [as 别名]
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')