deskbar-applet r1836 - in trunk: . deskbar deskbar/core deskbar/handlers deskbar/handlers/actions deskbar/interfaces deskbar/ui deskbar/ui/cuemiac



Author: sebp
Date: Fri Jan 11 23:46:47 2008
New Revision: 1836
URL: http://svn.gnome.org/viewvc/deskbar-applet?rev=1836&view=rev

Log:
Each file uses its own logger now

Modified:
   trunk/ChangeLog
   trunk/deskbar/__init__.py
   trunk/deskbar/core/CoreImpl.py
   trunk/deskbar/core/DeskbarHistory.py
   trunk/deskbar/core/Keybinder.py
   trunk/deskbar/core/ModuleLoader.py
   trunk/deskbar/core/Utils.py
   trunk/deskbar/deskbar-applet.py
   trunk/deskbar/gtkexcepthook.py
   trunk/deskbar/handlers/actions/ActionsFactory.py
   trunk/deskbar/handlers/actions/OpenFileAction.py
   trunk/deskbar/handlers/actions/OpenWithApplicationAction.py
   trunk/deskbar/handlers/beagle-live.py
   trunk/deskbar/handlers/mozilla.py
   trunk/deskbar/handlers/yahoo.py
   trunk/deskbar/interfaces/Match.py
   trunk/deskbar/ui/CuemiacWindowController.py
   trunk/deskbar/ui/cuemiac/CuemiacHistory.py
   trunk/deskbar/ui/cuemiac/CuemiacModel.py
   trunk/deskbar/ui/cuemiac/CuemiacTreeView.py

Modified: trunk/deskbar/__init__.py
==============================================================================
--- trunk/deskbar/__init__.py	(original)
+++ trunk/deskbar/__init__.py	Fri Jan 11 23:46:47 2008
@@ -2,6 +2,8 @@
 from os.path import join, exists, isdir, isfile, dirname, abspath, expanduser
 import logging
 
+LOGGER = logging.getLogger(__name__)
+
 # Autotools set the actual data_dir in defs.py
 from defs import *
 
@@ -26,7 +28,7 @@
     SHARED_DATA_DIR = abspath(join(dirname(__file__), '..', 'data'))
 else:
     SHARED_DATA_DIR = join(DATA_DIR, "deskbar-applet")
-logging.debug("Data Dir: %s" % SHARED_DATA_DIR)
+LOGGER.debug("Data Dir: %s" % SHARED_DATA_DIR)
 
 HANDLERS_DIR = []
 if UNINSTALLED_DESKBAR:
@@ -39,18 +41,18 @@
     try:
         os.makedirs(USER_DESKBAR_DIR, 0744)
     except Exception , msg:
-        logging.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:
-        logging.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
-logging.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/CoreImpl.py
==============================================================================
--- trunk/deskbar/core/CoreImpl.py	(original)
+++ trunk/deskbar/core/CoreImpl.py	Fri Jan 11 23:46:47 2008
@@ -12,6 +12,8 @@
 from deskbar.core.ThreadPool import ThreadPool
 import deskbar.interfaces
 
+LOGGER = logging.getLogger(__name__)
+
 class CoreImpl(deskbar.interfaces.Core):
     
     DEFAULT_KEYBINDING = "<Alt>F3"
@@ -157,9 +159,9 @@
         """
         self._gconf.set_keybinding(binding)
         if not self._keybinder.bind(binding):
-            logging.error("Keybinding is already in use")
+            LOGGER.error("Keybinding is already in use")
         else:
-            logging.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)
@@ -241,7 +243,7 @@
     def reload_all_modules(self):
         self._module_list.clear()
         self._disabled_module_list.clear()
-        logging.info("Reloading all modules")
+        LOGGER.info("Reloading all modules")
         self._module_loader.emit("modules-reloading")
         self._module_loader.load_all()
     

Modified: trunk/deskbar/core/DeskbarHistory.py
==============================================================================
--- trunk/deskbar/core/DeskbarHistory.py	(original)
+++ trunk/deskbar/core/DeskbarHistory.py	Fri Jan 11 23:46:47 2008
@@ -7,6 +7,8 @@
 from gettext import gettext as _
 from deskbar.core.Categories import CATEGORIES
 
+LOGGER = logging.getLogger(__name__)
+
 class ChooseFromHistoryAction (deskbar.interfaces.Action):
     """
     This will be displayed always at the top of the history
@@ -127,8 +129,8 @@
             pass
         except Exception, e:
             # The history file is corrupted
-            logging.error("Could not restore history")
-            logging.exception(e)
+            LOGGER.error("Could not restore history")
+            LOGGER.exception(e)
             pass
 
     def save (self):
@@ -143,7 +145,7 @@
         try:
             cPickle.dump(save, file(HISTORY_FILE, 'w'), cPickle.HIGHEST_PROTOCOL)
         except Exception, msg:
-            logging.error('History.save:%s', msg)
+            LOGGER.error('History.save:%s', msg)
         pass
     
     def append (self, timestamp, text, action):

Modified: trunk/deskbar/core/Keybinder.py
==============================================================================
--- trunk/deskbar/core/Keybinder.py	(original)
+++ trunk/deskbar/core/Keybinder.py	Fri Jan 11 23:46:47 2008
@@ -2,6 +2,8 @@
 import deskbar, deskbar.core.keybinder
 import logging
 
+LOGGER = logging.getLogger(__name__)
+
 class Keybinder(gobject.GObject):
     __gsignals__ = {
         "activated" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_ULONG]),
@@ -20,7 +22,7 @@
         if self.bound:
             self.unbind()
 
-        logging.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
@@ -31,7 +33,7 @@
         return self.bound
                     
     def unbind(self):
-        logging.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/ModuleLoader.py
==============================================================================
--- trunk/deskbar/core/ModuleLoader.py	(original)
+++ trunk/deskbar/core/ModuleLoader.py	Fri Jan 11 23:46:47 2008
@@ -6,6 +6,8 @@
 import deskbar, deskbar.core.Categories
 from deskbar.core.Watcher import DirWatcher
 
+LOGGER = logging.getLogger(__name__)
+
 class ModuleLoader (gobject.GObject):
     """
     An auxilary class to L{deskbar.core.ModuleList.ModuleList}.
@@ -83,7 +85,7 @@
                     if basename(i) not in [basename(j) for j in res]:
                         res.append(i)
             except OSError, err:
-                logging.error("Error reading directory %s, skipping." % d)
+                LOGGER.error("Error reading directory %s, skipping." % d)
                 traceback.print_exc()
         
         self.filelist = res
@@ -98,7 +100,7 @@
         try:
             mod = pydoc.importfile (filename)
         except Exception:
-            logging.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 +111,12 @@
         try:
             if (mod.HANDLERS): pass
         except AttributeError:
-            logging.error("The file %s is not a valid module. Skipping. A module must have the variable HANDLERS defined as a list." % filename)
+            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()
             return
         
         if mod.HANDLERS == None:
-            logging.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 = []
@@ -124,12 +126,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" )():
-                    logging.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:
-                logging.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
             
@@ -142,7 +144,7 @@
             return
         
         for mod in modules:
-            logging.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) )
@@ -155,7 +157,7 @@
         passing a corresponding module module.
         """
         if self.dirs is None:
-            logging.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:
@@ -172,7 +174,7 @@
         if module.is_enabled():
             return
             
-        logging.info("Initializing %s" % module.INFOS["name"])
+        LOGGER.info("Initializing %s" % module.INFOS["name"])
         
         try:
             module.initialize ()
@@ -182,7 +184,7 @@
                 for catname, catinfo in module.INFOS["categories"].items():
                     deskbar.core.Categories.CATEGORIES[catname] = catinfo
         except Exception, msg:
-            logging.error( "Error while initializing %s: %s" % (module.INFOS["name"],msg))
+            LOGGER.error( "Error while initializing %s: %s" % (module.INFOS["name"],msg))
             traceback.print_exc()
             module.set_enabled(False)
             self.emit("module-not-initialized", module)
@@ -198,7 +200,7 @@
         the stopped module as argument.
         """
         
-        logging.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 Jan 11 23:46:47 2008
@@ -9,6 +9,8 @@
 from deskbar.core._userdirs import *
 import deskbar.core.Categories
 
+LOGGER = logging.getLogger(__name__)
+
 ICON_THEME = gtk.icon_theme_get_default()
 factory = gnome.ui.ThumbnailFactory(deskbar.ICON_HEIGHT)
 
@@ -102,7 +104,7 @@
             try:
                 pixbuf = ICON_THEME.load_icon(icon, width, gtk.ICON_LOOKUP_USE_BUILTIN)
             except Exception, msg2:
-                logging.error('load_icon:Icon Load Error:%s (or %s)' % (msg1, msg2))
+                LOGGER.error('load_icon:Icon Load Error:%s (or %s)' % (msg1, msg2))
                 return ICON_THEME.load_icon("stock_unknown", width, gtk.ICON_LOOKUP_USE_BUILTIN)
                 
     # an icon that is too tall will make the EntryCompletion look funny

Modified: trunk/deskbar/deskbar-applet.py
==============================================================================
--- trunk/deskbar/deskbar-applet.py	(original)
+++ trunk/deskbar/deskbar-applet.py	Fri Jan 11 23:46:47 2008
@@ -41,8 +41,7 @@
     	logging.info ("Running uninstalled, adding %s to system path" % abspath(root_dir))
 
 # Setup logging
-logging.basicConfig(level=logging.DEBUG, format='%(levelname)-8s %(message)s',)
-logging.getLogger("deskbar-applet")
+logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M')
 
 # Delay loading of deskbar modules until we have the path set up,
 # to allow running in uninstalled mode

Modified: trunk/deskbar/gtkexcepthook.py
==============================================================================
--- trunk/deskbar/gtkexcepthook.py	(original)
+++ trunk/deskbar/gtkexcepthook.py	Fri Jan 11 23:46:47 2008
@@ -8,6 +8,8 @@
 import threading
 from os.path import basename
 
+LOGGER = logging.getLogger(__name__)
+
 # We don't want that errors in 3rd-party
 # handlers land in bugzilla
 
@@ -89,7 +91,7 @@
     threading.Thread.run = run
 
 if not sys.stderr.isatty():
-    logging.info('Using GTK exception handler')
+    LOGGER.info('Using GTK exception handler')
     _excepthook_save = sys.excepthook
     sys.excepthook = _info
     install_thread_excepthook()

Modified: trunk/deskbar/handlers/actions/ActionsFactory.py
==============================================================================
--- trunk/deskbar/handlers/actions/ActionsFactory.py	(original)
+++ trunk/deskbar/handlers/actions/ActionsFactory.py	Fri Jan 11 23:46:47 2008
@@ -7,6 +7,8 @@
 from os.path import basename, isdir
 from gettext import gettext as _
 
+LOGGER = logging.getLogger(__name__)
+
 def get_actions_for_uri(uri, display_name=None):
     """
     Return a list of applications suitable for
@@ -35,7 +37,7 @@
     try:
         fileinfo = gnomevfs.get_file_info(uri, gnomevfs.FILE_INFO_GET_MIME_TYPE | gnomevfs.FILE_INFO_FOLLOW_LINKS)
     except Exception, msg:
-        logging.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/OpenFileAction.py
==============================================================================
--- trunk/deskbar/handlers/actions/OpenFileAction.py	(original)
+++ trunk/deskbar/handlers/actions/OpenFileAction.py	Fri Jan 11 23:46:47 2008
@@ -3,6 +3,9 @@
 from deskbar.core.Utils import url_show_file
 from os.path import exists
 import gnomevfs
+import logging
+
+LOGGER = logging.getLogger(__name__) 
 
 class OpenFileAction(deskbar.interfaces.Action):
     """
@@ -28,14 +31,18 @@
             url = gnomevfs.unescape_string_for_display(url)
 
         if not exists(url):
+            LOGGER.debug("File %s does not exist" % url)
             return False
         else:
             try:
                 mime_type = gnomevfs.get_mime_type(url)
-                return gnomevfs.mime_get_default_application(mime_type) != None
+                returnval = gnomevfs.mime_get_default_application(mime_type) != None
             except RuntimeError, e:
                 # get_mime_type throws a RuntimeException when something went wrong
-                return False
+                returnval = False
+        if not returnval:
+            LOGGER.debug("File %s has no default application" % url)
+        return returnval
     
     def get_hash(self):
         return self._url

Modified: trunk/deskbar/handlers/actions/OpenWithApplicationAction.py
==============================================================================
--- trunk/deskbar/handlers/actions/OpenWithApplicationAction.py	(original)
+++ trunk/deskbar/handlers/actions/OpenWithApplicationAction.py	Fri Jan 11 23:46:47 2008
@@ -2,6 +2,9 @@
 from gettext import gettext as _
 from deskbar.core.Utils import spawn_async, is_program_in_path
 from os.path import exists, isabs
+import logging
+
+LOGGER = logging.getLogger(__name__)
 
 class OpenWithApplicationAction(deskbar.interfaces.Action):
     """
@@ -31,9 +34,12 @@
     
     def is_valid(self):
         if isabs(self._program):
-            return exists(self._program)
+            returnval = exists(self._program)
         else:
-            return is_program_in_path(self._program)
+            returnval = is_program_in_path(self._program)
+        if not returnval:
+            LOGGER.debug("%s does not exist" % self._program)
+        return returnval
        
     def get_hash(self):
         return self._program+" ".join(self._arguments)

Modified: trunk/deskbar/handlers/beagle-live.py
==============================================================================
--- trunk/deskbar/handlers/beagle-live.py	(original)
+++ trunk/deskbar/handlers/beagle-live.py	Fri Jan 11 23:46:47 2008
@@ -13,6 +13,8 @@
 import logging
 import threading
 
+LOGGER = logging.getLogger(__name__)
+
 MAX_RESULTS = 20 # per handler
 HANDLERS = ["BeagleLiveHandler"]
 
@@ -238,7 +240,7 @@
                                             )
             self.add_all_actions( actions )
         else:
-            logging.warning("Unknown beagle match type found: "+result["type"] )
+            LOGGER.warning("Unknown beagle match type found: "+result["type"] )
 
         # Load the correct icon
         
@@ -300,7 +302,7 @@
         hit_matches = []
         for hit in response.get_hits():
             if hit.get_type() not in TYPES:
-                logging.info("Beagle live seen an unknown type:"+ str(hit.get_type()))
+                LOGGER.info("Beagle live seen an unknown type:"+ str(hit.get_type()))
                 continue
             
             if "snippet" in TYPES[hit.get_type()] and TYPES[hit.get_type()]["snippet"]:

Modified: trunk/deskbar/handlers/mozilla.py
==============================================================================
--- trunk/deskbar/handlers/mozilla.py	(original)
+++ trunk/deskbar/handlers/mozilla.py	Fri Jan 11 23:46:47 2008
@@ -13,6 +13,8 @@
 import os, re, HTMLParser, base64, glob
 import urllib
 
+LOGGER = logging.getLogger(__name__)
+
 # Check for presence of set to be compatible with python 2.3
 try:
     set
@@ -278,7 +280,7 @@
                 self.indexed_file = self._index_mozilla()
             self.close()
         except Exception, e:
-            logging.error('Could not index Firefox bookmarks: %s' % e)
+            LOGGER.error('Could not index Firefox bookmarks: %s' % e)
         
     def get_indexer(self):
         """
@@ -296,7 +298,7 @@
                 self.feed(file(bookmarks_file).read())
                 return bookmarks_file
         except Exception, msg:
-            logging.error('Retrieving Mozilla Bookmarks: %s' % msg)
+            LOGGER.error('Retrieving Mozilla Bookmarks: %s' % msg)
         
     def _index_firefox(self):
         try:
@@ -305,7 +307,7 @@
                 self.feed(file(bookmarks_file).read())
                 return bookmarks_file
         except Exception, msg:
-            logging.error('Retrieving Firefox Bookmarks: %s' % msg)
+            LOGGER.error('Retrieving Firefox Bookmarks: %s' % msg)
     
     def handle_starttag(self, tag, attrs):
         tag = tag.lower()
@@ -385,7 +387,7 @@
         try:
             self._parse_image (xml)
         except Exception, msg:
-            logging.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
@@ -547,7 +549,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:
-            logging.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):
@@ -719,7 +721,7 @@
                 self._smart_bookmarks.append(bookmark)
                 
             except Exception, msg:
-                logging.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/yahoo.py
==============================================================================
--- trunk/deskbar/handlers/yahoo.py	(original)
+++ trunk/deskbar/handlers/yahoo.py	Fri Jan 11 23:46:47 2008
@@ -8,6 +8,8 @@
 import urllib
 import xml.dom.minidom
 
+LOGGER = logging.getLogger(__name__)
+
 YAHOO_API_KEY = 'deskbar-applet'
 YAHOO_URL = 'http://api.search.yahoo.com/WebSearchService/V1/webSearch?%s'
 MAX_QUERIES = 10
@@ -51,7 +53,7 @@
         # TODO: Missing
         #self.check_query_changed (timeout=QUERY_DELAY)
         
-        logging.info('Query yahoo for: '+qstring)
+        LOGGER.info('Query yahoo for: '+qstring)
         url = YAHOO_URL % urllib.urlencode(
                 {'appid': YAHOO_API_KEY,
                 'query': qstring,
@@ -59,11 +61,11 @@
         try:
             stream = urllib.urlopen(url, proxies=get_proxy())
         except IOError, msg:
-            logging.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)
-        logging.info('Got yahoo answer for: '+qstring)
+        LOGGER.info('Got yahoo answer for: '+qstring)
         
         # TODO: Missing
         #self.check_query_changed ()    
@@ -79,5 +81,5 @@
             for r in dom.getElementsByTagName("Result")]
         # TODO: Missing
         #self.check_query_changed ()
-        logging.info("Returning yahoo answer for: "+qstring)
+        LOGGER.info("Returning yahoo answer for: "+qstring)
         self._emit_query_ready(qstring, matches )

Modified: trunk/deskbar/interfaces/Match.py
==============================================================================
--- trunk/deskbar/interfaces/Match.py	(original)
+++ trunk/deskbar/interfaces/Match.py	Fri Jan 11 23:46:47 2008
@@ -3,6 +3,8 @@
 from deskbar.core.Categories import CATEGORIES 
 import logging
 
+LOGGER = logging.getLogger(__name__)
+
 """
 Represents a match returned by handlers
 """
@@ -141,8 +143,7 @@
         beacause it's not valid  
         """
         if not action.is_valid():
-            logging.error("Action %r is not valid, not adding it" % action)
-            logging.debug(action.get_hash())
+            LOGGER.error("Action %r is not valid, not adding it" % action)
             return False
         
         if not action.get_hash() in self.__actions_hashes:

Modified: trunk/deskbar/ui/CuemiacWindowController.py
==============================================================================
--- trunk/deskbar/ui/CuemiacWindowController.py	(original)
+++ trunk/deskbar/ui/CuemiacWindowController.py	Fri Jan 11 23:46:47 2008
@@ -7,6 +7,8 @@
 from deskbar.ui.About import show_about
 from deskbar.ui.preferences.DeskbarPreferences import DeskbarPreferences
 
+LOGGER = logging.getLogger(__name__)
+
 class CuemiacWindowController(deskbar.interfaces.Controller):
     """
     This class handels the input received from
@@ -121,7 +123,7 @@
         
     def on_action_selected(self, treeview, text, action, event):
         if not action.is_valid():
-            logging.warning("Action is not valid anymore")
+            LOGGER.warning("Action is not valid anymore")
             return
         self._model.get_history().add(text, action)
         action.activate(text)

Modified: trunk/deskbar/ui/cuemiac/CuemiacHistory.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/CuemiacHistory.py	(original)
+++ trunk/deskbar/ui/cuemiac/CuemiacHistory.py	Fri Jan 11 23:46:47 2008
@@ -1,6 +1,8 @@
 import gtk, pango, gobject
 import logging
 
+LOGGER = logging.getLogger(__name__)
+
 class CuemiacHistoryView (gtk.ComboBox):
 
     __gsignals__ = {
@@ -53,7 +55,7 @@
         if iter != None:
             timestamp, text, action = self.get_model()[iter]
             if not action.is_valid():
-                logging.warning("Action is not valid anymore. Removing it from history.")
+                LOGGER.warning("Action is not valid anymore. Removing it from history.")
                 self.get_model().remove(iter)
                 self.__select_default_item()
                 return False

Modified: trunk/deskbar/ui/cuemiac/CuemiacModel.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/CuemiacModel.py	(original)
+++ trunk/deskbar/ui/cuemiac/CuemiacModel.py	Fri Jan 11 23:46:47 2008
@@ -5,7 +5,9 @@
 import deskbar.interfaces.Match
 from deskbar.ui.cuemiac.CuemiacItems import CuemiacCategory
 import logging
-            
+      
+LOGGER = logging.getLogger(__name__)
+
 # The sort function ids
 SORT_BY_CATEGORY = 1
 
@@ -111,7 +113,7 @@
     def __append_match(self, match_obj, query_string):
         for action in match_obj.get_actions():
             if not action.is_valid():
-                logging.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:
                 return

Modified: trunk/deskbar/ui/cuemiac/CuemiacTreeView.py
==============================================================================
--- trunk/deskbar/ui/cuemiac/CuemiacTreeView.py	(original)
+++ trunk/deskbar/ui/cuemiac/CuemiacTreeView.py	Fri Jan 11 23:46:47 2008
@@ -7,6 +7,8 @@
 from deskbar.ui.cuemiac.CuemiacItems import CuemiacCategory
 from deskbar.interfaces import Match
 
+LOGGER = logging.getLogger(__name__)
+
 class CellRendererCuemiacCategory (gtk.CellRendererText):
     """
     Special cell renderer for the CuemiacTreeView.
@@ -366,7 +368,7 @@
                 cell.set_property ("pixbuf", match.get_icon())
                 cell.set_property ("visible", True)
             else:
-                logging.error("See bug 359251 or 471672 and report this output: Match object of unexpected type: %r - %r" % (match.__class__, match))
+                LOGGER.error("See bug 359251 or 471672 and report this output: Match object of unexpected type: %r - %r" % (match.__class__, match))
                 cell.set_property ("pixbuf", None)
                 cell.set_property ("visible", False)
         
@@ -387,7 +389,7 @@
         cell.set_property ("cell-background-gdk", self.style.base[gtk.STATE_NORMAL])
         
         if match == None:
-            logging.error("See bug 359251 or 471672 and report this output: Match object of unexpected type: %r - %r" % (match.__class__, match))
+            LOGGER.error("See bug 359251 or 471672 and report this output: Match object of unexpected type: %r - %r" % (match.__class__, match))
             cell.set_property ("has-more-actions", False)
             cell.set_property ("markup", "")
         else:



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