forked from openlp/openlp
Slide Controller refactoring ready for Verse changes
This commit is contained in:
parent
f04e5c078a
commit
829e4976e2
@ -89,6 +89,7 @@ class SlideController(QtGui.QWidget):
|
||||
self.selectedRow = 0
|
||||
self.serviceItem = None
|
||||
self.Panel = QtGui.QWidget(parent.ControlSplitter)
|
||||
self.slideList = {}
|
||||
# Layout for holding panel
|
||||
self.PanelLayout = QtGui.QVBoxLayout(self.Panel)
|
||||
self.PanelLayout.setSpacing(0)
|
||||
@ -416,7 +417,6 @@ class SlideController(QtGui.QWidget):
|
||||
#If old item was a command tell it to stop
|
||||
if self.serviceItem and self.serviceItem.is_command():
|
||||
self.onMediaStop()
|
||||
self.enableToolBar(item)
|
||||
if item.is_command():
|
||||
if self.isLive:
|
||||
Receiver.send_message(u'%s_start' % item.name.lower(), \
|
||||
@ -427,17 +427,18 @@ class SlideController(QtGui.QWidget):
|
||||
self.onMediaStart(item)
|
||||
self.displayServiceManagerItems(item, slideno)
|
||||
|
||||
def displayServiceManagerItems(self, serviceitem, slideno):
|
||||
def displayServiceManagerItems(self, serviceItem, slideno):
|
||||
"""
|
||||
Loads a ServiceItem into the system from ServiceManager
|
||||
Display the slide number passed
|
||||
"""
|
||||
log.debug(u'displayServiceManagerItems Start')
|
||||
self.slideList = {}
|
||||
width = self.parent.ControlSplitter.sizes()[self.split]
|
||||
#Set pointing cursor when we have somthing to point at
|
||||
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
|
||||
before = time.time()
|
||||
self.serviceItem = serviceitem
|
||||
self.serviceItem = serviceItem
|
||||
self.PreviewListWidget.clear()
|
||||
self.PreviewListWidget.setRowCount(0)
|
||||
self.PreviewListWidget.setColumnWidth(0, width)
|
||||
@ -446,8 +447,11 @@ class SlideController(QtGui.QWidget):
|
||||
self.PreviewListWidget.rowCount() + 1)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
slide_height = 0
|
||||
#It is a Image
|
||||
if not self.serviceItem.is_text():
|
||||
#It is a based Text Render
|
||||
if self.serviceItem.is_text():
|
||||
self.slideList[frame[u'verseTag']] = framenumber
|
||||
item.setText(frame[u'text'])
|
||||
else:
|
||||
label = QtGui.QLabel()
|
||||
label.setMargin(4)
|
||||
pixmap = self.parent.RenderManager.resize_image(frame[u'image'])
|
||||
@ -455,10 +459,6 @@ class SlideController(QtGui.QWidget):
|
||||
label.setPixmap(QtGui.QPixmap.fromImage(pixmap))
|
||||
self.PreviewListWidget.setCellWidget(framenumber, 0, label)
|
||||
slide_height = width * self.parent.RenderManager.screen_ratio
|
||||
else:
|
||||
variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
|
||||
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(frame[u'text']))
|
||||
item.setText(frame[u'text'])
|
||||
self.PreviewListWidget.setItem(framenumber, 0, item)
|
||||
if slide_height != 0:
|
||||
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
|
||||
@ -470,12 +470,14 @@ class SlideController(QtGui.QWidget):
|
||||
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
|
||||
else:
|
||||
self.PreviewListWidget.selectRow(slideno)
|
||||
self.enableToolBar(serviceItem)
|
||||
self.onSlideSelected()
|
||||
self.PreviewListWidget.setFocus()
|
||||
log.log(15, u'Display Rendering took %4s' % (time.time() - before))
|
||||
if self.isLive:
|
||||
self.serviceItem.request_audit()
|
||||
log.debug(u'displayServiceManagerItems End')
|
||||
print self.slideList
|
||||
|
||||
#Screen event methods
|
||||
def onSlideSelectedFirst(self):
|
||||
|
Loading…
Reference in New Issue
Block a user