From 0869dbaa9297b06319af8b311278156b4da93c4c Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 12 Nov 2002 04:12:18 +0000 Subject: [PATCH] Added ability to use natilus theme icons. Set default path for writing GEDCOM files. svn: r1185 --- src/GrampsCfg.py | 1 + src/ImageSelect.py | 1 - src/Utils.py | 38 ++++++++++++++++++++++++++++++++++++-- src/const.py | 3 +++ src/const.py.in | 3 +++ src/plugins/WriteGedcom.py | 5 +++++ 6 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 95aac9a80..9f02271fb 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -1080,3 +1080,4 @@ def save_filter(val): def get_filter(): return get_bool("/gramps/config/filter") + diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 8684f544d..40cfb732f 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -950,4 +950,3 @@ class DeleteMediaQuery: if self.update: self.update(0) - diff --git a/src/Utils.py b/src/Utils.py index e95432e50..3950dff17 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -332,9 +332,43 @@ def get_place_from_list(obj): else: return select[0].get_data(LISTOBJ) +def nautilus_icon(icon,type): + import GrampsCfg + + theme = GrampsCfg.client.get_string("/desktop/gnome/file_views/icon_theme") + + if icon : + newicon = "%s/%s/%s.png" % (const.nautdir,theme,icon) + if os.path.isfile(newicon): + return newicon + else: + newicon = "%s/document-icons/%s.png" % (const.pixdir,icon) + if os.path.isfile(newicon): + return newicon + return None + elif type == "x-directory/": + if theme: + newicon = "%s/%s/i-directory.png" % (const.nautdir,theme) + else: + newicon = "%s/gnome-folder.png" % const.pixdir + if os.path.isfile(newicon): + return newicon + return None + else: + icontmp = type.replace('/','-') + if theme: + newicon = "%s/%s/gnome-%s.png" % (const.nautdir,theme,icontmp) + if os.path.isfile(newicon): + return newicon + else: + newicon = "%s/document-icons/gnome-%s.png" % (const.nautdir,icontmp) + if os.path.isfile(newicon): + return newicon + return None + def find_icon(mtype): - n = "%s/icons/%s.png" % (const.rootDir,string.replace(string.replace(mtype,'/','-'),'.','-')) - if os.path.isfile(n): + n = nautilus_icon(None,mtype) + if n: return n else: return const.icon diff --git a/src/const.py b/src/const.py index 7a3598928..5f74b4c2a 100644 --- a/src/const.py +++ b/src/const.py @@ -42,6 +42,9 @@ editor = "gimp" zipcmd = "zip -r -q" convert = "convert" +pixdir = "/usr/share/pixmaps" +nautdir = "/usr/share/pixmaps/nautilus" + #------------------------------------------------------------------------- # # Paths to files - assumes that files reside in the same directory as diff --git a/src/const.py.in b/src/const.py.in index e3963333e..3cab6985c 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -42,6 +42,9 @@ editor = "gimp" zipcmd = "zip -r -q" convert = "convert" +pixdir = "/usr/share/pixmaps" +nautdir = "/usr/share/pixmaps/nautilus" + #------------------------------------------------------------------------- # # Paths to files - assumes that files reside in the same directory as diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index e1461b598..57b7163bb 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -356,6 +356,11 @@ class GedcomWriter: target_obj.set_menu(myMenu) self.target_menu = myMenu + + pathname = "%s.ged" % os.path.dirname(db.getSavePath()) + + filetgt = self.topDialog.get_widget('fileentry1') + filetgt.set_filename(pathname) self.topDialog.get_widget("gedcomExport").show()