forked from openlp/openlp
Added some methods to serviceitem.py so as not to expose "inner workings of ServiceItem" and modified get_frame_path method. (Which required a modification to slidecontroller.py & messagelistener.py)
This commit is contained in:
parent
713f742a3a
commit
d35d4f4f79
@ -451,14 +451,27 @@ class ServiceItem(object):
|
||||
except IndexError:
|
||||
return u''
|
||||
|
||||
def get_frame_path(self, row=0):
|
||||
def get_frame_path(self, row=0, frame=None):
|
||||
"""
|
||||
Returns the path of the raw frame
|
||||
"""
|
||||
try:
|
||||
return self._raw_frames[row][u'path']
|
||||
except IndexError:
|
||||
return u''
|
||||
if not frame:
|
||||
try:
|
||||
frame = self._raw_frames[row]
|
||||
except IndexError:
|
||||
return u''
|
||||
if self.is_image():
|
||||
path_from = frame[u'path']
|
||||
else:
|
||||
path_from = os.path.join(frame[u'path'], frame[u'title'])
|
||||
return path_from
|
||||
|
||||
def remove_frame(self, frame):
|
||||
"""
|
||||
Remove the soecified frame from the item
|
||||
"""
|
||||
if frame in self._raw_frames:
|
||||
self._raw_frames.remove(frame)
|
||||
|
||||
def get_media_time(self):
|
||||
"""
|
||||
|
@ -349,16 +349,6 @@ class ServiceManager(QtGui.QWidget):
|
||||
"""
|
||||
return self._modified
|
||||
|
||||
def get_frame_file_path(self, item, frame):
|
||||
"""
|
||||
Getter to get service item file path.
|
||||
"""
|
||||
if item[u'service_item'].is_image():
|
||||
path_from = frame[u'path']
|
||||
else:
|
||||
path_from = os.path.join(frame[u'path'], frame[u'title'])
|
||||
return path_from
|
||||
|
||||
def setFileName(self, fileName):
|
||||
"""
|
||||
Setter for service file.
|
||||
@ -504,7 +494,7 @@ class ServiceManager(QtGui.QWidget):
|
||||
if not item[u'service_item'].uses_file():
|
||||
continue
|
||||
for frame in item[u'service_item'].get_frames():
|
||||
path_from = self.get_frame_file_path(item, frame)
|
||||
path_from = item[u'service_item'].get_frame_path(frame=frame)
|
||||
if path_from in write_list or path_from in missing_list:
|
||||
continue
|
||||
if not os.path.exists(path_from):
|
||||
@ -532,10 +522,11 @@ class ServiceManager(QtGui.QWidget):
|
||||
self.mainwindow.incrementProgressBar()
|
||||
if item[u'service_item'].uses_file():
|
||||
for frame in item[u'service_item'].get_frames():
|
||||
path_from = self.get_frame_file_path(item, frame)
|
||||
path_from = item[u'service_item'].get_frame_path(
|
||||
frame=frame)
|
||||
if path_from in missing_list:
|
||||
item[u'service_item']._raw_frames.remove(frame)
|
||||
if not item[u'service_item']._raw_frames:
|
||||
item[u'service_item'].remove_frame(frame)
|
||||
if not item[u'service_item'].get_frames():
|
||||
self.serviceItems.remove(item)
|
||||
else:
|
||||
service_item = item[u'service_item'].get_service_repr()
|
||||
|
@ -1350,7 +1350,7 @@ class SlideController(Controller):
|
||||
Respond to the arrival of a media service item
|
||||
"""
|
||||
log.debug(u'SlideController onMediaStart')
|
||||
file = os.path.join(item.get_frame_path(), item.get_frame_title())
|
||||
file = item.get_frame_path()
|
||||
self.mediaController.video(self, file, False, False, self.hideMode())
|
||||
if not self.isLive or self.mediaController.withLivePreview:
|
||||
self.previewDisplay.show()
|
||||
|
@ -329,7 +329,7 @@ class MessageListener(object):
|
||||
item = message[0]
|
||||
log.debug(u'Startup called with message %s' % message)
|
||||
hide_mode = message[2]
|
||||
file = os.path.join(item.get_frame_path(), item.get_frame_title())
|
||||
file = item.get_frame_path()
|
||||
self.handler = item.title
|
||||
if self.handler == self.mediaitem.Automatic:
|
||||
self.handler = self.mediaitem.findControllerByType(file)
|
||||
|
Loading…
Reference in New Issue
Block a user