#1957 closed bug (Fixed)
Columns don't add resulting in keyerror for non-latin languages
Reported by: | Calum | Owned by: | Calum |
---|---|---|---|
Priority: | major | Milestone: | 2.x |
Component: | GTK UI | Version: | 1.3.3 |
Keywords: | Cc: | gymka2 |
Description
deluge-gtk crashed with KeyError in on_menuitem_toggled(): '\xd0\x97\xd0\xb0\xd0\xb3\xd1\x80\xd1\x83\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xbe' Traceback: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/deluge/ui/gtkui/listview.py", line 339, in on_menuitem_toggled self.columns[name].column.set_visible(widget.get_active()) KeyError: '\xd0\x97\xd0\xb0\xd0\xb3\xd1\x80\xd1\x83\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xbe'
From: https://bugs.launchpad.net/ubuntu/+source/deluge/+bug/854648
A workaround patch from Serge Matveenko has been attached.
Attachments (1)
Change History (10)
by , 13 years ago
Attachment: | 0001-Fix-crash-on-non-latin-1-named-column-active-state-c.patch added |
---|
comment:1 by , 13 years ago
Milestone: | 1.3.4 → 1.4.0 |
---|---|
Owner: | set to |
Status: | new → accepted |
comment:2 by , 13 years ago
this patch is bad! with it i can't hide/unhide columns if they has not latin letters, then i removed that patch everything is working. version 1.3.4
comment:3 by , 13 years ago
Cc: | added |
---|
comment:4 by , 13 years ago
btw without that patch nothing bad is hapening, everything works, program not crashes... only in console it gives that error
follow-up: 6 comment:5 by , 13 years ago
Could you try the following patch and whether you still see console errors.
diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index 887f2cb..72613b3 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -333,10 +333,13 @@ def get_state_field_column(self, field): def on_menuitem_toggled(self, widget): """Callback for the generated column menuitems.""" # Get the column name from the widget - name = unicode(widget.get_child().get_text()) + name = widget.get_child().get_text() # Set the column's visibility based on the widgets active state - self.columns[name].column.set_visible(widget.get_active()) + try: + self.columns[name].column.set_visible(widget.get_active()) + except KeyError: + self.columns[unicode(name)].column.set_visible(widget.get_active()) return def on_treeview_header_right_clicked(self, column, event):
comment:6 by , 13 years ago
Replying to Cas:
Could you try the following patch and whether you still see console errors.
with this pacth everything works and there is no any errors.
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
I am closing this issue because the problem is actually to do with menuitem get_text returning utf8 byte string not unicode string as stored in self.columns
. It's also difficult to justify the amount of work required to add an 'id' entry when there are currently no more issues with translated columns.
I am still not sure about the issue seen by gymka2. I can't replicate it but it could be that the unicode decode requires 'utf8' specified but since the last fix works I am leaving it as it.
Fix committed to 1.3-stable: 0941377
I will attempt to properly correct the use of translated text as keys in git master.