Example #1
0
	def __init__(self, BDD, TreeView, TVI, CB):
		self.BDD = BDD
		self.data_type = "image"
		
		#Ini panel dossiers
		self.liste_TV = gtk.ListStore(str, str)
		self.BDD.charger_images(self.liste_TV)
		TreeView.set_model(self.liste_TV)
		colonne = gtk.TreeViewColumn('Column 0')
		TreeView.append_column(colonne)
		cell = gtk.CellRendererText()
		pb = gtk.CellRendererPixbuf()
		pb.set_property('stock-id', gtk.STOCK_DIRECTORY)
		colonne.pack_start(pb, True)
		colonne.pack_start(cell, True)
		colonne.add_attribute(cell, 'text', 1)
		TreeView.connect("row-activated", self.on_dossier_click)
		
		#Ini panel catégories
		self.liste_sections = gtk.TreeStore(int, str, gtk.gdk.Pixbuf)
		messager.diffuser('liste_sectionsI', self, ["category", self.liste_sections])
		TVI.set_model(self.liste_sections)
		colonne = gtk.TreeViewColumn('Column 27')
		TVI.append_column(colonne)
		cell = gtk.CellRendererText()
		pb = gtk.CellRendererPixbuf()
		colonne.pack_start(pb, False)
		colonne.pack_start(cell, True)
		colonne.add_attribute(cell, 'text', 1)
		colonne.add_attribute(pb, 'pixbuf', 2)
		TVI.connect("row-activated", self.on_section_click)
		TVI.connect("drag-data-received", self.on_drag_data_receive)
		TVI.connect("button-press-event", self.on_right_click)
		
		#Le TreeView sera la destination à toucher avec la souris
		TVI.enable_model_drag_dest([('text/plain', 0, 0)],
                  gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
                  
		
                  
		#Ini panel univers
		#liste_univers = gtk.ListStore(int, str)
		#messager.diffuser('liste_universI', self, liste_univers)
		#messager.inscrire(self.reload_sections, 'nouvelle_categorieI')
		
		LS_CB = gtk.ListStore(str, str)
		LS_CB.append(["category", "Categories"])
		LS_CB.append(["universe", "Universe"])
		cell = gtk.CellRendererText()
		CB.pack_start(cell)
		CB.add_attribute(cell, "text", 1)
		CB.set_model(LS_CB)
		CB.set_active(0)
		CB.connect("changed", self.changer_mode)
		self.CB = CB
		messager.inscrire(self.reload_sections, "new_categoryI")
		messager.inscrire(self.reload_sections, "new_universeI")
Example #2
0
	def __init__(self, IconView, Image, Box_Controls):
		self.Image = Image

		#self.Image.connect_after("size-request", self.fit_window_size)
		self.Image.get_parent().connect("scroll-event", self.zoom)
		self.IconView = IconView
		self.index = -1
		#messager.inscrire(self.avancer, 'image_suivante')
		#messager.inscrire(self.reculer, 'image_precedente')
		messager.inscrire(self.charger_images, 'desImages')
		
		IconView.connect("drag-begin", self.tmp)
		IconView.connect("drag-data-get", self.on_drag_data_get)
	
		#ordre : id, x, x, thumbnail, note
		self.liste = gtk.ListStore(int, str, str, gtk.gdk.Pixbuf, int)
		IconView.set_model(self.liste)
		#IconView.set_text_column(1)
		IconView.set_pixbuf_column(3)
		IconView.show_all()
		
		#Le IV sera la base du glisser-déposer
		#IconView.enable_model_drag_source(gtk.gdk.MODIFIER_MASK, [('text/plain', 0, 0)],
                  #gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
                  
		#IconView.enable_model_drag_dest([('text/plain', 0, 0)],
                  #gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_MOVE)
		IconView.connect("item-activated", self.on_thumbnail_click)
		IconView.connect("button-press-event", self.on_button_press)
		#IconView.connect("selection-changed", self.on_selection_changed)
		
		#Ini boutons de contrôles
		B_Next = gtk.ToolButton(gtk.STOCK_MEDIA_NEXT)
		B_Prev = gtk.ToolButton(gtk.STOCK_MEDIA_PREVIOUS)
		B_Clear = gtk.ToolButton(gtk.STOCK_CLEAR)
		B_100 = gtk.ToolButton(gtk.STOCK_ZOOM_100)
		B_Zoom_Fit = gtk.ToolButton(gtk.STOCK_ZOOM_FIT)
		B_Zoom_In = gtk.ToolButton(gtk.STOCK_ZOOM_IN)
		B_Zoom_Out = gtk.ToolButton(gtk.STOCK_ZOOM_OUT)
		
		B_Prev.connect("clicked", self.reculer)
		B_Next.connect("clicked", self.avancer)
		B_Clear.connect('clicked', self.clear)
		B_100.connect('clicked', self.zoom, "original")
		B_Zoom_Fit.connect('clicked', self.zoom, "fit")
		B_Zoom_In.connect('clicked', self.zoom, "+")
		B_Zoom_Out.connect('clicked', self.zoom, "-")
		
		
		
		liste_categories = gtk.ListStore(int, str)
		messager.diffuser('liste_sectionsI', self, liste_categories)
		CB = gtk.ComboBoxEntry()
		CB.set_model(liste_categories)
		CB.set_text_column(1)
		CB.set_active(0)
			
		B_Ajouter = gtk.Button(None, gtk.STOCK_ADD)
		B_Ajouter.connect('clicked', self.set_categorie_on_image, CB)
		
		self.rating_item = etoiles.RatingWidget(3, auto_update=False)
		self.rating_item.connect('rating-changed', self.modifier_note)
		self.rating_item.set_sensitive(False)
		self.rating_item.show_all()
		
		#BB = Button Bar
		BB = gtk.HButtonBox()
		BB.add(B_Prev)
		BB.add(B_Next)
		BB.pack_end(B_Clear)
		BB.pack_start(B_100)
		BB.pack_start(B_Zoom_Fit)
		BB.pack_start(B_Zoom_In)
		BB.pack_start(B_Zoom_Out)
		Box_Controls.pack_start(BB, False)
		Box_Controls.pack_start(CB, False)
		Box_Controls.pack_start(B_Ajouter, False)
		Box_Controls.pack_start(self.rating_item, False)
		Box_Controls.show_all()
		

		IconView.enable_model_drag_source(gtk.gdk.MODIFIER_MASK,  [('text/plain', 0, 0)] ,
                  gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
		
		self.Image.set_from_file('icons/bullseye.svg')
		self.mode = "zoom"
		self.zoom = 1