deskbar-applet r2036 - in trunk: . deskbar deskbar/core deskbar/core/updater deskbar/handlers deskbar/handlers/actions deskbar/ui/cuemiac deskbar/ui/preferences



Author: sebp
Date: Fri Mar 21 12:42:11 2008
New Revision: 2036
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=2036&view=rev

Log:
Reorganized imports and logging statements

Modified:
   trunk/ChangeLog
   trunk/deskbar/__init__.py
   trunk/deskbar/core/BrowserMatch.py
   trunk/deskbar/core/CoreImpl.py
   trunk/deskbar/core/DeskbarHistory.py
   trunk/deskbar/core/Keybinder.py
   trunk/deskbar/core/ModuleList.py
   trunk/deskbar/core/ModuleLoader.py
   trunk/deskbar/core/Utils.py
   trunk/deskbar/core/Watcher.py
   trunk/deskbar/core/updater/Capuchin.py
   trunk/deskbar/deskbar-applet.py
   trunk/deskbar/handlers/actions/ActionsFactory.py
   trunk/deskbar/handlers/actions/OpenDesktopFileAction.py
   trunk/deskbar/handlers/actions/OpenFileAction.py
   trunk/deskbar/handlers/actions/OpenWithApplicationAction.py
   trunk/deskbar/handlers/beagle-live.py
   trunk/deskbar/handlers/beagle-static.py
   trunk/deskbar/handlers/desklicious.py
   trunk/deskbar/handlers/evolution.py
   trunk/deskbar/handlers/files.py
   trunk/deskbar/handlers/history.py
   trunk/deskbar/handlers/iswitch-window.py
   trunk/deskbar/handlers/mozilla.py
   trunk/deskbar/handlers/programs.py
   trunk/deskbar/handlers/recent.py
   trunk/deskbar/handlers/templates.py
   trunk/deskbar/handlers/tomboy.py
   trunk/deskbar/handlers/yahoo.py
   trunk/deskbar/ui/cuemiac/CuemiacEntry.py
   trunk/deskbar/ui/cuemiac/CuemiacHistory.py
   trunk/deskbar/ui/cuemiac/CuemiacModel.py
   trunk/deskbar/ui/cuemiac/LingeringSelectionWindow.py
   trunk/deskbar/ui/preferences/ModuleListView.py

Modified: trunk/deskbar/__init__.py
==============================================================================
--- trunk/deskbar/__init__.py	(original)
+++ trunk/deskbar/__init__.py	Fri Mar 21 12:42:11 2008
@@ -28,7 +28,7 @@
     SHARED_DATA_DIR = abspath(join(dirname(__file__), '..', 'data'))
 else:
     SHARED_DATA_DIR = join(DATA_DIR, "deskbar-applet")
-LOGGER.debug("Data Dir: %s" % SHARED_DATA_DIR)
+LOGGER.debug("Data Dir: %s", SHARED_DATA_DIR)
 
 HANDLERS_DIR = []
 if UNINSTALLED_DESKBAR:
@@ -41,18 +41,18 @@
     try:
         os.makedirs(USER_DESKBAR_DIR, 0744)
     except Exception , msg:
-        LOGGER.error('Could not create user handlers dir (%s): %s' % (USER_DESKBAR_DIR, msg))
+        LOGGER.error('Could not create user handlers dir (%s): %s', USER_DESKBAR_DIR, msg)
         
 USER_HANDLERS_DIR = expanduser("~/.gnome2/deskbar-applet/modules-2.20-compatible")
 if not exists(USER_HANDLERS_DIR):
     try:
         os.makedirs(USER_HANDLERS_DIR, 0744)
     except Exception , msg:
-        LOGGER.error('Could not create user handlers dir (%s): %s' % (USER_HANDLERS_DIR, msg))
+        LOGGER.error('Could not create user handlers dir (%s): %s', USER_HANDLERS_DIR, msg)
 USER_HANDLERS_DIR = [USER_HANDLERS_DIR]
 
 MODULES_DIRS = USER_HANDLERS_DIR+HANDLERS_DIR
-LOGGER.debug("Handlers Dir: %s" % MODULES_DIRS)
+LOGGER.debug("Handlers Dir: %s", MODULES_DIRS)
 # ------------------------------------------------------------------------------
 
 # Set the cwd to the home directory so spawned processes behave correctly

Modified: trunk/deskbar/core/BrowserMatch.py
==============================================================================
--- trunk/deskbar/core/BrowserMatch.py	(original)
+++ trunk/deskbar/core/BrowserMatch.py	Fri Mar 21 12:42:11 2008
@@ -1,11 +1,21 @@
-import re,cgi, urllib, os, logging
+from deskbar.core.GconfStore import GconfStore
+from deskbar.handlers.actions.CopyToClipboardAction import CopyToClipboardAction
+from deskbar.handlers.actions.ShowUrlAction import ShowUrlAction
 from gettext import gettext as _
-import gtk, gobject, os.path
-import deskbar, deskbar.interfaces.Match, deskbar.core.Utils
+import cgi
+import deskbar
+import deskbar.core.Utils
 import deskbar.interfaces.Action
-from deskbar.handlers.actions.ShowUrlAction import ShowUrlAction
-from deskbar.handlers.actions.CopyToClipboardAction import CopyToClipboardAction
-from deskbar.core.GconfStore import GconfStore
+import deskbar.interfaces.Match
+import gobject
+import gtk
+import logging
+import os
+import os.path
+import re
+import urllib
+
+LOGGER = logging.getLogger(__name__)
 
 def get_preferred_browser():
     http_handler = GconfStore.get_instance().get_client().get_string("/desktop/gnome/url-handlers/http/command")
@@ -137,7 +147,7 @@
             
         return urllib.splithost(clean)[0]
     except Exception, msg:
-        logging.error('get_url_host(%s):%s' % (url, msg))
+        LOGGER.error('get_url_host(%s):%s', url, msg)
         return url
 
 

Modified: trunk/deskbar/core/CoreImpl.py
==============================================================================
--- trunk/deskbar/core/CoreImpl.py	(original)
+++ trunk/deskbar/core/CoreImpl.py	Fri Mar 21 12:42:11 2008
@@ -168,7 +168,7 @@
         if not self._keybinder.bind(binding):
             LOGGER.error("Keybinding is already in use")
         else:
-            LOGGER.info("Successfully binded Deskbar to %s" % binding)
+            LOGGER.info("Successfully binded Deskbar to %s", binding)
     
     def set_min_chars(self, number):
         self._gconf.set_min_chars(number)

Modified: trunk/deskbar/core/DeskbarHistory.py
==============================================================================
--- trunk/deskbar/core/DeskbarHistory.py	(original)
+++ trunk/deskbar/core/DeskbarHistory.py	Fri Mar 21 12:42:11 2008
@@ -1,11 +1,12 @@
-import cPickle
-import gtk, gobject
-import time
-import logging
-import deskbar.interfaces.Action
 from deskbar import HISTORY_FILE
-from gettext import gettext as _
 from deskbar.core.Categories import CATEGORIES
+from gettext import gettext as _
+import cPickle
+import deskbar.interfaces.Action
+import gobject
+import gtk
+import logging
+import time
 
 LOGGER = logging.getLogger(__name__)
 

Modified: trunk/deskbar/core/Keybinder.py
==============================================================================
--- trunk/deskbar/core/Keybinder.py	(original)
+++ trunk/deskbar/core/Keybinder.py	Fri Mar 21 12:42:11 2008
@@ -1,5 +1,7 @@
-import gtk, gobject
-import deskbar, deskbar.core.keybinder
+import deskbar
+import deskbar.core.keybinder
+import gobject
+import gtk
 import logging
 
 LOGGER = logging.getLogger(__name__)
@@ -22,7 +24,7 @@
         if self.bound:
             self.unbind()
 
-        LOGGER.info('Binding Global shortcut %s to focus the deskbar' % keybinding)
+        LOGGER.info('Binding Global shortcut %s to focus the deskbar', keybinding)
         try:
             self.bound = deskbar.core.keybinder.tomboy_keybinder_bind(keybinding, self.on_keyboard_shortcut)
             self.prevbinding = keybinding
@@ -33,7 +35,7 @@
         return self.bound
                     
     def unbind(self):
-        LOGGER.info('Unbinding Global shortcut %s to focus the deskbar' % self.prevbinding)
+        LOGGER.info('Unbinding Global shortcut %s to focus the deskbar', self.prevbinding)
         try:
             deskbar.core.keybinder.tomboy_keybinder_unbind(self.prevbinding)
             self.bound = False

Modified: trunk/deskbar/core/ModuleList.py
==============================================================================
--- trunk/deskbar/core/ModuleList.py	(original)
+++ trunk/deskbar/core/ModuleList.py	Fri Mar 21 12:42:11 2008
@@ -120,7 +120,7 @@
     def remove_module(self, module):
         iter, index = self.get_position_from_context(module)
         if iter != None:
-            LOGGER.debug('Removing from modulelist: '+module.INFOS['name'])
+            LOGGER.debug('Removing from modulelist: %s', module.INFOS['name'])
             self.remove(iter)
         
     def module_changed(self, module):
@@ -226,7 +226,7 @@
     def remove_module(self, module):
         iter, index = self.get_position_from_context(module)
         if iter != None:
-            LOGGER.debug('Removing from disabledModulelist: '+str(module))
+            LOGGER.debug('Removing from disabledModulelist: %s', str(module))
             self.remove(iter)
 
 gobject.type_register(DisabledModuleList)

Modified: trunk/deskbar/core/ModuleLoader.py
==============================================================================
--- trunk/deskbar/core/ModuleLoader.py	(original)
+++ trunk/deskbar/core/ModuleLoader.py	Fri Mar 21 12:42:11 2008
@@ -1,10 +1,13 @@
-import os, pydoc
+from deskbar.core.Watcher import DirWatcher
 from os.path import abspath, expanduser, join, basename
-import traceback
-import gtk, gobject
+import deskbar
+import deskbar.core.Categories
+import gobject
+import gtk
 import logging
-import deskbar, deskbar.core.Categories
-from deskbar.core.Watcher import DirWatcher
+import os
+import pydoc
+import traceback
 
 LOGGER = logging.getLogger(__name__)
 
@@ -83,8 +86,8 @@
                     if basename(i) not in [basename(j) for j in res]:
                         res.append(i)
             except OSError, err:
-                LOGGER.error("Error reading directory %s, skipping." % d)
-                traceback.print_exc()
+                LOGGER.error("Error reading directory %s, skipping.", d)
+                LOGGER.exception(err)
         
         self.filelist = res
             
@@ -98,7 +101,7 @@
         try:
             mod = pydoc.importfile (filename)
         except Exception:
-            LOGGER.error("Error loading the file: %s." % filename)
+            LOGGER.error("Error loading the file: %s.", filename)
             error = traceback.format_exc()
             if "No module named deskbar.Handler" in error:
                 self.__old_modules.append(filename)
@@ -109,12 +112,11 @@
         try:
             if (mod.HANDLERS): pass
         except AttributeError:
-            LOGGER.error("The file %s is not a valid module. Skipping. A module must have the variable HANDLERS defined as a list." % filename)
-            #traceback.print_exc()
+            LOGGER.error("The file %s is not a valid module. Skipping. A module must have the variable HANDLERS defined as a list.", filename)
             return
         
         if mod.HANDLERS == None:
-            LOGGER.warning("The file %s doesn't contain a HANDERLS variable" % (filename))
+            LOGGER.warning("The file %s doesn't contain a HANDERLS variable", filename)
             return
         
         valid_modules = []
@@ -126,12 +128,12 @@
             if hasattr(module, "initialize") and hasattr( module, "INFOS"):
                 # Check that the given requirements for the handler are met
                 if not getattr(module, "has_requirements" )():
-                    LOGGER.warning("Class %s in file %s has missing requirements. Skipping." % (handler, filename))
+                    LOGGER.warning("Class %s in file %s has missing requirements. Skipping.", handler, filename)
                     self.emit("module-not-initialized", module)
                 else:
                     valid_modules.append(module)
             else:
-                LOGGER.error("Class %s in file %s does not have an initialize(self) method or does not define a 'INFOS' attribute. Skipping." % (handler, filename))
+                LOGGER.error("Class %s in file %s does not have an initialize(self) method or does not define a 'INFOS' attribute. Skipping.", handler, filename)
             
         return valid_modules
             
@@ -144,7 +146,7 @@
             return
         
         for mod in modules:
-            LOGGER.info("Loading module '%s' from file %s." % ( mod.INFOS["name"], filename))
+            LOGGER.info("Loading module '%s' from file %s.", mod.INFOS["name"], filename)
             mod_instance = mod ()
             mod_instance.set_filename( filename )
             mod_instance.set_id( os.path.basename(filename) )
@@ -157,9 +159,9 @@
         passing a corresponding module module.
         """
         if self.dirs is None:
-            LOGGER.error("The ModuleLoader at %s has no filelist! It was probably initialized with dirs=None." % str(id(self)))
+            LOGGER.error("The ModuleLoader at %s has no filelist! It was probably initialized with dirs=None.", str(id(self)))
             return
-            
+        
         for f in self.filelist:
             self.load (f)
         
@@ -174,7 +176,7 @@
         if module.is_enabled():
             return
             
-        LOGGER.info("Initializing %s" % module.INFOS["name"])
+        LOGGER.info("Initializing %s", module.INFOS["name"])
         
         try:
             module.initialize ()
@@ -184,8 +186,8 @@
                 for catname, catinfo in module.INFOS["categories"].items():
                     deskbar.core.Categories.CATEGORIES[catname] = catinfo
         except Exception, msg:
-            LOGGER.error( "Error while initializing %s: %s" % (module.INFOS["name"],msg))
-            traceback.print_exc()
+            LOGGER.error( "Error while initializing %s: %s", module.INFOS["name"], msg)
+            LOGGER.exception(msg)
             module.set_enabled(False)
             self.emit("module-not-initialized", module)
             return
@@ -200,7 +202,7 @@
         the stopped module as argument.
         """
         
-        LOGGER.info("Stopping %s" % module.INFOS["name"])
+        LOGGER.info("Stopping %s", module.INFOS["name"])
         module.stop ()
                 
         module.set_enabled(False)

Modified: trunk/deskbar/core/Utils.py
==============================================================================
--- trunk/deskbar/core/Utils.py	(original)
+++ trunk/deskbar/core/Utils.py	Fri Mar 21 12:42:11 2008
@@ -1,13 +1,18 @@
-import os, cgi, re
-from os.path import *
-from gettext import gettext as _
-import deskbar, deskbar.core.gnomedesktop
-import gtk, gtk.gdk, gnome.ui, gobject, gnomevfs
-from htmlentitydefs import name2codepoint
-import logging
 from deskbar.core.GconfStore import GconfStore
 from deskbar.core._userdirs import *
+from gettext import gettext as _
+from htmlentitydefs import name2codepoint
+from os.path import *
+import deskbar
 import deskbar.core.Categories
+import deskbar.core.gnomedesktop
+import gnome.ui
+import gnomevfs
+import gobject
+import gtk
+import gtk.gdk
+import logging
+import os, cgi, re
 
 LOGGER = logging.getLogger(__name__)
 

Modified: trunk/deskbar/core/Watcher.py
==============================================================================
--- trunk/deskbar/core/Watcher.py	(original)
+++ trunk/deskbar/core/Watcher.py	Fri Mar 21 12:42:11 2008
@@ -2,9 +2,12 @@
 Helper classes to monitor directories/files for changes using gnomevfs
 """
 
-import traceback
 import gnomevfs
-import gobject, gtk
+import gobject
+import gtk
+import logging
+
+LOGGER = logging.getLogger(__name__)
 
 class Watcher(gobject.GObject):
     __gsignals__ = {
@@ -27,7 +30,7 @@
                 try:
                     self.watched[name] = gnomevfs.monitor_add(name, self.monitor_type, self._on_change)
                 except Exception, msg:
-                    traceback.print_exc()
+                    LOGGER.exception(msg)
                     self.watched[name] = 0
     
     def remove(self, args):

Modified: trunk/deskbar/core/updater/Capuchin.py
==============================================================================
--- trunk/deskbar/core/updater/Capuchin.py	(original)
+++ trunk/deskbar/core/updater/Capuchin.py	Fri Mar 21 12:42:11 2008
@@ -23,7 +23,8 @@
         bus_names = _dbus.ListActivatableNames()
         return (CAPUCHIN_DBUS_SERVICE in bus_names)
     except (dbus.DBusException, dbus.exceptions.DBusException), e:
-        LOGGER.exception("D-Bus Error: %s" % e)
+        LOGGER.error("D-Bus Error")
+        LOGGER.exception(e)
         return False
 
 class AppObjectManager:

Modified: trunk/deskbar/deskbar-applet.py
==============================================================================
--- trunk/deskbar/deskbar-applet.py	(original)
+++ trunk/deskbar/deskbar-applet.py	Fri Mar 21 12:42:11 2008
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
-import gtk, gtk.gdk
+import gtk
+import gtk.gdk
 import sys
 from os.path import abspath, join, dirname, exists
 import logging

Modified: trunk/deskbar/handlers/actions/ActionsFactory.py
==============================================================================
--- trunk/deskbar/handlers/actions/ActionsFactory.py	(original)
+++ trunk/deskbar/handlers/actions/ActionsFactory.py	Fri Mar 21 12:42:11 2008
@@ -37,7 +37,7 @@
     try:
         fileinfo = gnomevfs.get_file_info(uri, gnomevfs.FILE_INFO_GET_MIME_TYPE | gnomevfs.FILE_INFO_FOLLOW_LINKS)
     except Exception, msg:
-        LOGGER.error("Could not retrieve MIME type of %s: %s" % (uri, msg))
+        LOGGER.error("Could not retrieve MIME type of %s: %s", uri, msg)
         return []
     mime = fileinfo.mime_type
     actions = []

Modified: trunk/deskbar/handlers/actions/OpenDesktopFileAction.py
==============================================================================
--- trunk/deskbar/handlers/actions/OpenDesktopFileAction.py	(original)
+++ trunk/deskbar/handlers/actions/OpenDesktopFileAction.py	Fri Mar 21 12:42:11 2008
@@ -1,8 +1,8 @@
-import deskbar.interfaces.Action
-import deskbar.core.gnomedesktop
 from deskbar.core.Utils import get_xdg_data_dirs
-from os.path import join, exists
 from gettext import gettext as _
+from os.path import join, exists
+import deskbar.core.gnomedesktop
+import deskbar.interfaces.Action
 import logging
 
 LOGGER = logging.getLogger(__name__)
@@ -76,7 +76,7 @@
     try:
         desktop = deskbar.core.gnomedesktop.item_new_from_file(desktop, deskbar.core.gnomedesktop.LOAD_ONLY_IF_EXISTS)
     except Exception, e:
-        LOGGER.warning('Couldn\'t read desktop file %s:' % desktop)
+        LOGGER.warning('Couldn\'t read desktop file %s:', desktop)
         LOGGER.exception(e)
         return None
     

Modified: trunk/deskbar/handlers/actions/OpenFileAction.py
==============================================================================
--- trunk/deskbar/handlers/actions/OpenFileAction.py	(original)
+++ trunk/deskbar/handlers/actions/OpenFileAction.py	Fri Mar 21 12:42:11 2008
@@ -1,7 +1,7 @@
-import deskbar.interfaces.Action
-from gettext import gettext as _
 from deskbar.core.Utils import url_show_file
+from gettext import gettext as _
 from os.path import exists
+import deskbar.interfaces.Action
 import gnomevfs
 import logging
 
@@ -31,7 +31,7 @@
             url = gnomevfs.unescape_string_for_display(url)
 
         if not exists(url):
-            LOGGER.debug("File %s does not exist" % url)
+            LOGGER.debug("File %s does not exist", url)
             return False
         else:
             try:
@@ -41,7 +41,7 @@
                 # get_mime_type throws a RuntimeException when something went wrong
                 returnval = False
         if not returnval:
-            LOGGER.debug("File %s has no default application" % url)
+            LOGGER.debug("File %s has no default application", url)
         return returnval
     
     def get_hash(self):

Modified: trunk/deskbar/handlers/actions/OpenWithApplicationAction.py
==============================================================================
--- trunk/deskbar/handlers/actions/OpenWithApplicationAction.py	(original)
+++ trunk/deskbar/handlers/actions/OpenWithApplicationAction.py	Fri Mar 21 12:42:11 2008
@@ -1,7 +1,7 @@
-import deskbar.interfaces.Action
-from gettext import gettext as _
 from deskbar.core.Utils import spawn_async, is_program_in_path
+from gettext import gettext as _
 from os.path import exists, isabs
+import deskbar.interfaces.Action
 import logging
 
 LOGGER = logging.getLogger(__name__)
@@ -38,7 +38,7 @@
         else:
             returnval = is_program_in_path(self._program)
         if not returnval:
-            LOGGER.debug("%s does not exist" % self._program)
+            LOGGER.debug("%s does not exist", self._program)
         return returnval
        
     def get_hash(self):

Modified: trunk/deskbar/handlers/beagle-live.py
==============================================================================
--- trunk/deskbar/handlers/beagle-live.py	(original)
+++ trunk/deskbar/handlers/beagle-live.py	Fri Mar 21 12:42:11 2008
@@ -288,7 +288,7 @@
                                             )
             self.add_all_actions( actions )
         else:
-            LOGGER.warning("Unknown beagle match type found: "+result["type"] )
+            LOGGER.warning("Unknown beagle match type found: %s", result["type"] )
 
         # Load the correct icon
         
@@ -352,7 +352,7 @@
         hit_matches = []
         for hit in response.get_hits():
             if hit.get_type() not in TYPES:
-                LOGGER.info("Beagle live seen an unknown type:"+ str(hit.get_type()))
+                LOGGER.info("Beagle live seen an unknown type: %s", str(hit.get_type()))
                 continue
             
             if "snippet" in TYPES[hit.get_type()] and TYPES[hit.get_type()]["snippet"]:

Modified: trunk/deskbar/handlers/beagle-static.py
==============================================================================
--- trunk/deskbar/handlers/beagle-static.py	(original)
+++ trunk/deskbar/handlers/beagle-static.py	Fri Mar 21 12:42:11 2008
@@ -1,10 +1,10 @@
-from os.path import join
-from glob import glob
-from gettext import gettext as _
-from deskbar.defs import VERSION
-import deskbar.interfaces.Module, deskbar.interfaces.Match
 from deskbar.core.Utils import get_xdg_data_dirs, spawn_async, load_icon
+from deskbar.defs import VERSION
+from gettext import gettext as _
+from glob import glob
+from os.path import join
 import deskbar.interfaces.Action
+import deskbar.interfaces.Module, deskbar.interfaces.Match
 
 HANDLERS = ["BeagleHandler"]
 

Modified: trunk/deskbar/handlers/desklicious.py
==============================================================================
--- trunk/deskbar/handlers/desklicious.py	(original)
+++ trunk/deskbar/handlers/desklicious.py	Fri Mar 21 12:42:11 2008
@@ -64,7 +64,7 @@
         #self.check_query_changed ()
         
         #The queryyyyYyyYy :)
-        LOGGER.info( "Asking del.icio.us tags for %s" % tag )
+        LOGGER.info( "Asking del.icio.us tags for %s", tag )
         posts = self._delicious.get_posts_by_tag(tag)
 
         # TODO: Missing
@@ -135,11 +135,11 @@
         
         #Get the info from del.icio.us and parse
         url = DEFAULT_QUERY_TAG % (urllib.quote_plus(self._user), urllib.quote_plus(tag))
-        LOGGER.debug("Opening URL "+url)
+        LOGGER.debug("Opening URL %s", url)
         try:
             stream = urllib.urlopen(url, proxies=deskbar.core.Utils.get_proxy())
         except IOError, msg:
-            LOGGER.error("Could not open URL %s: %s, %s" % (url, msg[0], msg[1]))
+            LOGGER.error("Could not open URL %s: %s, %s", url, msg[0], msg[1])
             return []
         
         dom = xml.dom.minidom.parse(stream)

Modified: trunk/deskbar/handlers/evolution.py
==============================================================================
--- trunk/deskbar/handlers/evolution.py	(original)
+++ trunk/deskbar/handlers/evolution.py	Fri Mar 21 12:42:11 2008
@@ -1,8 +1,13 @@
-from gettext import gettext as _
-import deskbar, deskbar.core.Indexer, deskbar.interfaces.Module, deskbar.handlers.evolution, deskbar.core.Utils, deskbar.interfaces.Match
 from deskbar.defs import VERSION
-from deskbar.handlers.actions.SendEmailToAction import SendEmailToAction
 from deskbar.handlers.actions.OpenWithApplicationAction import OpenWithApplicationAction
+from deskbar.handlers.actions.SendEmailToAction import SendEmailToAction
+from gettext import gettext as _
+import deskbar
+import deskbar.core.Indexer
+import deskbar.core.Utils
+import deskbar.handlers.evolution
+import deskbar.interfaces.Match
+import deskbar.interfaces.Module
 
 HANDLERS = ["EvolutionHandler"]
 

Modified: trunk/deskbar/handlers/files.py
==============================================================================
--- trunk/deskbar/handlers/files.py	(original)
+++ trunk/deskbar/handlers/files.py	Fri Mar 21 12:42:11 2008
@@ -1,20 +1,21 @@
-import os, urllib
+from deskbar.core.Watcher import FileWatcher
+from deskbar.defs import VERSION
+from deskbar.handlers.actions.ActionsFactory import get_actions_for_uri
+from deskbar.handlers.actions.CopyToClipboardAction import CopyToClipboardAction
+from deskbar.handlers.actions.OpenFileAction import OpenFileAction
+from deskbar.handlers.actions.OpenWithNautilusAction import OpenWithNautilusAction
+from deskbar.handlers.actions.ShowUrlAction import ShowUrlAction
+from gettext import gettext as _
 from os.path import join, basename, normpath, abspath, dirname
 from os.path import split, expanduser, exists, isfile
-from gettext import gettext as _
-import gtk, gnomevfs
-
 import deskbar, deskbar.core.Indexer
-import deskbar.interfaces.Module
 import deskbar.interfaces.Match
+import deskbar.interfaces.Module
+import gnomevfs
+import gtk
+import os, urllib
+
 
-from deskbar.defs import VERSION
-from deskbar.core.Watcher import FileWatcher
-from deskbar.handlers.actions.OpenWithNautilusAction import OpenWithNautilusAction
-from deskbar.handlers.actions.OpenFileAction import OpenFileAction
-from deskbar.handlers.actions.ShowUrlAction import ShowUrlAction
-from deskbar.handlers.actions.CopyToClipboardAction import CopyToClipboardAction
-from deskbar.handlers.actions.ActionsFactory import get_actions_for_uri
 
 MONITOR = gnomevfs.VolumeMonitor()
 

Modified: trunk/deskbar/handlers/history.py
==============================================================================
--- trunk/deskbar/handlers/history.py	(original)
+++ trunk/deskbar/handlers/history.py	Fri Mar 21 12:42:11 2008
@@ -1,11 +1,11 @@
+from deskbar.core.DeskbarHistory import DeskbarHistory
+from deskbar.defs import VERSION
 from gettext import gettext as _
-
+import deskbar.interfaces.Match
+import deskbar.interfaces.Module
 import gtk
 
-import deskbar.interfaces.Module
-import deskbar.interfaces.Match
-from deskbar.core.DeskbarHistory import DeskbarHistory
-from deskbar.defs import VERSION
+
 
 HANDLERS = ["HistoryHandler"]
 

Modified: trunk/deskbar/handlers/iswitch-window.py
==============================================================================
--- trunk/deskbar/handlers/iswitch-window.py	(original)
+++ trunk/deskbar/handlers/iswitch-window.py	Fri Mar 21 12:42:11 2008
@@ -1,7 +1,8 @@
-from gettext import gettext as _
 from deskbar.defs import VERSION
-import wnck, gtk
+from gettext import gettext as _
 import deskbar.interfaces.Module, deskbar.interfaces.Match, deskbar.interfaces.Action, deskbar
+import gtk
+import wnck
 
 HANDLERS = ["ISwitchWindowHandler"]
 

Modified: trunk/deskbar/handlers/mozilla.py
==============================================================================
--- trunk/deskbar/handlers/mozilla.py	(original)
+++ trunk/deskbar/handlers/mozilla.py	Fri Mar 21 12:42:11 2008
@@ -331,7 +331,8 @@
                 self.indexed_file = self._index_mozilla()
             self.close()
         except Exception, e:
-            LOGGER.error('Could not index Firefox bookmarks: %s' % e)
+            LOGGER.error('Could not index Firefox bookmarks')
+            LOGGER.exception(e)
         
     def get_indexer(self):
         """
@@ -349,7 +350,8 @@
                 self.feed(file(bookmarks_file).read())
                 return bookmarks_file
         except Exception, msg:
-            LOGGER.error('Retrieving Mozilla Bookmarks: %s' % msg)
+            LOGGER.error('Retrieving Mozilla Bookmarks')
+            LOGGER.exception(msg)
         
     def _index_firefox(self):
         try:
@@ -358,7 +360,8 @@
                 self.feed(file(bookmarks_file).read())
                 return bookmarks_file
         except Exception, msg:
-            LOGGER.error('Retrieving Firefox Bookmarks: %s' % msg)
+            LOGGER.error('Retrieving Firefox Bookmarks')
+            LOGGER.exception(msg)
     
     def handle_starttag(self, tag, attrs):
         tag = tag.lower()
@@ -438,7 +441,7 @@
         try:
             self._parse_image (xml)
         except Exception, msg:
-            LOGGER.error("Parsing icon for %s\n%s" % (self.filename,msg))
+            LOGGER.error("Parsing icon for %s\n%s", self.filename, msg)
     
     def _detect_namespace (self, xml):
         # Manually added search engines use the "os" namespace
@@ -600,7 +603,7 @@
             parent_dir = self.f[:self.f.rindex("/")]
             return [img for img in glob.glob(join(parent_dir, '%s.*' % self.f[:-4])) if not img.endswith(".src")][0]
         except Exception, msg:
-            LOGGER.warning("Error detecting icon for smart bookmark:%s\n%s" % (self.f,msg))
+            LOGGER.warning("Error detecting icon for smart bookmark:%s\n%s", self.f, msg)
             return None
     
     def _handle_token(self, state, tokens):
@@ -772,7 +775,7 @@
                 self._smart_bookmarks.append(bookmark)
                 
             except Exception, msg:
-                LOGGER.error('MozillaSmartBookmarksDirParser:cannot parse smart bookmark: %s\n%s' % (f,msg))
+                LOGGER.error('MozillaSmartBookmarksDirParser:cannot parse smart bookmark: %s\n%s', f, msg)
                     
     
     def get_smart_bookmarks(self):

Modified: trunk/deskbar/handlers/programs.py
==============================================================================
--- trunk/deskbar/handlers/programs.py	(original)
+++ trunk/deskbar/handlers/programs.py	Fri Mar 21 12:42:11 2008
@@ -1,17 +1,17 @@
-import re
-import glob
-import os
-from os.path import join, expanduser, isdir
-from gettext import gettext as _
-from deskbar.defs import VERSION
-import gobject
-import gtk
-import deskbar, deskbar.core.Indexer, deskbar.core.Utils
-import deskbar.interfaces.Module, deskbar.interfaces.Match, deskbar.core.gnomedesktop
 from deskbar.core.Utils import get_xdg_data_dirs, is_program_in_path, spawn_async, is_executable, PATH
-from deskbar.handlers.actions.OpenWithApplicationAction import OpenWithApplicationAction
+from deskbar.defs import VERSION
 from deskbar.handlers.actions.OpenDesktopFileAction import OpenDesktopFileAction, parse_desktop_file, parse_desktop_filename
+from deskbar.handlers.actions.OpenWithApplicationAction import OpenWithApplicationAction
+from gettext import gettext as _
+from os.path import join, expanduser, isdir
+import deskbar, deskbar.core.Indexer, deskbar.core.Utils
 import deskbar.interfaces.Action
+import deskbar.interfaces.Module, deskbar.interfaces.Match, deskbar.core.gnomedesktop
+import glob
+import gobject
+import gtk
+import os
+import re
 
 HANDLERS = [
     "ProgramsHandler",

Modified: trunk/deskbar/handlers/recent.py
==============================================================================
--- trunk/deskbar/handlers/recent.py	(original)
+++ trunk/deskbar/handlers/recent.py	Fri Mar 21 12:42:11 2008
@@ -1,13 +1,13 @@
+from deskbar.defs import VERSION
+from deskbar.handlers.actions.ActionsFactory import get_actions_for_uri
+from deskbar.handlers.actions.OpenFileAction import OpenFileAction
 from gettext import gettext as _
-import gtk
-
 import deskbar
-import deskbar.interfaces.Module
 import deskbar.interfaces.Match
+import deskbar.interfaces.Module
+import gtk
+
 
-from deskbar.handlers.actions.OpenFileAction import OpenFileAction
-from deskbar.handlers.actions.ActionsFactory import get_actions_for_uri
-from deskbar.defs import VERSION
 
 HANDLERS = ["RecentHandler"]
 

Modified: trunk/deskbar/handlers/templates.py
==============================================================================
--- trunk/deskbar/handlers/templates.py	(original)
+++ trunk/deskbar/handlers/templates.py	Fri Mar 21 12:42:11 2008
@@ -1,11 +1,17 @@
-import os, os.path, shutil, subprocess
-from gettext import gettext as _
-
 from deskbar.defs import VERSION
-import deskbar.interfaces.Module, deskbar.interfaces.Action, deskbar.interfaces.Match
-import deskbar.core.Indexer, deskbar.core.Utils
-import gtk
+from gettext import gettext as _
+import deskbar.core.Indexer
+import deskbar.core.Utils
+import deskbar.interfaces.Action
+import deskbar.interfaces.Match
+import deskbar.interfaces.Module 
 import gnomevfs
+import gtk
+import os
+import os.path
+import shutil
+import subprocess
+
 
 HANDLERS = ["TemplateHandler"]
 

Modified: trunk/deskbar/handlers/tomboy.py
==============================================================================
--- trunk/deskbar/handlers/tomboy.py	(original)
+++ trunk/deskbar/handlers/tomboy.py	Fri Mar 21 12:42:11 2008
@@ -1,16 +1,16 @@
-import os
-import re
-import dbus
 from dbus.mainloop.glib import DBusGMainLoop
-from deskbar.defs import VERSION
 from deskbar.core.Utils import load_icon
+from deskbar.defs import VERSION
+from deskbar.handlers.actions.CopyToClipboardAction import CopyToClipboardAction
+from gettext import gettext as _
+import dbus
 import deskbar.interfaces.Action
 import deskbar.interfaces.Match
 import deskbar.interfaces.Module
-from deskbar.handlers.actions.CopyToClipboardAction import CopyToClipboardAction
 import gtk
-from gettext import gettext as _
 import logging
+import os
+import re
 
 LOGGER = logging.getLogger(__name__)
 

Modified: trunk/deskbar/handlers/yahoo.py
==============================================================================
--- trunk/deskbar/handlers/yahoo.py	(original)
+++ trunk/deskbar/handlers/yahoo.py	Fri Mar 21 12:42:11 2008
@@ -53,7 +53,7 @@
         # TODO: Missing
         #self.check_query_changed (timeout=QUERY_DELAY)
         
-        LOGGER.info('Query yahoo for: '+qstring)
+        LOGGER.info('Query yahoo for: %s', qstring)
         url = YAHOO_URL % urllib.urlencode(
                 {'appid': YAHOO_API_KEY,
                 'query': qstring,
@@ -61,11 +61,11 @@
         try:
             stream = urllib.urlopen(url, proxies=get_proxy())
         except IOError, msg:
-            LOGGER.error("Could not open URL %s: %s, %s" % (url, msg[0], msg[1]))
+            LOGGER.error("Could not open URL %s: %s, %s", url, msg[0], msg[1])
             return
         
         dom = xml.dom.minidom.parse(stream)
-        LOGGER.info('Got yahoo answer for: '+qstring)
+        LOGGER.info('Got yahoo answer for: %s', qstring)
         
         # TODO: Missing
         #self.check_query_changed ()    
@@ -81,5 +81,5 @@
             for r in dom.getElementsByTagName("Result")]
         # TODO: Missing
         #self.check_query_changed ()
-        LOGGER.info("Returning yahoo answer for: "+qstring)
+        LOGGER.info("Returning yahoo answer for: %s", qstring)
         self._emit_query_ready(qstring, matches )

Modified: trunk/deskbar/ui/cuemiac/CuemiacEntry.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/CuemiacEntry.py	(original)
+++ trunk/deskbar/ui/cuemiac/CuemiacEntry.py	Fri Mar 21 12:42:11 2008
@@ -1,5 +1,5 @@
-import gobject, gtk
-
+import gobject
+import gtk
 import deskbar.ui.iconentry
 
 # Make epydoc document signal

Modified: trunk/deskbar/ui/cuemiac/CuemiacHistory.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/CuemiacHistory.py	(original)
+++ trunk/deskbar/ui/cuemiac/CuemiacHistory.py	Fri Mar 21 12:42:11 2008
@@ -1,4 +1,6 @@
-import gtk, pango, gobject
+import gtk
+import pango
+import gobject
 import logging
 
 LOGGER = logging.getLogger(__name__)

Modified: trunk/deskbar/ui/cuemiac/CuemiacModel.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/CuemiacModel.py	(original)
+++ trunk/deskbar/ui/cuemiac/CuemiacModel.py	Fri Mar 21 12:42:11 2008
@@ -115,24 +115,24 @@
         """
         match_iter = self.__match_hashes[hash]
         match_obj = self[match_iter][self.MATCHES]
-        LOGGER.debug ("Adding %i actions to match %r" % (len(actions), match_obj))
+        LOGGER.debug ("Adding %i actions to match %r", len(actions), match_obj)
         match_obj.add_all_actions(actions)
     
     def __append_match(self, match_obj, query_string):
         for action in match_obj.get_actions():
             if not action.is_valid():
-                LOGGER.error("Action %r is not valid, removing it" % action)
+                LOGGER.error("Action %r is not valid, removing it", action)
                 match_obj.remove_action(action)
 
         if len(match_obj.get_actions()) == 0:
-            LOGGER.error("Match %r has no actions" % match_obj)
+            LOGGER.error("Match %r has no actions", match_obj)
             return
         
         if not self.__match_hashes.has_key(match_obj.get_hash()): 
             iter = self.__append ( query_string, match_obj )
             self.__add_to_hash_iter_map(match_obj.get_hash(), iter)
         else:
-            LOGGER.debug("Match %r has the same hash (%s) as a match that has already been added" % (match_obj, match_obj.get_hash()))
+            LOGGER.debug("Match %r has the same hash (%s) as a match that has already been added", match_obj, match_obj.get_hash())
             self.__add_actions_to_match(match_obj.get_actions(), match_obj.get_hash())
     
     def append (self, match_obj, query_string):

Modified: trunk/deskbar/ui/cuemiac/LingeringSelectionWindow.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/LingeringSelectionWindow.py	(original)
+++ trunk/deskbar/ui/cuemiac/LingeringSelectionWindow.py	Fri Mar 21 12:42:11 2008
@@ -1,4 +1,5 @@
-import gtk, gobject
+import gtk
+import gobject
 
 class LingeringSelectionWindow (gtk.Window):
 	"""

Modified: trunk/deskbar/ui/preferences/ModuleListView.py
==============================================================================
--- trunk/deskbar/ui/preferences/ModuleListView.py	(original)
+++ trunk/deskbar/ui/preferences/ModuleListView.py	Fri Mar 21 12:42:11 2008
@@ -1,4 +1,5 @@
-import gtk, gobject
+import gtk
+import gobject
 from gettext import gettext as _
 
 class ModuleListView (gtk.TreeView):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]