forked from openlp/openlp
Update Logging and make bibles selected
This commit is contained in:
parent
58b563d976
commit
9457030c04
23
openlp.pyw
23
openlp.pyw
@ -20,7 +20,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging, logging.handlers
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
@ -28,9 +29,14 @@ from openlp.core.lib import Receiver
|
|||||||
from openlp.core.resources import *
|
from openlp.core.resources import *
|
||||||
from openlp.core.ui import MainWindow, SplashScreen
|
from openlp.core.ui import MainWindow, SplashScreen
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG,
|
filename=u'openlp.log'
|
||||||
format=u'%(asctime)s:%(msecs)3d %(name)-15s %(levelname)-8s %(message)s',
|
|
||||||
datefmt=u'%m-%d %H:%M:%S', filename=u'openlp.log', filemode=u'w')
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
|
|
||||||
|
logfile = logging.handlers.TimedRotatingFileHandler(filename , 'midnight', 1, backupCount=5)
|
||||||
|
logfile.setLevel(logging.INFO)
|
||||||
|
logfile.setFormatter(logging.Formatter(u'%(asctime)s:%(msecs)3d %(name)-15s %(levelname)-8s %(message)s'))
|
||||||
|
logging.getLogger().addHandler(logfile)
|
||||||
|
|
||||||
class OpenLP(QtGui.QApplication):
|
class OpenLP(QtGui.QApplication):
|
||||||
"""
|
"""
|
||||||
@ -74,10 +80,19 @@ class OpenLP(QtGui.QApplication):
|
|||||||
self.splash.finish(self.mainWindow)
|
self.splash.finish(self.mainWindow)
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
def main():
|
||||||
|
usage = "usage: %prog [options] arg1 arg2"
|
||||||
|
parser = OptionParser(usage=usage)
|
||||||
|
parser.add_option("-d", "--debug",
|
||||||
|
help="Switch on Dbugging ")
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
if options.debug is not None:
|
||||||
|
logfile.setLevel(logging.DEBUG)
|
||||||
if __name__ == u'__main__':
|
if __name__ == u'__main__':
|
||||||
"""
|
"""
|
||||||
Instantiate and run the application.
|
Instantiate and run the application.
|
||||||
"""
|
"""
|
||||||
|
main()
|
||||||
app = OpenLP(sys.argv)
|
app = OpenLP(sys.argv)
|
||||||
#import cProfile
|
#import cProfile
|
||||||
#cProfile.run("app.run()", "profile.out")
|
#cProfile.run("app.run()", "profile.out")
|
||||||
|
@ -432,13 +432,16 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
combo.addItem(unicode(i))
|
combo.addItem(unicode(i))
|
||||||
|
|
||||||
def displayResults(self, bible):
|
def displayResults(self, bible):
|
||||||
for verse in self.search_results:
|
for count, verse in enumerate(self.search_results):
|
||||||
bible_text = u' %s %d:%d (%s)' % (verse.book.name,
|
bible_text = u' %s %d:%d (%s)' % (verse.book.name,
|
||||||
verse.chapter, verse.verse, bible)
|
verse.chapter, verse.verse, bible)
|
||||||
bible_verse = QtGui.QListWidgetItem(bible_text)
|
bible_verse = QtGui.QListWidgetItem(bible_text)
|
||||||
bible_verse.setData(QtCore.Qt.UserRole,
|
bible_verse.setData(QtCore.Qt.UserRole,
|
||||||
QtCore.QVariant(bible_text))
|
QtCore.QVariant(bible_text))
|
||||||
self.ListView.addItem(bible_verse)
|
self.ListView.addItem(bible_verse)
|
||||||
|
cr = self.ListView.setCurrentRow(count)
|
||||||
|
if cr is not None:
|
||||||
|
cr.setSelected(True)
|
||||||
|
|
||||||
def searchByReference(self, bible, search):
|
def searchByReference(self, bible, search):
|
||||||
log.debug(u'searchByReference %s ,%s', bible, search)
|
log.debug(u'searchByReference %s ,%s', bible, search)
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
||||||
"""
|
|
||||||
OpenLP - Open Source Lyrics Projection
|
|
||||||
Copyright (c) 2008 Raoul Snyman
|
|
||||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation; version 2 of the License.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
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 logging
|
|
||||||
import os
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
from openlp.core.lib import OpenLPToolbar, translate, Receiver
|
|
||||||
from openlp.core.ui.slidecontroller import MasterToolbar
|
|
||||||
|
|
||||||
class ImageToolbar(MasterToolbar):
|
|
||||||
|
|
||||||
def __init__(self, parent, isLive):
|
|
||||||
MasterToolbar.__init__(self, isLive)
|
|
||||||
self.parent = parent
|
|
||||||
self.Toolbar = None
|
|
||||||
self.isLive = isLive
|
|
||||||
|
|
||||||
def defineZone5(self):
|
|
||||||
self.Toolbar.addSeparator()
|
|
||||||
self.Toolbar.addToolbarButton(u'Start Loop',
|
|
||||||
u':/media/media_time.png',
|
|
||||||
translate(u'SlideController', u'Start continuous loop'),
|
|
||||||
self.onStartLoop)
|
|
||||||
self.Toolbar.addToolbarButton(u'Stop Loop',
|
|
||||||
u':/media/media_stop.png',
|
|
||||||
translate(u'SlideController', u'Stop continuous loop'),
|
|
||||||
self.onStopLoop)
|
|
||||||
self.Toolbar.addSeparator()
|
|
||||||
self.DelaySpinBox = QtGui.QSpinBox(self.Toolbar)
|
|
||||||
self.SpinWidget = QtGui.QWidgetAction(self.Toolbar)
|
|
||||||
self.SpinWidget.setDefaultWidget(self.DelaySpinBox)
|
|
||||||
self.Toolbar.addAction(self.SpinWidget)
|
|
||||||
self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
|
|
||||||
self.DelaySpinBox.setSuffix(translate(u'ImageSlideController', u's'))
|
|
||||||
|
|
||||||
def onStartLoop(self):
|
|
||||||
"""
|
|
||||||
Trigger the slide controller to start to loop passing the delay
|
|
||||||
"""
|
|
||||||
Receiver().send_message(u'%sslide_start_loop' % self.prefix, self.DelaySpinBox.value())
|
|
||||||
|
|
||||||
def onStopLoop(self):
|
|
||||||
"""
|
|
||||||
Trigger the slide controller to stop the loop
|
|
||||||
"""
|
|
||||||
Receiver().send_message(u'%sslide_stop_loop' % self.prefix)
|
|
Loading…
Reference in New Issue
Block a user