[GTK3] Fix path chooser warnings and errors

This commit is contained in:
Calum Lind 2018-09-19 17:53:13 +01:00 committed by Calum Lind
parent 2e88fa1dfc
commit 13e1fa355d
1 changed files with 8 additions and 1 deletions

View File

@ -11,6 +11,7 @@
from __future__ import division, print_function, unicode_literals
import os
import warnings
# FIXME: use this as fallback to get_introspection_module?
# from gi.importer import modules
@ -21,6 +22,11 @@ from gi.repository.GObject import SignalFlags
from deluge.common import PY2, resource_filename
from deluge.path_chooser_common import get_completion_paths
# Filter the pygobject signal warning:
# g_value_get_int: assertion 'G_VALUE_HOLDS_INT (value)' failed.
# See: https://gitlab.gnome.org/GNOME/pygobject/issues/12
warnings.filterwarnings('ignore', '.*g_value_get_int.*G_VALUE_HOLDS_INT.*', Warning)
def is_ascii_value(keyval, ascii_key):
try:
@ -969,7 +975,7 @@ class PathCompletionPopup(CompletionList, PathChooserPopup):
Handles scroll events from the treeview
"""
x, y, state = event.window.get_pointer()
x, y = event.window.get_pointer()
self.handle_list_scroll(
_next=event.direction == Gdk.ScrollDirection.DOWN,
set_entry=widget != self.treeview,
@ -1392,6 +1398,7 @@ class PathChooserComboBox(GtkGI.Box, StoredValuesPopup, GObject.GObject):
self.emit('text-changed', self.get_text())
def _on_entry_text_focus_out_event(self, widget, event):
# FIXME: This causes text to be deselected on right-click.
# Update text on the button label
self.set_text(self.get_text())