Use 'hooke' log vs. print to output debugging messages in hooke.ui.gui
authorW. Trevor King <wking@drexel.edu>
Sat, 31 Jul 2010 20:31:19 +0000 (16:31 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 31 Jul 2010 20:31:19 +0000 (16:31 -0400)
hooke/ui/gui/__init__.py
hooke/ui/gui/panel/playlist.py

index 38d00bd002d063c4dffdd01a142e4dfa9d7a1f4a..61ed74d2203069713fe86590e11a3516dcc40806 100644 (file)
@@ -10,6 +10,7 @@ import wxversion
 wxversion.select(WX_GOOD)\r
 \r
 import copy\r
+import logging\r
 import os\r
 import os.path\r
 import platform\r
@@ -42,6 +43,7 @@ class HookeFrame (wx.Frame):
     """\r
     def __init__(self, gui, commands, inqueue, outqueue, *args, **kwargs):\r
         super(HookeFrame, self).__init__(*args, **kwargs)\r
+        self.log = logging.getLogger('hooke')\r
         self.gui = gui\r
         self.commands = commands\r
         self.inqueue = inqueue\r
@@ -259,6 +261,7 @@ class HookeFrame (wx.Frame):
         dialog.Destroy()\r
 \r
     def _on_close(self, *args):\r
+        self.log.info('closing GUI framework')\r
         # apply changes\r
         self.gui.config['main height'] = str(self.GetSize().GetHeight())\r
         self.gui.config['main left'] = str(self.GetPosition()[0])\r
@@ -302,7 +305,7 @@ class HookeFrame (wx.Frame):
             for name,value in self._c['property editor'].get_values().items():\r
                 if name in arg_names:\r
                     args[name] = value\r
-        print 'executing', command.name, args\r
+        self.log.debug('executing %s with %s' % (command.name, args))\r
         self.inqueue.put(CommandMessage(command, args))\r
         results = []\r
         while True:\r
@@ -729,7 +732,6 @@ class HookeFrame (wx.Frame):
 \r
     def _on_panel_visibility(self, _class, method, panel_name, visible):\r
         pane = self._c['manager'].GetPane(panel_name)\r
-        print visible\r
         pane.Show(visible)\r
         #if we don't do the following, the Folders pane does not resize properly on hide/show\r
         if pane.caption == 'Folders' and pane.IsShown() and pane.IsDocked():\r
@@ -786,7 +788,8 @@ class HookeFrame (wx.Frame):
 \r
     def _delete_perspectives(self, perspective_dir, names,\r
                              extension=None):\r
-        print 'pop', names\r
+        self.log.debug('remove perspectives %s from %s'\r
+                       % (names, perspective_dir))\r
         for name in names:\r
             path = os.path.join(perspective_dir, name)\r
             if extension != None:\r
@@ -804,7 +807,7 @@ class HookeFrame (wx.Frame):
 \r
     def _restore_perspective(self, name, force=False):\r
         if name != self.gui.config['active perspective'] or force == True:\r
-            print 'restoring perspective:', name\r
+            self.log.debug('restore perspective %s' % name)\r
             self.gui.config['active perspective'] = name  # TODO: push to engine's Hooke\r
             self._c['manager'].LoadPerspective(self._perspectives[name])\r
             self._c['manager'].Update()\r
@@ -900,7 +903,6 @@ class HookeApp (wx.App):
 \r
     def _setup_splash_screen(self):\r
         if self.gui.config['show splash screen'] == 'True': # HACK: config should decode\r
-            print 'splash', self.gui.config['show splash screen']\r
             path = self.gui.config['splash screen image']\r
             if os.path.isfile(path):\r
                 duration = int(self.gui.config['splash screen duration'])  # HACK: config should decode types\r
index d9c996c6628c62a7a98af39d437fe814af26a5b5..85184737b3d441a95cf2a7091fb36fc9b6ecefec 100644 (file)
@@ -6,6 +6,7 @@ Provides a nice GUI interface to the
 :class:`~hooke.plugin.playlist.PlaylistPlugin`.\r
 """\r
 \r
+import logging\r
 import types\r
 \r
 import wx\r
@@ -29,6 +30,7 @@ class Tree (wx.TreeCtrl):
     """:class:`wx.TreeCtrl` subclass handling playlist and curve selection.\r
     """\r
     def __init__(self, *args, **kwargs):\r
+        self.log = logging.getLogger('hooke')\r
         self._panel = kwargs['parent']\r
         self._callbacks = self._panel._callbacks # TODO: CallbackClass.set_callback{,s}()\r
         super(Tree, self).__init__(*args, **kwargs)\r
@@ -301,10 +303,10 @@ class Tree (wx.TreeCtrl):
     def set_selected_curve(self, playlist, curve):\r
         """Make the curve the playlist's current curve.\r
         """\r
-        print 'expanding', playlist.name\r
+        self.log.debug('playlist tree expanding %s' % playlist.name)\r
         self.Expand(self._id_for_name[playlist.name])\r
         self.Unbind(wx.EVT_TREE_SEL_CHANGED)\r
-        print 'selecting', curve.name\r
+        self.log.debug('playlist tree selecting %s' % curve.name)\r
         self.SelectItem(self._id_for_name[(playlist.name, curve.name)])\r
         self.Bind(wx.EVT_TREE_SEL_CHANGED, self._on_select)\r
 \r