forked from openlp/openlp
Add Buttonsbar to slidecontroller and add actions
Add Buttons to ServiceManager Add Slide up/Down to slidecontroller.py Fix missing data on selection in bibles and custom plugins
This commit is contained in:
parent
4930d3291c
commit
ce3d1cffc6
@ -97,8 +97,6 @@ class MainWindow(object):
|
||||
|
||||
# Initialise SlideControllers
|
||||
log.info(u'Set Up SlideControllers')
|
||||
self.PreviewController.isLive = False
|
||||
self.LiveController.isLive = True
|
||||
self.LiveController.mainDisplay = self.main_display
|
||||
|
||||
def setupUi(self):
|
||||
@ -130,8 +128,8 @@ class MainWindow(object):
|
||||
self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.ControlSplitter.setObjectName(u'ControlSplitter')
|
||||
self.MainContentLayout.addWidget(self.ControlSplitter)
|
||||
self.PreviewController = SlideController(self.ControlSplitter)
|
||||
self.LiveController = SlideController(self.ControlSplitter)
|
||||
self.PreviewController = SlideController(self.ControlSplitter, False)
|
||||
self.LiveController = SlideController(self.ControlSplitter, True)
|
||||
self.MenuBar = QtGui.QMenuBar(self.main_window)
|
||||
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
|
||||
self.MenuBar.setObjectName(u'MenuBar')
|
||||
@ -296,10 +294,10 @@ class MainWindow(object):
|
||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.ToolsAddToolItem.setIcon(AddToolIcon)
|
||||
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
|
||||
self.action_Preview_Pane = QtGui.QAction(self.main_window)
|
||||
self.action_Preview_Pane.setCheckable(True)
|
||||
self.action_Preview_Pane.setChecked(True)
|
||||
self.action_Preview_Pane.setObjectName(u'action_Preview_Pane')
|
||||
self.action_Preview_Panel = QtGui.QAction(self.main_window)
|
||||
self.action_Preview_Panel.setCheckable(True)
|
||||
self.action_Preview_Panel.setChecked(True)
|
||||
self.action_Preview_Panel.setObjectName(u'action_Preview_Panel')
|
||||
self.ModeLiveItem = QtGui.QAction(self.main_window)
|
||||
self.ModeLiveItem.setObjectName(u'ModeLiveItem')
|
||||
self.FileImportMenu.addAction(self.ImportThemeItem)
|
||||
@ -322,7 +320,7 @@ class MainWindow(object):
|
||||
self.OptionsViewMenu.addAction(self.ViewServiceManagerItem)
|
||||
self.OptionsViewMenu.addAction(self.ViewThemeManagerItem)
|
||||
self.OptionsViewMenu.addSeparator()
|
||||
self.OptionsViewMenu.addAction(self.action_Preview_Pane)
|
||||
self.OptionsViewMenu.addAction(self.action_Preview_Panel)
|
||||
self.OptionsLanguageMenu.addAction(self.LanguageEnglishItem)
|
||||
self.OptionsLanguageMenu.addSeparator()
|
||||
self.OptionsLanguageMenu.addAction(self.LanguageTranslateItem)
|
||||
@ -353,8 +351,8 @@ class MainWindow(object):
|
||||
QtCore.SIGNAL(u'triggered(bool)'), self.ServiceManagerDock.setVisible)
|
||||
QtCore.QObject.connect(self.ViewThemeManagerItem,
|
||||
QtCore.SIGNAL(u'triggered(bool)'), self.ThemeManagerDock.setVisible)
|
||||
QtCore.QObject.connect(self.action_Preview_Pane,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.PreviewController.Pane.setVisible)
|
||||
QtCore.QObject.connect(self.action_Preview_Panel,
|
||||
QtCore.SIGNAL(u'toggled(bool)'), self.PreviewController.Panel.setVisible)
|
||||
QtCore.QObject.connect(self.MediaManagerDock,
|
||||
QtCore.SIGNAL(u'visibilityChanged(bool)'), self.ViewMediaManagerItem.setChecked)
|
||||
QtCore.QObject.connect(self.ServiceManagerDock,
|
||||
@ -451,7 +449,7 @@ class MainWindow(object):
|
||||
self.LanguageEnglishItem.setStatusTip(translate(u'main_window', u'Set the interface language to English'))
|
||||
self.ToolsAddToolItem.setText(translate(u'main_window', u'&Add Tool...'))
|
||||
self.ToolsAddToolItem.setStatusTip(translate(u'main_window', u'Add an application to the list of tools'))
|
||||
self.action_Preview_Pane.setText(translate(u'main_window', u'&Preview Pane'))
|
||||
self.action_Preview_Panel.setText(translate(u'main_window', u'&Preview Pane'))
|
||||
self.ModeLiveItem.setText(translate(u'main_window', u'&Live'))
|
||||
|
||||
def show(self):
|
||||
|
@ -21,15 +21,16 @@ import os
|
||||
|
||||
from time import sleep
|
||||
from copy import deepcopy
|
||||
from PyQt4 import *
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
|
||||
# from openlp.core.resources import *
|
||||
# from openlp.core.ui import AboutForm, AlertForm, SettingsForm, SlideController
|
||||
from openlp.core.lib import OpenLPToolbar
|
||||
from openlp.core.lib import ServiceItem
|
||||
from openlp.core.lib import RenderManager
|
||||
from openlp.core import translate
|
||||
|
||||
# from openlp.core import PluginManager
|
||||
import logging
|
||||
@ -47,6 +48,9 @@ class ServiceData(QAbstractItemModel):
|
||||
self.items=[]
|
||||
log.info("Starting")
|
||||
|
||||
def clearItems(self):
|
||||
self.items = []
|
||||
|
||||
def columnCount(self, parent):
|
||||
return 1; # always only a single column (for now)
|
||||
|
||||
@ -122,33 +126,73 @@ class ServiceManager(QWidget):
|
||||
def __init__(self, parent):
|
||||
QWidget.__init__(self)
|
||||
self.parent=parent
|
||||
self.Layout = QtGui.QVBoxLayout(self)
|
||||
self.Layout = QVBoxLayout(self)
|
||||
self.Layout.setSpacing(0)
|
||||
self.Layout.setMargin(0)
|
||||
self.Toolbar = OpenLPToolbar(self)
|
||||
self.Toolbar.addToolbarButton("Move to top", ":/services/service_top.png")
|
||||
self.Toolbar.addToolbarButton("Move up", ":/services/service_up.png")
|
||||
self.Toolbar.addToolbarButton("Move down", ":/services/service_down.png")
|
||||
self.Toolbar.addToolbarButton("Move to bottom", ":/services/service_bottom.png")
|
||||
self.Toolbar.addToolbarButton("Move to top", ":/services/service_top.png",
|
||||
translate(u'ServiceManager', u'Move to start'), self.onServiceTop)
|
||||
self.Toolbar.addToolbarButton("Move up", ":/services/service_up.png",
|
||||
translate(u'ServiceManager', u'Move up order'), self.onServiceUp)
|
||||
self.Toolbar.addToolbarButton("Move down", ":/services/service_down.png",
|
||||
translate(u'ServiceManager', u'Move down order'), self.onServiceDown)
|
||||
self.Toolbar.addToolbarButton("Move to bottom", ":/services/service_bottom.png",
|
||||
translate(u'ServiceManager', u'Move to end'), self.onServiceEnd)
|
||||
self.Toolbar.addSeparator()
|
||||
self.Toolbar.addToolbarButton("New Service", ":/services/service_new.png")
|
||||
self.Toolbar.addToolbarButton("Save Service", ":/services/service_save.png")
|
||||
self.Toolbar.addToolbarButton("New Service", ":/services/service_new.png",
|
||||
translate(u'ServiceManager', u'Create a new Service'), self.onNewService)
|
||||
self.Toolbar.addToolbarButton("Delete From Service", ":/services/service_delete.png",
|
||||
translate(u'ServiceManager', u'Delete From Service'), self.onDeleteFromService)
|
||||
self.Toolbar.addSeparator()
|
||||
self.ThemeComboBox = QtGui.QComboBox(self.Toolbar)
|
||||
self.ThemeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||
self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar)
|
||||
self.Toolbar.addToolbarButton("Save Service", ":/services/service_save.png",
|
||||
translate(u'ServiceManager', u'Save Service'), self.onSaveService)
|
||||
self.Toolbar.addToolbarButton("Load Service", ":/services/service_open.png",
|
||||
translate(u'ServiceManager', u'Load Existing'), self.onLoadService)
|
||||
|
||||
self.Toolbar.addSeparator()
|
||||
self.ThemeComboBox = QComboBox(self.Toolbar)
|
||||
self.ThemeComboBox.setSizeAdjustPolicy(QComboBox.AdjustToContents)
|
||||
self.ThemeWidget = QWidgetAction(self.Toolbar)
|
||||
self.ThemeWidget.setDefaultWidget(self.ThemeComboBox)
|
||||
self.Toolbar.addAction(self.ThemeWidget)
|
||||
|
||||
self.Layout.addWidget(self.Toolbar)
|
||||
|
||||
self.TreeView = QtGui.QTreeView(self)
|
||||
self.TreeView = QTreeView(self)
|
||||
self.service_data=ServiceData()
|
||||
self.TreeView.setModel(self.service_data)
|
||||
self.TreeView.setAlternatingRowColors(True)
|
||||
self.Layout.addWidget(self.TreeView)
|
||||
|
||||
QtCore.QObject.connect(self.ThemeComboBox,
|
||||
QtCore.SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
|
||||
QObject.connect(self.ThemeComboBox,
|
||||
SIGNAL("activated(int)"), self.onThemeComboBoxSelected)
|
||||
|
||||
def onServiceTop(self):
|
||||
pass
|
||||
|
||||
def onServiceUp(self):
|
||||
pass
|
||||
|
||||
def onServiceDown(self):
|
||||
pass
|
||||
|
||||
def onServiceEnd(self):
|
||||
pass
|
||||
|
||||
def onNewService(self):
|
||||
self.service_data.clearItems()
|
||||
|
||||
def onDeleteFromService(self):
|
||||
pass
|
||||
|
||||
def onSaveService(self):
|
||||
Pass
|
||||
|
||||
def onLoadService(self):
|
||||
Pass
|
||||
|
||||
|
||||
|
||||
|
||||
def onThemeComboBoxSelected(self, currentIndex):
|
||||
self.renderManager.default_theme = self.ThemeComboBox.currentText()
|
||||
|
@ -20,10 +20,12 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
import logging
|
||||
import os
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
|
||||
from openlp.core.lib import OpenLPToolbar
|
||||
from openlp.core import translate
|
||||
|
||||
class SlideData(QAbstractListModel):
|
||||
"""
|
||||
Tree of items for an order of Theme.
|
||||
@ -46,14 +48,14 @@ class SlideData(QAbstractListModel):
|
||||
def columnCount(self, parent):
|
||||
return 1
|
||||
|
||||
def rowCount(self, parent):
|
||||
def rowCount(self, parent=None):
|
||||
return len(self.items)
|
||||
|
||||
def insertRow(self, row, frame):
|
||||
self.beginInsertRows(QModelIndex(),row,row)
|
||||
log.info(u'insert row %d' % row)
|
||||
# create a preview image
|
||||
frame1 = frame.scaled(QtCore.QSize(350,260))
|
||||
frame1 = frame.scaled(QSize(350,260))
|
||||
self.items.insert(row,(frame1))
|
||||
log.info(u'Items: %s' % self.items)
|
||||
self.endInsertRows()
|
||||
@ -99,48 +101,112 @@ class SlideData(QAbstractListModel):
|
||||
return filelist
|
||||
|
||||
|
||||
class SlideController(QtGui.QWidget):
|
||||
class SlideController(QWidget):
|
||||
global log
|
||||
log=logging.getLogger(u'SlideController')
|
||||
|
||||
def __init__(self, control_splitter):
|
||||
QtGui.QWidget.__init__(self)
|
||||
self.Pane = QtGui.QWidget(control_splitter)
|
||||
self.Splitter = QtGui.QSplitter(self.Pane)
|
||||
self.Splitter.setOrientation(QtCore.Qt.Vertical)
|
||||
def __init__(self, control_splitter, isLive):
|
||||
QWidget.__init__(self)
|
||||
self.isLive = isLive
|
||||
self.Panel = QWidget(control_splitter)
|
||||
self.Splitter = QSplitter(self.Panel)
|
||||
self.Splitter.setOrientation(Qt.Vertical)
|
||||
|
||||
self.PaneLayout = QtGui.QVBoxLayout(self.Pane)
|
||||
self.PaneLayout.addWidget(self.Splitter)
|
||||
self.PaneLayout.setSpacing(50)
|
||||
self.PaneLayout.setMargin(0)
|
||||
self.PanelLayout = QVBoxLayout(self.Panel)
|
||||
self.PanelLayout.addWidget(self.Splitter)
|
||||
self.PanelLayout.setSpacing(50)
|
||||
self.PanelLayout.setMargin(0)
|
||||
|
||||
self.Controller = QtGui.QScrollArea(self.Splitter)
|
||||
self.Controller = QScrollArea(self.Splitter)
|
||||
self.Controller.setWidgetResizable(True)
|
||||
|
||||
self.PreviewListView = QtGui.QListView(self.Splitter)
|
||||
self.PreviewListView = QListView(self.Splitter)
|
||||
self.PreviewListView.setAlternatingRowColors(True)
|
||||
self.PreviewListData = SlideData()
|
||||
self.PreviewListView.setModel(self.PreviewListData)
|
||||
self.Controller.setGeometry(QtCore.QRect(0, 0, 828, 536))
|
||||
|
||||
self.Controller.setGeometry(QRect(0, 0, 828, 536))
|
||||
self.Controller.setWidget(self.PreviewListView)
|
||||
|
||||
self.SlidePreview = QtGui.QLabel(self.Splitter)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
self.Toolbar = OpenLPToolbar(self.Splitter)
|
||||
sizeToolbarPolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
sizeToolbarPolicy.setHorizontalStretch(0)
|
||||
sizeToolbarPolicy.setVerticalStretch(0)
|
||||
sizeToolbarPolicy.setHeightForWidth(self.Toolbar.sizePolicy().hasHeightForWidth())
|
||||
|
||||
if self.isLive:
|
||||
self.Toolbar.addToolbarButton("First Slide", ":/slides/slide_first.png",
|
||||
translate(u'SlideController', u'Move to first'), self.onSlideSelectedFirst)
|
||||
self.Toolbar.addToolbarButton("Last Slide", ":/slides/slide_previous.png",
|
||||
translate(u'SlideController', u'Move to previous'), self.onSlideSelectedPrevious)
|
||||
self.Toolbar.addToolbarButton("First Slide", ":/slides/slide_next.png",
|
||||
translate(u'SlideController', u'Move to next'), self.onSlideSelectedNext)
|
||||
if self.isLive:
|
||||
self.Toolbar.addToolbarButton("Last Slide", ":/slides/slide_last.png",
|
||||
translate(u'SlideController', u'Move to last'), self.onSlideSelectedLast)
|
||||
self.Toolbar.addSeparator()
|
||||
self.Toolbar.addToolbarButton("Close Sscreen", ":/slides/slide_close.png",
|
||||
translate(u'SlideController', u'Close Screen'), self.onBlankScreen)
|
||||
|
||||
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
|
||||
|
||||
self.SlidePreview = QLabel(self.Splitter)
|
||||
sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.SlidePreview.sizePolicy().hasHeightForWidth())
|
||||
self.SlidePreview.setSizePolicy(sizePolicy)
|
||||
self.SlidePreview.setMinimumSize(QtCore.QSize(250, 190))
|
||||
self.SlidePreview.setFrameShape(QtGui.QFrame.WinPanel)
|
||||
self.SlidePreview.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.SlidePreview.setMinimumSize(QSize(250, 190))
|
||||
self.SlidePreview.setFrameShape(QFrame.WinPanel)
|
||||
self.SlidePreview.setFrameShadow(QFrame.Sunken)
|
||||
self.SlidePreview.setLineWidth(1)
|
||||
self.SlidePreview.setScaledContents(True)
|
||||
self.SlidePreview.setObjectName("SlidePreview")
|
||||
|
||||
QtCore.QObject.connect(self.PreviewListView,
|
||||
QtCore.SIGNAL("clicked(QModelIndex)"), self.onSlideSelected)
|
||||
QObject.connect(self.PreviewListView,
|
||||
SIGNAL("clicked(QModelIndex)"), self.onSlideSelected)
|
||||
|
||||
def onSlideSelectedFirst(self):
|
||||
row = self.PreviewListData.createIndex(0, 0)
|
||||
if row.isValid():
|
||||
self.PreviewListView.selectionModel().setCurrentIndex(row, QItemSelectionModel.SelectCurrent)
|
||||
self.onSlideSelected(row)
|
||||
|
||||
def onSlideSelectedNext(self):
|
||||
indexes = self.PreviewListView.selectedIndexes()
|
||||
rowNumber = 0
|
||||
for index in indexes:
|
||||
if index.row() == self.PreviewListData.rowCount() - 1:
|
||||
rowNumber = 0
|
||||
else:
|
||||
rowNumber = index.row() + 1
|
||||
row = self.PreviewListData.createIndex(rowNumber , 0)
|
||||
if row.isValid():
|
||||
self.PreviewListView.selectionModel().setCurrentIndex(row, QItemSelectionModel.SelectCurrent)
|
||||
self.onSlideSelected(row)
|
||||
|
||||
|
||||
def onSlideSelectedPrevious(self):
|
||||
indexes = self.PreviewListView.selectedIndexes()
|
||||
rowNumber = 0
|
||||
for index in indexes:
|
||||
if index.row() == 0:
|
||||
rowNumber = self.PreviewListData.rowCount() - 1
|
||||
else:
|
||||
rowNumber = index.row() - 1
|
||||
row = self.PreviewListData.createIndex(rowNumber , 0)
|
||||
if row.isValid():
|
||||
self.PreviewListView.selectionModel().setCurrentIndex(row, QItemSelectionModel.SelectCurrent)
|
||||
self.onSlideSelected(row)
|
||||
|
||||
def onSlideSelectedLast(self):
|
||||
row = self.PreviewListData.createIndex(self.PreviewListData.rowCount() - 1 , 0)
|
||||
if row.isValid():
|
||||
self.PreviewListView.selectionModel().setCurrentIndex(row, QItemSelectionModel.SelectCurrent)
|
||||
self.onSlideSelected(row)
|
||||
|
||||
def onBlankScreen(self):
|
||||
pass
|
||||
|
||||
def onSlideSelected(self, index):
|
||||
frame = self.PreviewListData.getValue(index)
|
||||
@ -158,5 +224,10 @@ class SlideController(QtGui.QWidget):
|
||||
for frame in self.serviceitem.frames:
|
||||
self.PreviewListData.addRow(frame)
|
||||
|
||||
row = self.PreviewListData.createIndex(0, 0)
|
||||
if row.isValid():
|
||||
self.PreviewListView.selectionModel().setCurrentIndex(row, QItemSelectionModel.SelectCurrent)
|
||||
self.onSlideSelected(row)
|
||||
|
||||
def render(self):
|
||||
pass
|
||||
|
@ -164,12 +164,13 @@ class ThemeManager(QWidget):
|
||||
translate(u'ThemeManager', u'Export a theme'), self.onExportTheme)
|
||||
self.ThemeWidget = QtGui.QWidgetAction(self.Toolbar)
|
||||
self.Layout.addWidget(self.Toolbar)
|
||||
|
||||
self.ThemeListView = QtGui.QListView(self)
|
||||
self.themeData = ThemeData()
|
||||
self.ThemeListView.setModel(self.themeData)
|
||||
self.ThemeListView.setAlternatingRowColors(True)
|
||||
self.Layout.addWidget(self.ThemeListView)
|
||||
self.ThemeListView.setAlternatingRowColors(True)
|
||||
|
||||
self.themelist = []
|
||||
self.path = os.path.join(ConfigHelper.get_data_path(), u'themes')
|
||||
self.checkThemesExists(self.path)
|
||||
|
@ -371,10 +371,10 @@ class BibleMediaItem(MediaManagerItem):
|
||||
if len(raw_footer) <= 1:
|
||||
raw_footer.append(book)
|
||||
|
||||
service_item.theme = None
|
||||
|
||||
service_item.raw_slides = raw_slides
|
||||
service_item.raw_footer = raw_footer
|
||||
if len(raw_slides) > 0:
|
||||
service_item.theme = None
|
||||
service_item.raw_slides = raw_slides
|
||||
service_item.raw_footer = raw_footer
|
||||
|
||||
def formatVerse(self, old_chapter, chapter, verse, opening, closing):
|
||||
loc = opening
|
||||
|
@ -226,6 +226,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||
for verse in verseList:
|
||||
raw_slides.append(verse[1])
|
||||
raw_footer.append(title + u' '+ credit)
|
||||
service_item.title = title
|
||||
service_item.raw_slides = raw_slides
|
||||
service_item.raw_footer = raw_footer
|
||||
if theme is not None:
|
||||
service_item.title = title
|
||||
service_item.raw_slides = raw_slides
|
||||
service_item.raw_footer = raw_footer
|
||||
|
Loading…
Reference in New Issue
Block a user