[GTKUI] Import gobject module names directly

This commit is contained in:
Calum Lind 2016-11-10 11:17:14 +00:00 committed by Calum Lind
parent 52d591c83b
commit c619674cf9
9 changed files with 38 additions and 40 deletions

View File

@ -14,8 +14,8 @@ import logging
import os
from xml.sax.saxutils import escape as xml_escape
import gobject
import gtk
from gobject import TYPE_INT64, TYPE_UINT64
import deluge.common
import deluge.component as component
@ -67,7 +67,7 @@ class AddTorrentDialog(component.Component):
# download?, path, filesize, sequence number, inconsistent?
self.files_treestore = gtk.TreeStore(
bool, str, gobject.TYPE_UINT64, gobject.TYPE_INT64, bool, str)
bool, str, TYPE_UINT64, TYPE_INT64, bool, str)
self.files_treestore.set_sort_column_id(1, gtk.SORT_ASCENDING)
# Holds the files info

View File

@ -13,8 +13,8 @@ import base64
import logging
import os.path
import gobject
import gtk
from gobject import TYPE_UINT64, idle_add
from twisted.internet.threads import deferToThread
import deluge.component as component
@ -69,7 +69,7 @@ class CreateTorrentDialog(object):
})
# path, icon, size
self.files_treestore = gtk.TreeStore(str, str, gobject.TYPE_UINT64)
self.files_treestore = gtk.TreeStore(str, str, TYPE_UINT64)
column = gtk.TreeViewColumn(_('Filename'))
render = gtk.CellRendererPixbuf()
@ -389,7 +389,7 @@ class CreateTorrentDialog(object):
if percent >= 0 and percent <= 1.0:
# Make sure there are no threads race conditions that can
# crash the UI while updating it.
gobject.idle_add(update_pbar_with_gobject, percent)
idle_add(update_pbar_with_gobject, percent)
def _on_button_up_clicked(self, widget):
log.debug('_on_button_up_clicked')

View File

@ -13,9 +13,9 @@ import cPickle
import logging
import os.path
import gobject
import gtk
import gtk.gdk
from gobject import TYPE_UINT64
import deluge.component as component
from deluge.common import FILE_PRIORITY, open_file, show_file
@ -97,7 +97,7 @@ class FilesTab(Tab):
self.listview = builder.get_object('files_listview')
# filename, size, progress string, progress value, priority, file index, icon id
self.treestore = gtk.TreeStore(str, gobject.TYPE_UINT64, str, float, int, int, str)
self.treestore = gtk.TreeStore(str, TYPE_UINT64, str, float, int, int, str)
self.treestore.set_sort_column_id(0, gtk.SORT_ASCENDING)
# We need to store the row that's being edited to prevent updating it until

View File

@ -19,8 +19,8 @@ import pygtk # isort:skip (Required before gtk import).
pygtk.require('2.0') # NOQA: E402
# isort:imports-thirdparty
import gobject
import gtk
from gobject import set_prgname
from twisted.internet import defer, gtk2reactor
from twisted.internet.error import ReactorAlreadyInstalledError
from twisted.internet.task import LoopingCall
@ -59,9 +59,7 @@ from deluge.ui.sessionproxy import SessionProxy
from deluge.ui.tracker_icons import TrackerIcons
from deluge.ui.util import lang
gobject.set_prgname('deluge')
set_prgname('deluge')
log = logging.getLogger(__name__)
try:

View File

@ -12,8 +12,8 @@ from __future__ import division, print_function
import os
import gobject
import gtk
from gobject import SIGNAL_RUN_FIRST, TYPE_NONE, GObject, type_register
from gtk import gdk, keysyms
from deluge.common import resource_filename
@ -1004,26 +1004,26 @@ class PathAutoCompleter(object):
self.completion_popup.popdown()
class PathChooserComboBox(gtk.HBox, StoredValuesPopup, gobject.GObject):
class PathChooserComboBox(gtk.HBox, StoredValuesPopup, GObject):
__gsignals__ = {
'list-value-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'list-value-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'list-values-reordered': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'list-values-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'auto-complete-enabled-toggled': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'show-filechooser-toggled': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'show-path-entry-toggled': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'show-folder-name-on-button': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'show-hidden-files-toggled': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'accelerator-set': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'max-rows-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'text-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (object, )),
'list-value-added': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'list-value-removed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'list-values-reordered': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'list-values-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'auto-complete-enabled-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'show-filechooser-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'show-path-entry-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'show-folder-name-on-button': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'show-hidden-files-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'accelerator-set': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'max-rows-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
'text-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )),
}
def __init__(self, max_visible_rows=20, auto_complete=True, use_completer_popup=True):
gtk.HBox.__init__(self)
gobject.GObject.__init__(self)
GObject.__init__(self)
self._stored_values_popping_down = False
self.filechooser_visible = True
self.filechooser_enabled = True
@ -1486,7 +1486,7 @@ class PathChooserComboBox(gtk.HBox, StoredValuesPopup, gobject.GObject):
'on_show_hidden_files_checkbutton_toggled': on_show_hidden_files_toggled,
}
gobject.type_register(PathChooserComboBox)
type_register(PathChooserComboBox)
if __name__ == '__main__':
import sys

View File

@ -10,8 +10,8 @@
import logging
import os.path
import gobject
import gtk
from gobject import timeout_add
import deluge.common
import deluge.component as component
@ -107,7 +107,7 @@ class QueuedTorrents(component.Component):
except Exception:
# The statusbar hasn't been loaded yet, so we'll add a timer to
# update it later.
gobject.timeout_add(100, self.update_status_bar)
timeout_add(100, self.update_status_bar)
return False
# Set the label text for statusbar

View File

@ -11,8 +11,8 @@ from __future__ import division
import logging
import gobject
import gtk
from gobject import timeout_add
import deluge.component as component
from deluge.common import fsize, fspeed, get_pixmap
@ -250,7 +250,7 @@ class StatusBar(component.Component):
"""Adds an item to the StatusBar for seconds"""
item = self.add_item(image, stock, text, callback)
# Start a timer to remove this item in seconds
gobject.timeout_add(seconds * 1000, self.remove_item, item)
timeout_add(seconds * 1000, self.remove_item, item)
def display_warning(self, text, callback=None):
"""Displays a warning to the user in the status bar"""
@ -258,7 +258,7 @@ class StatusBar(component.Component):
item = self.add_item(
stock=gtk.STOCK_DIALOG_WARNING, text=text, callback=callback)
self.current_warnings.append(text)
gobject.timeout_add(3000, self.remove_warning, item)
timeout_add(3000, self.remove_warning, item)
def remove_warning(self, item):
self.current_warnings.remove(item.get_text())

View File

@ -12,8 +12,8 @@
import logging
from locale import strcoll
import gobject
import gtk
from gobject import TYPE_UINT64, idle_add
from twisted.internet import reactor
import deluge.component as component
@ -250,15 +250,15 @@ class TorrentView(ListView, component.Component):
function=funcs.cell_data_statusicon,
default_sort=True)
self.add_func_column(_('Size'), funcs.cell_data_size,
[gobject.TYPE_UINT64],
[TYPE_UINT64],
status_field=['total_wanted'])
self.add_func_column(_('Downloaded'), funcs.cell_data_size,
[gobject.TYPE_UINT64],
[TYPE_UINT64],
status_field=['all_time_download'], default=False)
self.add_func_column(_('Uploaded'), funcs.cell_data_size,
[gobject.TYPE_UINT64],
[TYPE_UINT64],
status_field=['total_uploaded'], default=False)
self.add_func_column(_('Remaining'), funcs.cell_data_size, [gobject.TYPE_UINT64],
self.add_func_column(_('Remaining'), funcs.cell_data_size, [TYPE_UINT64],
status_field=['total_remaining'], default=False)
self.add_progress_column(_('Progress'),
status_field=['progress', 'state'],
@ -465,7 +465,7 @@ class TorrentView(ListView, component.Component):
# An update request is scheduled, let's wait for that one
return
# Send a status request
gobject.idle_add(self.send_status_request, None, select_row)
idle_add(self.send_status_request, None, select_row)
def update_view(self, load_new_list=False):
"""Update the torrent view model with data we've received."""

View File

@ -12,8 +12,8 @@ from __future__ import print_function
import warnings
from functools import partial
import gobject
import gtk
from gobject import GError
import deluge.common as common
import deluge.component as component
@ -96,7 +96,7 @@ def set_icon(icon, cell):
if pixbuf is None:
try:
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon.get_filename(), 16, 16)
except gobject.GError:
except GError:
# Failed to load the pixbuf (Bad image file), so set a blank pixbuf
pixbuf = create_blank_pixbuf()
finally: