forked from openlp/openlp
Fix slide controller look and feel
bzr-revno: 628
This commit is contained in:
commit
993140dc14
@ -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):
|
||||
"""
|
||||
|
@ -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)
|
||||
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():
|
||||
@ -427,11 +415,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.
|
||||
|
Loading…
Reference in New Issue
Block a user