This commit is contained in:
Tim Bentley 2011-08-22 18:32:18 +01:00
parent d1f823d864
commit 957a86b11e
3 changed files with 15 additions and 6 deletions

View File

@ -228,11 +228,11 @@ class MainDisplay(QtGui.QGraphicsView):
shrinkItem.setVisible(False)
self.setGeometry(self.screen[u'size'])
def directImage(self, name, path):
def directImage(self, name, path, background):
"""
API for replacement backgrounds so Images are added directly to cache
"""
self.imageManager.add_image(name, path)
self.imageManager.add_image(name, path, u'image', background)
if hasattr(self, u'serviceItem'):
self.override[u'image'] = name
self.override[u'theme'] = self.serviceItem.themedata.theme_name

View File

@ -188,9 +188,6 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
html_data.body, classId=u'serviceTitle')
for index, item in enumerate(self.serviceManager.serviceItems):
self._addPreviewItem(html_data.body, item[u'service_item'], index)
# Trigger Audit requests
Receiver.send_message(u'print_service_started',
[item[u'service_item']])
# Add the custom service notes:
if self.footerTextEdit.toPlainText():
div = self._addElement(u'div', parent=html_data.body,
@ -299,6 +296,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
``printer``
A *QPrinter* object.
"""
self.update_song_usage()
self.document.print_(printer)
def displaySizeChanged(self, display):
@ -330,12 +328,14 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
"""
Copies the display text to the clipboard as plain text
"""
self.update_song_usage()
self.mainWindow.clipboard.setText(self.document.toPlainText())
def copyHtmlText(self):
"""
Copies the display text to the clipboard as Html
"""
self.update_song_usage()
self.mainWindow.clipboard.setText(self.document.toHtml())
def printServiceOrder(self):
@ -400,3 +400,9 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
settings.setValue(u'print notes',
QtCore.QVariant(self.notesCheckBox.isChecked()))
settings.endGroup()
def update_song_usage(self):
for index, item in enumerate(self.serviceManager.serviceItems):
# Trigger Audit requests
Receiver.send_message(u'print_service_started',
[item[u'service_item']])

View File

@ -208,13 +208,16 @@ class ImageMediaItem(MediaManagerItem):
if check_item_selected(self.listView,
translate('ImagePlugin.MediaItem',
'You must select an image to replace the background with.')):
background = QtGui.QColor(QtCore.QSettings().value(
self.settingsSection + u'/background color',
QtCore.QVariant(u'#000000')))
item = self.listView.selectedIndexes()[0]
bitem = self.listView.item(item.row())
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename):
(path, name) = os.path.split(filename)
if self.plugin.liveController.display.directImage(name,
filename):
filename, background):
self.resetAction.setVisible(True)
else:
critical_error_message_box(UiStrings().LiveBGError,