本文整理汇总了Python中MapList.MapList类的典型用法代码示例。如果您正苦于以下问题:Python MapList类的具体用法?Python MapList怎么用?Python MapList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MapList类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: remove_map_cb
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
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:7,代码来源:Browser.py
示例2: delete_clicked
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')
开发者ID:amilapsn,项目名称:labyrinth,代码行数:26,代码来源:Browser.py
示例3: delete_clicked
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')
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:26,代码来源:Browser.py
示例4: get_selected_map
def get_selected_map(self):
sel = self.view.get_selection ()
(model, it) = sel.get_selected ()
if it:
(num,) = MapList.tree_view_model.get (it, self.COL_ID)
return MapList.get_by_index(num)
return None
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:7,代码来源:Browser.py
示例5: open_map
def open_map (self, map, imported=False):
win = MainWindow.LabyrinthWindow (map.filename, imported)
win.connect ("title-changed", self.map_title_cb)
win.connect ("window_closed", self.remove_map_cb)
win.connect ("file_saved", self.file_save_cb)
win.show ()
map.window = win
return (MapList.index(map), win)
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:8,代码来源:Browser.py
示例6: quit_clicked
def quit_clicked (self, button, other=None, *data):
for map in MapList.get_open_windows():
map.window.close_window_cb (None)
width, height = self.main_window.get_size()
if os.name != 'nt':
self.config_client.set_int('/apps/labyrinth/width', width)
self.config_client.set_int('/apps/labyrinth/height', height)
Gtk.main_quit ()
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:11,代码来源:Browser.py
示例7: populate_view
def populate_view (self):
cellrenderer = Gtk.CellRendererText()
cellrenderer.set_property("ellipsize", Pango.EllipsizeMode.END)
column = Gtk.TreeViewColumn(_("Map Name"), cellrenderer,
text=self.COL_TITLE)
column.set_resizable(True)
column.set_expand (True)
column.set_sort_column_id (1)
self.view.append_column(column)
col1 = Gtk.TreeViewColumn (_("Last Modified"), Gtk.CellRendererText(),
text=self.COL_MODTIME)
col1.set_resizable(True)
col1.set_sort_column_id (2)
self.view.append_column(col1)
self.view.set_model (MapList.get_TreeViewModel())
self.view.set_search_column(self.COL_TITLE)
self.view.set_enable_search (True)
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:19,代码来源:Browser.py
示例8: import_clicked
def import_clicked(self, button, other=None, *data):
chooser = Gtk.FileChooserDialog(title=_("Open File"), action=Gtk.FileChooserAction.OPEN, \
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
filtr = Gtk.FileFilter ()
filtr.set_name(_('MAPZ Compressed Map (*.mapz)'))
filtr.add_pattern('*.mapz')
chooser.add_filter(filtr)
response = chooser.run()
if response == Gtk.ResponseType.OK:
filename = chooser.get_filename()
tf = tarfile.open(filename)
mapname = utils.get_save_dir() + tf.getnames()[0]
tf.extractall(utils.get_save_dir())
tf.close()
map = MapList.new_from_file(mapname)
map.filename = mapname
chooser.destroy()
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:20,代码来源:Browser.py
示例9: import_clicked
def import_clicked(self, button, other=None, *data):
chooser = gtk.FileChooserDialog(title=_("Open File"), action=gtk.FILE_CHOOSER_ACTION_OPEN, \
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
filtr = gtk.FileFilter ()
filtr.set_name(_('MAPZ Compressed Map (*.mapz)'))
filtr.add_pattern('*.mapz')
chooser.add_filter(filtr)
response = chooser.run()
if response == gtk.RESPONSE_OK:
filename = chooser.get_filename()
tf = tarfile.open(filename)
mapname = os.path.join (utils.get_save_dir (), tf.getnames()[0])
tf.extractall(utils.get_save_dir())
tf.close()
map = MapList.new_from_file(mapname)
map.filename = mapname
chooser.destroy()
开发者ID:rainbof,项目名称:labyrinth,代码行数:20,代码来源:Browser.py
示例10: file_save_cb
def file_save_cb (self, mobj, new_fname, mobj1):
map = MapList.get_by_window(mobj)
if map:
map.window = None
map.filename = new_fname
return
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:6,代码来源:Browser.py
示例11: new_clicked
def new_clicked (self, button):
map = MapList.create_empty_map()
self.open_map(map)
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:3,代码来源:Browser.py
示例12: map_title_cb
def map_title_cb (self, mobj, new_title, mobj1):
map = MapList.get_by_window(mobj)
if not map:
raise AttributeError ("What a mess, can't find the map")
map.title = new_title
开发者ID:Boquete,项目名称:activity-labyrinth,代码行数:5,代码来源:Browser.py
注:本文中的MapList.MapList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论