コード例 #1
0
ファイル: modales.py プロジェクト: yoann01/bullseye
		def __init__(self, section='general'):
			gtk.Dialog.__init__(self, title=_("Settings editor"), buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
			self.Box_Main = gtk.HBox()
			self.get_content_area().pack_start(self.Box_Main)
			
			icons_dir = xdg.get_data_dir() + 'icons/'
			TreeView = gtk.TreeView()
			TreeView.connect("button-press-event", self.on_section_click)
			self.liste_sections = gtk.TreeStore(str, str, gtk.gdk.Pixbuf)
			self.liste_sections.append(None, ['general', _('General'), None])
			self.liste_sections.append(None, ['folders', _('Indexed folders'), None])
			music_node = self.liste_sections.append(None, ['music', _('Music'), gtk.gdk.pixbuf_new_from_file(icons_dir + 'track.png')])
			self.liste_sections.append(music_node, ['music_filters', _('Filters'), None])
			self.liste_sections.append(music_node, ['audioscrobbler', _('Audioscrobbler'), None])
			self.liste_sections.append(None, ['pictures', _('Pictures'), None])
			self.liste_sections.append(None, ['videos', _('Videos'), None])
			
			cell = gtk.CellRendererText()
			cellpb = gtk.CellRendererPixbuf()
			Col_Label = gtk.TreeViewColumn(_('Section'), cellpb, pixbuf=2)
			Col_Label.pack_start(cell, False)
			Col_Label.set_attributes(cell, text=1)
			TreeView.append_column(Col_Label)
			TreeView.set_model(self.liste_sections)
			self.Box_Main.pack_start(TreeView, False)
			
			self.show_all()
			self.initialiser_composants()
			self.load_section(section)
			
			reponse = self.run()
			if(reponse == -3):
				self.valider()
			self.destroy()
コード例 #2
0
ファイル: iconselector.py プロジェクト: yoann01/bullseye
	def data(self, index, role):
		item = self.items[index.row()]
		if not index.isValid():
			return None
		elif role == QtCore.Qt.DisplayRole:
			if item.module != 'picture':
				return item.file[:20] + (item.file[20:] and '..')
			else:
				return None
		elif role == QtCore.Qt.DecorationRole:
			try:
				if(item.icon is None):
					item.icon = QtGui.QPixmap(item.thumbnail_path)
					
			except:
				item.icon = QtGui.QPixmap(item.thumbnail_path)
				
			if item.icon.isNull():
				item.icon = QtGui.QPixmap(xdg.get_data_dir() + os.sep + 'icons' + os.sep + item.module + '.png')
				
			return item.icon