Fix logging to single file

Fix QMessage to displays on correct screen.
This commit is contained in:
Tim Bentley 2010-01-24 13:58:39 +00:00
parent c35ff6b8d1
commit ad40020169
5 changed files with 16 additions and 13 deletions

View File

@ -28,7 +28,7 @@ import os
import sys import sys
import logging import logging
from logging.handlers import RotatingFileHandler from logging import FileHandler
from optparse import OptionParser from optparse import OptionParser
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
@ -154,7 +154,7 @@ def main():
help="Set the Qt4 style (passed directly to Qt4).") help="Set the Qt4 style (passed directly to Qt4).")
# Set up logging # Set up logging
filename = u'openlp.log' filename = u'openlp.log'
logfile = RotatingFileHandler(filename, maxBytes=200000, backupCount=5) logfile = FileHandler(filename)
logfile.setFormatter(logging.Formatter( logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s')) u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
log.addHandler(logfile) log.addHandler(logfile)

View File

@ -208,9 +208,11 @@ class MainDisplay(DisplayWidget):
self.repaint() self.repaint()
self.frame = frame[u'trans'] self.frame = frame[u'trans']
self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main'])) self.display.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
self.display_frame = frame[u'main']
self.repaint() self.repaint()
else: else:
self.display.setPixmap(QtGui.QPixmap.fromImage(frame)) self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
self.display_frame = frame
if not self.isVisible(): if not self.isVisible():
self.setVisible(True) self.setVisible(True)
self.showFullScreen() self.showFullScreen()
@ -221,11 +223,11 @@ class MainDisplay(DisplayWidget):
self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame)) self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
else: else:
self.displayBlank = False self.displayBlank = False
if self.frame: if self.display_frame:
self.frameView(self.frame) self.frameView(self.display_frame)
if blanked != self.parent.LiveController.blankButton.isChecked(): # if blanked != self.parent.LiveController.blankButton.isChecked():
self.parent.LiveController.blankButton.setChecked(self.displayBlank) # self.parent.LiveController.blankButton.setChecked(self.displayBlank)
self.parent.generalConfig.set_config(u'screen blank', self.displayBlank) # self.parent.generalConfig.set_config(u'screen blank', self.displayBlank)
def displayAlert(self, text=u''): def displayAlert(self, text=u''):
""" """
@ -313,6 +315,7 @@ class MainDisplay(DisplayWidget):
def onMediaStop(self): def onMediaStop(self):
log.debug(u'Media stopped by user') log.debug(u'Media stopped by user')
self.mediaObject.stop() self.mediaObject.stop()
self.onMediaFinish()
def onMediaFinish(self): def onMediaFinish(self):
log.debug(u'Reached end of media playlist') log.debug(u'Reached end of media playlist')

View File

@ -545,7 +545,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if app_version != version: if app_version != version:
version_text = unicode(self.trUtf8('OpenLP version %s has been updated ' version_text = unicode(self.trUtf8('OpenLP version %s has been updated '
'to version %s\n\nYou can obtain the latest version from http://openlp.org')) 'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
QtGui.QMessageBox.question(None, QtGui.QMessageBox.question(self,
self.trUtf8('OpenLP Version Updated'), self.trUtf8('OpenLP Version Updated'),
version_text % (app_version, version), version_text % (app_version, version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
@ -576,7 +576,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.ServiceManagerContents.onLoadService(True) self.ServiceManagerContents.onLoadService(True)
if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \ if str_to_bool(self.generalConfig.get_config(u'screen blank', False)) \
and str_to_bool(self.generalConfig.get_config(u'blank warning', False)): and str_to_bool(self.generalConfig.get_config(u'blank warning', False)):
QtGui.QMessageBox.question(None, QtGui.QMessageBox.question(self,
self.trUtf8('OpenLP Main Display Blanked'), self.trUtf8('OpenLP Main Display Blanked'),
self.trUtf8('The Main Display has been blanked out'), self.trUtf8('The Main Display has been blanked out'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
@ -620,7 +620,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Hook to close the main window and display windows on exit Hook to close the main window and display windows on exit
""" """
if self.serviceNotSaved: if self.serviceNotSaved:
ret = QtGui.QMessageBox.question(None, ret = QtGui.QMessageBox.question(self,
self.trUtf8('Save Changes to Service?'), self.trUtf8('Save Changes to Service?'),
self.trUtf8('Your service has changed, do you want to save those changes?'), self.trUtf8('Your service has changed, do you want to save those changes?'),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(

View File

@ -348,7 +348,7 @@ class ServiceManager(QtGui.QWidget):
if self.parent.serviceNotSaved and \ if self.parent.serviceNotSaved and \
str_to_bool(PluginConfig(u'General'). str_to_bool(PluginConfig(u'General').
get_config(u'save prompt', u'False')): get_config(u'save prompt', u'False')):
ret = QtGui.QMessageBox.question(None, ret = QtGui.QMessageBox.question(self,
self.trUtf8('Save Changes to Service?'), self.trUtf8('Save Changes to Service?'),
self.trUtf8('Your service is unsaved, do you want to save those ' self.trUtf8('Your service is unsaved, do you want to save those '
'changes before creating a new one ?'), 'changes before creating a new one ?'),
@ -697,4 +697,4 @@ class ServiceManager(QtGui.QWidget):
theme = unicode(self.sender().text()) theme = unicode(self.sender().text())
item, count = self.findServiceItem() item, count = self.findServiceItem()
self.serviceItems[item][u'service_item'].theme = theme self.serviceItems[item][u'service_item'].theme = theme
self.regenerateServiceItems() self.regenerateServiceItems()

View File

@ -493,7 +493,7 @@ class SlideController(QtGui.QWidget):
""" """
Blank the screen. Blank the screen.
""" """
print "onbl", blanked print "Button Pressed", blanked
if self.serviceItem is not None: if self.serviceItem is not None:
if self.serviceItem.is_command(): if self.serviceItem.is_command():
if blanked: if blanked: