diff --git a/src/Config.py b/src/Config.py index 52800f6aa..42b0002e6 100644 --- a/src/Config.py +++ b/src/Config.py @@ -93,6 +93,7 @@ prefsTop = None autoload = 0 usetabs = 0 usevc = 0 +vc_comment = 0 uncompress = 0 show_detail = 0 hide_altnames = 0 @@ -152,6 +153,7 @@ def loadConfig(call): global owner global usetabs global usevc + global vc_comment global uncompress global id_visible global id_edit @@ -175,6 +177,7 @@ def loadConfig(call): lastfile = gnome.config.get_string("/gramps/data/LastFile") usetabs = gnome.config.get_bool("/gramps/config/UseTabs") usevc = gnome.config.get_bool("/gramps/config/UseVersionControl") + vc_comment = gnome.config.get_bool("/gramps/config/UseComment") uncompress = gnome.config.get_bool("/gramps/config/DontCompressXML") id_visible = gnome.config.get_bool("/gramps/config/IdVisible") id_edit = gnome.config.get_bool("/gramps/config/IdEdit") @@ -248,6 +251,8 @@ def loadConfig(call): usetabs = 0 if usevc == None: usevc = 0 + if vc_comment == None: + vc_comment = 0 if uncompress == None: uncompress = 0 if id_visible == None: @@ -354,6 +359,7 @@ def on_propertybox_apply(obj,page): global owner global usetabs global usevc + global vc_comment global uncompress global id_visible global id_edit @@ -377,6 +383,7 @@ def on_propertybox_apply(obj,page): attr_name = string.strip(prefsTop.get_widget("attr_name").get_text()) usetabs = prefsTop.get_widget("usetabs").get_active() usevc = prefsTop.get_widget("use_vc").get_active() + vc_comment = prefsTop.get_widget("vc_comment").get_active() uncompress = prefsTop.get_widget("uncompress").get_active() id_visible = prefsTop.get_widget("gid_visible").get_active() id_edit = prefsTop.get_widget("gid_edit").get_active() @@ -408,6 +415,7 @@ def on_propertybox_apply(obj,page): gnome.config.set_bool("/gramps/config/UseTabs",usetabs) gnome.config.set_bool("/gramps/config/UseVersionControl",usevc) + gnome.config.set_bool("/gramps/config/UseComment",vc_comment) gnome.config.set_bool("/gramps/config/DontCompressXML",uncompress) gnome.config.set_bool("/gramps/config/IdVisible",id_visible) gnome.config.set_bool("/gramps/config/IdEdit",id_edit) @@ -551,6 +559,7 @@ def display_preferences_box(): idedit = prefsTop.get_widget("gid_edit") tabs = prefsTop.get_widget("usetabs") vc = prefsTop.get_widget("use_vc") + vcom = prefsTop.get_widget("vc_comment") compress = prefsTop.get_widget("uncompress") detail = prefsTop.get_widget("showdetail") display_attr_obj = prefsTop.get_widget("attr_display") @@ -559,6 +568,7 @@ def display_preferences_box(): detail.set_active(show_detail) tabs.set_active(usetabs) vc.set_active(usevc) + vcom.set_active(vc_comment) compress.set_active(uncompress) vis.set_active(id_visible) idedit.set_active(id_edit) diff --git a/src/ImageSelect.py b/src/ImageSelect.py new file mode 100644 index 000000000..b8ae688ff --- /dev/null +++ b/src/ImageSelect.py @@ -0,0 +1,122 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000 Donald N. Allingham +# +# 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 +# + +#------------------------------------------------------------------------- +# +# Standard python modules +# +#------------------------------------------------------------------------- +import os +import string + +#------------------------------------------------------------------------- +# +# GTK/Gnome modules +# +#------------------------------------------------------------------------- +from gtk import * +from gnome.ui import * +import libglade +import GdkImlib + +#------------------------------------------------------------------------- +# +# gramps modules +# +#------------------------------------------------------------------------- +import intl +import const +import utils +import Config +from RelLib import * +import RelImage +import Sources + +_ = intl.gettext + +#------------------------------------------------------------------------- +# +# ImageSelect class +# +#------------------------------------------------------------------------- +class ImageSelect: + + #--------------------------------------------------------------------- + # + # __init__ - Creates an edit window. Associates a person with the + # window. + # + #--------------------------------------------------------------------- + def __init__(self, path, prefix): + self.path = path; + self.prefix = prefix; + self.glade = libglade.GladeXML(const.imageselFile,"imageSelect") + self.window = self.glade.get_widget("imageSelect") + self.fname = self.glade.get_widget("fname") + self.image = self.glade.get_widget("image") + self.description = self.glade.get_widget("photoDescription") + self.external = self.glade.get_widget("private") + + self.glade.signal_autoconnect({ + "on_savephoto_clicked" : self.on_savephoto_clicked, + "on_name_changed" : self.on_name_changed, + "destroy_passed_object" : utils.destroy_passed_object + }) + + self.window.editable_enters(self.description) + self.window.show() + + def on_name_changed(self, obj): + filename = self.fname.get_text() + if os.path.isfile(filename): + image = RelImage.scale_image(filename,const.thumbScale) + self.image.load_imlib(image) + + def on_savephoto_clicked(self, obj): + filename = self.glade.get_widget("photosel").get_full_path(0) + description = self.glade.get_widget("photoDescription").get_text() + + if os.path.exists(filename) == 0: + return + + if self.external.get_active() == 1: + if os.path.isfile(filename): + name = filename + thumb = "%s%s.thumb%s%s" % (self.path,os.sep,os.sep,os.path.basename(filename)) + RelImage.mk_thumb(filename,thumb,const.thumbScale) + else: + return + else: + name = RelImage.import_photo(filename,self.path,self.prefix) + if name == None: + return + + photo = Photo() + photo.setPath(name) + photo.setDescription(description) + + self.savephoto(photo) + + utils.modified() + utils.destroy_passed_object(obj) + + def savephoto(self, photo): + assert 0, "The savephoto function must be subclassed" + diff --git a/src/config.glade b/src/config.glade index bfdeb355b..3777870bb 100644 --- a/src/config.glade +++ b/src/config.glade @@ -59,7 +59,7 @@ GtkTable table13 - 3 + 6 2 False 0 @@ -125,20 +125,20 @@ GtkCheckButton - use_vc + usetabs True toggled on_object_toggled propertybox - Tue, 02 Oct 2001 14:14:35 GMT + Thu, 15 Feb 2001 21:32:23 GMT - + False True 0 - 1 + 2 2 3 5 @@ -153,20 +153,114 @@ - GtkOptionMenu - vc_menu + GtkEntry + attr_name True - RCS - - 0 + + changed + on_object_toggled + propertybox + Thu, 24 May 2001 21:14:30 GMT + + True + True + 0 + 1 2 - 2 - 3 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + + + + + GtkCheckButton + gid_edit + True + + toggled + on_object_toggled + propertybox + Thu, 12 Jul 2001 13:42:44 GMT + + + False + True + + 0 + 2 + 4 + 5 5 5 - True + False + False + False + False + True + False + + + + + GtkCheckButton + gid_visible + True + + toggled + on_object_toggled + propertybox + Thu, 12 Jul 2001 13:42:44 GMT + + + False + True + + 0 + 2 + 3 + 4 + 5 + 5 + False + False + False + False + True + False + + + + + GtkCheckButton + attr_display + True + + toggled + on_object_toggled + propertybox + Thu, 24 May 2001 21:14:10 GMT + + + False + True + + 0 + 1 + 5 + 6 + 5 + 5 + False False False False @@ -198,105 +292,17 @@ 0 0 - - GtkEntry - attr_name - True - - changed - on_object_toggled - propertybox - Thu, 24 May 2001 21:14:30 GMT - - True - True - 0 - - - 1 - 2 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - GtkCheckButton - attr_display + vc_comment True toggled on_object_toggled propertybox - Thu, 24 May 2001 21:14:10 GMT + Thu, 04 Oct 2001 13:26:10 GMT - - False - True - - 0 - 1 - 3 - 4 - 5 - 5 - False - False - False - False - True - False - - - - - GtkCheckButton - usetabs - True - - toggled - on_object_toggled - propertybox - Thu, 15 Feb 2001 21:32:23 GMT - - - False - True - - 0 - 2 - 0 - 1 - 5 - 5 - False - False - False - False - True - False - - - - - GtkCheckButton - gid_visible - True - - toggled - on_object_toggled - propertybox - Thu, 12 Jul 2001 13:42:44 GMT - - + False True @@ -317,22 +323,45 @@ GtkCheckButton - gid_edit + use_vc True toggled on_object_toggled propertybox - Thu, 12 Jul 2001 13:42:44 GMT + Tue, 02 Oct 2001 14:14:35 GMT - + False True 0 + 1 + 0 + 1 + 5 + 5 + False + False + False + False + True + False + + + + + GtkOptionMenu + vc_menu + True + RCS + + 0 + + 1 2 - 2 - 3 + 0 + 1 5 5 False @@ -349,7 +378,7 @@ GtkLabel Notebook:tab label209 - + GTK_JUSTIFY_CENTER False 0.5 diff --git a/src/gramps.glade b/src/gramps.glade index f16a2be03..db59ff184 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -6463,4 +6463,118 @@ Unknown + + GnomeDialog + revcom + Gramps - Revison Control Comment + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox17 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area17 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button135 + True + True + + clicked + on_savecomment_clicked + revcom + Thu, 04 Oct 2001 13:42:23 GMT + + GNOME_STOCK_BUTTON_OK + + + + + GtkVBox + vbox46 + False + 0 + + 0 + True + True + + + + GtkLabel + label252 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkHSeparator + hseparator26 + + 10 + False + False + + + + + GtkEntry + text + 350 + True + True + True + 0 + + + 0 + False + False + + + + + + diff --git a/src/gramps_main.py b/src/gramps_main.py index d143f5ba1..34b4b3ff0 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1231,14 +1231,17 @@ def on_ok_button2_clicked(obj): filename = obj.get_filename() if filename: utils.destroy_passed_object(obj) - save_file(filename) + if Config.usevc and Config.vc_comment: + display_comment_box(filename) + else: + save_file(filename,_("No Comment Provided")) #------------------------------------------------------------------------- # # # #------------------------------------------------------------------------- -def save_file(filename): +def save_file(filename,comment): import WriteXML import VersionControl @@ -1280,7 +1283,7 @@ def save_file(filename): if Config.usevc: vc = VersionControl.RcsVersionControl(path) - vc.checkin(filename,"comments not supported yet",not Config.uncompress) + vc.checkin(filename,comment,not Config.uncompress) statusbar.set_status("") statusbar.set_progress(0) @@ -1983,35 +1986,52 @@ def on_save_as_activate(obj): fileSelector = wFs.get_widget(FILESEL) fileSelector.show() -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- def on_save_activate(obj): + """Saves the file, first prompting for a comment if revision control needs it""" if not database.getSavePath(): on_save_as_activate(obj) else: - save_file(database.getSavePath()) + if Config.usevc and Config.vc_comment: + display_comment_box(database.getSavePath()) + else: + save_file(database.getSavePath(),_("No Comment Provided")) -#------------------------------------------------------------------------- -# -# Switch notebook pages from menu -# -#------------------------------------------------------------------------- +def display_comment_box(filename): + """Displays a dialog box, prompting for a revison control comment""" + top = libglade.GladeXML(const.gladeFile,"revcom") + rc = top.get_widget("revcom") + tbox = top.get_widget("text") + + rc.editable_enters(tbox) + rc.set_data("f",filename) + rc.set_data("t",tbox) + top.signal_autoconnect({ + "on_savecomment_clicked" : on_savecomment_clicked, + }) + +def on_savecomment_clicked(obj): + """Saves the database, passing the revison control comment to the save routine""" + save_file(obj.get_data("f"),obj.get_data("t").get_text()) + utils.destroy_passed_object(obj) + def on_person_list1_activate(obj): + """Switches to the person list view""" notebook.set_page(0) def on_family1_activate(obj): + """Switches to the family view""" notebook.set_page(1) def on_pedegree1_activate(obj): + """Switches to the pedigree view""" notebook.set_page(2) def on_sources_activate(obj): + """Switches to the sources view""" notebook.set_page(3) def on_places_activate(obj): + """Switches to the places view""" notebook.set_page(4) #-------------------------------------------------------------------------