forked from openlp/openlp
Renamed and moved both enumerations to lib/__init__.py
This commit is contained in:
parent
6487a3248a
commit
02975a61bf
@ -42,6 +42,24 @@ class MediaType(object):
|
||||
"""
|
||||
Audio = 1
|
||||
Video = 2
|
||||
|
||||
class SlideLimits(object):
|
||||
"""
|
||||
Provides an enumeration for behaviour of OpenLP at the end limits of each
|
||||
service item when pressing the up/down arrow keys
|
||||
"""
|
||||
End = 1
|
||||
Wrap = 2
|
||||
Next = 3
|
||||
|
||||
class ServiceItemAction(object):
|
||||
"""
|
||||
Provides an enumeration for the required action moving between service
|
||||
items by left/right arrow keys
|
||||
"""
|
||||
Previous = 1
|
||||
PreviousLastSlide = 2
|
||||
Next = 3
|
||||
|
||||
def translate(context, text, comment=None,
|
||||
encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
|
||||
|
@ -112,8 +112,8 @@ class EventReceiver(QtCore.QObject):
|
||||
``slidecontroller_live_spin_delay``
|
||||
Pushes out the loop delay.
|
||||
|
||||
``slidecontroller_update_slide_advance``
|
||||
Updates the slide_advance variable from the saved settings.
|
||||
``slidecontroller_update_slide_limits``
|
||||
Updates the slide_limits variable from the saved settings.
|
||||
|
||||
``slidecontroller_live_stop_loop``
|
||||
Stop the loop on the main display.
|
||||
|
@ -47,15 +47,6 @@ class ServiceItemType(object):
|
||||
Image = 2
|
||||
Command = 3
|
||||
|
||||
class SlideAdvance(object):
|
||||
"""
|
||||
Provides an enumeration for the service item slide advance by up/down
|
||||
arrow keys
|
||||
"""
|
||||
End = 1
|
||||
Wrap = 2
|
||||
Next = 3
|
||||
|
||||
class ItemCapabilities(object):
|
||||
"""
|
||||
Provides an enumeration of a serviceitem's capabilities
|
||||
|
@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import SettingsTab, Receiver, translate
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
from openlp.core.lib.serviceitem import SlideAdvance
|
||||
from openlp.core.lib import SlideLimits
|
||||
from openlp.core.ui import ScreenList
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@ -178,7 +178,7 @@ class GeneralTab(SettingsTab):
|
||||
self.audioLayout.addWidget(self.startPausedCheckBox)
|
||||
self.rightLayout.addWidget(self.audioGroupBox)
|
||||
self.rightLayout.addStretch()
|
||||
# Service Item Slide Advance
|
||||
# Service Item Slide Limits
|
||||
self.slideGroupBox = QtGui.QGroupBox(self.rightColumn)
|
||||
self.slideGroupBox.setObjectName(u'slideGroupBox')
|
||||
self.slideLayout = QtGui.QFormLayout(self.slideGroupBox)
|
||||
@ -290,9 +290,9 @@ class GeneralTab(SettingsTab):
|
||||
translate('OpenLP.GeneralTab', 'Background Audio'))
|
||||
self.startPausedCheckBox.setText(
|
||||
translate('OpenLP.GeneralTab', 'Start background audio paused'))
|
||||
# Slide Advance
|
||||
# Slide Limits
|
||||
self.slideGroupBox.setTitle(
|
||||
translate('OpenLP.GeneralTab', 'Service Item Slide Advance'))
|
||||
translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
|
||||
self.endSlideRadioButton.setText(
|
||||
translate('OpenLP.GeneralTab', '&End Slide'))
|
||||
self.endSlideLabel.setText(
|
||||
@ -363,12 +363,12 @@ class GeneralTab(SettingsTab):
|
||||
self.customWidthValueEdit.setEnabled(self.overrideCheckBox.isChecked())
|
||||
self.display_changed = False
|
||||
settings.beginGroup(self.settingsSection)
|
||||
self.slide_advance = settings.value(
|
||||
u'slide advance', QtCore.QVariant(SlideAdvance.End)).toInt()[0]
|
||||
self.slide_limits = settings.value(
|
||||
u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0]
|
||||
settings.endGroup()
|
||||
if self.slide_advance == SlideAdvance.End:
|
||||
if self.slide_limits == SlideLimits.End:
|
||||
self.endSlideRadioButton.setChecked(True)
|
||||
elif self.slide_advance == SlideAdvance.Wrap:
|
||||
elif self.slide_limits == SlideLimits.Wrap:
|
||||
self.wrapSlideRadioButton.setChecked(True)
|
||||
else:
|
||||
self.nextSlideRadioButton.setChecked(True)
|
||||
@ -417,7 +417,7 @@ class GeneralTab(SettingsTab):
|
||||
QtCore.QVariant(self.overrideCheckBox.isChecked()))
|
||||
settings.setValue(u'audio start paused',
|
||||
QtCore.QVariant(self.startPausedCheckBox.isChecked()))
|
||||
settings.setValue(u'slide advance', QtCore.QVariant(self.slide_advance))
|
||||
settings.setValue(u'slide limits', QtCore.QVariant(self.slide_limits))
|
||||
settings.endGroup()
|
||||
# On save update the screens as well
|
||||
self.postSetUp(True)
|
||||
@ -446,7 +446,7 @@ class GeneralTab(SettingsTab):
|
||||
if self.display_changed:
|
||||
Receiver.send_message(u'config_screen_changed')
|
||||
self.display_changed = False
|
||||
Receiver.send_message(u'slidecontroller_update_slide_advance')
|
||||
Receiver.send_message(u'slidecontroller_update_slide_limits')
|
||||
|
||||
def onOverrideCheckBoxToggled(self, checked):
|
||||
"""
|
||||
@ -468,10 +468,10 @@ class GeneralTab(SettingsTab):
|
||||
self.display_changed = True
|
||||
|
||||
def onEndSlideButtonPressed(self):
|
||||
self.slide_advance = SlideAdvance.End
|
||||
self.slide_limits = SlideLimits.End
|
||||
|
||||
def onWrapSlideButtonPressed(self):
|
||||
self.slide_advance = SlideAdvance.Wrap
|
||||
self.slide_limits = SlideLimits.Wrap
|
||||
|
||||
def onNextSlideButtonPressed(self):
|
||||
self.slide_advance = SlideAdvance.Next
|
||||
self.slide_limits = SlideLimits.Next
|
||||
|
@ -38,7 +38,7 @@ from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \
|
||||
PluginManager, Receiver, translate, ImageManager, PluginStatus
|
||||
from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
|
||||
icon_action, shortcut_action
|
||||
from openlp.core.lib.serviceitem import SlideAdvance
|
||||
from openlp.core.lib import SlideLimits
|
||||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
|
||||
ThemeManager, SlideController, PluginForm, MediaDockManager, \
|
||||
ShortcutListForm, FormattingTagForm
|
||||
@ -1314,10 +1314,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
if QtCore.QSettings().value(self.generalSettingsSection +
|
||||
u'/enable slide loop', QtCore.QVariant(True)).toBool():
|
||||
QtCore.QSettings().setValue(self.generalSettingsSection +
|
||||
u'/slide advance', QtCore.QVariant(SlideAdvance.Wrap))
|
||||
u'/slide limits', QtCore.QVariant(SlideLimits.Wrap))
|
||||
else:
|
||||
QtCore.QSettings().setValue(self.generalSettingsSection +
|
||||
u'/slide advance', QtCore.QVariant(SlideAdvance.End))
|
||||
u'/slide limits', QtCore.QVariant(SlideLimits.End))
|
||||
QtCore.QSettings().remove(self.generalSettingsSection +
|
||||
u'/enable slide loop')
|
||||
settings = QtCore.QSettings()
|
||||
|
@ -35,7 +35,7 @@ from PyQt4 import QtCore, QtGui
|
||||
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, \
|
||||
translate, build_icon, ServiceItem, build_html, PluginManager, ServiceItem
|
||||
from openlp.core.lib.ui import UiStrings, shortcut_action
|
||||
from openlp.core.lib.serviceitem import SlideAdvance
|
||||
from openlp.core.lib import SlideLimits, ServiceItemAction
|
||||
from openlp.core.ui import HideMode, MainDisplay, Display, ScreenList
|
||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||
|
||||
@ -48,15 +48,6 @@ class SlideList(QtGui.QTableWidget):
|
||||
"""
|
||||
def __init__(self, parent=None, name=None):
|
||||
QtGui.QTableWidget.__init__(self, parent.controller)
|
||||
|
||||
class ServiceItemAdvance(object):
|
||||
"""
|
||||
Provides an enumeration for the service item advance by left/right
|
||||
arrow keys
|
||||
"""
|
||||
Previous = 1
|
||||
PreviousLastSlide = 2
|
||||
Next = 3
|
||||
|
||||
class Controller(QtGui.QWidget):
|
||||
"""
|
||||
@ -112,8 +103,8 @@ class SlideController(Controller):
|
||||
self.songEdit = False
|
||||
self.selectedRow = 0
|
||||
self.serviceItem = None
|
||||
self.slide_advance = None
|
||||
self.updateSlideAdvance()
|
||||
self.slide_limits = None
|
||||
self.updateSlideLimits()
|
||||
self.panel = QtGui.QWidget(parent.controlSplitter)
|
||||
self.slideList = {}
|
||||
# Layout for holding panel
|
||||
@ -463,8 +454,8 @@ class SlideController(Controller):
|
||||
QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix),
|
||||
self.onSlideUnblank)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'slidecontroller_update_slide_advance'),
|
||||
self.updateSlideAdvance)
|
||||
QtCore.SIGNAL(u'slidecontroller_update_slide_limits'),
|
||||
self.updateSlideLimits)
|
||||
|
||||
def slideShortcutActivated(self):
|
||||
"""
|
||||
@ -607,14 +598,14 @@ class SlideController(Controller):
|
||||
"""
|
||||
Live event to select the previous service item from the service manager.
|
||||
"""
|
||||
self.keypress_queue.append(ServiceItemAdvance.Previous)
|
||||
self.keypress_queue.append(ServiceItemAction.Previous)
|
||||
self._process_queue()
|
||||
|
||||
def serviceNext(self):
|
||||
"""
|
||||
Live event to select the next service item from the service manager.
|
||||
"""
|
||||
self.keypress_queue.append(ServiceItemAdvance.Next)
|
||||
self.keypress_queue.append(ServiceItemAction.Next)
|
||||
self._process_queue()
|
||||
|
||||
def _process_queue(self):
|
||||
@ -626,9 +617,9 @@ class SlideController(Controller):
|
||||
while len(self.keypress_queue) and not self.keypress_loop:
|
||||
self.keypress_loop = True
|
||||
keypressCommand = self.keypress_queue.popleft()
|
||||
if keypressCommand == ServiceItemAdvance.Previous:
|
||||
if keypressCommand == ServiceItemAction.Previous:
|
||||
Receiver.send_message('servicemanager_previous_item', None)
|
||||
elif keypressCommand == ServiceItemAdvance.PreviousLastSlide:
|
||||
elif keypressCommand == ServiceItemAction.PreviousLastSlide:
|
||||
# Go to the last slide of the previous item
|
||||
Receiver.send_message('servicemanager_previous_item', 'last slide')
|
||||
else:
|
||||
@ -719,13 +710,13 @@ class SlideController(Controller):
|
||||
"""
|
||||
self.delaySpinBox.setValue(int(value))
|
||||
|
||||
def updateSlideAdvance(self):
|
||||
def updateSlideLimits(self):
|
||||
"""
|
||||
Updates the Slide Advance variable from the settings.
|
||||
Updates the Slide Limits variable from the settings.
|
||||
"""
|
||||
self.slide_advance = QtCore.QSettings().value(
|
||||
self.parent().generalSettingsSection + u'/slide advance',
|
||||
QtCore.QVariant(SlideAdvance.End)).toInt()[0]
|
||||
self.slide_limits = QtCore.QSettings().value(
|
||||
self.parent().generalSettingsSection + u'/slide limits',
|
||||
QtCore.QVariant(SlideLimits.End)).toInt()[0]
|
||||
|
||||
def enableToolBar(self, item):
|
||||
"""
|
||||
@ -1204,9 +1195,9 @@ class SlideController(Controller):
|
||||
row = self.previewListWidget.currentRow() + 1
|
||||
if row == self.previewListWidget.rowCount():
|
||||
if wrap is None:
|
||||
if self.slide_advance == SlideAdvance.Wrap:
|
||||
if self.slide_limits == SlideLimits.Wrap:
|
||||
row = 0
|
||||
elif self.slide_advance == SlideAdvance.Next:
|
||||
elif self.slide_limits == SlideLimits.Next:
|
||||
self.serviceNext()
|
||||
return
|
||||
else:
|
||||
@ -1231,10 +1222,10 @@ class SlideController(Controller):
|
||||
else:
|
||||
row = self.previewListWidget.currentRow() - 1
|
||||
if row == -1:
|
||||
if self.slide_advance == SlideAdvance.Wrap:
|
||||
if self.slide_limits == SlideLimits.Wrap:
|
||||
row = self.previewListWidget.rowCount() - 1
|
||||
elif self.slide_advance == SlideAdvance.Next:
|
||||
self.keypress_queue.append(ServiceItemAdvance.PreviousLastSlide)
|
||||
elif self.slide_limits == SlideLimits.Next:
|
||||
self.keypress_queue.append(ServiceItemAction.PreviousLastSlide)
|
||||
self._process_queue()
|
||||
return
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user