forked from openlp/openlp
Fix paths and add logging.
bzr-revno: 146
This commit is contained in:
parent
9c5b487840
commit
6eb2b9cc62
@ -22,6 +22,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
import sys
|
import sys
|
||||||
from PyQt4 import QtCore, QtGui
|
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.resources import *
|
||||||
from openlp.core.ui import MainWindow, SplashScreen
|
from openlp.core.ui import MainWindow, SplashScreen
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ class PluginManager(object):
|
|||||||
log.debug("Inserting %s into sys.path", dir)
|
log.debug("Inserting %s into sys.path", dir)
|
||||||
sys.path.insert(0, dir)
|
sys.path.insert(0, dir)
|
||||||
self.basepath=os.path.abspath(dir)
|
self.basepath=os.path.abspath(dir)
|
||||||
|
log.debug("Base path %s ", self.basepath)
|
||||||
self.plugins = []
|
self.plugins = []
|
||||||
self.find_plugins(dir)
|
self.find_plugins(dir)
|
||||||
log.info("Plugin manager done init")
|
log.info("Plugin manager done init")
|
||||||
@ -53,7 +54,7 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
Scan the directory dir for objects inheriting from openlp.plugin
|
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 root, dirs, files in os.walk(dir):
|
||||||
for name in files:
|
for name in files:
|
||||||
if name.endswith(".py") and not name.startswith("__"):
|
if name.endswith(".py") and not name.startswith("__"):
|
||||||
@ -70,6 +71,7 @@ class PluginManager(object):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
self.plugins = Plugin.__subclasses__()
|
self.plugins = Plugin.__subclasses__()
|
||||||
|
print self.plugins
|
||||||
self.plugin_by_name = {}
|
self.plugin_by_name = {}
|
||||||
for p in self.plugins:
|
for p in self.plugins:
|
||||||
plugin = p()
|
plugin = p()
|
||||||
|
@ -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
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
import os, os.path
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
@ -32,7 +32,9 @@ class MainWindow(object):
|
|||||||
self.about_form = AboutForm()
|
self.about_form = AboutForm()
|
||||||
self.alert_form = AlertForm()
|
self.alert_form = AlertForm()
|
||||||
self.settings_form = SettingsDialog()
|
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()
|
self.setupUi()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user