mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 15:38:43 +00:00
[GTK3] Fix import and attribute warnings
Fixes: - warning import GConf - Gtk is not defined - 'ResponseType' has no attribute 'Yes' - selection.data should be selection.get_data
This commit is contained in:
parent
2f879c33f3
commit
dfed17ac0d
7 changed files with 12 additions and 9 deletions
|
@ -802,7 +802,7 @@ class AddTorrentDialog(component.Component):
|
||||||
dialog.show_all()
|
dialog.show_all()
|
||||||
response = dialog.run()
|
response = dialog.run()
|
||||||
infohash = entry.get_text().strip()
|
infohash = entry.get_text().strip()
|
||||||
if response == Gtk.RESPONSE_OK and deluge.common.is_infohash(infohash):
|
if response == Gtk.ResponseType.OK and deluge.common.is_infohash(infohash):
|
||||||
# Create a list of trackers from the textview buffer
|
# Create a list of trackers from the textview buffer
|
||||||
tview_buf = textview.get_buffer()
|
tview_buf = textview.get_buffer()
|
||||||
trackers_text = tview_buf.get_text(*tview_buf.get_bounds())
|
trackers_text = tview_buf.get_text(*tview_buf.get_bounds())
|
||||||
|
|
|
@ -247,8 +247,11 @@ def associate_magnet_links(overwrite=False):
|
||||||
elif not osx_check():
|
elif not osx_check():
|
||||||
# gconf method is only available in a GNOME environment
|
# gconf method is only available in a GNOME environment
|
||||||
try:
|
try:
|
||||||
|
import gi
|
||||||
|
|
||||||
|
gi.require_version('GConf', '2.0')
|
||||||
from gi.repository import GConf
|
from gi.repository import GConf
|
||||||
except ImportError:
|
except ValueError:
|
||||||
log.debug(
|
log.debug(
|
||||||
'gconf not available, so will not attempt to register magnet uri handler'
|
'gconf not available, so will not attempt to register magnet uri handler'
|
||||||
)
|
)
|
||||||
|
|
|
@ -322,7 +322,7 @@ class ConnectionManager(component.Component):
|
||||||
dialog = AuthenticationDialog(reason.value.message, reason.value.username)
|
dialog = AuthenticationDialog(reason.value.message, reason.value.username)
|
||||||
|
|
||||||
def dialog_finished(response_id):
|
def dialog_finished(response_id):
|
||||||
if response_id == Gtk.RESPONSE_OK:
|
if response_id == Gtk.ResponseType.OK:
|
||||||
self._connect(host_id, dialog.get_username(), dialog.get_password())
|
self._connect(host_id, dialog.get_username(), dialog.get_password())
|
||||||
|
|
||||||
return dialog.run().addCallback(dialog_finished)
|
return dialog.run().addCallback(dialog_finished)
|
||||||
|
|
|
@ -29,7 +29,7 @@ def last_tier_trackers_from_liststore(trackers_liststore):
|
||||||
"""Create a list of tracker from existing liststore and find last tier number.
|
"""Create a list of tracker from existing liststore and find last tier number.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tracker_liststore (Gtk.ListStore): A gtk.ListStore with [tier (int), tracker (str)] rows.
|
tracker_liststore (Gtk.ListStore): A Gtk.ListStore with [tier (int), tracker (str)] rows.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
tuple(int, list): A tuple containing last tier number and list of trackers.
|
tuple(int, list): A tuple containing last tier number and list of trackers.
|
||||||
|
|
|
@ -821,9 +821,9 @@ class FilesTab(Tab):
|
||||||
self, treeview, context, x, y, selection, info, etime
|
self, treeview, context, x, y, selection, info, etime
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
selected = pickle.loads(selection.data)
|
selected = pickle.loads(selection.get_data())
|
||||||
except pickle.UnpicklingError:
|
except pickle.UnpicklingError:
|
||||||
log.debug('Invalid selection data: %s', selection.data)
|
log.debug('Invalid selection data: %s', selection.get_data())
|
||||||
return
|
return
|
||||||
log.debug('selection.data: %s', selected)
|
log.debug('selection.data: %s', selected)
|
||||||
drop_info = treeview.get_dest_row_at_pos(x, y)
|
drop_info = treeview.get_dest_row_at_pos(x, y)
|
||||||
|
|
|
@ -354,7 +354,7 @@ class GtkUI(object):
|
||||||
|
|
||||||
def on_dialog_response(response):
|
def on_dialog_response(response):
|
||||||
"""User response to switching mode dialog."""
|
"""User response to switching mode dialog."""
|
||||||
if response == ResponseType.Yes:
|
if response == ResponseType.YES:
|
||||||
# Turning off standalone
|
# Turning off standalone
|
||||||
self.config['standalone'] = False
|
self.config['standalone'] = False
|
||||||
self._start_thinclient()
|
self._start_thinclient()
|
||||||
|
|
|
@ -17,7 +17,7 @@ gi.require_version('PangoCairo', '1.0') # NOQA: E402
|
||||||
|
|
||||||
# isort:imports-thirdparty
|
# isort:imports-thirdparty
|
||||||
from gi.repository import PangoCairo, cairo
|
from gi.repository import PangoCairo, cairo
|
||||||
from gi.repository.Gtk import DrawingArea, ProgressBar
|
from gi.repository.Gtk import DrawingArea, ProgressBar, StateFlags
|
||||||
from gi.repository.Pango import SCALE, Weight
|
from gi.repository.Pango import SCALE, Weight
|
||||||
|
|
||||||
# isort:imports-firstparty
|
# isort:imports-firstparty
|
||||||
|
@ -36,7 +36,7 @@ class PiecesBar(DrawingArea):
|
||||||
# Get progress bar styles, in order to keep font consistency
|
# Get progress bar styles, in order to keep font consistency
|
||||||
pb = ProgressBar()
|
pb = ProgressBar()
|
||||||
pb_style = pb.get_style_context()
|
pb_style = pb.get_style_context()
|
||||||
self.text_font = pb_style.get_property('font', Gtk.StateFlags.NORMAL)
|
self.text_font = pb_style.get_property('font', StateFlags.NORMAL)
|
||||||
self.text_font.set_weight(Weight.BOLD)
|
self.text_font.set_weight(Weight.BOLD)
|
||||||
# Done with the ProgressBar styles, don't keep refs of it
|
# Done with the ProgressBar styles, don't keep refs of it
|
||||||
del pb, pb_style
|
del pb, pb_style
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue