Review comments

This commit is contained in:
Tim Bentley 2011-02-13 13:11:15 +00:00
parent c75e884c7e
commit 720c2036e3
5 changed files with 24 additions and 24 deletions

View File

@ -109,7 +109,7 @@ class ServiceItem(object):
self.data_string = u''
self.edit_id = None
self.xml_version = None
self.start_time = [0, 0, 0]
self.start_time = 0
self._new_item()
def _new_item(self):
@ -436,16 +436,16 @@ class ServiceItem(object):
tooltip = None
start = None
end = None
if self.start_time != [0, 0, 0]:
start = UiStrings.Start % \
(self.start_time[0], self.start_time[1], self.start_time[2])
if self.start_time != 0:
start = UiStrings.StartTimeCode % \
unicode(datetime.timedelta(seconds=self.start_time))
path = os.path.join(self.get_frames()[0][u'path'],
self.get_frames()[0][u'title'])
if os.path.isfile(path):
file = mutagen.File(path)
if file is not None:
seconds = int(file.info.length)
end = UiStrings.Length % \
end = UiStrings.LengthTime % \
unicode(datetime.timedelta(seconds=seconds))
if not start and not end:
return None

View File

@ -58,7 +58,7 @@ class UiStrings(object):
ExportType = unicode(translate('OpenLP.Ui', 'Export %s'))
Import = translate('OpenLP.Ui', 'Import')
ImportType = unicode(translate('OpenLP.Ui', 'Import %s'))
Length = unicode(translate('OpenLP.Ui', 'Length %s'))
LengthTime = unicode(translate('OpenLP.Ui', 'Length %s'))
Live = translate('OpenLP.Ui', 'Live')
Load = translate('OpenLP.Ui', 'Load')
LoadANew = unicode(translate('OpenLP.Ui', 'Load a new %s.'))
@ -76,7 +76,7 @@ class UiStrings(object):
SendSelectLive = unicode(translate('OpenLP.Ui',
'Send the selected %s live.'))
Service = translate('OpenLP.Ui', 'Service')
Start = unicode(translate('OpenLP.Ui', 'Start %02d:%02d:%02d'))
StartTimeCode = unicode(translate('OpenLP.Ui', 'Start %s'))
Theme = translate('OpenLP.Ui', 'Theme')
Themes = translate('OpenLP.Ui', 'Themes')

View File

@ -349,10 +349,7 @@ class MainDisplay(DisplayWidget):
Start the video at a predetermined point.
"""
if newState == 2:
time = self.serviceItem.start_time[0] * 60 * 60 + \
self.serviceItem.start_time[1] * 60 + \
self.serviceItem.start_time[2]
self.mediaObject.seek(time * 1000)
self.mediaObject.seek(self.serviceItem.start_time * 1000)
def isWebLoaded(self):
"""

View File

@ -611,11 +611,9 @@ class ServiceManager(QtGui.QWidget):
item = self.findServiceItem()[0]
self.startTimeForm.item = self.serviceItems[item]
if self.startTimeForm.exec_():
self.serviceItems[item][u'service_item'].start_time[0] = \
self.startTimeForm.hourSpinBox.value()
self.serviceItems[item][u'service_item'].start_time[1] = \
self.startTimeForm.minuteSpinBox.value()
self.serviceItems[item][u'service_item'].start_time[2] = \
self.serviceItems[item][u'service_item'].start_time = \
self.startTimeForm.hourSpinBox.value() * 3600 + \
self.startTimeForm.minuteSpinBox.value() * 60 + \
self.startTimeForm.secondSpinBox.value()
self.repaintServiceList(item, -1)
@ -865,9 +863,11 @@ class ServiceManager(QtGui.QWidget):
text = frame[u'title'].replace(u'\n', u' ')
child.setText(0, text[:40])
child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count))
tip = item[u'service_item'].get_media_time()
if tip:
child.setToolTip(0, tip)
if item[u'service_item'] \
.is_capable(ItemCapabilities.AllowsVarableStartTime):
tip = item[u'service_item'].get_media_time()
if tip:
child.setToolTip(0, tip)
if serviceItem == itemcount:
if item[u'expanded'] and serviceItemChild == count:
self.serviceManagerList.setCurrentItem(child)

View File

@ -28,8 +28,6 @@ from PyQt4 import QtGui
from starttimedialog import Ui_StartTimeDialog
from openlp.core.lib import translate
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
"""
The exception dialog
@ -42,8 +40,13 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
"""
Run the Dialog with correct heading.
"""
self.hourSpinBox.setValue(self.item[u'service_item'].start_time[0])
self.minuteSpinBox.setValue(self.item[u'service_item'].start_time[1])
self.secondSpinBox.setValue(self.item[u'service_item'].start_time[2])
seconds = self.item[u'service_item'].start_time
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)