From c784be9b0f94e1829cb5a7338c1a3a47891bfeba Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 7 Feb 2002 14:42:53 +0000 Subject: [PATCH] Plugins can now add attributes to the image attribute pulldown menu svn: r762 --- src/ImageSelect.py | 15 ++++++++++----- src/Plugins.py | 13 +++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 738f74071..49476de42 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -46,6 +46,7 @@ import libglade import const import utils import Config +import Plugins from RelLib import * import RelImage @@ -210,7 +211,7 @@ class Gallery(ImageSelect): icon_list.drag_dest_set(GTK.DEST_DEFAULT_ALL, t, GDK.ACTION_COPY | GDK.ACTION_MOVE) icon_list.connect("drag_data_received", self.on_photolist_drag_data_received) - icon_list.drag_source_set(GDK.BUTTON1_MASK|GDK.BUTTON3_MASK,t,\ + icon_list.drag_source_set(GDK.BUTTON1_MASK|GDK.BUTTON3_MASK,t, GDK.ACTION_COPY | GDK.ACTION_MOVE) icon_list.connect("drag_data_get", self.on_photolist_drag_data_get) @@ -573,7 +574,8 @@ class LocalMediaProperties: if len(obj.selection) > 0: row = obj.selection[0] attr = obj.get_row_data(row) - AttrEdit.AttributeEditor(self,attr,"Media Object",[]) + AttrEdit.AttributeEditor(self,attr,"Media Object", + Plugins.get_image_attributes()) def on_delete_attr_clicked(self,obj): if utils.delete_selected(obj,self.alist): @@ -582,7 +584,8 @@ class LocalMediaProperties: def on_add_attr_clicked(self,obj): import AttrEdit - AttrEdit.AttributeEditor(self,None,"Media Object",[]) + AttrEdit.AttributeEditor(self,None,"Media Object", + Plugins.get_image_attributes()) #------------------------------------------------------------------------- # @@ -745,7 +748,8 @@ class GlobalMediaProperties: if len(obj.selection) > 0: row = obj.selection[0] attr = obj.get_row_data(row) - AttrEdit.AttributeEditor(self,attr,"Media Object",[]) + AttrEdit.AttributeEditor(self,attr,"Media Object", + Plugins.get_image_attributes()) def on_delete_attr_clicked(self,obj): if utils.delete_selected(obj,self.alist): @@ -754,7 +758,8 @@ class GlobalMediaProperties: def on_add_attr_clicked(self,obj): import AttrEdit - AttrEdit.AttributeEditor(self,None,"Media Object",[]) + AttrEdit.AttributeEditor(self,None,"Media Object", + Plugins.get_image_attributes()) #------------------------------------------------------------------------- # diff --git a/src/Plugins.py b/src/Plugins.py index 109362117..0fe6704a8 100644 --- a/src/Plugins.py +++ b/src/Plugins.py @@ -371,6 +371,19 @@ def register_draw_doc(name,classref): return _drawdoc.append((name,classref)) +#------------------------------------------------------------------------- +# +# Image attributes +# +#------------------------------------------------------------------------- +_image_attributes = [] +def register_image_attribute(name): + if name not in _image_attributes: + _image_attributes.append(name) + +def get_image_attributes(): + return _image_attributes + #------------------------------------------------------------------------- # # Building pulldown menus