openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #11363
[Merge] lp:~raoul-snyman/openlp/bug-825809 into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-825809 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #825809 in OpenLP: "Extracting Song Usage report crashes"
https://bugs.launchpad.net/openlp/+bug/825809
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-825809/+merge/71770
Fixed bug #825809 where SQLAlchemy 0.7 throws a 'ArgumentError: SQL expression object or string expected' when passed something other than an SQL expression object or a string.
--
https://code.launchpad.net/~raoul-snyman/openlp/bug-825809/+merge/71770
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-825809 into lp:openlp.
=== modified file 'openlp/core/lib/db.py'
--- openlp/core/lib/db.py 2011-06-12 16:02:52 +0000
+++ openlp/core/lib/db.py 2011-08-16 20:00:26 +0000
@@ -223,7 +223,9 @@
query = self.session.query(object_class)
if filter_clause is not None:
query = query.filter(filter_clause)
- if order_by_ref is not None:
+ if isinstance(order_by_ref, list):
+ return query.order_by(*order_by_ref).all()
+ elif order_by_ref is not None:
return query.order_by(order_by_ref).all()
return query.all()
=== modified file 'openlp/plugins/songusage/forms/songusagedeletedialog.py'
--- openlp/plugins/songusage/forms/songusagedeletedialog.py 2011-06-12 16:02:52 +0000
+++ openlp/plugins/songusage/forms/songusagedeletedialog.py 2011-08-16 20:00:26 +0000
@@ -34,26 +34,33 @@
def setupUi(self, songUsageDeleteDialog):
songUsageDeleteDialog.setObjectName(u'songUsageDeleteDialog')
songUsageDeleteDialog.resize(291, 243)
- self.layoutWidget = QtGui.QWidget(songUsageDeleteDialog)
- self.layoutWidget.setGeometry(QtCore.QRect(20, 10, 247, 181))
- self.layoutWidget.setObjectName(u'layoutWidget')
- self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget)
+ self.verticalLayout = QtGui.QVBoxLayout(songUsageDeleteDialog)
+ self.verticalLayout.setSpacing(8)
+ self.verticalLayout.setContentsMargins(8, 8, 8, 8)
self.verticalLayout.setObjectName(u'verticalLayout')
- self.deleteCalendar = QtGui.QCalendarWidget(self.layoutWidget)
+ self.deleteLabel = QtGui.QLabel(songUsageDeleteDialog)
+ self.deleteLabel.setObjectName(u'deleteLabel')
+ self.verticalLayout.addWidget(self.deleteLabel)
+ self.deleteCalendar = QtGui.QCalendarWidget(songUsageDeleteDialog)
self.deleteCalendar.setFirstDayOfWeek(QtCore.Qt.Sunday)
self.deleteCalendar.setGridVisible(True)
self.deleteCalendar.setVerticalHeaderFormat(
QtGui.QCalendarWidget.NoVerticalHeader)
self.deleteCalendar.setObjectName(u'deleteCalendar')
self.verticalLayout.addWidget(self.deleteCalendar)
- self.buttonBox = create_accept_reject_button_box(
- songUsageDeleteDialog, True)
- self.buttonBox.setGeometry(QtCore.QRect(30, 210, 245, 25))
+ self.buttonBox = QtGui.QDialogButtonBox(songUsageDeleteDialog)
+ self.buttonBox.setStandardButtons(
+ QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
self.buttonBox.setObjectName(u'buttonBox')
+ self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(songUsageDeleteDialog)
- QtCore.QMetaObject.connectSlotsByName(songUsageDeleteDialog)
def retranslateUi(self, songUsageDeleteDialog):
songUsageDeleteDialog.setWindowTitle(
translate('SongUsagePlugin.SongUsageDeleteForm',
- 'Delete Song Usage Data'))
+ 'Delete Song Usage Data'))
+ self.deleteLabel.setText(
+ translate('SongUsagePlugin.SongUsageDeleteForm',
+ 'Select the date up to which the song usage data should be '
+ 'deleted. All data recorded before this date will be '
+ 'permanently deleted.'))
=== modified file 'openlp/plugins/songusage/forms/songusagedeleteform.py'
--- openlp/plugins/songusage/forms/songusagedeleteform.py 2011-06-12 16:02:52 +0000
+++ openlp/plugins/songusage/forms/songusagedeleteform.py 2011-08-16 20:00:26 +0000
@@ -25,7 +25,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from PyQt4 import QtGui
+from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, Receiver
from openlp.plugins.songusage.lib.db import SongUsageItem
@@ -42,23 +42,32 @@
self.manager = manager
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
+ QtCore.QObject.connect(
+ self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
+ self.onButtonBoxClicked)
- def accept(self):
- ret = QtGui.QMessageBox.question(self,
- translate('SongUsagePlugin.SongUsageDeleteForm',
- 'Delete Selected Song Usage Events?'),
- translate('SongUsagePlugin.SongUsageDeleteForm',
- 'Are you sure you want to delete selected Song Usage data?'),
- QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok |
- QtGui.QMessageBox.Cancel),
- QtGui.QMessageBox.Cancel)
- if ret == QtGui.QMessageBox.Ok:
- deleteDate = self.deleteCalendar.selectedDate().toPyDate()
- self.manager.delete_all_objects(SongUsageItem,
- SongUsageItem.usagedate <= deleteDate)
- Receiver.send_message(u'openlp_information_message', {
- u'title': translate('SongUsagePlugin.SongUsageDeleteForm',
- 'Deletion Successful'),
- u'message': translate('SongUsagePlugin.SongUsageDeleteForm',
- 'All requested data has been deleted successfully. ')})
- self.close()
+ def onButtonBoxClicked(self, button):
+ if self.buttonBox.standardButton(button) == QtGui.QDialogButtonBox.Ok:
+ ret = QtGui.QMessageBox.question(self,
+ translate('SongUsagePlugin.SongUsageDeleteForm',
+ 'Delete Selected Song Usage Events?'),
+ translate('SongUsagePlugin.SongUsageDeleteForm',
+ 'Are you sure you want to delete selected Song Usage '
+ 'data?'),
+ QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
+ QtGui.QMessageBox.No),
+ QtGui.QMessageBox.No)
+ if ret == QtGui.QMessageBox.Yes:
+ deleteDate = self.deleteCalendar.selectedDate().toPyDate()
+ self.manager.delete_all_objects(SongUsageItem,
+ SongUsageItem.usagedate <= deleteDate)
+ Receiver.send_message(u'openlp_information_message', {
+ u'title': translate('SongUsagePlugin.SongUsageDeleteForm',
+ 'Deletion Successful'),
+ u'message': translate(
+ 'SongUsagePlugin.SongUsageDeleteForm',
+ 'All requested data has been deleted successfully. ')}
+ )
+ self.accept()
+ else:
+ self.reject()
=== modified file 'openlp/plugins/songusage/forms/songusagedetaildialog.py'
--- openlp/plugins/songusage/forms/songusagedetaildialog.py 2011-06-12 16:02:52 +0000
+++ openlp/plugins/songusage/forms/songusagedetaildialog.py 2011-08-16 20:00:26 +0000
@@ -35,12 +35,14 @@
songUsageDetailDialog.setObjectName(u'songUsageDetailDialog')
songUsageDetailDialog.resize(609, 413)
self.verticalLayout = QtGui.QVBoxLayout(songUsageDetailDialog)
+ self.verticalLayout.setSpacing(8)
+ self.verticalLayout.setContentsMargins(8, 8, 8, 8)
self.verticalLayout.setObjectName(u'verticalLayout')
self.dateRangeGroupBox = QtGui.QGroupBox(songUsageDetailDialog)
self.dateRangeGroupBox.setObjectName(u'dateRangeGroupBox')
- self.verticalLayout2 = QtGui.QVBoxLayout(self.dateRangeGroupBox)
- self.verticalLayout2.setObjectName(u'verticalLayout2')
- self.dateHorizontalLayout = QtGui.QHBoxLayout()
+ self.dateHorizontalLayout = QtGui.QHBoxLayout(self.dateRangeGroupBox)
+ self.dateHorizontalLayout.setSpacing(8)
+ self.dateHorizontalLayout.setContentsMargins(8, 8, 8, 8)
self.dateHorizontalLayout.setObjectName(u'dateHorizontalLayout')
self.fromDate = QtGui.QCalendarWidget(self.dateRangeGroupBox)
self.fromDate.setObjectName(u'fromDate')
@@ -53,26 +55,25 @@
self.toDate = QtGui.QCalendarWidget(self.dateRangeGroupBox)
self.toDate.setObjectName(u'toDate')
self.dateHorizontalLayout.addWidget(self.toDate)
- self.verticalLayout2.addLayout(self.dateHorizontalLayout)
+ self.verticalLayout.addWidget(self.dateRangeGroupBox)
self.fileGroupBox = QtGui.QGroupBox(self.dateRangeGroupBox)
self.fileGroupBox.setObjectName(u'fileGroupBox')
- self.verticalLayout4 = QtGui.QVBoxLayout(self.fileGroupBox)
- self.verticalLayout4.setObjectName(u'verticalLayout4')
- self.horizontalLayout = QtGui.QHBoxLayout()
- self.horizontalLayout.setObjectName(u'horizontalLayout')
+ self.fileHorizontalLayout = QtGui.QHBoxLayout(self.fileGroupBox)
+ self.fileHorizontalLayout.setSpacing(8)
+ self.fileHorizontalLayout.setContentsMargins(8, 8, 8, 8)
+ self.fileHorizontalLayout.setObjectName(u'fileHorizontalLayout')
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.fileHorizontalLayout.addWidget(self.fileLineEdit)
self.saveFilePushButton = QtGui.QPushButton(self.fileGroupBox)
+ self.saveFilePushButton.setMaximumWidth(
+ self.saveFilePushButton.size().height())
self.saveFilePushButton.setIcon(
build_icon(u':/general/general_open.png'))
self.saveFilePushButton.setObjectName(u'saveFilePushButton')
- self.horizontalLayout.addWidget(self.saveFilePushButton)
- self.verticalLayout4.addLayout(self.horizontalLayout)
- self.verticalLayout2.addWidget(self.fileGroupBox)
- self.verticalLayout.addWidget(self.dateRangeGroupBox)
+ self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
+ self.verticalLayout.addWidget(self.fileGroupBox)
self.buttonBox = create_accept_reject_button_box(
songUsageDetailDialog, True)
self.verticalLayout.addWidget(self.buttonBox)
=== modified file 'openlp/plugins/songusage/songusageplugin.py'
--- openlp/plugins/songusage/songusageplugin.py 2011-08-02 18:17:07 +0000
+++ openlp/plugins/songusage/songusageplugin.py 2011-08-16 20:00:26 +0000
@@ -96,6 +96,7 @@
self.songUsageActiveButton = QtGui.QToolButton(
self.formparent.statusBar)
self.songUsageActiveButton.setCheckable(True)
+ self.songUsageActiveButton.setAutoRaise(True)
self.songUsageActiveButton.setStatusTip(translate('SongUsagePlugin',
'Toggle the tracking of song usage.'))
self.songUsageActiveButton.setObjectName(u'songUsageActiveButton')
Follow ups