From e9917bfbb2a6099519dc9f29832db989dc3fab48 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 1 Sep 2007 11:52:01 +0000 Subject: [PATCH] Code clean-up. --- deluge/plugins/queue/queue/gtkui.py | 20 ++++---------------- deluge/ui/gtkui/gtkui.py | 5 +---- deluge/ui/gtkui/mainwindow.py | 5 +---- deluge/ui/gtkui/menubar.py | 5 +---- deluge/ui/gtkui/toolbar.py | 5 +---- deluge/ui/ui.py | 7 +------ 6 files changed, 9 insertions(+), 38 deletions(-) diff --git a/deluge/plugins/queue/queue/gtkui.py b/deluge/plugins/queue/queue/gtkui.py index 448d2d3c2..f00d23331 100644 --- a/deluge/plugins/queue/queue/gtkui.py +++ b/deluge/plugins/queue/queue/gtkui.py @@ -31,26 +31,14 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -import logging - -try: - import dbus, dbus.service - dbus_version = getattr(dbus, "version", (0,0,0)) - if dbus_version >= (0,41,0) and dbus_version < (0,80,0): - import dbus.glib - elif dbus_version >= (0,80,0): - from dbus.mainloop.glib import DBusGMainLoop - DBusGMainLoop(set_as_default=True) - else: - pass -except: dbus_imported = False -else: dbus_imported = True +import dbus +from dbus.mainloop.glib import DBusGMainLoop +DBusGMainLoop(set_as_default=True) import pkg_resources import gtk.glade -# Get the logger -log = logging.getLogger("deluge") +from deluge.log import LOG as log class GtkUI: def __init__(self, plugin_manager): diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 3d405706e..a14918f2d 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -31,8 +31,6 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -import logging - import pygtk pygtk.require('2.0') import gtk, gtk.glade @@ -43,8 +41,7 @@ from mainwindow import MainWindow from signals import Signals from pluginmanager import PluginManager -# Get the logger -log = logging.getLogger("deluge") +from deluge.log import LOG as log class GtkUI: def __init__(self): diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py index ffa8b66c9..c544469d5 100644 --- a/deluge/ui/gtkui/mainwindow.py +++ b/deluge/ui/gtkui/mainwindow.py @@ -31,8 +31,6 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -import logging - import pygtk pygtk.require('2.0') import gtk, gtk.glade @@ -43,8 +41,7 @@ from menubar import MenuBar from toolbar import ToolBar from torrentview import TorrentView -# Get the logger -log = logging.getLogger("deluge") +from deluge.log import LOG as log class MainWindow: def __init__(self): diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index 56682196b..205426b06 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -31,8 +31,6 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -import logging - import pygtk pygtk.require('2.0') import gtk, gtk.glade @@ -40,8 +38,7 @@ import pkg_resources import deluge.ui.functions as functions -# Get the logger -log = logging.getLogger("deluge") +from deluge.log import LOG as log class MenuBar: def __init__(self, window): diff --git a/deluge/ui/gtkui/toolbar.py b/deluge/ui/gtkui/toolbar.py index 65ae7683e..95058e125 100644 --- a/deluge/ui/gtkui/toolbar.py +++ b/deluge/ui/gtkui/toolbar.py @@ -31,14 +31,11 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -import logging - import pygtk pygtk.require('2.0') import gtk, gtk.glade -# Get the logger -log = logging.getLogger("deluge") +from deluge.log import LOG as log class ToolBar: def __init__(self, window): diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py index 24edba815..e13b15d1f 100644 --- a/deluge/ui/ui.py +++ b/deluge/ui/ui.py @@ -31,14 +31,9 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -import logging - -import time - from deluge.config import Config -# Get the logger -log = logging.getLogger("deluge") +from deluge.log import LOG as log DEFAULT_PREFS = { "selected_ui": "gtk"