This commit is contained in:
Andreas Preikschat 2011-02-04 21:10:32 +01:00
parent 9659eb2a1c
commit 860b1d376b
2 changed files with 117 additions and 5 deletions

View File

@ -42,6 +42,16 @@ class PrintServiceOrderForm(QtGui.QDialog):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi() self.setupUi()
self.retranslateUi() self.retranslateUi()
# Load the settings for this dialog.
settings = QtCore.QSettings()
settings.beginGroup(u'advanced')
self.printSlideTextCheckBox.setChecked(settings.value(
u'print slide text', QtCore.QVariant(False)).toBool())
self.printMetaDataCheckBox.setChecked(settings.value(
u'print file meta data', QtCore.QVariant(False)).toBool())
self.printNotesCheckBox.setChecked(settings.value(
u'print notes', QtCore.QVariant(False)).toBool())
settings.endGroup()
def setupUi(self): def setupUi(self):
self.dialogLayout = QtGui.QHBoxLayout(self) self.dialogLayout = QtGui.QHBoxLayout(self)
@ -63,9 +73,9 @@ class PrintServiceOrderForm(QtGui.QDialog):
self.printNotesCheckBox = QtGui.QCheckBox(self) self.printNotesCheckBox = QtGui.QCheckBox(self)
self.printNotesCheckBox.setObjectName(u'printNotesCheckBox') self.printNotesCheckBox.setObjectName(u'printNotesCheckBox')
self.verticalLayout.addWidget(self.printNotesCheckBox) self.verticalLayout.addWidget(self.printNotesCheckBox)
self.metaDataCheckBox = QtGui.QCheckBox(self) self.printMetaDataCheckBox = QtGui.QCheckBox(self)
self.metaDataCheckBox.setObjectName(u'metaDataCheckBox') self.printMetaDataCheckBox.setObjectName(u'printMetaDataCheckBox')
self.verticalLayout.addWidget(self.metaDataCheckBox) self.verticalLayout.addWidget(self.printMetaDataCheckBox)
self.verticalLayout.addWidget(save_cancel_button_box(self)) self.verticalLayout.addWidget(save_cancel_button_box(self))
self.dialogLayout.addLayout(self.verticalLayout) self.dialogLayout.addLayout(self.verticalLayout)
QtCore.QMetaObject.connectSlotsByName(self) QtCore.QMetaObject.connectSlotsByName(self)
@ -77,7 +87,8 @@ class PrintServiceOrderForm(QtGui.QDialog):
'OpenLP.PrintServiceOrderForm', 'Include slide text if avaialbe')) 'OpenLP.PrintServiceOrderForm', 'Include slide text if avaialbe'))
self.printNotesCheckBox.setText(translate( self.printNotesCheckBox.setText(translate(
'OpenLP.PrintServiceOrderForm', 'Include service item notes')) 'OpenLP.PrintServiceOrderForm', 'Include service item notes'))
self.metaDataCheckBox.setText(translate('OpenLP.PrintServiceOrderForm', self.printMetaDataCheckBox.setText(
translate('OpenLP.PrintServiceOrderForm',
'Include play lenght of media items')) 'Include play lenght of media items'))
self.serviceTitleLabel.setText(translate( self.serviceTitleLabel.setText(translate(
'OpenLP.PrintServiceOrderForm', 'Service Order Title:')) 'OpenLP.PrintServiceOrderForm', 'Service Order Title:'))
@ -118,7 +129,7 @@ class PrintServiceOrderForm(QtGui.QDialog):
text += u'<p><b>%s</b> %s</p>' % (translate( text += u'<p><b>%s</b> %s</p>' % (translate(
'OpenLP.ServiceManager', 'Notes:'), item.notes) 'OpenLP.ServiceManager', 'Notes:'), item.notes)
# Add play length of media files. # Add play length of media files.
if item.is_media() and self.metaDataCheckBox.isChecked(): if item.is_media() and self.printMetaDataCheckBox.isChecked():
path = os.path.join(item.get_frames()[0][u'path'], path = os.path.join(item.get_frames()[0][u'path'],
item.get_frames()[0][u'title']) item.get_frames()[0][u'title'])
if not os.path.isfile(path): if not os.path.isfile(path):
@ -129,4 +140,14 @@ class PrintServiceOrderForm(QtGui.QDialog):
text += u'<p><b>%s</b> %s</p>' % (translate( text += u'<p><b>%s</b> %s</p>' % (translate(
'OpenLP.ServiceManager', u'Playing time:'), 'OpenLP.ServiceManager', u'Playing time:'),
unicode(datetime.timedelta(seconds=length))) unicode(datetime.timedelta(seconds=length)))
# Save the settings for this dialog.
settings = QtCore.QSettings()
settings.beginGroup(u'advanced')
settings.setValue(u'print slide text',
QtCore.QVariant(self.printSlideTextCheckBox.isChecked()))
settings.setValue(u'print file meta data',
QtCore.QVariant(self.printMetaDataCheckBox.isChecked()))
settings.setValue(u'print notes',
QtCore.QVariant(self.printNotesCheckBox.isChecked()))
settings.endGroup()
return text return text

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>321</width>
<height>205</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="serviceTitleLayout">
<item>
<widget class="QLabel" name="serviceTitleLabel">
<property name="text">
<string>Service Title:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="serviceTitleLineEdit"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="printSlideTextCheckBox">
<property name="text">
<string>Include slide text if avaialbe</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printNotesCheckBox">
<property name="text">
<string>Include service item notes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="metaDataCheckBox">
<property name="text">
<string>Include play lenght of media items</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="buttonLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="printButton">
<property name="text">
<string>Print</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>