diff --git a/gramps/src/AbiWordDoc.py b/gramps/src/AbiWordDoc.py index aa2de2751..469200504 100644 --- a/gramps/src/AbiWordDoc.py +++ b/gramps/src/AbiWordDoc.py @@ -167,7 +167,7 @@ class AbiWordDoc(TextDoc): self.f.write(leader) self.f.write('\t') - def page_break(self,orientation=None): + def page_break(self): self.new_page = 1 def end_paragraph(self): @@ -213,25 +213,4 @@ class AbiWordDoc(TextDoc): self.f.write('; text-decoration:underline') self.f.write('">') - -if __name__ == "__main__": - paper = PaperStyle("Letter",27.94,21.59) - - doc = AbiWordDoc(paper,PAPER_PORTRAIT) - foo = FontStyle() - foo.set_type_face(FONT_SANS_SERIF) - foo.set_color((255,0,0)) - foo.set_size(24) - - para = ParagraphStyle() - doc.add_style("Normal",para) - - doc.open("test") - - doc.start_paragraph("Normal") - doc.add_photo("image.jpg",200,200) - doc.end_paragraph() - - doc.close() - diff --git a/gramps/src/Config.py b/gramps/src/Config.py index 0e3554aa3..96e64f7a0 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -24,9 +24,7 @@ # Standard python modules # #------------------------------------------------------------------------- -import sys import string -import re import os import PaperMenu @@ -92,6 +90,7 @@ _name_format_list = [ #------------------------------------------------------------------------- owner = Researcher.Researcher() +prefsTop = None autoload = 0 usetabs = 0 uncompress = 0 diff --git a/gramps/src/DrawDoc.py b/gramps/src/DrawDoc.py index c2c0d635c..ce6db5ec7 100644 --- a/gramps/src/DrawDoc.py +++ b/gramps/src/DrawDoc.py @@ -22,7 +22,6 @@ from TextDoc import * import string import os -import sys import utils #------------------------------------------------------------------------ diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 71e8be2fc..2322e58a6 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -25,7 +25,6 @@ #------------------------------------------------------------------------- import os import string -import utils #------------------------------------------------------------------------- # @@ -850,8 +849,7 @@ def on_add_address_clicked(obj): # #------------------------------------------------------------------------- def on_event_add_clicked(obj): - epo = obj.get_data(EDITPERSON) - editor = EventEditor(epo,None) + EventEditor(obj.get_data(EDITPERSON),None) #------------------------------------------------------------------------- # @@ -889,10 +887,7 @@ def on_event_update_clicked(obj): row = obj.get_data(INDEX) if row < 0: return - - epo = obj.get_data(EDITPERSON) - event = obj.get_row_data(row) - editor = EventEditor(epo,event) + EventEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) #------------------------------------------------------------------------- # diff --git a/gramps/src/EditSource.py b/gramps/src/EditSource.py index 5444c9cb3..e03a04e2e 100644 --- a/gramps/src/EditSource.py +++ b/gramps/src/EditSource.py @@ -26,7 +26,6 @@ #------------------------------------------------------------------------- import os import string -import utils #------------------------------------------------------------------------- # @@ -47,7 +46,6 @@ import libglade import intl import const import utils -import Config from RelLib import * import RelImage @@ -375,6 +373,29 @@ def on_change_description(obj): "on_apply_clicked" : on_apply_clicked }) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_ok_clicked(obj): + on_apply_clicked(obj) + utils.destroy_passed_object(obj) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_apply_clicked(obj): + photo = obj.get_data("p") + text = obj.get_data("t").get_text() + if text != photo.getDescription(): + photo.setDescription(text) + edit_window = obj.get_data("m") + edit_window.load_images() + utils.modified() + #------------------------------------------------------------------------- # # diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py index f5d519368..10bc1379e 100644 --- a/gramps/src/GrampsParser.py +++ b/gramps/src/GrampsParser.py @@ -910,7 +910,7 @@ class GrampsParser(handler.ContentHandler): # Gramps database parsing class. Derived from SAX XML parser # #------------------------------------------------------------------------- -class GrampsImportParser(handler.ContentHandler): +class GrampsImportParser(GrampsParser): #--------------------------------------------------------------------- # diff --git a/gramps/src/HtmlDoc.py b/gramps/src/HtmlDoc.py index 760f3e4ff..24cc7c8d1 100644 --- a/gramps/src/HtmlDoc.py +++ b/gramps/src/HtmlDoc.py @@ -19,16 +19,15 @@ # import os -import tempfile import string import re import intl import utils +import gnome.ui _ = intl.gettext from TextDoc import * -import const #------------------------------------------------------------------------ # @@ -116,7 +115,6 @@ class HtmlDoc(TextDoc): mymsg = _("The marker '' was not in the template") gnome.ui.GnomeErrorDialog(mymsg) except IOError,msg: - import gnome.ui mymsg = _("Could not open %s\nUsing the default template") % \ self.template @@ -125,8 +123,6 @@ class HtmlDoc(TextDoc): self.bottom = _bottom self.top = _top except: - import gnome.ui - mymsg = _("Could not open %s\nUsing the default template") % \ self.template gnome.ui.GnomeWarningDialog(mymsg) diff --git a/gramps/src/KwordDoc.py b/gramps/src/KwordDoc.py index 956af21e6..18a68cb4b 100644 --- a/gramps/src/KwordDoc.py +++ b/gramps/src/KwordDoc.py @@ -219,7 +219,6 @@ class KwordDoc(TextDoc): self.f.write('\n') first = p.get_first_indent() - right = p.get_right_margin() left = p.get_left_margin() first = left+first @@ -318,7 +317,6 @@ class KwordDoc(TextDoc): self.f.write('') self.f.write(latin_to_utf8(self.text)) self.f.write('\n') - old_pos = 0 self.f.write('\n') for format in self.format_list: self.f.write(format) @@ -337,7 +335,6 @@ class KwordDoc(TextDoc): self.f.write('\n') first = self.p.get_first_indent() - right = self.p.get_right_margin() left = self.p.get_left_margin() first = left+first diff --git a/gramps/src/ListColors.py b/gramps/src/ListColors.py index 456f70e2c..bde3168f2 100644 --- a/gramps/src/ListColors.py +++ b/gramps/src/ListColors.py @@ -20,8 +20,6 @@ from gtk import * -import sys - _enable = 0 oddbg = (0xffff,0xffff,0xffff) evenbg = (0xffff,0xffff,0xffff) diff --git a/gramps/src/Marriage.py b/gramps/src/Marriage.py index b6e79361f..22a9bb935 100644 --- a/gramps/src/Marriage.py +++ b/gramps/src/Marriage.py @@ -122,7 +122,6 @@ class Marriage: self.attr_changed = 0 # set initial data - mevent_list = self.get_widget("marriageEvent") self.load_images() self.type_field.set_popdown_strings(const.familyRelations) @@ -388,7 +387,7 @@ def on_close_marriage_editor(obj): # #------------------------------------------------------------------------- def on_add_clicked(obj): - editor = EventEditor(obj.get_data(MARRIAGE),None) + EventEditor(obj.get_data(MARRIAGE),None) #------------------------------------------------------------------------- # @@ -400,10 +399,7 @@ def on_update_clicked(obj): row = obj.get_data(INDEX) if row < 0: return - - family_obj = obj.get_data(MARRIAGE) - event = obj.get_row_data(row) - editor = EventEditor(family_obj,event) + EventEditor(obj.get_data(MARRIAGE),obj.get_row_data(row)) #------------------------------------------------------------------------- # diff --git a/gramps/src/OpenDrawDoc.py b/gramps/src/OpenDrawDoc.py index 7e7f5d1e5..be1a65863 100644 --- a/gramps/src/OpenDrawDoc.py +++ b/gramps/src/OpenDrawDoc.py @@ -243,7 +243,6 @@ class OpenDrawDoc(DrawDoc): self.f.write('draw:shadow="visible" ') else: self.f.write('draw:shadow="hidden" ') - pname = style.get_paragraph_style() self.f.write('/>\n') self.f.write('\n') @@ -445,28 +444,3 @@ class OpenDrawDoc(DrawDoc): else: self.f.write('/>\n') -if __name__ == "__main__": - - - - s = PaperStyle("Junk",27.94,21.59) - x = OpenDrawDoc(s,PAPER_PORTRAIT) - f = FontStyle() - f.set_type_face(FONT_SANS_SERIF) - f.set_size(14) - p = ParagraphStyle() - p.set_font(f) - x.add_paragraph_style("mytest",p) - - g = GraphicsStyle() - g.set_width(2) - g.set_height(2) - g.set_paragraph_style("mytest") - g.set_shadow(1) - x.add_draw_style("mybox",g) - - x.open("/home/dona/test") - x.start_page() - x.draw_box("mybox","Hello",4,4) - x.end_page() - x.close() diff --git a/gramps/src/Plugins.py b/gramps/src/Plugins.py index 2c7fa14b8..3f9db1022 100644 --- a/gramps/src/Plugins.py +++ b/gramps/src/Plugins.py @@ -24,10 +24,7 @@ # #------------------------------------------------------------------------- from gtk import * -from gnome.ui import * -import GTK -import gnome.config import libglade import intl diff --git a/gramps/src/RTFDoc.py b/gramps/src/RTFDoc.py index 5eb33959d..d9ad76c67 100644 --- a/gramps/src/RTFDoc.py +++ b/gramps/src/RTFDoc.py @@ -130,7 +130,7 @@ class RTFDoc(TextDoc): # #-------------------------------------------------------------------- def start_paragraph(self,style_name,leader=None): - self.open = 0 + self.opened = 0 p = self.style_list[style_name] # build font information @@ -181,17 +181,17 @@ class RTFDoc(TextDoc): self.f.write('\\ri%d' % twips(p.get_right_margin())) if leader: - self.open = 1 + self.opened = 1 self.f.write('\\tx%d' % twips(p.get_left_margin())) self.f.write('{%s ' % self.font_type) self.write_text(leader) self.f.write('\\tab}') - self.open = 0 + self.opened = 0 #-------------------------------------------------------------------- # # Ends a paragraph. Care has to be taken to make sure that the - # braces are closed properly. The self.open flag is used to indicate + # braces are closed properly. The self.opened flag is used to indicate # if braces are currently open. If the last write was the end of # a bold-faced phrase, braces may already be closed. # @@ -199,10 +199,10 @@ class RTFDoc(TextDoc): def end_paragraph(self): if not self.in_table: self.f.write(self.text) - if self.open: + if self.opened: self.f.write('}') self.text = "" - self.open = 0 + self.opened = 0 self.f.write('\n\\par') else: if self.text == "": @@ -215,10 +215,10 @@ class RTFDoc(TextDoc): # #-------------------------------------------------------------------- def start_bold(self): - if self.open: + if self.opened: self.f.write('}') self.f.write('{%s\\b ' % self.font_type) - self.open = 1 + self.opened = 1 #-------------------------------------------------------------------- # @@ -226,7 +226,7 @@ class RTFDoc(TextDoc): # #-------------------------------------------------------------------- def end_bold(self): - self.open = 0 + self.opened = 0 self.f.write('}') #-------------------------------------------------------------------- @@ -358,8 +358,8 @@ class RTFDoc(TextDoc): # #-------------------------------------------------------------------- def write_text(self,text): - if self.open == 0: - self.open = 1 + if self.opened == 0: + self.opened = 1 self.text = self.text + '{%s ' % self.font_type for i in text: if ord(i) > 127: diff --git a/gramps/src/ReadXML.py b/gramps/src/ReadXML.py index 8ee994d1b..1704a853b 100644 --- a/gramps/src/ReadXML.py +++ b/gramps/src/ReadXML.py @@ -159,33 +159,3 @@ def loadData(database, filename, callback): xml_file.close() return 1 - - -if __name__ == "__main__": - - import sys - import time - import profile - - def lcb(val): - pass - - db = RelDataBase() - file = sys.argv[1] - - t1 = time.time() - - profile.run('loadData(db,file,lcb)') -# loadData(db,file,lcb) - t2 = time.time() - print t2 - t1 - - - - - - - - - - diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index 6ec6ef3ae..6c1dd0915 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -124,7 +124,7 @@ class Attribute: def setNoteObj(self,obj): self.note = obj - def getNoteObj(self,obj): + def getNoteObj(self): return self.note def setSourceRef(self,id) : @@ -217,7 +217,7 @@ class Address: def setNoteObj(self,obj): self.note = obj - def getNoteObj(self,obj): + def getNoteObj(self): return self.note def setDate(self,text): @@ -990,9 +990,6 @@ class SourceRef: def setNoteObj(self,note): self.comments = note - def getComments(self): - return self.comments - def setComments(self,comments): self.comments.set(comments) diff --git a/gramps/src/Sources.py b/gramps/src/Sources.py index 3e7c24075..aba528719 100644 --- a/gramps/src/Sources.py +++ b/gramps/src/Sources.py @@ -18,13 +18,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -#------------------------------------------------------------------------- -# -# Standard python modules -# -#------------------------------------------------------------------------- -import os - #------------------------------------------------------------------------- # # GTK/Gnome modules diff --git a/gramps/src/SpreadSheetDoc.py b/gramps/src/SpreadSheetDoc.py index 22804b1f7..3d16d47c5 100644 --- a/gramps/src/SpreadSheetDoc.py +++ b/gramps/src/SpreadSheetDoc.py @@ -82,7 +82,7 @@ class SpreadSheetDoc: def close(self): pass - def start_page(self,orientation=None): + def start_page(self,name,style_name): pass def end_page(self): diff --git a/gramps/src/StyleEditor.py b/gramps/src/StyleEditor.py index e3cedf037..7bf10e410 100644 --- a/gramps/src/StyleEditor.py +++ b/gramps/src/StyleEditor.py @@ -67,7 +67,7 @@ def on_add_clicked(obj): top = obj.get_data("o") style = top.sheetlist.get_style_sheet("default") - x = StyleEditor("New Style",style,top) + StyleEditor("New Style",style,top) #------------------------------------------------------------------------ # @@ -100,7 +100,7 @@ def on_edit_clicked(obj): index = top.list.get_data("i") (name,style) = top.list.get_row_data(index) - x = StyleEditor(name,style,top) + StyleEditor(name,style,top) #------------------------------------------------------------------------ # diff --git a/gramps/src/TextDoc.py b/gramps/src/TextDoc.py index c5582159f..fd3e4501c 100644 --- a/gramps/src/TextDoc.py +++ b/gramps/src/TextDoc.py @@ -20,7 +20,6 @@ import string import os -import sys import utils #------------------------------------------------------------------------- diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index 0bbb7ad85..cae5186a3 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -221,8 +221,6 @@ def dump_name(g,label,name,index=1): #------------------------------------------------------------------------- def exportData(database, filename, callback): - global db - db = database date = string.split(time.ctime(time.time())) fileroot = os.path.dirname(filename) @@ -440,9 +438,9 @@ def exportData(database, filename, callback): g.write(" \n") g.write(" \n") - if len(db.getBookmarks()) > 0: + if len(database.getBookmarks()) > 0: g.write(" \n") - for person in db.getBookmarks(): + for person in database.getBookmarks(): g.write(' \n' % person.getId()) g.write(" \n") diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 10eb59fdf..74ad9c2b1 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -24,9 +24,7 @@ # Standard python modules # #------------------------------------------------------------------------- -import sys import string -import re import os #------------------------------------------------------------------------- @@ -34,7 +32,7 @@ import os # internationalization # #------------------------------------------------------------------------- -import intl,sys +import intl _ = intl.gettext #------------------------------------------------------------------------- @@ -90,6 +88,9 @@ select_father = None select_spouse = None select_mother = None select_child_list = {} +childWindow = None +newChildWindow= None +addChildList = None bookmarks = None id2col = {} @@ -2331,8 +2332,6 @@ def apply_filter(): color_clist = ListColors.ColorList(person_list,1) - i=0 - datacomp = DataFilter.compare clistadd = color_clist.add_with_data gname = utils.phonebook_from_name diff --git a/gramps/src/latin_ansel.py b/gramps/src/latin_ansel.py index e69325890..d779738e8 100644 --- a/gramps/src/latin_ansel.py +++ b/gramps/src/latin_ansel.py @@ -68,14 +68,6 @@ _t0 = { 0xDF : chr(0xCF), 0xDE : chr(0xA4), 0xFE : chr(0xB4), 0xD8 : chr(0xA2), 0xF8 : chr(0xB3), 0xC6 : chr(0xA5), 0xE6 : chr(0xB5), 0xBA : chr(0xF0) } -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- - -import cStringIO - #------------------------------------------------------------------------- # # @@ -86,7 +78,7 @@ def ansel_to_latin(s): while s: try: head,s = ansel_to_code(s) - except Exception,e: + except Exception: from traceback import print_exc print_exc() head = s[0] @@ -116,7 +108,7 @@ def latin_to_ansel(s): ansel = _t1[c] buff.write(ansel[0]) buff.write(ansel[1]) - except Exception,e: + except Exception: print "ANSEL decoding error: %x: %s" % (c,orig) s = s[1:] ans = buff.getvalue() diff --git a/gramps/src/utils.py b/gramps/src/utils.py index 48d0264c6..865a3d676 100644 --- a/gramps/src/utils.py +++ b/gramps/src/utils.py @@ -50,7 +50,6 @@ def clearModified(): def wasModified(): return _modifiedFlag - #------------------------------------------------------------------------- # # Short hand function to return either the person's name, or an empty