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:
|
except IndexError:
|
||||||
return u''
|
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
|
Returns the path of the raw frame
|
||||||
"""
|
"""
|
||||||
|
if not frame:
|
||||||
try:
|
try:
|
||||||
return self._raw_frames[row][u'path']
|
frame = self._raw_frames[row]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return u''
|
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):
|
def get_media_time(self):
|
||||||
"""
|
"""
|
||||||
|
@ -349,16 +349,6 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
return self._modified
|
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):
|
def setFileName(self, fileName):
|
||||||
"""
|
"""
|
||||||
Setter for service file.
|
Setter for service file.
|
||||||
@ -504,7 +494,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if not item[u'service_item'].uses_file():
|
if not item[u'service_item'].uses_file():
|
||||||
continue
|
continue
|
||||||
for frame in item[u'service_item'].get_frames():
|
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:
|
if path_from in write_list or path_from in missing_list:
|
||||||
continue
|
continue
|
||||||
if not os.path.exists(path_from):
|
if not os.path.exists(path_from):
|
||||||
@ -532,10 +522,11 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.mainwindow.incrementProgressBar()
|
self.mainwindow.incrementProgressBar()
|
||||||
if item[u'service_item'].uses_file():
|
if item[u'service_item'].uses_file():
|
||||||
for frame in item[u'service_item'].get_frames():
|
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:
|
if path_from in missing_list:
|
||||||
item[u'service_item']._raw_frames.remove(frame)
|
item[u'service_item'].remove_frame(frame)
|
||||||
if not item[u'service_item']._raw_frames:
|
if not item[u'service_item'].get_frames():
|
||||||
self.serviceItems.remove(item)
|
self.serviceItems.remove(item)
|
||||||
else:
|
else:
|
||||||
service_item = item[u'service_item'].get_service_repr()
|
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
|
Respond to the arrival of a media service item
|
||||||
"""
|
"""
|
||||||
log.debug(u'SlideController onMediaStart')
|
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())
|
self.mediaController.video(self, file, False, False, self.hideMode())
|
||||||
if not self.isLive or self.mediaController.withLivePreview:
|
if not self.isLive or self.mediaController.withLivePreview:
|
||||||
self.previewDisplay.show()
|
self.previewDisplay.show()
|
||||||
|
@ -329,7 +329,7 @@ class MessageListener(object):
|
|||||||
item = message[0]
|
item = message[0]
|
||||||
log.debug(u'Startup called with message %s' % message)
|
log.debug(u'Startup called with message %s' % message)
|
||||||
hide_mode = message[2]
|
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
|
self.handler = item.title
|
||||||
if self.handler == self.mediaitem.Automatic:
|
if self.handler == self.mediaitem.Automatic:
|
||||||
self.handler = self.mediaitem.findControllerByType(file)
|
self.handler = self.mediaitem.findControllerByType(file)
|
||||||
|
Loading…
Reference in New Issue
Block a user