From: Doug B. <dou...@gm...> - 2010-01-28 13:03:35
|
I think I understand why this is occurring, and should be an easy fix. Thanks to all for tracking this down! -Doug On Thu, Jan 28, 2010 at 7:24 AM, jerome <rom...@ya...> wrote: > Peter, > > > As we both have problem to return some translation strings [1] and we both > use non-ASCII characters on our locale, do you thing glade issue is also > related to this one (ListStore and type unicode) ? > > Reading last "unstable" but documented spec [2], it seems that Gramps will > still have different behavior according our Gtk version [3][4][5] :( > > > [1] http://www.gramps-project.org/bugs/view.php?id=3090 > [2] > http://library.gnome.org/devel/gtk/unstable/GtkTreeView.html#GtkTreeView-BUILDER-UI > [3] OpenSuse 10.3 > http://www.gramps-project.org/bugs/view.php?id=3090#c12417 > [4] OpenSuse 10.3 > http://www.gramps-project.org/bugs/view.php?id=3090#c10567 > [5] Ubuntu 9.04 http://www.gramps-project.org/bugs/view.php?id=3090#c12344 > > > --- En date de : Jeu 28.1.10, jerome <rom...@ya...> a écrit : > > > De: jerome <rom...@ya...> > > Objet: Re: [Gramps-devel] Gtk Tree and unicode [was Probably alive] > > À: "Peter Landgren" <pet...@te...> > > Cc: gra...@li... > > Date: Jeudi 28 Janvier 2010, 11h37 > > > The first suggestion does not > > make sense as it says > > > convert to 'str' if string is of type 'str'! > > > > and columns.append(col) if type(col) is unicode > > > > I do not know if my lib2to3 version is the last stable, but > > it was just a test "how this could be handled under python > > 3.0 ?" > > If there was a coding error, then maybe script could > > highlight it ? > > > > > the problem is with gtk.ListStore, that > > > obviously can't handle the type 'unicode'. > > > > Does it mean that : > > > > File "trunk/src/Simple/_SimpleTable.py", line 440, in > > write > > model = gtk.ListStore(*types) > > TypeError: could not get typecode from object > > > > cannot or should not be fixed ? > > > > > > --- En date de : Jeu 28.1.10, Peter Landgren <pet...@te...> > > a écrit : > > > > > De: Peter Landgren <pet...@te...> > > > Objet: Re: Gtk Tree and unicode [was Probably alive] > > > À: "jerome" <rom...@ya...> > > > Cc: gra...@li... > > > Date: Jeudi 28 Janvier 2010, 11h19 > > > Jerome, > > > > > > The first suggestion does not make sense as it says > > > convert to 'str' if string is of type 'str'! > > > > > > I any case , the problem is with gtk.ListStore, that > > > obviously can't handle the type 'unicode'. > > > /Peter > > > > > > > Peter, > > > > > > > > $ 2to3 python _SimpleTable.py returns : > > > > > > > > --- _SimpleTable.py (original) > > > > +++ _SimpleTable.py (refactored) > > > > @@ -94,7 +94,7 @@ > > > > # gtk tree doesn't > > > like unicode?! > > > > columns = [] > > > > for col in cols: > > > > - if > > > type(col) == unicode: > > > > + if > > > type(col) == str: > > > > > > > columns.append(str(col)) > > > > else: > > > > > > > columns.append(col) > > > > @@ -235,13 +235,13 @@ > > > > # > > > FIXME: add better text representations of these > > objects > > > > if > > > item is None: > > > > > > > retval.append("") > > > > - elif > > > isinstance(item, basestring): > > > > + elif > > > isinstance(item, str): > > > > > > > if item == "checkbox": > > > > > > > retval.append("") > > > > > > > self.set_cell_type(col, "checkbox") > > > > > > > else: > > > > > > > retval.append(item) > > > > - elif > > > isinstance(item, (int, float, long)): > > > > + elif > > > isinstance(item, (int, float)): > > > > > > > retval.append(item) > > > > > > > self.row_sort_val(col, item) > > > > elif > > > isinstance(item, gen.lib.Person): > > > > @@ -453,7 +453,7 @@ > > > > > > > try: > > > > > > > model.append(row=([count] + > > > list(rowdata) + > > > > [col[count] for col in sort_data])) except: > > > > - > > > print "error in row %d: data: %s, sort > > > data: %d" % > > > > (count, rowdata, len(sort_data[0])) + > > > > > > print("error in > > > > row %d: data: %s, sort data: %d" % (count, > > rowdata, > > > len(sort_data[0]))) > > > > count += 1 > > > > > > > text_view.show_all() > > > > > > > self.simpledoc.paragraph("") > > > > > > > > --- En date de : Mer 27.1.10, Peter Landgren > > <pet...@te...> > > > a écrit : > > > > > De: Peter Landgren <pet...@te...> > > > > > Objet: Re: [Gramps-devel] Probably alive > > > > > À: gra...@li... > > > > > Date: Mercredi 27 Janvier 2010, 20h37 > > > > > Den Wednesday 27 January 2010 > > > > > > > > > > 20.27.10 skrev Peter Landgren: > > > > > > Den Wednesday 27 January 2010 20.15.17 > > skrev > > > Peter > > > > > > > > > > Landgren: > > > > > > > Den Wednesday 27 January 2010 > > 16.21.21 > > > skrev > > > > > > > > > > jerome: > > > > > > > > yes, you got all of them. :) > > > > > > > > Great ! > > > > > > > > > > > > > > > > There is still a "non-ASCII" > > key > > > error : > > > > > > > > > > > > > > > > 221672: ERROR: gramps.py: > > line > > > 120: > > > > > > > > > > Unhandled exception > > > > > > > > > > > > > Traceback (most recent call > > > last): > > > > > > > > File > > > > > > > > > > > > > "trunk/src/plugins/tool/CalculateEstimatedDates.py", > > line > > > > > 399, > > > > > > > > > > > > > in select_all select_col = > > > > > > > > > > > > self.table.model_index_of_column[_("Select")] > > > KeyError: > > > > > > > > u'S\xe9lectionner' > > > > > > > > > > > > > > > > 262852: ERROR: gramps.py: > > line > > > 120: > > > > > > > > > > Unhandled exception > > > > > > > > > > > > > Traceback (most recent call > > > last): > > > > > > > > File > > > > > > > > > > > > > "trunk/src/plugins/tool/CalculateEstimatedDates.py", > > line > > > > > 404, > > > > > > > > > > > > > in select_none select_col = > > > > > > > > > > > > self.table.model_index_of_column[_("Select")] > > > KeyError: > > > > > > > > u'S\xe9lectionner' > > > > > > > > > > > > > > > > 293370: ERROR: gramps.py: > > line > > > 120: > > > > > > > > > > Unhandled exception > > > > > > > > > > > > > Traceback (most recent call > > > last): > > > > > > > > File > > > > > > > > > > > > > "trunk/src/plugins/tool/CalculateEstimatedDates.py", > > line > > > > > 409, > > > > > > > > > > > > > in toggle_select select_col > > = > > > > > > > > > > > > self.table.model_index_of_column[_("Select")] > > > KeyError: > > > > > > > > u'S\xe9lectionner' > > > > > > > > > > > > > > > > 156268: ERROR: gramps.py: > > line > > > 120: > > > > > > > > > > Unhandled exception > > > > > > > > > > > > > Traceback (most recent call > > > last): > > > > > > > > File > > > > > > > > > > > > > "trunk/src/plugins/tool/CalculateEstimatedDates.py", > > line > > > > > 419, > > > > > > > > > > > > > in apply_selection select_col > > = > > > > > > > > > > > > self.table.model_index_of_column[_("Select")] > > > KeyError: > > > > > > > > u'S\xe9lectionner' > > > > > > > > > > > > > > > > but this is not directly > > related > > > to alive > > > > > > > > > > algorithm. > > > > > > > > > > > > > Jérôme > > > > > > > > > > > > > > I looked at this as I thought it > > was a > > > > > > > > > > translation/unicode problem, but > > > > > > > > > > > > it's not directly. How/where are > > the > > > keys > > > > > > > > > > filling > > > > > > > > > > > > > > > "self.table.model_index_of_column[...]"? > > > > > > > > > > > > > > However, I tried Gramps in English > > and > > > ran into: > > > > > > > 73302: ERROR: gramps.py: line > > > 120: > > > > > > > > > > Unhandled exception > > > > > > > > > > > > Traceback (most recent call > > last): > > > > > > > File > > > > > > > > > > > > > > > "/home/peter/svn/GRAMPSTRUNK/trunk/src/plugins/tool/CalculateEstimatedDat > > > > > > > > > > > >es .py", line 420, in > > apply_selection > > > > > > > source = > > > > > > > > > > self.get_or_create_source(source_text) > > > > > > > > > > > > File > > > > > > > > > > > > > > > "/home/peter/svn/GRAMPSTRUNK/trunk/src/plugins/tool/CalculateEstimatedDat > > > > > > > > > > > >es .py", line 506, in > > > get_or_create_source > > > > > > > > > > > > > > > > > self.db.add_source(source, > > > self.trans) > > > > > > > > > > > > AttributeError: > > 'CalcToolManagedWindow' > > > object > > > > > > > > > > has no attribute 'trans' > > > > > > > > > > > > when I pressed the tab "Add > > Selected > > > Events". > > > > > > > /Peter > > > > > > > > > > > > I just found that the keys in > > > > > > > > > > "self.table.model_index_of_column[...]" are > > > > > > > > > > > of type 'str'! So my question above > > needs an > > > answer > > > > > > > > > > > :) > > > > > : > > > > > > /Peter > > > > > > > > > > In _SimpleTable.py line 97: > > > > > if type(col) == unicode: > > > > > columns.add(str(col)) > > > > > > > > > > So thats why the keys are 'str' and not > > unicode > > > when > > > > > running with non English locale! > > > > > > > > > > So my question is now: > > > > > Why this? > > > > > > > > > > /Peter > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > The Planet: dedicated and managed hosting, cloud storage, > > colocation > > Stay online with enterprise data centers and the best > > network in the business > > Choose flexible plans and management services without > > long-term contracts > > Personal 24x7 support from experience hosting pros just a > > phone call away. > > http://p.sf.net/sfu/theplanet-com > > _______________________________________________ > > Gramps-devel mailing list > > Gra...@li... > > https://lists.sourceforge.net/lists/listinfo/gramps-devel > > > > > > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the > business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Gramps-devel mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > |