Fix slide controller look and feel

bzr-revno: 628
This commit is contained in:
raoul.snyman@saturnlaboratories.co.za 2009-10-26 05:33:41 +00:00 committed by Tim Bentley
commit 993140dc14
2 changed files with 13 additions and 24 deletions

View File

@ -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):
"""

View File

@ -28,14 +28,6 @@ import time
from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, 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:
@ -336,22 +322,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)
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():