forked from openlp/openlp
OOS changes
This commit is contained in:
parent
7becc9cb56
commit
594ea63e22
@ -51,6 +51,7 @@ class ServiceItem():
|
|||||||
self.service_frames = []
|
self.service_frames = []
|
||||||
|
|
||||||
def addIcon(self, icon):
|
def addIcon(self, icon):
|
||||||
|
self.icon = icon
|
||||||
self.iconic_representation = buildIcon(icon)
|
self.iconic_representation = buildIcon(icon)
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
@ -76,7 +77,7 @@ class ServiceItem():
|
|||||||
self.frames = self.service_frames
|
self.frames = self.service_frames
|
||||||
self.service_frames = []
|
self.service_frames = []
|
||||||
else:
|
else:
|
||||||
assert(0 , u'Invalid value rendere :%s' % self.service_item_type)
|
log.error(u'Invalid value rendere :%s' % self.service_item_type)
|
||||||
|
|
||||||
def add_from_image(self, frame_title, image):
|
def add_from_image(self, frame_title, image):
|
||||||
self.service_item_type = u'image'
|
self.service_item_type = u'image'
|
||||||
@ -91,14 +92,18 @@ class ServiceItem():
|
|||||||
self.service_item_type = u'command'
|
self.service_item_type = u'command'
|
||||||
self.service_frames.append({u'title': frame_title, u'command': command})
|
self.service_frames.append({u'title': frame_title, u'command': command})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_oos_repr(self):
|
def get_oos_repr(self):
|
||||||
"""
|
"""
|
||||||
This method returns some text which can be saved into the OOS
|
This method returns some text which can be saved into the OOS
|
||||||
file to represent this item
|
file to represent this item
|
||||||
"""
|
"""
|
||||||
pass
|
oos_header = {u'type': self.shortname,u'theme':self.theme, u'title':self.title,
|
||||||
|
u'icon':self.icon, u'footer':self.raw_footer}
|
||||||
|
oos_data = []
|
||||||
|
if self.service_item_type == u'text':
|
||||||
|
for slide in self.service_frames:
|
||||||
|
oos_data.append(slide[u'raw_slide'])
|
||||||
|
return {u'header': oos_header, u'data': oos_data}
|
||||||
|
|
||||||
def set_from_oos(self, oostext):
|
def set_from_oos(self, oostext):
|
||||||
"""
|
"""
|
||||||
@ -106,9 +111,3 @@ class ServiceItem():
|
|||||||
and parses it into the data actually required
|
and parses it into the data actually required
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_from_plugin(self):
|
|
||||||
"""
|
|
||||||
Takes data from the plugin media chooser
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
@ -119,7 +119,10 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def onSaveService(self):
|
def onSaveService(self):
|
||||||
pass
|
service = []
|
||||||
|
for item in self.serviceItems:
|
||||||
|
service.append({u'serviceitem':item[u'data'].get_oos_repr()})
|
||||||
|
print service
|
||||||
|
|
||||||
def onLoadService(self):
|
def onLoadService(self):
|
||||||
pass
|
pass
|
||||||
@ -129,13 +132,13 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.parent.RenderManager.set_service_theme(self.service_theme)
|
self.parent.RenderManager.set_service_theme(self.service_theme)
|
||||||
self.config.set_config(u'theme service theme', self.service_theme)
|
self.config.set_config(u'theme service theme', self.service_theme)
|
||||||
|
|
||||||
def addServiceItem(self, item):
|
def addServiceItem(self, item, expand=True):
|
||||||
self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})
|
self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})
|
||||||
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
|
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
|
||||||
treewidgetitem.setText(0,item.title) # + u':' + item.shortname)
|
treewidgetitem.setText(0,item.title)
|
||||||
treewidgetitem.setIcon(0,item.iconic_representation)
|
treewidgetitem.setIcon(0,item.iconic_representation)
|
||||||
treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(len(self.serviceItems)))
|
treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(len(self.serviceItems)))
|
||||||
treewidgetitem.setExpanded(True)
|
treewidgetitem.setExpanded(expand)
|
||||||
item.render()
|
item.render()
|
||||||
count = 0
|
count = 0
|
||||||
for frame in item.frames:
|
for frame in item.frames:
|
||||||
@ -159,13 +162,14 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
count = 0
|
count = 0
|
||||||
for item in items:
|
for item in items:
|
||||||
childCount = item.childCount()
|
childCount = item.childCount()
|
||||||
if childCount >= 1: # is the parent
|
if childCount >= 1:
|
||||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
else:
|
else:
|
||||||
parentitem = item.parent()
|
parentitem = item.parent()
|
||||||
pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
count = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
count = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
pos = pos - 1 #adjust for zeor indexing
|
#adjuest for zero based arrays
|
||||||
|
pos = pos - 1
|
||||||
return pos, count
|
return pos, count
|
||||||
|
|
||||||
def dragEnterEvent(self, event):
|
def dragEnterEvent(self, event):
|
||||||
@ -184,26 +188,6 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
plugin = event.mimeData().text()
|
plugin = event.mimeData().text()
|
||||||
self.parent.EventManager.post_event(Event(EventType.LoadServiceItem, plugin))
|
self.parent.EventManager.post_event(Event(EventType.LoadServiceItem, plugin))
|
||||||
|
|
||||||
def oos_as_text(self):
|
|
||||||
text=[]
|
|
||||||
log.info( "oos as text")
|
|
||||||
log.info("Data:"+str(self.service_data))
|
|
||||||
for i in self.service_data:
|
|
||||||
text.append("# " + str(i))
|
|
||||||
text.append(i.get_oos_text())
|
|
||||||
return '\n'.join(text)
|
|
||||||
|
|
||||||
def write_oos(self, filename):
|
|
||||||
"""
|
|
||||||
Write a full OOS file out - iterate over plugins and call their respective methods
|
|
||||||
This format is totally arbitrary testing purposes - something sensible needs to go in here!
|
|
||||||
"""
|
|
||||||
oosfile=open(filename, "w")
|
|
||||||
oosfile.write("# BEGIN OOS\n")
|
|
||||||
oosfile.write(self.oos_as_text)
|
|
||||||
oosfile.write("# END OOS\n")
|
|
||||||
oosfile.close()
|
|
||||||
|
|
||||||
def updateThemeList(self, theme_list):
|
def updateThemeList(self, theme_list):
|
||||||
"""
|
"""
|
||||||
Called from ThemeManager when the Themes have changed
|
Called from ThemeManager when the Themes have changed
|
||||||
|
Loading…
Reference in New Issue
Block a user