forked from openlp/openlp
Fix go-live in service manager if no current item
Add advanced option to auto-preview in media manager Add keyboard shortcuts for media manager (Delete,+,Enter,Shift-Enter) bzr-revno: 1442
This commit is contained in:
commit
38d8e32735
@ -166,7 +166,7 @@ def build_icon(icon):
|
|||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
return button_icon
|
return button_icon
|
||||||
|
|
||||||
def context_menu_action(base, icon, text, slot):
|
def context_menu_action(base, icon, text, slot, shortcuts=None):
|
||||||
"""
|
"""
|
||||||
Utility method to help build context menus for plugins
|
Utility method to help build context menus for plugins
|
||||||
|
|
||||||
@ -186,6 +186,8 @@ def context_menu_action(base, icon, text, slot):
|
|||||||
if icon:
|
if icon:
|
||||||
action.setIcon(build_icon(icon))
|
action.setIcon(build_icon(icon))
|
||||||
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
|
QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered()'), slot)
|
||||||
|
if shortcuts:
|
||||||
|
action.setShortcuts(shortcuts)
|
||||||
return action
|
return action
|
||||||
|
|
||||||
def context_menu(base, icon, text):
|
def context_menu(base, icon, text):
|
||||||
|
@ -101,6 +101,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.toolbar = None
|
self.toolbar = None
|
||||||
self.remoteTriggered = None
|
self.remoteTriggered = None
|
||||||
self.singleServiceItem = True
|
self.singleServiceItem = True
|
||||||
|
self.quickPreviewAllowed = False
|
||||||
self.pageLayout = QtGui.QVBoxLayout(self)
|
self.pageLayout = QtGui.QVBoxLayout(self)
|
||||||
self.pageLayout.setSpacing(0)
|
self.pageLayout.setSpacing(0)
|
||||||
self.pageLayout.setMargin(0)
|
self.pageLayout.setMargin(0)
|
||||||
@ -266,23 +267,25 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_delete.png',
|
self.listView, u':/general/general_delete.png',
|
||||||
self.plugin.getString(StringContent.Delete)[u'title'],
|
self.plugin.getString(StringContent.Delete)[u'title'],
|
||||||
self.onDeleteClick))
|
self.onDeleteClick, [QtCore.Qt.Key_Delete]))
|
||||||
self.listView.addAction(context_menu_separator(self.listView))
|
self.listView.addAction(context_menu_separator(self.listView))
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_preview.png',
|
self.listView, u':/general/general_preview.png',
|
||||||
self.plugin.getString(StringContent.Preview)[u'title'],
|
self.plugin.getString(StringContent.Preview)[u'title'],
|
||||||
self.onPreviewClick))
|
self.onPreviewClick, [QtCore.Qt.Key_Enter]))
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_live.png',
|
self.listView, u':/general/general_live.png',
|
||||||
self.plugin.getString(StringContent.Live)[u'title'],
|
self.plugin.getString(StringContent.Live)[u'title'],
|
||||||
self.onLiveClick))
|
self.onLiveClick, [QtCore.Qt.ShiftModifier + \
|
||||||
|
QtCore.Qt.Key_Enter, QtCore.Qt.ShiftModifier + \
|
||||||
|
QtCore.Qt.Key_Return]))
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_add.png',
|
self.listView, u':/general/general_add.png',
|
||||||
self.plugin.getString(StringContent.Service)[u'title'],
|
self.plugin.getString(StringContent.Service)[u'title'],
|
||||||
self.onAddClick))
|
self.onAddClick, [QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal]))
|
||||||
if self.addToServiceItem:
|
if self.addToServiceItem:
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
@ -293,6 +296,9 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
QtCore.QObject.connect(self.listView,
|
QtCore.QObject.connect(self.listView,
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||||
self.onClickPressed)
|
self.onClickPressed)
|
||||||
|
QtCore.QObject.connect(self.listView,
|
||||||
|
QtCore.SIGNAL(u'itemSelectionChanged()'),
|
||||||
|
self.onSelectionChange)
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
"""
|
"""
|
||||||
@ -411,7 +417,16 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
else:
|
else:
|
||||||
self.onPreviewClick()
|
self.onPreviewClick()
|
||||||
|
|
||||||
def onPreviewClick(self):
|
def onSelectionChange(self):
|
||||||
|
"""
|
||||||
|
Allows the change of current item in the list to be actioned
|
||||||
|
"""
|
||||||
|
if QtCore.QSettings().value(u'advanced/single click preview',
|
||||||
|
QtCore.QVariant(False)).toBool() and self.quickPreviewAllowed \
|
||||||
|
and self.listView.selectedIndexes():
|
||||||
|
self.onPreviewClick(True)
|
||||||
|
|
||||||
|
def onPreviewClick(self, keepFocus=False):
|
||||||
"""
|
"""
|
||||||
Preview an item by building a service item then adding that service
|
Preview an item by building a service item then adding that service
|
||||||
item to the preview slide controller.
|
item to the preview slide controller.
|
||||||
@ -426,6 +441,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
if serviceItem:
|
if serviceItem:
|
||||||
serviceItem.from_plugin = True
|
serviceItem.from_plugin = True
|
||||||
self.parent.previewController.addServiceItem(serviceItem)
|
self.parent.previewController.addServiceItem(serviceItem)
|
||||||
|
if keepFocus:
|
||||||
|
self.listView.setFocus()
|
||||||
|
|
||||||
def onLiveClick(self):
|
def onLiveClick(self):
|
||||||
"""
|
"""
|
||||||
|
@ -67,6 +67,10 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||||
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
|
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
|
||||||
self.uiLayout.addRow(self.doubleClickLiveCheckBox)
|
self.uiLayout.addRow(self.doubleClickLiveCheckBox)
|
||||||
|
self.singleClickPreviewCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||||
|
self.singleClickPreviewCheckBox.setObjectName(
|
||||||
|
u'singleClickPreviewCheckBox')
|
||||||
|
self.uiLayout.addRow(self.singleClickPreviewCheckBox)
|
||||||
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||||
self.expandServiceItemCheckBox.setObjectName(
|
self.expandServiceItemCheckBox.setObjectName(
|
||||||
u'expandServiceItemCheckBox')
|
u'expandServiceItemCheckBox')
|
||||||
@ -130,6 +134,8 @@ class AdvancedTab(SettingsTab):
|
|||||||
'Remember active media manager tab on startup'))
|
'Remember active media manager tab on startup'))
|
||||||
self.doubleClickLiveCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.doubleClickLiveCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Double-click to send items straight to live'))
|
'Double-click to send items straight to live'))
|
||||||
|
self.singleClickPreviewCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||||
|
'Preview items when clicked in Media Manager'))
|
||||||
self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.expandServiceItemCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||||
'Expand new service items on creation'))
|
'Expand new service items on creation'))
|
||||||
self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
self.enableAutoCloseCheckBox.setText(translate('OpenLP.AdvancedTab',
|
||||||
@ -164,6 +170,9 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.doubleClickLiveCheckBox.setChecked(
|
self.doubleClickLiveCheckBox.setChecked(
|
||||||
settings.value(u'double click live',
|
settings.value(u'double click live',
|
||||||
QtCore.QVariant(False)).toBool())
|
QtCore.QVariant(False)).toBool())
|
||||||
|
self.singleClickPreviewCheckBox.setChecked(
|
||||||
|
settings.value(u'single click preview',
|
||||||
|
QtCore.QVariant(False)).toBool())
|
||||||
self.expandServiceItemCheckBox.setChecked(
|
self.expandServiceItemCheckBox.setChecked(
|
||||||
settings.value(u'expand service item',
|
settings.value(u'expand service item',
|
||||||
QtCore.QVariant(False)).toBool())
|
QtCore.QVariant(False)).toBool())
|
||||||
@ -193,6 +202,8 @@ class AdvancedTab(SettingsTab):
|
|||||||
QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
|
QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
|
||||||
settings.setValue(u'double click live',
|
settings.setValue(u'double click live',
|
||||||
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
|
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
|
||||||
|
settings.setValue(u'single click preview',
|
||||||
|
QtCore.QVariant(self.singleClickPreviewCheckBox.isChecked()))
|
||||||
settings.setValue(u'expand service item',
|
settings.setValue(u'expand service item',
|
||||||
QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
|
QtCore.QVariant(self.expandServiceItemCheckBox.isChecked()))
|
||||||
settings.setValue(u'enable exit confirmation',
|
settings.setValue(u'enable exit confirmation',
|
||||||
|
@ -1125,6 +1125,9 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
-1 is passed if the value is not set
|
-1 is passed if the value is not set
|
||||||
"""
|
"""
|
||||||
item, child = self.findServiceItem()
|
item, child = self.findServiceItem()
|
||||||
|
# No items in service
|
||||||
|
if item == -1:
|
||||||
|
return
|
||||||
if row != -1:
|
if row != -1:
|
||||||
child = row
|
child = row
|
||||||
if self.serviceItems[item][u'service_item'].is_valid:
|
if self.serviceItems[item][u'service_item'].is_valid:
|
||||||
|
@ -46,6 +46,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
self.IconPath = u'custom/custom'
|
self.IconPath = u'custom/custom'
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
self.singleServiceItem = False
|
self.singleServiceItem = False
|
||||||
|
self.quickPreviewAllowed = True
|
||||||
# Holds information about whether the edit is remotly triggered and
|
# Holds information about whether the edit is remotly triggered and
|
||||||
# which Custom is required.
|
# which Custom is required.
|
||||||
self.remoteCustom = -1
|
self.remoteCustom = -1
|
||||||
|
@ -46,6 +46,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
def __init__(self, parent, plugin, icon):
|
def __init__(self, parent, plugin, icon):
|
||||||
self.IconPath = u'images/image'
|
self.IconPath = u'images/image'
|
||||||
MediaManagerItem.__init__(self, parent, self, icon)
|
MediaManagerItem.__init__(self, parent, self, icon)
|
||||||
|
self.quickPreviewAllowed = True
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.remoteSong = -1
|
self.remoteSong = -1
|
||||||
self.editItem = None
|
self.editItem = None
|
||||||
self.whitespace = re.compile(r'\W+', re.UNICODE)
|
self.whitespace = re.compile(r'\W+', re.UNICODE)
|
||||||
|
self.quickPreviewAllowed = True
|
||||||
|
|
||||||
def addEndHeaderBar(self):
|
def addEndHeaderBar(self):
|
||||||
self.addToolbarSeparator()
|
self.addToolbarSeparator()
|
||||||
|
Loading…
Reference in New Issue
Block a user