本文整理匯總了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')