correct tab errors given by tabnanny

svn: r16439
This commit is contained in:
Benny Malengier 2011-01-22 16:47:26 +00:00
parent ad0e1c0a29
commit 710726f259
3 changed files with 77 additions and 77 deletions

View File

@ -8,7 +8,7 @@
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
@ -101,7 +101,7 @@ class CLIDialog:
def destroy(self): def destroy(self):
pass pass
vbox = CLIVbox() vbox = CLIVbox()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Progress meter class # Progress meter class
@ -111,23 +111,23 @@ class CLIDialog:
class ProgressMeter(object): class ProgressMeter(object):
""" """
Progress meter class for GRAMPS. Progress meter class for GRAMPS.
The progress meter has two modes: The progress meter has two modes:
MODE_FRACTION is used when you know the number of steps that will be taken. MODE_FRACTION is used when you know the number of steps that will be taken.
Set the total number of steps, and then call step() that many times. Set the total number of steps, and then call step() that many times.
The progress bar will progress from left to right. The progress bar will progress from left to right.
MODE_ACTIVITY is used when you don't know the number of steps that will be MODE_ACTIVITY is used when you don't know the number of steps that will be
taken. Set up the total number of steps for the bar to get from one end of taken. Set up the total number of steps for the bar to get from one end of
the bar to the other. Then, call step() as many times as you want. The bar the bar to the other. Then, call step() as many times as you want. The bar
will move from left to right until you stop calling step. will move from left to right until you stop calling step.
""" """
MODE_FRACTION = 0 MODE_FRACTION = 0
MODE_ACTIVITY = 1 MODE_ACTIVITY = 1
def __init__(self, title, header='', can_cancel=False, def __init__(self, title, header='', can_cancel=False,
cancel_callback=None, message_area=False): cancel_callback=None, message_area=False):
""" """
Specify the title and the current pass header. Specify the title and the current pass header.
@ -143,7 +143,7 @@ class ProgressMeter(object):
self.__cancel_callback = cancel_callback self.__cancel_callback = cancel_callback
else: else:
self.__cancel_callback = self.handle_cancel self.__cancel_callback = self.handle_cancel
if has_display(): if has_display():
self.__dialog = gtk.Dialog() self.__dialog = gtk.Dialog()
else: else:
@ -158,15 +158,15 @@ class ProgressMeter(object):
self.__dialog.vbox.set_spacing(10) self.__dialog.vbox.set_spacing(10)
self.__dialog.vbox.set_border_width(24) self.__dialog.vbox.set_border_width(24)
self.__dialog.set_size_request(350, 125) self.__dialog.set_size_request(350, 125)
tlbl = gtk.Label('<span size="larger" weight="bold">%s</span>' % title) tlbl = gtk.Label('<span size="larger" weight="bold">%s</span>' % title)
tlbl.set_use_markup(True) tlbl.set_use_markup(True)
self.__dialog.vbox.add(tlbl) self.__dialog.vbox.add(tlbl)
self.__lbl = gtk.Label(header) self.__lbl = gtk.Label(header)
self.__lbl.set_use_markup(True) self.__lbl.set_use_markup(True)
self.__dialog.vbox.add(self.__lbl) self.__dialog.vbox.add(self.__lbl)
self.__pbar = gtk.ProgressBar() self.__pbar = gtk.ProgressBar()
self.__dialog.vbox.add(self.__pbar) self.__dialog.vbox.add(self.__pbar)
@ -216,7 +216,7 @@ class ProgressMeter(object):
buffer.set_text(text) buffer.set_text(text)
else: else:
print "Progress:", text print "Progress:", text
def handle_cancel(self, *args, **kwargs): def handle_cancel(self, *args, **kwargs):
""" """
Default cancel handler (if enabled). Default cancel handler (if enabled).
@ -242,7 +242,7 @@ class ProgressMeter(object):
self.__mode = mode self.__mode = mode
self.__pbar_max = total self.__pbar_max = total
self.__pbar_index = 0.0 self.__pbar_index = 0.0
# If it is cancelling, don't overwite that message: # If it is cancelling, don't overwite that message:
if not self.__cancelled: if not self.__cancelled:
self.__lbl.set_text(header) self.__lbl.set_text(header)
@ -255,7 +255,7 @@ class ProgressMeter(object):
self.__pbar.set_fraction(0.0) self.__pbar.set_fraction(0.0)
else: # ProgressMeter.MODE_ACTIVITY else: # ProgressMeter.MODE_ACTIVITY
self.__pbar.set_pulse_step(1.0/self.__pbar_max) self.__pbar.set_pulse_step(1.0/self.__pbar_max)
while gtk.events_pending(): while gtk.events_pending():
gtk.main_iteration() gtk.main_iteration()
@ -268,22 +268,22 @@ class ProgressMeter(object):
import gtk import gtk
if self.__mode is ProgressMeter.MODE_FRACTION: if self.__mode is ProgressMeter.MODE_FRACTION:
self.__pbar_index = self.__pbar_index + 1.0 self.__pbar_index = self.__pbar_index + 1.0
if self.__pbar_index > self.__pbar_max: if self.__pbar_index > self.__pbar_max:
self.__pbar_index = self.__pbar_max self.__pbar_index = self.__pbar_max
try: try:
val = int(100*self.__pbar_index/self.__pbar_max) val = int(100*self.__pbar_index/self.__pbar_max)
except ZeroDivisionError: except ZeroDivisionError:
val = 0 val = 0
if val != self.__old_val: if val != self.__old_val:
self.__pbar.set_text("%d%%" % val) self.__pbar.set_text("%d%%" % val)
self.__pbar.set_fraction(val/100.0) self.__pbar.set_fraction(val/100.0)
self.__old_val = val self.__old_val = val
else: # ProgressMeter.MODE_ACTIVITY else: # ProgressMeter.MODE_ACTIVITY
self.__pbar.pulse() self.__pbar.pulse()
while gtk.events_pending(): while gtk.events_pending():
gtk.main_iteration() gtk.main_iteration()
@ -293,16 +293,16 @@ class ProgressMeter(object):
import gtk import gtk
self.__lbl.set_text(text) self.__lbl.set_text(text)
while gtk.events_pending(): while gtk.events_pending():
gtk.main_iteration() gtk.main_iteration()
def __warn(self, *obj): def __warn(self, *obj):
""" """
Don't let the user close the progress dialog. Don't let the user close the progress dialog.
""" """
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
WarningDialog( WarningDialog(
_("Attempt to force closing the dialog"), _("Attempt to force closing the dialog"),
_("Please do not force closing this important dialog."), _("Please do not force closing this important dialog."),
self.__dialog) self.__dialog)
return True return True
@ -319,10 +319,10 @@ class ProgressMeter(object):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def open_file_with_default_application( file_path ): def open_file_with_default_application( file_path ):
""" """
Launch a program to open an arbitrary file. The file will be opened using Launch a program to open an arbitrary file. The file will be opened using
whatever program is configured on the host as the default program for that whatever program is configured on the host as the default program for that
type of file. type of file.
@param file_path: The path to the file to be opened. @param file_path: The path to the file to be opened.
Example: "c:\foo.txt" Example: "c:\foo.txt"
@type file_path: string @type file_path: string
@ -330,11 +330,11 @@ def open_file_with_default_application( file_path ):
""" """
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
norm_path = os.path.normpath( file_path ) norm_path = os.path.normpath( file_path )
if not os.path.exists(norm_path): if not os.path.exists(norm_path):
ErrorDialog(_("Error Opening File"), _("File does not exist")) ErrorDialog(_("Error Opening File"), _("File does not exist"))
return return
if constfunc.win(): if constfunc.win():
try: try:
os.startfile(norm_path) os.startfile(norm_path)

View File

@ -75,8 +75,8 @@ _level_name_plural = [ "", "primeiros", "segundos", "terceiros", "quartos",
# i.e. bisavô is 'segundo avô' and so on, that has been the # i.e. bisavô is 'segundo avô' and so on, that has been the
# traditional way in Portuguese. When we run out of ordinals we resort to # traditional way in Portuguese. When we run out of ordinals we resort to
# Nº notation, that is sort of understandable if in context. # Nº notation, that is sort of understandable if in context.
# There is a specificity for pt_BR where they can use "tataravô" instead # There is a specificity for pt_BR where they can use "tataravô" instead
# of "tetravô", being both forms correct for pt_BR but just "tetravô" # of "tetravô", being both forms correct for pt_BR but just "tetravô"
# correct for pt. Translation keeps "tetravô". # correct for pt. Translation keeps "tetravô".
_parents_level = [ "", "pais", "avós", "bisavós", "trisavós", _parents_level = [ "", "pais", "avós", "bisavós", "trisavós",
"tetravós", "pentavós", "hexavós", "heptavós", "octavós"] "tetravós", "pentavós", "hexavós", "heptavós", "octavós"]
@ -99,26 +99,26 @@ _son_level = [ "", "filho", "neto", "bisneto",
_daughter_level = [ "", "filha", "neta", "bisneta", _daughter_level = [ "", "filha", "neta", "bisneta",
"trineta", "tretaneta", "pentaneta", "hexaneta", "heptaneta", "octaneta"] "trineta", "tretaneta", "pentaneta", "hexaneta", "heptaneta", "octaneta"]
_sister_level = [ "", "irmã", "tia", "tia avó", "tia bisavó", "tia trisavó", "tia tetravó", _sister_level = [ "", "irmã", "tia", "tia avó", "tia bisavó", "tia trisavó", "tia tetravó",
"tia pentavó", "tia hexavó", "tia heptavó", "tia octovó"] "tia pentavó", "tia hexavó", "tia heptavó", "tia octovó"]
_brother_level = [ "", "irmão", "tio", "tio avô", "tio bisavô", "tio trisavô", _brother_level = [ "", "irmão", "tio", "tio avô", "tio bisavô", "tio trisavô",
"tio tetravô", "tio pentavô", "tio hexavô", "tio heptavô", "tio octavô"] "tio tetravô", "tio pentavô", "tio hexavô", "tio heptavô", "tio octavô"]
_nephew_level = [ "", "sobrinho", "sobrinho neto", "sobrinho bisneto", "sobrinho trineto", _nephew_level = [ "", "sobrinho", "sobrinho neto", "sobrinho bisneto", "sobrinho trineto",
"sobrinho tetraneto", "sobrinho pentaneto", "sobrinho hexaneto", "sobrinho tetraneto", "sobrinho pentaneto", "sobrinho hexaneto",
"sobrinho heptaneto", "sobrinho octaneto"] "sobrinho heptaneto", "sobrinho octaneto"]
_niece_level = [ "", "sobrinha", "sobrinha neta", "sobrinha bisneta", "sobrinha trineta", _niece_level = [ "", "sobrinha", "sobrinha neta", "sobrinha bisneta", "sobrinha trineta",
"sobrinha tetraneta", "sobrinha pentaneta", "sobrinha hexaneta", "sobrinha tetraneta", "sobrinha pentaneta", "sobrinha hexaneta",
"sobrinha heptaneta", "sobrinha octaneta"] "sobrinha heptaneta", "sobrinha octaneta"]
# Relatório de Parentesco # Relatório de Parentesco
_PARENTS_LEVEL = [u"", u"pais", u"avós", u"bisavós", u"tetravós", _PARENTS_LEVEL = [u"", u"pais", u"avós", u"bisavós", u"tetravós",
u"pentavós", u"hexavós", u"heptavós", u"octavós"] u"pentavós", u"hexavós", u"heptavós", u"octavós"]
_CHILDREN_LEVEL = [u"", u"filhos", u"netos", u"bisnetos", u"trinetos", _CHILDREN_LEVEL = [u"", u"filhos", u"netos", u"bisnetos", u"trinetos",
u"tetranetos", u"pentanetos", u"hexanetos", u"heptanetos" u"tetranetos", u"pentanetos", u"hexanetos", u"heptanetos"
u"octanetos"] u"octanetos"]
@ -154,39 +154,39 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
def get_male_cousin(self, level): def get_male_cousin(self, level):
if level < len(_level_name_male): if level < len(_level_name_male):
return "%s primo" % (_level_name_male[level]) return "%s primo" % (_level_name_male[level])
else: else:
return "%dº primo" % level return "%dº primo" % level
def get_female_cousin(self, level): def get_female_cousin(self, level):
if level < len(_level_name_female): if level < len(_level_name_female):
return "%s prima" % (_level_name_female[level]) return "%s prima" % (_level_name_female[level])
else: else:
return "%dª prima" % level return "%dª prima" % level
def get_distant_uncle(self, level): def get_distant_uncle(self, level):
if level < len(_level_name_male): if level < len(_level_name_male):
return "%s tio" % (_level_name_male[level]) return "%s tio" % (_level_name_male[level])
else: else:
return "%dº tio" % level return "%dº tio" % level
def get_distant_aunt(self, level): def get_distant_aunt(self, level):
if level < len(_level_name_female): if level < len(_level_name_female):
return "%s tia" % (_level_name_female[level]) return "%s tia" % (_level_name_female[level])
else: else:
return "%dª tia" % level return "%dª tia" % level
def get_distant_nephew(self, level): def get_distant_nephew(self, level):
if level < len(_level_name_male): if level < len(_level_name_male):
return "%s sobrinho" % (_level_name_male[level]) return "%s sobrinho" % (_level_name_male[level])
else: else:
return "%dº sobrinho" % level return "%dº sobrinho" % level
def get_distant_niece(self, level): def get_distant_niece(self, level):
if level < len(_level_name_female): if level < len(_level_name_female):
return "%s sobrinha" % (_level_name_female[level]) return "%s sobrinha" % (_level_name_female[level])
else: else:
return "%dª sobrinha" % level return "%dª sobrinha" % level
def get_male_relative(self, level1, level2): def get_male_relative(self, level1, level2):
if level1 < len(_level_name_male_a): if level1 < len(_level_name_male_a):
@ -282,7 +282,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
def get_relationship(self, secondRel, firstRel, orig_person_gender, other_person_gender): def get_relationship(self, secondRel, firstRel, orig_person_gender, other_person_gender):
""" """
returns a string representing the relationshp between the two people, returns a string representing the relationshp between the two people,
along with a list of common ancestors (typically father, mother) along with a list of common ancestors (typically father, mother)
""" """
common = "" common = ""
@ -336,11 +336,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b, def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b,
reltocommon_a, reltocommon_b, reltocommon_a, reltocommon_b,
only_birth=True, only_birth=True,
in_law_a=False, in_law_b=False): in_law_a=False, in_law_b=False):
return self.get_relationship(Ga, Gb, gender_a, gender_b)[0]; return self.get_relationship(Ga, Gb, gender_a, gender_b)[0];
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b, def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
in_law_a=False, in_law_b=False): in_law_a=False, in_law_b=False):
return self.get_relationship(1, 1, gender_a, gender_b)[0]; return self.get_relationship(1, 1, gender_a, gender_b)[0];
@ -375,9 +375,9 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
Gb: O número de gerações desta pessoa (person_handle) até o Gb: O número de gerações desta pessoa (person_handle) até o
ancestral comum. É incrementado quando descer as ancestral comum. É incrementado quando descer as
gerações and posto a zero quando subir as gerações. gerações and posto a zero quando subir as gerações.
skip_handle: Identificador opcional para pular quando descer. skip_handle: Identificador opcional para pular quando descer.
Isso é útil para pular o descendente que trouxe essa generação em primeiro lugar. Isso é útil para pular o descendente que trouxe essa generação em primeiro lugar.
Preenche um mapa das matrizes contendo os ancestrais Preenche um mapa das matrizes contendo os ancestrais
da pessoa falecida. Esta função chama a si mesma recursivamente até da pessoa falecida. Esta função chama a si mesma recursivamente até
atingir max_ascend. atingir max_ascend.
@ -439,10 +439,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# security # security
rel_str = u"primos primas" rel_str = u"primos primas"
if in_law_b == True: if in_law_b == True:
rel_str = u"cônjuges dos %s" % rel_str rel_str = u"cônjuges dos %s" % rel_str
return rel_str return rel_str
if __name__ == "__main__": if __name__ == "__main__":
@ -453,7 +453,7 @@ if __name__ == "__main__":
# python src/plugins/rel/rel_pt.py # python src/plugins/rel/rel_pt.py
# (Above not needed here) # (Above not needed here)
"""TRANSLATORS, copy this if statement at the bottom of your """TRANSLATORS, copy this if statement at the bottom of your
rel_xx.py module, and test your work with: rel_xx.py module, and test your work with:
python src/plugins/rel/rel_xx.py python src/plugins/rel/rel_xx.py
""" """

View File

@ -55,7 +55,7 @@ import DateHandler
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
from gui.plug import tool from gui.plug import tool
from gen.plug.report import utils as ReportUtils from gen.plug.report import utils as ReportUtils
import GrampsDisplay import GrampsDisplay
import ManagedWindow import ManagedWindow
from gen.ggettext import sgettext as _ from gen.ggettext import sgettext as _
from glade import Glade from glade import Glade
@ -83,7 +83,7 @@ class TableReport(object):
def __init__(self,filename,doc): def __init__(self,filename,doc):
self.filename = filename self.filename = filename
self.doc = doc self.doc = doc
def initialize(self,cols): def initialize(self,cols):
self.doc.open(self.filename) self.doc.open(self.filename)
self.doc.start_page() self.doc.start_page()
@ -91,7 +91,7 @@ class TableReport(object):
def finalize(self): def finalize(self):
self.doc.end_page() self.doc.end_page()
self.doc.close() self.doc.close()
def write_table_data(self,data,skip_columns=[]): def write_table_data(self,data,skip_columns=[]):
self.doc.start_row() self.doc.start_row()
index = -1 index = -1
@ -103,7 +103,7 @@ class TableReport(object):
def set_row(self,val): def set_row(self,val):
self.row = val + 2 self.row = val + 2
def write_table_head(self, data): def write_table_head(self, data):
self.doc.start_row() self.doc.start_row()
map(self.doc.write_cell, data) map(self.doc.write_cell, data)
@ -111,18 +111,18 @@ class TableReport(object):
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class EventComparison(tool.Tool,ManagedWindow.ManagedWindow): class EventComparison(tool.Tool,ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, options_class, name, callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
self.dbstate = dbstate self.dbstate = dbstate
self.uistate = uistate self.uistate = uistate
tool.Tool.__init__(self,dbstate, options_class, name) tool.Tool.__init__(self,dbstate, options_class, name)
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
self.qual = 0 self.qual = 0
self.filterDialog = Glade(toplevel="filters") self.filterDialog = Glade(toplevel="filters")
self.filterDialog.connect_signals({ self.filterDialog.connect_signals({
"on_apply_clicked" : self.on_apply_clicked, "on_apply_clicked" : self.on_apply_clicked,
@ -131,7 +131,7 @@ class EventComparison(tool.Tool,ManagedWindow.ManagedWindow):
"destroy_passed_object" : self.close, "destroy_passed_object" : self.close,
"on_write_table" : self.__dummy, "on_write_table" : self.__dummy,
}) })
window = self.filterDialog.toplevel window = self.filterDialog.toplevel
window.show() window.show()
self.filters = self.filterDialog.get_object("filter_list") self.filters = self.filterDialog.get_object("filter_list")
@ -226,7 +226,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
self.my_list = people_list self.my_list = people_list
self.row_data = [] self.row_data = []
self.save_form = None self.save_form = None
self.topDialog = Glade() self.topDialog = Glade()
self.topDialog.connect_signals({ self.topDialog.connect_signals({
"on_write_table" : self.on_write_table, "on_write_table" : self.on_write_table,
@ -240,21 +240,21 @@ class DisplayChart(ManagedWindow.ManagedWindow):
window.show() window.show()
self.set_window(window, self.topDialog.get_object('title'), self.set_window(window, self.topDialog.get_object('title'),
_('Event Comparison Results')) _('Event Comparison Results'))
self.eventlist = self.topDialog.get_object('treeview') self.eventlist = self.topDialog.get_object('treeview')
self.sort = Sort.Sort(self.db) self.sort = Sort.Sort(self.db)
self.my_list.sort(self.sort.by_last_name) self.my_list.sort(self.sort.by_last_name)
self.event_titles = self.make_event_titles() self.event_titles = self.make_event_titles()
self.table_titles = [_("Person"),_("ID")] self.table_titles = [_("Person"),_("ID")]
for event_name in self.event_titles: for event_name in self.event_titles:
self.table_titles.append(_("%(event_name)s Date") % self.table_titles.append(_("%(event_name)s Date") %
{'event_name' :event_name }) {'event_name' :event_name })
self.table_titles.append('sort') # This won't be shown in a tree self.table_titles.append('sort') # This won't be shown in a tree
self.table_titles.append(_("%(event_name)s Place") % self.table_titles.append(_("%(event_name)s Place") %
{'event_name' :event_name }) {'event_name' :event_name })
self.build_row_data() self.build_row_data()
self.draw_display() self.draw_display()
self.show() self.show()
@ -368,7 +368,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
the_map[name] += 1 the_map[name] += 1
unsort_list = sorted([(d, k) for k,d in the_map.iteritems()],by_value) unsort_list = sorted([(d, k) for k,d in the_map.iteritems()],by_value)
sort_list = [ item[1] for item in unsort_list ] sort_list = [ item[1] for item in unsort_list ]
## Presently there's no Birth and Death. Instead there's Birth Date and ## Presently there's no Birth and Death. Instead there's Birth Date and
## Birth Place, as well as Death Date and Death Place. ## Birth Place, as well as Death Date and Death Place.
@ -376,7 +376,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
## if _("Death") in the_map: ## if _("Death") in the_map:
## sort_list.remove(_("Death")) ## sort_list.remove(_("Death"))
## sort_list = [_("Death")] + sort_list ## sort_list = [_("Death")] + sort_list
## if _("Birth") in the_map: ## if _("Birth") in the_map:
## sort_list.remove(_("Birth")) ## sort_list.remove(_("Birth"))
## sort_list = [_("Birth")] + sort_list ## sort_list = [_("Birth")] + sort_list
@ -426,7 +426,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# #
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
class EventComparisonOptions(tool.ToolOptions): class EventComparisonOptions(tool.ToolOptions):