From 5035f79f50ea52d2e612c7abd04e738dd87cf552 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 21 Oct 2009 18:11:58 +0200 Subject: [PATCH 1/2] 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 e95eb437e240327a16039238de705aacae6b07c2 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 25 Oct 2009 23:33:07 +0200 Subject: [PATCH 2/2] 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():