Fix slidecontroller resizing and cleanups

bzr-revno: 1215
This commit is contained in:
Andreas Preikschat 2011-01-14 16:21:15 +00:00 committed by Jon Tibble
commit aa9fe688bf
3 changed files with 19 additions and 11 deletions

View File

@ -60,6 +60,7 @@ class ItemCapabilities(object):
AddIfNewItem = 9
ProvidesOwnDisplay = 10
class ServiceItem(object):
"""
The service item is a base class for the plugins to use to interact with

View File

@ -399,7 +399,8 @@ class SlideController(QtGui.QWidget):
def previewSizeChanged(self):
"""
Takes care of the SlidePreview's size. Is called when one of the the
splitters is moved or when the screen size is changed.
splitters is moved or when the screen size is changed. Note, that this
method is (also) called frequently from the mainwindow *paintEvent*.
"""
if self.ratio < float(self.PreviewFrame.width()) / float(
self.PreviewFrame.height()):
@ -412,10 +413,16 @@ class SlideController(QtGui.QWidget):
max_width = self.PreviewFrame.width() - self.grid.margin() * 2
self.SlidePreview.setFixedSize(QtCore.QSize(max_width,
max_width / self.ratio))
# Make sure that the frames have the correct size.
self.PreviewListWidget.setColumnWidth(0,
self.PreviewListWidget.viewport().size().width())
if self.serviceItem:
# Sort out songs, bibles, etc.
if self.serviceItem.is_text():
self.PreviewListWidget.resizeRowsToContents()
else:
# Sort out image heights.
width = self.parent.ControlSplitter.sizes()[self.split]
self.PreviewListWidget.setColumnWidth(0, width)
# Sort out image heights (Songs, bibles excluded)
if self.serviceItem and not self.serviceItem.is_text():
for framenumber in range(len(self.serviceItem.get_frames())):
self.PreviewListWidget.setRowHeight(
framenumber, width / self.ratio)