本文整理汇总了Python中gtk.ListStore.get_iter方法的典型用法代码示例。如果您正苦于以下问题:Python ListStore.get_iter方法的具体用法?Python ListStore.get_iter怎么用?Python ListStore.get_iter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.ListStore
的用法示例。
在下文中一共展示了ListStore.get_iter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InputWidget
# 需要导入模块: from gtk import ListStore [as 别名]
# 或者: from gtk.ListStore import get_iter [as 别名]
#.........这里部分代码省略.........
def add_picture_cb(self, widget):
"""Show image selection dialog."""
self.main_widget().soundplayer.stop()
self.liststore.clear()
self.imagedir = self.conf['imagedir']
if not os.path.exists(self.imagedir):
self.imagedir = "./images" # on Desktop
if not os.path.exists(self.imagedir):
self.main_widget().information_box(\
_("'Images' directory does not exist!"))
return
if os.listdir(self.imagedir):
self.widgets["MediaDialog"].show()
for fname in os.listdir(self.imagedir):
if os.path.isfile(os.path.join(self.imagedir, fname)):
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(\
os.path.join(self.imagedir, fname), 100, 100)
self.liststore.append(["", "img", fname, \
self.imagedir, pixbuf])
else:
self.main_widget().information_box(\
_("There are no files in 'Images' directory!"))
def select_item_cb(self, widget):
"""
Set html-text with media path and type when user
select media filefrom media selection dialog.
"""
self.widgets["MediaDialog"].hide()
item_index = self.w_tree.get_widget("iconview_widget"). \
get_selected_items()[0]
item_type = self.liststore.get_value( \
self.liststore.get_iter(item_index), 1)
item_fname = self.liststore.get_value( \
self.liststore.get_iter(item_index), 2)
item_dirname = self.liststore.get_value( \
self.liststore.get_iter(item_index), 3)
question_text = """<%s src="%s">""" % \
(item_type, os.path.abspath(os.path.join(item_dirname, item_fname)))
self.areas["question"].get_buffer().set_text(question_text)
self.show_snd_container()
def add_sound_cb(self, widget):
"""Show sound selection dialog."""
self.main_widget().soundplayer.stop()
self.liststore.clear()
self.sounddir = self.conf['sounddir']
if not os.path.exists(self.sounddir):
self.sounddir = "./sounds" # on Desktop
if not os.path.exists(self.sounddir):
self.main_widget().information_box(\
_("'Sounds' directory does not exist!"))
return
if os.listdir(self.sounddir):
self.widgets["MediaDialog"].show()
for fname in os.listdir(self.sounddir):
if os.path.isfile(os.path.join(self.sounddir, fname)):
sound_logo_file = os.path.join( \
self.conf["theme_path"], "soundlogo.png")
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(\
sound_logo_file, 100, 100)
self.liststore.append([fname, "sound", fname, \
self.sounddir, pixbuf])
else: