openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #05896
[Merge] lp:~trb143/openlp/bugs into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bugs into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
#693150 Custom Slide Display footer option
https://bugs.launchpad.net/bugs/693150
#693202 delete theme
https://bugs.launchpad.net/bugs/693202
For more details, see:
https://code.launchpad.net/~trb143/openlp/bugs/+merge/47892
Fix Up / Down Confusion
Give SongUsage some TLC and fix UTF8 bugs and better messaging.
Service Items now more meaningful in their titles.
--
https://code.launchpad.net/~trb143/openlp/bugs/+merge/47892
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugs into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2011-01-15 11:56:40 +0000
+++ openlp/core/lib/__init__.py 2011-01-29 09:46:12 +0000
@@ -315,7 +315,7 @@
``dir``
Theme directory to make sure exists
"""
- log.debug(u'check_directory_exists')
+ log.debug(u'check_directory_exists %s' % dir)
if not os.path.exists(dir):
os.makedirs(dir)
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2011-01-22 12:48:16 +0000
+++ openlp/core/lib/serviceitem.py 2011-01-29 09:46:12 +0000
@@ -59,6 +59,7 @@
OnLoadUpdate = 8
AddIfNewItem = 9
ProvidesOwnDisplay = 10
+ AllowsDetailedTitleDisplay = 11
class ServiceItem(object):
@@ -314,6 +315,20 @@
path, text_image[u'title'], text_image[u'image'] )
self._new_item()
+ def get_display_title(self):
+ """
+ Returns the title of the service item.
+ """
+ if self.is_text():
+ return self.title
+ else:
+ if ItemCapabilities.AllowsDetailedTitleDisplay in self.capabilities:
+ return self._raw_frames[0][u'title']
+ elif len(self._raw_frames) > 1:
+ return self.title
+ else:
+ return self._raw_frames[0][u'title']
+
def merge(self, other):
"""
Updates the _uuid with the value from the original one
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2011-01-26 16:05:55 +0000
+++ openlp/core/ui/servicemanager.py 2011-01-29 09:46:12 +0000
@@ -179,7 +179,7 @@
None,
translate('OpenLP.ServiceManager',
'Moves the selection up the window.'),
- self.onMoveSelectionDown, shortcut=QtCore.Qt.Key_Up)
+ self.onMoveSelectionDown, shortcut=QtCore.Qt.Key_Down)
self.serviceManagerList.down.setVisible(False)
self.serviceManagerList.up = self.orderToolbar.addToolbarButton(
translate('OpenLP.ServiceManager', 'Move up'),
@@ -833,7 +833,7 @@
else:
treewidgetitem.setIcon(0,
build_icon(u':/general/general_delete.png'))
- treewidgetitem.setText(0, serviceitem.title)
+ treewidgetitem.setText(0, serviceitem.get_display_title())
treewidgetitem.setToolTip(0, serviceitem.notes)
treewidgetitem.setData(0, QtCore.Qt.UserRole,
QtCore.QVariant(item[u'order']))
@@ -1176,7 +1176,7 @@
for item in self.serviceItems:
service_item = item[u'service_item']
data_item = {}
- data_item[u'title'] = unicode(service_item.title)
+ data_item[u'title'] = unicode(service_item.get_display_title())
data_item[u'plugin'] = unicode(service_item.name)
data_item[u'notes'] = unicode(service_item.notes)
data_item[u'selected'] = (item == curitem)
=== modified file 'openlp/plugins/presentations/lib/mediaitem.py'
--- openlp/plugins/presentations/lib/mediaitem.py 2011-01-22 10:30:19 +0000
+++ openlp/plugins/presentations/lib/mediaitem.py 2011-01-29 09:46:12 +0000
@@ -250,6 +250,7 @@
service_item.title = unicode(self.displayTypeComboBox.currentText())
service_item.shortname = unicode(self.displayTypeComboBox.currentText())
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
+ service_item.add_capability(ItemCapabilities.AllowsDetailedTitleDisplay)
shortname = service_item.shortname
if shortname:
for item in items:
=== modified file 'openlp/plugins/songusage/forms/songusagedeleteform.py'
--- openlp/plugins/songusage/forms/songusagedeleteform.py 2010-12-26 11:04:47 +0000
+++ openlp/plugins/songusage/forms/songusagedeleteform.py 2011-01-29 09:46:12 +0000
@@ -26,7 +26,7 @@
from PyQt4 import QtGui
-from openlp.core.lib import translate
+from openlp.core.lib import translate, Receiver
from openlp.plugins.songusage.lib.db import SongUsageItem
from songusagedeletedialog import Ui_SongUsageDeleteDialog
@@ -55,4 +55,9 @@
deleteDate = self.deleteCalendar.selectedDate().toPyDate()
self.manager.delete_all_objects(SongUsageItem,
SongUsageItem.usagedate <= deleteDate)
- self.close()
\ No newline at end of file
+ Receiver.send_message(u'openlp_information_message', {
+ u'title': translate('SongUsagePlugin.SongUsageDeleteForm',
+ 'Deletion Sucessful'),
+ u'message': translate('SongUsagePlugin.SongUsageDeleteForm',
+ 'All requested data has been deleted sucessfully. ')})
+ self.close()
=== modified file 'openlp/plugins/songusage/forms/songusagedetaildialog.py'
--- openlp/plugins/songusage/forms/songusagedetaildialog.py 2010-12-26 11:04:47 +0000
+++ openlp/plugins/songusage/forms/songusagedetaildialog.py 2011-01-29 09:46:12 +0000
@@ -60,10 +60,12 @@
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.fileLineEdit = QtGui.QLineEdit(self.fileGroupBox)
self.fileLineEdit.setObjectName(u'fileLineEdit')
+ self.fileLineEdit.setReadOnly(True)
+ self.fileLineEdit.setEnabled(False)
self.horizontalLayout.addWidget(self.fileLineEdit)
self.saveFilePushButton = QtGui.QPushButton(self.fileGroupBox)
self.saveFilePushButton.setIcon(
- build_icon(u':/general/general_load.png'))
+ build_icon(u':/general/general_open.png'))
self.saveFilePushButton.setObjectName(u'saveFilePushButton')
self.horizontalLayout.addWidget(self.saveFilePushButton)
self.verticalLayout4.addLayout(self.horizontalLayout)
@@ -96,4 +98,4 @@
translate('SongUsagePlugin.SongUsageDetailForm', 'to'))
self.fileGroupBox.setTitle(
translate('SongUsagePlugin.SongUsageDetailForm',
- 'Report Location'))
\ No newline at end of file
+ 'Report Location'))
=== modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
--- openlp/plugins/songusage/forms/songusagedetailform.py 2010-12-31 02:17:41 +0000
+++ openlp/plugins/songusage/forms/songusagedetailform.py 2011-01-29 09:46:12 +0000
@@ -30,7 +30,8 @@
from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import and_
-from openlp.core.lib import SettingsManager, translate
+from openlp.core.lib import SettingsManager, translate, Receiver, \
+ check_directory_exists
from openlp.plugins.songusage.lib.db import SongUsageItem
from songusagedetaildialog import Ui_SongUsageDetailDialog
@@ -51,49 +52,74 @@
self.setupUi(self)
def initialise(self):
+ """
+ We need to set up the screen
+ """
year = QtCore.QDate().currentDate().year()
if QtCore.QDate().currentDate().month() < 9:
year -= 1
- toDate = QtCore.QDate(year, 8, 31)
- fromDate = QtCore.QDate(year - 1, 9, 1)
+ toDate = QtCore.QSettings().value(
+ u'songusage/to date',
+ QtCore.QVariant(QtCore.QDate(year, 8, 31))).toDate()
+ fromDate = QtCore.QSettings().value(
+ u'songusage/from date',
+ QtCore.QVariant(QtCore.QDate(year - 1, 9, 1))).toDate()
self.fromDate.setSelectedDate(fromDate)
self.toDate.setSelectedDate(toDate)
self.fileLineEdit.setText(
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
def defineOutputLocation(self):
+ """
+ Triggered when the Directory selection button is pressed
+ """
path = QtGui.QFileDialog.getExistingDirectory(self,
translate('SongUsagePlugin.SongUsageDetailForm',
'Output File Location'),
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
path = unicode(path)
- if path != u'':
+ if path:
SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1)
self.fileLineEdit.setText(path)
def accept(self):
- log.debug(u'Detailed report generated')
+ """
+ Ok was pressed so lets save the data and run the report
+ """
+ log.debug(u'accept')
+ path = unicode(self.fileLineEdit.text())
+ check_directory_exists(path)
filename = unicode(translate('SongUsagePlugin.SongUsageDetailForm',
'usage_detail_%s_%s.txt')) % (
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
self.toDate.selectedDate().toString(u'ddMMyyyy'))
+ QtCore.QSettings().setValue(u'songusage/from date',
+ QtCore.QVariant(self.fromDate.selectedDate()))
+ QtCore.QSettings().setValue(u'songusage/to date',
+ QtCore.QVariant(self.toDate.selectedDate()))
usage = self.plugin.manager.get_all_objects(
SongUsageItem, and_(
SongUsageItem.usagedate >= self.fromDate.selectedDate().toPyDate(),
SongUsageItem.usagedate < self.toDate.selectedDate().toPyDate()),
[SongUsageItem.usagedate, SongUsageItem.usagetime])
- outname = os.path.join(unicode(self.fileLineEdit.text()), filename)
- file = None
+ outname = os.path.join(path, filename)
+ fileHandle = None
try:
- file = open(outname, u'w')
+ fileHandle = open(outname, u'w')
for instance in usage:
record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"\n' % (
instance.usagedate, instance.usagetime, instance.title,
instance.copyright, instance.ccl_number, instance.authors)
- file.write(record)
+ fileHandle.write(record.encode(u'utf-8'))
+ Receiver.send_message(u'openlp_information_message', {
+ u'title': translate('SongUsagePlugin.SongUsageDetailForm',
+ 'Report Creation'),
+ u'message': unicode(translate(
+ 'SongUsagePlugin.SongUsageDetailForm', 'Report \n%s \n'
+ 'has been sucessfully created. ')) % outname})
except IOError:
log.exception(u'Failed to write out song usage records')
finally:
- if file:
- file.close()
+ if fileHandle:
+ fileHandle.close()
self.close()