diff --git a/src/gui/utils.py b/src/gui/utils.py index 502efb8fa..fcd15135d 100644 --- a/src/gui/utils.py +++ b/src/gui/utils.py @@ -8,7 +8,7 @@ # 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, +# 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. @@ -101,7 +101,7 @@ class CLIDialog: def destroy(self): pass vbox = CLIVbox() - + #------------------------------------------------------------------------- # # Progress meter class @@ -111,23 +111,23 @@ class CLIDialog: class ProgressMeter(object): """ Progress meter class for GRAMPS. - + The progress meter has two modes: - + 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. - + 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 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_ACTIVITY = 1 - - def __init__(self, title, header='', can_cancel=False, + + def __init__(self, title, header='', can_cancel=False, cancel_callback=None, message_area=False): """ Specify the title and the current pass header. @@ -143,7 +143,7 @@ class ProgressMeter(object): self.__cancel_callback = cancel_callback else: self.__cancel_callback = self.handle_cancel - + if has_display(): self.__dialog = gtk.Dialog() else: @@ -158,15 +158,15 @@ class ProgressMeter(object): self.__dialog.vbox.set_spacing(10) self.__dialog.vbox.set_border_width(24) self.__dialog.set_size_request(350, 125) - + tlbl = gtk.Label('%s' % title) tlbl.set_use_markup(True) self.__dialog.vbox.add(tlbl) - + self.__lbl = gtk.Label(header) self.__lbl.set_use_markup(True) self.__dialog.vbox.add(self.__lbl) - + self.__pbar = gtk.ProgressBar() self.__dialog.vbox.add(self.__pbar) @@ -216,7 +216,7 @@ class ProgressMeter(object): buffer.set_text(text) else: print "Progress:", text - + def handle_cancel(self, *args, **kwargs): """ Default cancel handler (if enabled). @@ -242,7 +242,7 @@ class ProgressMeter(object): self.__mode = mode self.__pbar_max = total self.__pbar_index = 0.0 - + # If it is cancelling, don't overwite that message: if not self.__cancelled: self.__lbl.set_text(header) @@ -255,7 +255,7 @@ class ProgressMeter(object): self.__pbar.set_fraction(0.0) else: # ProgressMeter.MODE_ACTIVITY self.__pbar.set_pulse_step(1.0/self.__pbar_max) - + while gtk.events_pending(): gtk.main_iteration() @@ -268,22 +268,22 @@ class ProgressMeter(object): import gtk if self.__mode is ProgressMeter.MODE_FRACTION: self.__pbar_index = self.__pbar_index + 1.0 - + if self.__pbar_index > self.__pbar_max: self.__pbar_index = self.__pbar_max - + try: val = int(100*self.__pbar_index/self.__pbar_max) except ZeroDivisionError: val = 0 - + if val != self.__old_val: self.__pbar.set_text("%d%%" % val) self.__pbar.set_fraction(val/100.0) self.__old_val = val else: # ProgressMeter.MODE_ACTIVITY self.__pbar.pulse() - + while gtk.events_pending(): gtk.main_iteration() @@ -293,16 +293,16 @@ class ProgressMeter(object): import gtk self.__lbl.set_text(text) while gtk.events_pending(): - gtk.main_iteration() - + gtk.main_iteration() + def __warn(self, *obj): """ Don't let the user close the progress dialog. """ from QuestionDialog import WarningDialog WarningDialog( - _("Attempt to force closing the dialog"), - _("Please do not force closing this important dialog."), + _("Attempt to force closing the dialog"), + _("Please do not force closing this important dialog."), self.__dialog) return True @@ -319,10 +319,10 @@ class ProgressMeter(object): #------------------------------------------------------------------------- def open_file_with_default_application( file_path ): """ - 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 + 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 type of file. - + @param file_path: The path to the file to be opened. Example: "c:\foo.txt" @type file_path: string @@ -330,11 +330,11 @@ def open_file_with_default_application( file_path ): """ from QuestionDialog import ErrorDialog norm_path = os.path.normpath( file_path ) - + if not os.path.exists(norm_path): ErrorDialog(_("Error Opening File"), _("File does not exist")) return - + if constfunc.win(): try: os.startfile(norm_path) diff --git a/src/plugins/rel/rel_pt.py b/src/plugins/rel/rel_pt.py index ca92b300a..afa10c609 100644 --- a/src/plugins/rel/rel_pt.py +++ b/src/plugins/rel/rel_pt.py @@ -75,8 +75,8 @@ _level_name_plural = [ "", "primeiros", "segundos", "terceiros", "quartos", # 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 # Nº notation, that is sort of understandable if in context. -# 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ô" +# 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ô" # correct for pt. Translation keeps "tetravô". _parents_level = [ "", "pais", "avós", "bisavós", "trisavó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", "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ó"] _brother_level = [ "", "irmão", "tio", "tio avô", "tio bisavô", "tio trisavô", "tio tetravô", "tio pentavô", "tio hexavô", "tio heptavô", "tio octavô"] -_nephew_level = [ "", "sobrinho", "sobrinho neto", "sobrinho bisneto", "sobrinho trineto", - "sobrinho tetraneto", "sobrinho pentaneto", "sobrinho hexaneto", +_nephew_level = [ "", "sobrinho", "sobrinho neto", "sobrinho bisneto", "sobrinho trineto", + "sobrinho tetraneto", "sobrinho pentaneto", "sobrinho hexaneto", "sobrinho heptaneto", "sobrinho octaneto"] -_niece_level = [ "", "sobrinha", "sobrinha neta", "sobrinha bisneta", "sobrinha trineta", - "sobrinha tetraneta", "sobrinha pentaneta", "sobrinha hexaneta", +_niece_level = [ "", "sobrinha", "sobrinha neta", "sobrinha bisneta", "sobrinha trineta", + "sobrinha tetraneta", "sobrinha pentaneta", "sobrinha hexaneta", "sobrinha heptaneta", "sobrinha octaneta"] # 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"] -_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"octanetos"] @@ -154,39 +154,39 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): def get_male_cousin(self, level): if level < len(_level_name_male): - return "%s primo" % (_level_name_male[level]) + return "%s primo" % (_level_name_male[level]) else: - return "%dº primo" % level + return "%dº primo" % level def get_female_cousin(self, level): if level < len(_level_name_female): - return "%s prima" % (_level_name_female[level]) + return "%s prima" % (_level_name_female[level]) else: - return "%dª prima" % level + return "%dª prima" % level def get_distant_uncle(self, level): if level < len(_level_name_male): - return "%s tio" % (_level_name_male[level]) + return "%s tio" % (_level_name_male[level]) else: - return "%dº tio" % level + return "%dº tio" % level def get_distant_aunt(self, level): if level < len(_level_name_female): - return "%s tia" % (_level_name_female[level]) + return "%s tia" % (_level_name_female[level]) else: - return "%dª tia" % level + return "%dª tia" % level def get_distant_nephew(self, level): if level < len(_level_name_male): - return "%s sobrinho" % (_level_name_male[level]) + return "%s sobrinho" % (_level_name_male[level]) else: - return "%dº sobrinho" % level + return "%dº sobrinho" % level def get_distant_niece(self, level): if level < len(_level_name_female): - return "%s sobrinha" % (_level_name_female[level]) + return "%s sobrinha" % (_level_name_female[level]) else: - return "%dª sobrinha" % level + return "%dª sobrinha" % level def get_male_relative(self, level1, level2): 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): """ 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 = "" @@ -336,11 +336,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): def get_single_relationship_string(self, Ga, Gb, gender_a, gender_b, reltocommon_a, reltocommon_b, - only_birth=True, + only_birth=True, in_law_a=False, in_law_b=False): 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): 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 ancestral comum. É incrementado quando descer as 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. - + Preenche um mapa das matrizes contendo os ancestrais da pessoa falecida. Esta função chama a si mesma recursivamente até atingir max_ascend. @@ -439,10 +439,10 @@ class RelationshipCalculator(Relationship.RelationshipCalculator): # security rel_str = u"primos primas" - + 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 if __name__ == "__main__": @@ -453,7 +453,7 @@ if __name__ == "__main__": # python src/plugins/rel/rel_pt.py # (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: python src/plugins/rel/rel_xx.py """ diff --git a/src/plugins/tool/EventCmp.py b/src/plugins/tool/EventCmp.py index 4e3cb89f3..cf9f6c64b 100644 --- a/src/plugins/tool/EventCmp.py +++ b/src/plugins/tool/EventCmp.py @@ -55,7 +55,7 @@ import DateHandler from QuestionDialog import WarningDialog from gui.plug import tool from gen.plug.report import utils as ReportUtils -import GrampsDisplay +import GrampsDisplay import ManagedWindow from gen.ggettext import sgettext as _ from glade import Glade @@ -83,7 +83,7 @@ class TableReport(object): def __init__(self,filename,doc): self.filename = filename self.doc = doc - + def initialize(self,cols): self.doc.open(self.filename) self.doc.start_page() @@ -91,7 +91,7 @@ class TableReport(object): def finalize(self): self.doc.end_page() self.doc.close() - + def write_table_data(self,data,skip_columns=[]): self.doc.start_row() index = -1 @@ -103,7 +103,7 @@ class TableReport(object): def set_row(self,val): self.row = val + 2 - + def write_table_head(self, data): self.doc.start_row() map(self.doc.write_cell, data) @@ -111,18 +111,18 @@ class TableReport(object): #------------------------------------------------------------------------ # -# +# # #------------------------------------------------------------------------ class EventComparison(tool.Tool,ManagedWindow.ManagedWindow): def __init__(self, dbstate, uistate, options_class, name, callback=None): self.dbstate = dbstate self.uistate = uistate - + tool.Tool.__init__(self,dbstate, options_class, name) ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) self.qual = 0 - + self.filterDialog = Glade(toplevel="filters") self.filterDialog.connect_signals({ "on_apply_clicked" : self.on_apply_clicked, @@ -131,7 +131,7 @@ class EventComparison(tool.Tool,ManagedWindow.ManagedWindow): "destroy_passed_object" : self.close, "on_write_table" : self.__dummy, }) - + window = self.filterDialog.toplevel window.show() self.filters = self.filterDialog.get_object("filter_list") @@ -226,7 +226,7 @@ class DisplayChart(ManagedWindow.ManagedWindow): self.my_list = people_list self.row_data = [] self.save_form = None - + self.topDialog = Glade() self.topDialog.connect_signals({ "on_write_table" : self.on_write_table, @@ -240,21 +240,21 @@ class DisplayChart(ManagedWindow.ManagedWindow): window.show() self.set_window(window, self.topDialog.get_object('title'), _('Event Comparison Results')) - + self.eventlist = self.topDialog.get_object('treeview') self.sort = Sort.Sort(self.db) self.my_list.sort(self.sort.by_last_name) self.event_titles = self.make_event_titles() - + self.table_titles = [_("Person"),_("ID")] 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 }) 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 }) - + self.build_row_data() self.draw_display() self.show() @@ -368,7 +368,7 @@ class DisplayChart(ManagedWindow.ManagedWindow): the_map[name] += 1 unsort_list = sorted([(d, k) for k,d in the_map.iteritems()],by_value) - + sort_list = [ item[1] for item in unsort_list ] ## Presently there's no Birth and Death. Instead there's Birth Date and ## Birth Place, as well as Death Date and Death Place. @@ -376,7 +376,7 @@ class DisplayChart(ManagedWindow.ManagedWindow): ## if _("Death") in the_map: ## sort_list.remove(_("Death")) ## sort_list = [_("Death")] + sort_list - + ## if _("Birth") in the_map: ## sort_list.remove(_("Birth")) ## sort_list = [_("Birth")] + sort_list @@ -426,7 +426,7 @@ class DisplayChart(ManagedWindow.ManagedWindow): #------------------------------------------------------------------------ # -# +# # #------------------------------------------------------------------------ class EventComparisonOptions(tool.ToolOptions):