Quantcast

gen.lib.attribute and MediaObj

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

gen.lib.attribute and MediaObj

jerome
Devs,


It seems that there was no support for MediaObject reference into
gen.lib.attribute!

Maybe this explains why attribute_list is not updated after creating a
custom attribute on a media object? Related issues might be on
to_struct() and backreferences.


I tried to provide a patch but got two loops on modules loading
(Attribute -> MediaBase -> MediaRef -> Attribute)!

I do not know if we should fix all branches, despite the fact that I
get the problem from 3.4 to master ... Maybe this was always missing?
This could be a major problem, but I did no have major issues by
quickly looking at this problem (i.e only minor refresh issue for
attribute list and empty backreferences for attribute).



Jérôme













------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gen.lib.media... and custom attributes

jerome
Sorry, the missing reference is rather somewhere on gen.lib.media*.py
for custom attributes and/or related to meta_data table.


Jérôme


Le sam. 19 juil. 2014 at 17:32, Jerome <[hidden email]> a écrit :

> Devs,
>
>
> It seems that there was no support for MediaObject reference into
> gen.lib.attribute!
>
> Maybe this explains why attribute_list is not updated after creating
> a
> custom attribute on a media object? Related issues might be on
> to_struct() and backreferences.
>
>
> I tried to provide a patch but got two loops on modules loading
> (Attribute -> MediaBase -> MediaRef -> Attribute)!
>
> I do not know if we should fix all branches, despite the fact that I
> get the problem from 3.4 to master ... Maybe this was always missing?
> This could be a major problem, but I did no have major issues by
> quickly looking at this problem (i.e only minor refresh issue for
> attribute list and empty backreferences for attribute).
>
>
>
> Jérôme
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index
> and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gen.lib.media... and custom attributes

Tim Lyons
Administrator
Jérôme

I am afraid that I don't understand at all what you think is missing.

Perhaps you could send (privately to my email address?) some screenshots of what you tried to do and what you expected to see.

Please note that it is not the case that every reference can be attached to every object. Perhaps what you think is missing is never supposed to be there?

Tim.




jerome wrote
Sorry, the missing reference is rather somewhere on gen.lib.media*.py
for custom attributes and/or related to meta_data table.


Jérôme


Le sam. 19 juil. 2014 at 17:32, Jerome <[hidden email]> a écrit :
> Devs,
>
>
> It seems that there was no support for MediaObject reference into
> gen.lib.attribute!
>
> Maybe this explains why attribute_list is not updated after creating
> a
> custom attribute on a media object? Related issues might be on
> to_struct() and backreferences.
>
>
> I tried to provide a patch but got two loops on modules loading
> (Attribute -> MediaBase -> MediaRef -> Attribute)!
>
> I do not know if we should fix all branches, despite the fact that I
> get the problem from 3.4 to master ... Maybe this was always missing?
> This could be a major problem, but I did no have major issues by
> quickly looking at this problem (i.e only minor refresh issue for
> attribute list and empty backreferences for attribute).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gen.lib.media... and custom attributes

jerome
Tim,

Thank you!

Yes, I was wrong about the cause,
but the issue exists
and maybe it was always there!

I got problems to properly identify the process used to refresh
attributes list when a new custom attribute has been created (ie. only
on a media object).

I thought it was on gen.lib.media* or related modules, but everything
looks right. By right, I just mean same common logic as event or person
objects; two objects also handling custom attributes, so something goes
wrong for handling a custom attribute on media object. Looks like
something related to metadata (custom objects) and user's data (custom
attributes on media object).

I know that I can quickly be unclear ... but this issue is something I
am monitoring since last year. You can look at birth of this on bug
report #6934[1]. Skip first comments from history and start from
comment ~37541[2].

After creating a custom attribute on a media object, this new entry -
despite stored into meta_data table (.db) - is not added as a new
custom attribute available on attributes list. This works fine for
event and person objects!

This issue might be cosmetic (refresh on GUI), but it is also pointing
to DB read/write and/or update signal. To identify the cause is
something that I was not able to do.

Otherwise, this issue can be also confusing for users after importing
some custom data like exhibits (census, records, TMG, etc ...).

Anyway, you are right I should rather fill a bug report with steps to
reproduce it, and maybe a simple testcase database with screenshots.


[1] https://gramps-project.org/bugs/view.php?id=6934
[2] https://gramps-project.org/bugs/view.php?id=6934#c37541


Jérôme.


Le jeu. 31 juil. 2014 at 19:11, Tim Lyons <[hidden email]> a
écrit :

> Jérôme
>
> I am afraid that I don't understand at all what you think is missing.
>
> Perhaps you could send (privately to my email address?) some
> screenshots of
> what you tried to do and what you expected to see.
>
> Please note that it is not the case that every reference can be
> attached to
> every object. Perhaps what you think is missing is never supposed to
> be
> there?
>
> Tim.
>
>
>
>
>
> jerome wrote
>>  Sorry, the missing reference is rather somewhere on
>> gen.lib.media*.py
>>  for custom attributes and/or related to meta_data table.
>>  
>>  
>>  Jérôme
>>  
>>
> --
> View this message in context:
> http://gramps.1791082.n4.nabble.com/gen-lib-attribute-and-MediaObj-tp4666646p4666714.html
> Sent from the GRAMPS - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: gen.lib.media... and custom attributes

jerome
In reply to this post by Tim Lyons
Tim,


Nick pointed out the missing module into displaytabs!

It was a simple GUI issue with user's callback leading to inconsistency
on embeded custom attribute list behavior between some primary objects.

eg, this patch (master/41) works for me:

diff --git a/gramps/gui/editors/displaytabs/__init__.py
b/gramps/gui/editors/displaytabs/__init__.py
index 3611865..16ae65a 100644
--- a/gramps/gui/editors/displaytabs/__init__.py
+++ b/gramps/gui/editors/displaytabs/__init__.py
@@ -46,6 +46,7 @@ from .familyldsembedlist import FamilyLdsEmbedList
 from .gallerytab import GalleryTab
 from .ldsembedlist import LdsEmbedList
 from .locationembedlist import LocationEmbedList
+from .mediaattrembedlist import MediaAttrEmbedList
 from .mediabackreflist import MediaBackRefList
 from .nameembedlist import NameEmbedList
 from .notebackreflist import NoteBackRefList
diff --git a/gramps/gui/editors/displaytabs/mediaattrembedlist.py
b/gramps/gui/editors/displaytabs/mediaattrembedlist.py
new file mode 100644
index 0000000..749849f
--- /dev/null
+++ b/gramps/gui/editors/displaytabs/mediaattrembedlist.py
@@ -0,0 +1,43 @@
+#
+# Gramps - a GTK+/GNOME based genealogy program
+#
+# Copyright (C) 2014 Nick Hall
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+#
+
+#-------------------------------------------------------------------------
+#
+# Gramps classes
+#
+#-------------------------------------------------------------------------
+from .attrembedlist import AttrEmbedList
+
+#-------------------------------------------------------------------------
+#
+# MediaAttrEmbedList
+#
+#-------------------------------------------------------------------------
+class MediaAttrEmbedList(AttrEmbedList):
+
+ def __init__(self, dbstate, uistate, track, data):
+ AttrEmbedList.__init__(self, dbstate, uistate, track, data)
+
+ def get_editor(self):
+ from .. import EditAttribute
+ return EditAttribute
+
+ def get_user_values(self):
+ return self.dbstate.db.get_media_attribute_types()
diff --git a/gramps/gui/editors/editmedia.py
b/gramps/gui/editors/editmedia.py
index 10c2772..428606f 100644
--- a/gramps/gui/editors/editmedia.py
+++ b/gramps/gui/editors/editmedia.py
@@ -52,7 +52,7 @@ from gramps.gen.utils.file import (media_path_full,
find_file, create_checksum)
 from .editprimary import EditPrimary
 from ..widgets import (MonitoredDate, MonitoredEntry, PrivacyButton,
                          MonitoredTagList)
-from .displaytabs import (CitationEmbedList, AttrEmbedList, NoteTab,
+from .displaytabs import (CitationEmbedList, MediaAttrEmbedList,
NoteTab,
                          MediaBackRefList)
 from .addmedia import AddMediaObject
 from ..dialog import ErrorDialog
@@ -201,7 +201,7 @@ class EditMedia(EditPrimary):
         self._add_tab(notebook, self.citation_tab)
         self.track_ref_for_deletion("citation_tab")
 
- self.attr_tab = AttrEmbedList(self.dbstate,
+ self.attr_tab = MediaAttrEmbedList(self.dbstate,
                                       self.uistate,
                                       self.track,
                                       self.obj.get_attribute_list())
diff --git a/gramps/gui/editors/editmediaref.py
b/gramps/gui/editors/editmediaref.py
index 0b45003..8027715 100644
--- a/gramps/gui/editors/editmediaref.py
+++ b/gramps/gui/editors/editmediaref.py
@@ -54,7 +54,7 @@ from gramps.gen.utils.file import (media_path_full,
find_file, create_checksum)
 from gramps.gen.lib import NoteType
 from gramps.gen.db import DbTxn
 from ..glade import Glade
-from .displaytabs import (CitationEmbedList, AttrEmbedList,
MediaBackRefList,
+from .displaytabs import (CitationEmbedList, MediaAttrEmbedList,
MediaBackRefList,
                          NoteTab)
 from ..widgets import (MonitoredSpinButton, MonitoredEntry,
PrivacyButton,
                        MonitoredDate, MonitoredTagList,
SelectionWidget, Region)
@@ -459,7 +459,7 @@ class EditMediaRef(EditReference):
         self._add_tab(notebook_ref, self.srcref_list)
         self.track_ref_for_deletion("srcref_list")
 
- self.attr_list = AttrEmbedList(self.dbstate,self.uistate,self.track,
+ self.attr_list =
MediaAttrEmbedList(self.dbstate,self.uistate,self.track,
                                       
self.source_ref.get_attribute_list())
         self._add_tab(notebook_ref, self.attr_list)
         self.track_ref_for_deletion("attr_list")
@@ -484,7 +484,7 @@ class EditMediaRef(EditReference):
         self._add_tab(notebook_src, self.src_srcref_list)
         self.track_ref_for_deletion("src_srcref_list")
 
- self.src_attr_list =
AttrEmbedList(self.dbstate,self.uistate,self.track,
+ self.src_attr_list =
MediaAttrEmbedList(self.dbstate,self.uistate,self.track,
                                           
self.source.get_attribute_list())
         self._add_tab(notebook_src, self.src_attr_list)
         self.track_ref_for_deletion("src_attr_list")
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 59ec824..718f0cd 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -298,6 +298,7 @@ gramps/gui/editors/displaytabs/grampstab.py
 gramps/gui/editors/displaytabs/groupembeddedlist.py
 gramps/gui/editors/displaytabs/ldsmodel.py
 gramps/gui/editors/displaytabs/locationmodel.py
+gramps/gui/editors/displaytabs/mediaattrembedlist.py
 gramps/gui/editors/displaytabs/mediabackreflist.py
 gramps/gui/editors/displaytabs/notebackreflist.py
 gramps/gui/editors/displaytabs/notemodel.py



Thank you.

Jérôme


Le jeu. 31 juil. 2014 at 19:11, Tim Lyons <[hidden email]> a
écrit :

> Jérôme
>
> I am afraid that I don't understand at all what you think is missing.
>
> Perhaps you could send (privately to my email address?) some
> screenshots of
> what you tried to do and what you expected to see.
>
> Please note that it is not the case that every reference can be
> attached to
> every object. Perhaps what you think is missing is never supposed to
> be
> there?
>
> Tim.
>
>
> --
> View this message in context:
> http://gramps.1791082.n4.nabble.com/gen-lib-attribute-and-MediaObj-tp4666646p4666714.html
> Sent from the GRAMPS - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Infragistics Professional
> Build stunning WinForms apps today!
> Reboot your WinForms applications with our WinForms controls.
> Build a bridge from your legacy apps to the future.
> http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Loading...