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