More general code clean up
svn: r478
This commit is contained in:
parent
5c6fac8c16
commit
188e011dd5
@ -155,7 +155,7 @@ class EditPerson:
|
||||
self.window.editable_enters(self.ddate);
|
||||
self.window.editable_enters(self.dplace);
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
id = self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : self.on_cancel_edit,
|
||||
"on_add_address_clicked" : self.on_add_addr_clicked,
|
||||
"on_add_aka_clicked" : self.on_add_aka_clicked,
|
||||
@ -260,6 +260,7 @@ class EditPerson:
|
||||
self.redraw_addr_list()
|
||||
self.redraw_name_list()
|
||||
self.redraw_url_list()
|
||||
self.window.show()
|
||||
|
||||
def get_widget(self,str):
|
||||
"""returns the widget related to the passed string"""
|
||||
@ -370,17 +371,24 @@ class EditPerson:
|
||||
gnome.url.show(text)
|
||||
|
||||
def on_cancel_edit(self,obj):
|
||||
global quit
|
||||
|
||||
if self.did_data_change():
|
||||
q = _("Data was modified. Are you sure you want to abandon your changes?")
|
||||
quit = obj
|
||||
GnomeQuestionDialog(q,cancel_callback)
|
||||
q = _("Are you sure you want to abandon your changes?")
|
||||
GnomeQuestionDialog(q,self.cancel_callback)
|
||||
else:
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
def on_delete_event(self,obj,b):
|
||||
self.on_cancel_edit(obj)
|
||||
if self.did_data_change():
|
||||
q = _("Are you sure you want to abandon your changes?")
|
||||
GnomeQuestionDialog(q,self.cancel_callback)
|
||||
return TRUE
|
||||
else:
|
||||
utils.destroy_passed_object(obj)
|
||||
return FALSE
|
||||
|
||||
def cancel_callback(self,a):
|
||||
if a==0:
|
||||
utils.destroy_passed_object(self.window)
|
||||
|
||||
def did_data_change(self):
|
||||
|
||||
@ -695,6 +703,7 @@ class EditPerson:
|
||||
|
||||
self.update_lists()
|
||||
self.callback(self)
|
||||
self.window.hide()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
def on_primary_name_source_clicked(self,obj):
|
||||
@ -794,19 +803,9 @@ def disp_event(event):
|
||||
return [const.display_pevent(event.getName()),
|
||||
event.getQuoteDate(),event.getPlaceName(),attr]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def cancel_callback(a):
|
||||
if a==0:
|
||||
utils.destroy_passed_object(quit)
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# birth_dates_in_order
|
||||
|
@ -129,14 +129,7 @@ class ImageSelect:
|
||||
self.savephoto(mobj)
|
||||
|
||||
if type[0:5] == "image":
|
||||
if self.external.get_active() == 1:
|
||||
if os.path.isfile(filename):
|
||||
name = filename
|
||||
thumb = "%s/.thumb/%s.jpg" % (self.path,mobj.getId())
|
||||
RelImage.mk_thumb(filename,thumb,const.thumbScale)
|
||||
else:
|
||||
return
|
||||
else:
|
||||
if self.external.get_active() == 0:
|
||||
name = RelImage.import_media_object(filename,self.path,mobj.getId())
|
||||
else:
|
||||
if self.external.get_active() == 1:
|
||||
@ -217,11 +210,7 @@ class Gallery(ImageSelect):
|
||||
def add_thumbnail(self, photo):
|
||||
object = photo.getReference()
|
||||
path = object.getPath()
|
||||
if object.getMimeType()[0:5] == "image":
|
||||
thumb = "%s/.thumb/%s.jpg" % (self.path,object.getId())
|
||||
RelImage.check_thumb(path,thumb,const.thumbScale)
|
||||
else:
|
||||
thumb = utils.find_icon(object.getMimeType())
|
||||
thumb = utils.thumb_path(self.db.getSavePath(),object)
|
||||
self.icon_list.append(thumb,object.getDescription())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -401,12 +390,7 @@ class LocalMediaProperties:
|
||||
|
||||
descr_window.set_text(self.object.getDescription())
|
||||
mtype = self.object.getMimeType()
|
||||
if mtype[0:5] == "image":
|
||||
thumb = "%s/.thumb/%s" % (path,self.object.getId())
|
||||
RelImage.check_thumb(fname,thumb,const.thumbScale)
|
||||
pixmap.load_file(thumb)
|
||||
else:
|
||||
pixmap.load_file(utils.find_icon(mtype))
|
||||
pixmap.load_file(utils.thumb_path(path,self.object))
|
||||
|
||||
self.change_dialog.get_widget("private").set_active(photo.getPrivacy())
|
||||
self.change_dialog.get_widget("gid").set_text(self.object.getId())
|
||||
@ -489,12 +473,7 @@ class GlobalMediaProperties:
|
||||
|
||||
descr_window.set_text(self.object.getDescription())
|
||||
mtype = self.object.getMimeType()
|
||||
if mtype[0:5] == "image":
|
||||
thumb = "%s/.thumb/%s" % (path,self.object.getId())
|
||||
RelImage.check_thumb(fname,thumb,const.thumbScale)
|
||||
pixmap.load_file(thumb)
|
||||
else:
|
||||
pixmap.load_file(utils.find_icon(mtype))
|
||||
pixmap.load_file(utils.thumb_path(path,self.object))
|
||||
|
||||
self.change_dialog.get_widget("gid").set_text(self.object.getId())
|
||||
|
||||
|
@ -178,9 +178,9 @@ class RcsVersionControl(VersionControl):
|
||||
ofile.close()
|
||||
else:
|
||||
try:
|
||||
os.link("%s/%s" %(self.wd,name),self.tfile)
|
||||
os.link(name,self.tfile)
|
||||
except OSError:
|
||||
shutil.copyfile("%s/%s" %(self.wd,name),self.tfile)
|
||||
shutil.copyfile(name,self.tfile)
|
||||
|
||||
proc = popen2.Popen3("ci -u %s" % self.tfile,1)
|
||||
proc.tochild.write(comment)
|
||||
|
@ -56,7 +56,7 @@ def sortById(first,second):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def fix(line):
|
||||
l = string.stripline(line)
|
||||
l = string.strip(line)
|
||||
l = string.replace(l,'&','&')
|
||||
l = string.replace(l,'>','>')
|
||||
l = string.replace(l,'<','<')
|
||||
|
@ -93,7 +93,7 @@ useExceptions= 0
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
picWidth = 275.0
|
||||
thumbScale = 100.0
|
||||
thumbScale = 96.0
|
||||
indexFile = "data.gramps"
|
||||
male = _("male")
|
||||
female = _("female")
|
||||
|
1802
src/gramps_main.py
1802
src/gramps_main.py
File diff suppressed because it is too large
Load Diff
10
src/utils.py
10
src/utils.py
@ -24,6 +24,7 @@ from gnome.ui import *
|
||||
import string
|
||||
import os
|
||||
import const
|
||||
import RelImage
|
||||
import intl
|
||||
|
||||
_ = intl.gettext
|
||||
@ -378,3 +379,12 @@ def birthday(person):
|
||||
return person.getBirth().getQuoteDate()
|
||||
else:
|
||||
return ""
|
||||
|
||||
def thumb_path(dir,mobj):
|
||||
type = mobj.getMimeType()
|
||||
if type[0:5] == "image":
|
||||
thumb = "%s/.thumb/%s.jpg" % (dir,mobj.getId())
|
||||
RelImage.check_thumb(mobj.getPath(),thumb,const.thumbScale)
|
||||
return thumb
|
||||
else:
|
||||
return find_icon(type)
|
||||
|
Loading…
x
Reference in New Issue
Block a user