From 6eb2b9cc6200fc4160fd4296da911516bbe61b49 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 1 Dec 2008 05:58:25 +0000 Subject: [PATCH] Fix paths and add logging. bzr-revno: 146 --- openlp.pyw | 7 +++++++ openlp/core/pluginmanager.py | 4 +++- openlp/core/ui/mainwindow.py | 6 ++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index fc72c8273..f99c0c481 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -22,6 +22,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA import sys from PyQt4 import QtCore, QtGui +import logging +logging.basicConfig(level=logging.DEBUG, + format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', + datefmt='%m-%d %H:%M', + filename='plugins.log', + filemode='w') + from openlp.core.resources import * from openlp.core.ui import MainWindow, SplashScreen diff --git a/openlp/core/pluginmanager.py b/openlp/core/pluginmanager.py index da575178a..2062863c9 100644 --- a/openlp/core/pluginmanager.py +++ b/openlp/core/pluginmanager.py @@ -45,6 +45,7 @@ class PluginManager(object): log.debug("Inserting %s into sys.path", dir) sys.path.insert(0, dir) self.basepath=os.path.abspath(dir) + log.debug("Base path %s ", self.basepath) self.plugins = [] self.find_plugins(dir) log.info("Plugin manager done init") @@ -53,7 +54,7 @@ class PluginManager(object): """ Scan the directory dir for objects inheriting from openlp.plugin """ - log.debug("find plugins" + str(dir)) + log.debug("find plugins " + str(dir)) for root, dirs, files in os.walk(dir): for name in files: if name.endswith(".py") and not name.startswith("__"): @@ -70,6 +71,7 @@ class PluginManager(object): except ImportError: pass self.plugins = Plugin.__subclasses__() + print self.plugins self.plugin_by_name = {} for p in self.plugins: plugin = p() diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 8db4ed4a0..92df782ff 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ - +import os, os.path from time import sleep from PyQt4 import QtCore, QtGui @@ -32,7 +32,9 @@ class MainWindow(object): self.about_form = AboutForm() self.alert_form = AlertForm() self.settings_form = SettingsDialog() - self.plugin_manager = PluginManager('/home/raoul/Projects/openlp-2/openlp/plugins') + pluginpath=os.path.split(os.path.abspath(__file__))[0] + pluginpath = os.path.join(pluginpath, '..', '..','plugins') + self.plugin_manager = PluginManager(pluginpath) self.setupUi() def setupUi(self):