[GTK3] Marked FIXME code changes for GTK3

This commit is contained in:
Calum Lind 2016-11-11 15:23:22 +00:00 committed by Calum Lind
commit e2ba980299
8 changed files with 38 additions and 16 deletions

View file

@ -352,7 +352,9 @@ class AddTorrentDialog(component.Component):
_file, _file['path'], idx, _file.get('download', True), split_files _file, _file['path'], idx, _file.get('download', True), split_files
) )
self.add_files(None, split_files) self.add_files(None, split_files)
self.listview_files.expand_row(b'0', False) # FIXME add back expand_row
# self.listview_files.expand_row(b'0', False)
self.listview_files.expand_all()
def prepare_file(self, _file, file_name, file_num, download, files_storage): def prepare_file(self, _file, file_name, file_num, download, files_storage):
first_slash_index = file_name.find(os.path.sep) first_slash_index = file_name.find(os.path.sep)
@ -1043,7 +1045,9 @@ class AddTorrentDialog(component.Component):
# We need to re-expand the view because it might contracted # We need to re-expand the view because it might contracted
# if we change the root iter # if we change the root iter
self.listview_files.expand_row(b'0', False) # FIXME add back expand_row
# self.listview_files.expand_row('0', False)
self.listview_files.expand_all()
else: else:
# This was a simple folder rename without any splits, so just # This was a simple folder rename without any splits, so just
# change the path for itr # change the path for itr

View file

@ -379,7 +379,8 @@ class FilesTab(Tab):
def update_files(self): def update_files(self):
with listview_replace_treestore(self.listview): with listview_replace_treestore(self.listview):
self.prepare_file_store(self.files_list[self.torrent_id]) self.prepare_file_store(self.files_list[self.torrent_id])
self.listview.expand_row(b'0', False) # FIXME
# self.listview.expand_row(b'0', False)
def get_selected_files(self): def get_selected_files(self):
"""Returns a list of file indexes that are selected.""" """Returns a list of file indexes that are selected."""
@ -414,7 +415,8 @@ class FilesTab(Tab):
def update_folder_percentages(self): def update_folder_percentages(self):
"""Go through the tree and update the folder complete percentages.""" """Go through the tree and update the folder complete percentages."""
root = self.treestore.get_iter_root() # FIXME Why changed? Was: self.treestore.get_iter_root()
root = self.treestore.get_iter_first()
if root is None or self.treestore[root][5] != -1: if root is None or self.treestore[root][5] != -1:
return return

View file

@ -190,8 +190,11 @@ class GtkUI(object):
self.queuedtorrents = QueuedTorrents() self.queuedtorrents = QueuedTorrents()
self.ipcinterface = IPCInterface(args.torrents) self.ipcinterface = IPCInterface(args.torrents)
# Initialize gdk threading # FIXME: Verify that removing gdk threading has no adverse effects.
threads_init() # There are the two commits [64a94ec] [1f3e930] that added gdk threading
# and my thinking is there is no need for the code anymore.
# Since PyGObject 3.10.2, calling GObject.threads_init() this is no longer needed.
# threads_init()
# We make sure that the UI components start once we get a core URI # We make sure that the UI components start once we get a core URI
client.set_disconnect_callback(self.__on_disconnect) client.set_disconnect_callback(self.__on_disconnect)

View file

@ -18,6 +18,7 @@ from gtk.gdk import Event # pylint: disable=ungrouped-imports
from deluge.common import decode_bytes from deluge.common import decode_bytes
from deluge.ui.gtkui.common import load_pickled_state_file, save_pickled_state_file from deluge.ui.gtkui.common import load_pickled_state_file, save_pickled_state_file
# FIXME: ?
signal_new( signal_new(
'button-press-event', gtk.TreeViewColumn, SIGNAL_RUN_LAST, TYPE_NONE, (Event,) 'button-press-event', gtk.TreeViewColumn, SIGNAL_RUN_LAST, TYPE_NONE, (Event,)
) )
@ -41,6 +42,12 @@ class ListViewColumnState: # pylint: disable=old-style-class
self.sort_order = sort_order self.sort_order = sort_order
# FIXME: Why is this needed?
class TreeModel(GObject.Object, Gtk.TreeModel):
def __init__(self, filter):
Gtk.TreeModel.__init__(self, filter)
class ListView(object): class ListView(object):
"""ListView is used to make custom GtkTreeViews. It supports the adding """ListView is used to make custom GtkTreeViews. It supports the adding
and removing of columns, creating a menu for a column toggle list and and removing of columns, creating a menu for a column toggle list and
@ -220,7 +227,11 @@ class ListView(object):
self.last_sort_order = {} self.last_sort_order = {}
def record_position(model, path, _iter, data): def record_position(model, path, _iter, data):
self.last_sort_order[model[_iter][self.unique_column_id]] = path[0] # FIXME: TypeError: 'TreePath' object does not support indexing
# Verify (old code: ` = path[0]`)
self.last_sort_order[model[_iter][self.unique_column_id]] = int(
str(model.get_path(iter))
)
model.foreach(record_position, None) model.foreach(record_position, None)
@ -575,6 +586,7 @@ class ListView(object):
column.set_min_width(20) column.set_min_width(20)
column.set_reorderable(True) column.set_reorderable(True)
column.set_visible(not hidden) column.set_visible(not hidden)
# FIXME: Check for errors with button press, related new signal
column.connect('button-press-event', self.on_treeview_header_right_clicked) column.connect('button-press-event', self.on_treeview_header_right_clicked)
if tooltip: if tooltip:

View file

@ -76,9 +76,8 @@ class MainWindow(component.Component):
# Think about splitting up mainwindow gtkbuilder file into the necessary parts # Think about splitting up mainwindow gtkbuilder file into the necessary parts
# to avoid GtkBuilder monkey patch. Those parts would then need adding to mainwindow 'by hand'. # to avoid GtkBuilder monkey patch. Those parts would then need adding to mainwindow 'by hand'.
self.gtk_builder_signals_holder = _GtkBuilderSignalsHolder() self.gtk_builder_signals_holder = _GtkBuilderSignalsHolder()
self.main_builder.prev_connect_signals = copy.deepcopy( # FIXME: The deepcopy has been removed: copy.deepcopy(self.main_builder.connect_signals)
self.main_builder.connect_signals self.main_builder.prev_connect_signals = self.main_builder.connect_signals
)
def patched_connect_signals(*a, **k): def patched_connect_signals(*a, **k):
raise RuntimeError( raise RuntimeError(

View file

@ -12,9 +12,11 @@ from __future__ import division, print_function, unicode_literals
import os import os
import gtk # FIXME: use this as fallback to get_introspection_module?
from gobject import SIGNAL_RUN_FIRST, TYPE_NONE, GObject, type_register from gi.importer import modules
from gtk import gdk, keysyms # pylint: disable=ungrouped-imports
# from gi.module import get_introspection_module
from gi.repository import Gdk, GObject, Gtk
import deluge.component as component import deluge.component as component
from deluge.common import resource_filename from deluge.common import resource_filename

View file

@ -357,9 +357,8 @@ class SystemTray(component.Component):
if windows_check() or osx_check(): if windows_check() or osx_check():
popup_function = None popup_function = None
button = 0 button = 0
self.tray_menu.popup( # FIXME why was status_icon removed??
None, None, popup_function, button, activate_time, status_icon self.tray_menu.popup(None, None, None, popup_function, button, activate_time)
)
def on_menuitem_show_deluge_activate(self, menuitem): def on_menuitem_show_deluge_activate(self, menuitem):
log.debug('on_menuitem_show_deluge_activate') log.debug('on_menuitem_show_deluge_activate')

View file

@ -660,6 +660,7 @@ class TorrentView(ListView, component.Component):
to_update = [] to_update = []
for i, status_field in fields_to_update: for i, status_field in fields_to_update:
row_value = status[torrent_id][status_field] row_value = status[torrent_id][status_field]
# FIXME: Seeing UnicodeWarning??
if row[i] != row_value: if row[i] != row_value:
to_update.append(i) to_update.append(i)
to_update.append(row_value) to_update.append(row_value)