Change ThemeManager to use new XML format and renderer API's

Put in Propper logging for Screen resolution detection.
This commit is contained in:
Tim Bentley 2009-04-10 06:59:40 +01:00
parent b581fcab8f
commit 9b29d2b668
3 changed files with 23 additions and 19 deletions

View File

@ -26,23 +26,26 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M',
filename='openlp.log',
filemode='w')
format=u'%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt=u'%m-%d %H:%M',
filename=u'openlp.log',
filemode=u'w')
from openlp.core.resources import *
from openlp.core.ui import MainWindow, SplashScreen
class OpenLP(QtGui.QApplication):
global log
log=logging.getLogger(u'OpenLP Application')
log.info(u'Application Loaded')
def run(self):
#provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL('openlpprocessevents'), self.processEvents)
QtCore.SIGNAL(u'openlpprocessevents'), self.processEvents)
self.setApplicationName('openlp.org')
self.setApplicationVersion('1.9.0')
self.setApplicationName(u'openlp.org')
self.setApplicationVersion(u'1.9.0')
self.splash = SplashScreen()
self.splash.show()
# make sure Qt really display the splash screen
@ -51,6 +54,7 @@ class OpenLP(QtGui.QApplication):
# Decide how many screens we have and their size
for i in range (0 , self.desktop().numScreens()):
screens.insert(i, (i+1, self.desktop().availableGeometry(i+1)))
log.info(u'Screen %d found with resolution %s', i+1, self.desktop().availableGeometry(i+1))
# start the main app window
self.main_window = MainWindow(screens)
self.main_window.show()

View File

@ -31,7 +31,6 @@ class GeneralTab(SettingsTab):
def __init__(self, screen_list):
SettingsTab.__init__(self, translate(u'GeneralTab', u'General'))
self.screen_list = screen_list
print screen_list
def setupUi(self):
self.setObjectName(u'GeneralTab')

View File

@ -276,8 +276,8 @@ class ThemeManager(QWidget):
else:
newtheme.add_background_image(str(t.BackgroundParameter1))
newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2))
newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'footer')
newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(t.FontProportion * 2), u'False')
newtheme.add_font(str(t.FontName), str(t.FontColor.name()), str(12), u'False', u'footer')
outline = False
shadow = False
if t.Shadow == 1:
@ -302,7 +302,7 @@ class ThemeManager(QWidget):
r.set_theme(theme) # set default theme
r._render_background()
r.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1))
r.set_text_rectangle(QtCore.QRect(0,0, size.width()-1, size.height()-1), QtCore.QRect(10,560, size.width()-1, size.height()-1))
lines=[]
lines.append(u'Amazing Grace!')
@ -310,17 +310,18 @@ class ThemeManager(QWidget):
lines.append(u'To save a wretch like me;')
lines.append(u'I once was lost but now am found,')
lines.append(u'Was blind, but now I see.')
lines1=[]
lines1.append(u'Amazing Grace (John Newton)' )
lines1.append(u'CCLI xxx (c)Openlp.org')
answer=r._render_lines(lines)
r._get_extent_and_render(u'Amazing Grace (John Newton) ', (10, 560), True, None, True)
r._get_extent_and_render(u'CCLI xxx (c)Openlp.org', (10, 580), True, None, True)
answer=r._render_lines(lines, lines1)
im=frame.GetPixmap().toImage()
testpathname=os.path.join(dir, name+u'.png')
if os.path.exists(testpathname):
os.unlink(testpathname)
im.save(testpathname, u'png')
log.debug(u'Theme image written to %s',testpathname)
samplepathname=os.path.join(dir, name+u'.png')
if os.path.exists(samplepathname):
os.unlink(samplepathname)
im.save(samplepathname, u'png')
log.debug(u'Theme image written to %s',samplepathname)
class TstFrame: