From 5035f79f50ea52d2e612c7abd04e738dd87cf552 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 21 Oct 2009 18:11:58 +0200 Subject: [PATCH 1/7] Started working on a non-UI converter (for web-based import). --- openlp-1to2-converter.py | 22 ++++++++++++++++++++++ openlp/core/lib/plugin.py | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/openlp-1to2-converter.py b/openlp-1to2-converter.py index dd1d601dd..bccb44d31 100644 --- a/openlp-1to2-converter.py +++ b/openlp-1to2-converter.py @@ -1,5 +1,27 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# 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 sys import os diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 84087a166..0dd8b5230 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -129,7 +129,8 @@ class Plugin(object): self.settings = plugin_helpers[u'settings'] self.mediadock = plugin_helpers[u'toolbox'] QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event) + QtCore.SIGNAL(u'%s_add_service_item'% self.name), + self.process_add_service_event) def check_pre_conditions(self): """ From 2bf6fe0227ece9c060f6ac93f544817e8eba8547 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 21 Oct 2009 21:39:55 +0200 Subject: [PATCH 2/7] Made the dark->lighter selection colour slightly stronger. --- openlp/core/ui/slidecontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 4f7163ba0..dc3e6099b 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -48,7 +48,7 @@ class SlideList(QtGui.QTableWidget): if text_color.value() > 128: text_color = text_color.darker(120).name() else: - text_color = text_color.lighter(120).name() + text_color = text_color.lighter(130).name() self.setStyleSheet(label_stylesheet % text_color) def keyPressEvent(self, event): From 47edd31b58b46ef847dba47610b01b3d07644476 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 24 Oct 2009 13:12:10 +0200 Subject: [PATCH 3/7] Let's try fix the version check message. --- openlp/core/ui/mainwindow.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c768210a0..a9d86155d 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -529,10 +529,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): applicationVersion = self.generalConfig.get_config(u'Application version', u'1.9.0-595') version = check_latest_version(self.generalConfig, applicationVersion) if applicationVersion != version: + version_text = self.trUtf8(u'OpenLP version %s has been updated ' + u'to version %s') QtGui.QMessageBox.question(None, - self.trUtf8(u'OpenLP version Updated'), - self.trUtf8(u'OpenLP version %s has been updated to version %s') - % (applicationVersion, version), + self.trUtf8(u'OpenLP Version Updated'), + version_text % (applicationVersion, version), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), QtGui.QMessageBox.Ok) self.generalConfig.set_config(u'Application version', version) From 803987d40289fcaebaab59eaccac9d59121eafda Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 24 Oct 2009 13:14:26 +0200 Subject: [PATCH 4/7] Not quite - I needed to cast it to unicode. --- openlp/core/ui/mainwindow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a9d86155d..7d00e9890 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -529,8 +529,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): applicationVersion = self.generalConfig.get_config(u'Application version', u'1.9.0-595') version = check_latest_version(self.generalConfig, applicationVersion) if applicationVersion != version: - version_text = self.trUtf8(u'OpenLP version %s has been updated ' - u'to version %s') + version_text = unicode(self.trUtf8(u'OpenLP version %s has been updated ' + u'to version %s')) QtGui.QMessageBox.question(None, self.trUtf8(u'OpenLP Version Updated'), version_text % (applicationVersion, version), From 08c852f8eec17aa8998e31d33f5d9fb2259005bf Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 24 Oct 2009 13:46:57 +0200 Subject: [PATCH 5/7] Fixed problem in "AmendThemForm" --- openlp/core/ui/amendthemeform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 82afbd332..115f4d522 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -674,7 +674,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.theme.font_main_italics)# italic metrics = QtGui.QFontMetrics(mainFont) page_length = (int(self.FontMainHeightSpinBox.value()) / metrics.height() - 2) - 1 - self.FontMainLinesPageLabel.setText( - self.trUtf8(u'Slide Height is %s rows') % page_length) + page_length_text = unicode(self.trUtf8(u'Slide Height is %s rows')) + self.FontMainLinesPageLabel.setText(page_length_text % page_length) frame = self.thememanager.generateImage(theme) self.ThemePreview.setPixmap(QtGui.QPixmap.fromImage(frame)) From 07468597aaf1374a39e1f4b378321cb7b091489e Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 25 Oct 2009 22:20:03 +0200 Subject: [PATCH 6/7] Just changed the SlideController selection back for the moment. --- openlp/core/ui/slidecontroller.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index aab72ec75..24a61425a 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -44,12 +44,12 @@ class SlideList(QtGui.QTableWidget): def __init__(self, parent=None, name=None): QtGui.QTableWidget.__init__(self, parent.Controller) self.parent = parent - text_color = QtGui.QApplication.palette().color(QtGui.QPalette.Base) - if text_color.value() > 128: - text_color = text_color.darker(120).name() - else: - text_color = text_color.lighter(130).name() - self.setStyleSheet(label_stylesheet % text_color) + #text_color = QtGui.QApplication.palette().color(QtGui.QPalette.Base) + #if text_color.value() > 128: + # text_color = text_color.darker(120).name() + #else: + # text_color = text_color.lighter(130).name() + #self.setStyleSheet(label_stylesheet % text_color) def keyPressEvent(self, event): if type(event) == QtGui.QKeyEvent: @@ -427,11 +427,11 @@ class SlideController(QtGui.QWidget): winid = QtGui.QApplication.desktop().winId() rect = rm.screen_list[rm.current_display][u'size'] winimg = QtGui.QPixmap.grabWindow(winid, rect.x(), rect.y(), rect.width(), rect.height()) - self.SlidePreview.setPixmap(winimg) + self.SlidePreview.setPixmap(winimg) else: label = self.PreviewListWidget.cellWidget(self.PreviewListWidget.currentRow(), 0) self.SlidePreview.setPixmap(label.pixmap()) - + def onSlideSelectedNext(self): """ Go to the next slide. From e95eb437e240327a16039238de705aacae6b07c2 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 25 Oct 2009 23:33:07 +0200 Subject: [PATCH 7/7] Removed the QLabels from text service items. It's nigh impossible to dynamically style QLabels in QTableWdigetItems. --- openlp/core/ui/slidecontroller.py | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 4f7163ba0..b45a47c46 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -28,14 +28,6 @@ import time from PyQt4 import QtCore, QtGui from openlp.core.lib import OpenLPToolbar, translate, Receiver, ServiceType -label_stylesheet = u""" -QTableWidget::item:selected -{ - background-color: %s; -} -""" - - class SlideList(QtGui.QTableWidget): """ Customised version of QTableWidget which can respond to keyboard @@ -44,12 +36,6 @@ class SlideList(QtGui.QTableWidget): def __init__(self, parent=None, name=None): QtGui.QTableWidget.__init__(self, parent.Controller) self.parent = parent - text_color = QtGui.QApplication.palette().color(QtGui.QPalette.Base) - if text_color.value() > 128: - text_color = text_color.darker(120).name() - else: - text_color = text_color.lighter(120).name() - self.setStyleSheet(label_stylesheet % text_color) def keyPressEvent(self, event): if type(event) == QtGui.QKeyEvent: @@ -316,22 +302,24 @@ class SlideController(QtGui.QWidget): self.PreviewListWidget.setRowCount( self.PreviewListWidget.rowCount() + 1) item = QtGui.QTableWidgetItem() - label = QtGui.QLabel() - label.setMargin(4) + slide_height = 0 #It is a Image if frame[u'text'] is None: + label = QtGui.QLabel() + label.setMargin(4) pixmap = self.parent.RenderManager.resize_image(frame[u'image']) label.setScaledContents(True) label.setPixmap(QtGui.QPixmap.fromImage(pixmap)) + self.PreviewListWidget.setCellWidget(framenumber, 0, label) slide_height = self.settingsmanager.slidecontroller_image * \ self.parent.RenderManager.screen_ratio else: - label.setText(frame[u'text']) - label.setAlignment(QtCore.Qt.AlignHCenter) - slide_height = label.sizeHint().height() - self.PreviewListWidget.setCellWidget(framenumber, 0, label) + item.setText(frame[u'text']) self.PreviewListWidget.setItem(framenumber, 0, item) - self.PreviewListWidget.setRowHeight(framenumber, slide_height) + if slide_height != 0: + self.PreviewListWidget.setRowHeight(framenumber, slide_height) + if self.serviceitem.frames[0][u'text'] is not None: + self.PreviewListWidget.resizeRowsToContents() self.PreviewListWidget.setColumnWidth( 0, self.PreviewListWidget.viewport().size().width()) if slideno > self.PreviewListWidget.rowCount():