pychecker fixes

svn: r321
This commit is contained in:
Don Allingham 2001-08-10 04:32:31 +00:00
parent 806eacf320
commit ed3ce9f818
23 changed files with 55 additions and 157 deletions

View File

@ -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):
@ -214,24 +214,3 @@ class AbiWordDoc(TextDoc):
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()

View File

@ -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

View File

@ -22,7 +22,6 @@ from TextDoc import *
import string
import os
import sys
import utils
#------------------------------------------------------------------------

View File

@ -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))
#-------------------------------------------------------------------------
#

View File

@ -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()
#-------------------------------------------------------------------------
#
#

View File

@ -910,7 +910,7 @@ class GrampsParser(handler.ContentHandler):
# Gramps database parsing class. Derived from SAX XML parser
#
#-------------------------------------------------------------------------
class GrampsImportParser(handler.ContentHandler):
class GrampsImportParser(GrampsParser):
#---------------------------------------------------------------------
#

View File

@ -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 '<!-- START -->' 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)

View File

@ -219,7 +219,6 @@ class KwordDoc(TextDoc):
self.f.write('<FLOW value="1"/>\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('<TEXT>')
self.f.write(latin_to_utf8(self.text))
self.f.write('</TEXT>\n')
old_pos = 0
self.f.write('<FORMATS>\n')
for format in self.format_list:
self.f.write(format)
@ -337,7 +335,6 @@ class KwordDoc(TextDoc):
self.f.write('<FLOW value="1"/>\n')
first = self.p.get_first_indent()
right = self.p.get_right_margin()
left = self.p.get_left_margin()
first = left+first

View File

@ -20,8 +20,6 @@
from gtk import *
import sys
_enable = 0
oddbg = (0xffff,0xffff,0xffff)
evenbg = (0xffff,0xffff,0xffff)

View File

@ -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))
#-------------------------------------------------------------------------
#

View File

@ -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('</style:style>\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()

View File

@ -24,10 +24,7 @@
#
#-------------------------------------------------------------------------
from gtk import *
from gnome.ui import *
import GTK
import gnome.config
import libglade
import intl

View File

@ -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:

View File

@ -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

View File

@ -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)

View File

@ -18,13 +18,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import os
#-------------------------------------------------------------------------
#
# GTK/Gnome modules

View File

@ -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):

View File

@ -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)
#------------------------------------------------------------------------
#

View File

@ -20,7 +20,6 @@
import string
import os
import sys
import utils
#-------------------------------------------------------------------------

View File

@ -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(" </source>\n")
g.write(" </sources>\n")
if len(db.getBookmarks()) > 0:
if len(database.getBookmarks()) > 0:
g.write(" <bookmarks>\n")
for person in db.getBookmarks():
for person in database.getBookmarks():
g.write(' <bookmark ref="%s"/>\n' % person.getId())
g.write(" </bookmarks>\n")

View File

@ -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

View File

@ -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()

View File

@ -50,7 +50,6 @@ def clearModified():
def wasModified():
return _modifiedFlag
#-------------------------------------------------------------------------
#
# Short hand function to return either the person's name, or an empty