Fix paths and add logging.

bzr-revno: 146
This commit is contained in:
Tim Bentley 2008-12-01 05:58:25 +00:00
parent 9c5b487840
commit 6eb2b9cc62
3 changed files with 14 additions and 3 deletions

View File

@ -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

View File

@ -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()

View File

@ -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):