forked from openlp/openlp
Update the Media timer UI
This commit is contained in:
parent
38243af7de
commit
5e7fa59407
@ -56,6 +56,7 @@ class UiStrings(object):
|
||||
Export = translate('OpenLP.Ui', 'Export')
|
||||
FontSizePtUnit = translate('OpenLP.Ui', 'pt',
|
||||
'Abbreviated font pointsize unit')
|
||||
H = translate('OpenLP.Ui', 'h', 'The abbreviated unit for hours')
|
||||
Image = translate('OpenLP.Ui', 'Image')
|
||||
Import = translate('OpenLP.Ui', 'Import')
|
||||
LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
|
||||
@ -63,6 +64,7 @@ class UiStrings(object):
|
||||
LiveBGError = translate('OpenLP.Ui', 'Live Background Error')
|
||||
LivePanel = translate('OpenLP.Ui', 'Live Panel')
|
||||
Load = translate('OpenLP.Ui', 'Load')
|
||||
M = translate('OpenLP.Ui', 'm', 'The abbreviated unit for minutes')
|
||||
Middle = translate('OpenLP.Ui', 'Middle')
|
||||
New = translate('OpenLP.Ui', 'New')
|
||||
NewService = translate('OpenLP.Ui', 'New Service')
|
||||
|
@ -32,39 +32,78 @@ from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
|
||||
class Ui_StartTimeDialog(object):
|
||||
def setupUi(self, StartTimeDialog):
|
||||
StartTimeDialog.setObjectName(u'StartTimeDialog')
|
||||
StartTimeDialog.resize(300, 10)
|
||||
StartTimeDialog.resize(350, 10)
|
||||
self.dialogLayout = QtGui.QGridLayout(StartTimeDialog)
|
||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
||||
self.startLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.startLabel.setObjectName(u'startLabel')
|
||||
self.startLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialogLayout.addWidget(self.startLabel, 0, 1, 1, 1)
|
||||
self.finishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.finishLabel.setObjectName(u'finishLabel')
|
||||
self.finishLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialogLayout.addWidget(self.finishLabel, 0, 2, 1, 1)
|
||||
self.lengthLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.lengthLabel.setObjectName(u'startLabel')
|
||||
self.lengthLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialogLayout.addWidget(self.lengthLabel, 0, 3, 1, 1)
|
||||
self.hourLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.hourLabel.setObjectName("hourLabel")
|
||||
self.dialogLayout.addWidget(self.hourLabel, 0, 0, 1, 1)
|
||||
self.hourLabel.setObjectName(u'hourLabel')
|
||||
self.dialogLayout.addWidget(self.hourLabel, 1, 0, 1, 1)
|
||||
self.hourSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.hourSpinBox.setObjectName("hourSpinBox")
|
||||
self.dialogLayout.addWidget(self.hourSpinBox, 0, 1, 1, 1)
|
||||
self.hourSpinBox.setObjectName(u'hourSpinBox')
|
||||
self.dialogLayout.addWidget(self.hourSpinBox, 1, 1, 1, 1)
|
||||
self.hourFinishSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.hourFinishSpinBox.setObjectName(u'hourFinishSpinBox')
|
||||
self.dialogLayout.addWidget(self.hourFinishSpinBox, 1, 2, 1, 1)
|
||||
self.hourFinishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.hourFinishLabel.setObjectName(u'hourLabel')
|
||||
self.hourFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialogLayout.addWidget(self.hourFinishLabel, 1, 3, 1, 1)
|
||||
self.minuteLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.minuteLabel.setObjectName("minuteLabel")
|
||||
self.dialogLayout.addWidget(self.minuteLabel, 1, 0, 1, 1)
|
||||
self.minuteLabel.setObjectName(u'minuteLabel')
|
||||
self.dialogLayout.addWidget(self.minuteLabel, 2, 0, 1, 1)
|
||||
self.minuteSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.minuteSpinBox.setObjectName("minuteSpinBox")
|
||||
self.dialogLayout.addWidget(self.minuteSpinBox, 1, 1, 1, 1)
|
||||
self.minuteSpinBox.setObjectName(u'minuteSpinBox')
|
||||
self.dialogLayout.addWidget(self.minuteSpinBox, 2, 1, 1, 1)
|
||||
self.minuteFinishSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.minuteFinishSpinBox.setObjectName(u'minuteFinishSpinBox')
|
||||
self.dialogLayout.addWidget(self.minuteFinishSpinBox, 2, 2, 1, 1)
|
||||
self.minuteFinishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.minuteFinishLabel.setObjectName(u'minuteLabel')
|
||||
self.minuteFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialogLayout.addWidget(self.minuteFinishLabel, 2, 3, 1, 1)
|
||||
self.secondLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.secondLabel.setObjectName("secondLabel")
|
||||
self.dialogLayout.addWidget(self.secondLabel, 2, 0, 1, 1)
|
||||
self.secondLabel.setObjectName(u'secondLabel')
|
||||
self.dialogLayout.addWidget(self.secondLabel, 3, 0, 1, 1)
|
||||
self.secondSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.secondSpinBox.setObjectName("secondSpinBox")
|
||||
self.dialogLayout.addWidget(self.secondSpinBox, 2, 1, 1, 1)
|
||||
self.secondSpinBox.setObjectName(u'secondSpinBox')
|
||||
self.secondFinishSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.secondFinishSpinBox.setObjectName(u'secondFinishSpinBox')
|
||||
self.dialogLayout.addWidget(self.secondFinishSpinBox, 3, 2, 1, 1)
|
||||
self.secondFinishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.secondFinishLabel.setObjectName(u'secondLabel')
|
||||
self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1)
|
||||
self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1)
|
||||
self.buttonBox = create_accept_reject_button_box(StartTimeDialog, True)
|
||||
self.dialogLayout.addWidget(self.buttonBox, 4, 0, 1, 2)
|
||||
self.dialogLayout.addWidget(self.buttonBox, 5, 2, 1, 2)
|
||||
self.retranslateUi(StartTimeDialog)
|
||||
self.setMaximumHeight(self.sizeHint().height())
|
||||
QtCore.QMetaObject.connectSlotsByName(StartTimeDialog)
|
||||
|
||||
def retranslateUi(self, StartTimeDialog):
|
||||
self.setWindowTitle(translate('OpenLP.StartTimeForm',
|
||||
'Item Start Time'))
|
||||
self.hourLabel.setText(translate('OpenLP.StartTimeForm', 'Hours:'))
|
||||
self.hourSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'h'))
|
||||
self.minuteSpinBox.setSuffix(translate('OpenLP.StartTimeForm', 'm'))
|
||||
'Item Start and Fnish Time'))
|
||||
self.hourSpinBox.setSuffix(UiStrings.H)
|
||||
self.minuteSpinBox.setSuffix(UiStrings.M)
|
||||
self.secondSpinBox.setSuffix(UiStrings.S)
|
||||
self.hourFinishSpinBox.setSuffix(UiStrings.H)
|
||||
self.minuteFinishSpinBox.setSuffix(UiStrings.M)
|
||||
self.secondFinishSpinBox.setSuffix(UiStrings.S)
|
||||
self.hourLabel.setText(translate('OpenLP.StartTimeForm', 'Hours:'))
|
||||
self.minuteLabel.setText(translate('OpenLP.StartTimeForm', 'Minutes:'))
|
||||
self.secondLabel.setText(translate('OpenLP.StartTimeForm', 'Seconds:'))
|
||||
self.startLabel.setText(translate('OpenLP.StartTimeForm', 'Start'))
|
||||
self.finishLabel.setText(translate('OpenLP.StartTimeForm', 'Finish'))
|
||||
self.lengthLabel.setText(translate('OpenLP.StartTimeForm', 'Length'))
|
||||
|
@ -27,6 +27,7 @@
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from starttimedialog import Ui_StartTimeDialog
|
||||
from openlp.core.lib.ui import UiStrings
|
||||
|
||||
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
||||
"""
|
||||
@ -40,13 +41,30 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
||||
"""
|
||||
Run the Dialog with correct heading.
|
||||
"""
|
||||
seconds = self.item[u'service_item'].start_time
|
||||
hour, minutes, seconds = self._time_split(
|
||||
self.item[u'service_item'].start_time)
|
||||
self.hourSpinBox.setValue(hour)
|
||||
self.minuteSpinBox.setValue(minutes)
|
||||
self.secondSpinBox.setValue(seconds)
|
||||
hours, minutes, seconds = self._time_split(
|
||||
self.item[u'service_item'].media_length)
|
||||
self.hourFinishSpinBox.setValue(hours)
|
||||
self.minuteFinishSpinBox.setValue(minutes)
|
||||
self.secondFinishSpinBox.setValue(seconds)
|
||||
self.hourFinishLabel.setText(u'%s%s' % (unicode(hour), UiStrings.H))
|
||||
self.minuteFinishLabel.setText(u'%s%s' %
|
||||
(unicode(minutes), UiStrings.M))
|
||||
self.secondFinishLabel.setText(u'%s%s' %
|
||||
(unicode(seconds), UiStrings.S))
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def accept(self):
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def _time_split(self, seconds):
|
||||
hours = seconds / 3600
|
||||
seconds -= 3600 * hours
|
||||
minutes = seconds / 60
|
||||
seconds -= 60 * minutes
|
||||
self.hourSpinBox.setValue(hours)
|
||||
self.minuteSpinBox.setValue(minutes)
|
||||
self.secondSpinBox.setValue(seconds)
|
||||
return QtGui.QDialog.exec_(self)
|
||||
return hours, minutes, seconds
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user