forked from openlp/openlp
Clean up Song Usage dialog
This commit is contained in:
parent
616684d9ad
commit
0d6e9389b9
@ -34,30 +34,30 @@ from openlp.core.lib.ui import create_button_box
|
|||||||
|
|
||||||
|
|
||||||
class Ui_SongUsageDetailDialog(object):
|
class Ui_SongUsageDetailDialog(object):
|
||||||
def setupUi(self, songUsageDetailDialog):
|
def setupUi(self, song_usage_detail_dialog):
|
||||||
songUsageDetailDialog.setObjectName(u'songUsageDetailDialog')
|
song_usage_detail_dialog.setObjectName(u'song_usage_detail_dialog')
|
||||||
songUsageDetailDialog.resize(609, 413)
|
song_usage_detail_dialog.resize(609, 413)
|
||||||
self.vertical_layout = QtGui.QVBoxLayout(songUsageDetailDialog)
|
self.vertical_layout = QtGui.QVBoxLayout(song_usage_detail_dialog)
|
||||||
self.vertical_layout.setSpacing(8)
|
self.vertical_layout.setSpacing(8)
|
||||||
self.vertical_layout.setContentsMargins(8, 8, 8, 8)
|
self.vertical_layout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.vertical_layout.setObjectName(u'vertical_layout')
|
self.vertical_layout.setObjectName(u'vertical_layout')
|
||||||
self.date_range_group_box = QtGui.QGroupBox(songUsageDetailDialog)
|
self.date_range_group_box = QtGui.QGroupBox(song_usage_detail_dialog)
|
||||||
self.date_range_group_box.setObjectName(u'date_range_group_box')
|
self.date_range_group_box.setObjectName(u'date_range_group_box')
|
||||||
self.date_horizontal_layout = QtGui.QHBoxLayout(self.date_range_group_box)
|
self.date_horizontal_layout = QtGui.QHBoxLayout(self.date_range_group_box)
|
||||||
self.date_horizontal_layout.setSpacing(8)
|
self.date_horizontal_layout.setSpacing(8)
|
||||||
self.date_horizontal_layout.setContentsMargins(8, 8, 8, 8)
|
self.date_horizontal_layout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.date_horizontal_layout.setObjectName(u'date_horizontal_layout')
|
self.date_horizontal_layout.setObjectName(u'date_horizontal_layout')
|
||||||
self.from_date = QtGui.QCalendarWidget(self.date_range_group_box)
|
self.from_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box)
|
||||||
self.from_date.setObjectName(u'from_date')
|
self.from_date_calendar.setObjectName(u'from_date_calendar')
|
||||||
self.date_horizontal_layout.addWidget(self.from_date)
|
self.date_horizontal_layout.addWidget(self.from_date_calendar)
|
||||||
self.to_label = QtGui.QLabel(self.date_range_group_box)
|
self.to_label = QtGui.QLabel(self.date_range_group_box)
|
||||||
self.to_label.setScaledContents(False)
|
self.to_label.setScaledContents(False)
|
||||||
self.to_label.setAlignment(QtCore.Qt.AlignCenter)
|
self.to_label.setAlignment(QtCore.Qt.AlignCenter)
|
||||||
self.to_label.setObjectName(u'to_label')
|
self.to_label.setObjectName(u'to_label')
|
||||||
self.date_horizontal_layout.addWidget(self.to_label)
|
self.date_horizontal_layout.addWidget(self.to_label)
|
||||||
self.to_date = QtGui.QCalendarWidget(self.date_range_group_box)
|
self.to_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box)
|
||||||
self.to_date.setObjectName(u'to_date')
|
self.to_date_calendar.setObjectName(u'to_date_calendar')
|
||||||
self.date_horizontal_layout.addWidget(self.to_date)
|
self.date_horizontal_layout.addWidget(self.to_date_calendar)
|
||||||
self.vertical_layout.addWidget(self.date_range_group_box)
|
self.vertical_layout.addWidget(self.date_range_group_box)
|
||||||
self.file_group_box = QtGui.QGroupBox(self.date_range_group_box)
|
self.file_group_box = QtGui.QGroupBox(self.date_range_group_box)
|
||||||
self.file_group_box.setObjectName(u'file_group_box')
|
self.file_group_box.setObjectName(u'file_group_box')
|
||||||
@ -75,13 +75,13 @@ class Ui_SongUsageDetailDialog(object):
|
|||||||
self.save_file_push_button.setObjectName(u'save_file_push_button')
|
self.save_file_push_button.setObjectName(u'save_file_push_button')
|
||||||
self.file_horizontal_layout.addWidget(self.save_file_push_button)
|
self.file_horizontal_layout.addWidget(self.save_file_push_button)
|
||||||
self.vertical_layout.addWidget(self.file_group_box)
|
self.vertical_layout.addWidget(self.file_group_box)
|
||||||
self.button_box = create_button_box(songUsageDetailDialog, u'button_box', [u'cancel', u'ok'])
|
self.button_box = create_button_box(song_usage_detail_dialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.vertical_layout.addWidget(self.button_box)
|
self.vertical_layout.addWidget(self.button_box)
|
||||||
self.retranslateUi(songUsageDetailDialog)
|
self.retranslateUi(song_usage_detail_dialog)
|
||||||
self.save_file_push_button.clicked.connect(songUsageDetailDialog.define_output_location)
|
self.save_file_push_button.clicked.connect(song_usage_detail_dialog.define_output_location)
|
||||||
|
|
||||||
def retranslateUi(self, songUsageDetailDialog):
|
def retranslateUi(self, song_usage_detail_dialog):
|
||||||
songUsageDetailDialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Song Usage Extraction'))
|
song_usage_detail_dialog.setWindowTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Song Usage Extraction'))
|
||||||
self.date_range_group_box.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Select Date Range'))
|
self.date_range_group_box.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Select Date Range'))
|
||||||
self.to_label.setText(translate('SongUsagePlugin.SongUsageDetailForm', 'to'))
|
self.to_label.setText(translate('SongUsagePlugin.SongUsageDetailForm', 'to'))
|
||||||
self.file_group_box.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Report Location'))
|
self.file_group_box.setTitle(translate('SongUsagePlugin.SongUsageDetailForm', 'Report Location'))
|
||||||
|
@ -58,10 +58,8 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
|||||||
"""
|
"""
|
||||||
We need to set up the screen
|
We need to set up the screen
|
||||||
"""
|
"""
|
||||||
to_date = Settings().value(self.plugin.settingsSection + u'/to date')
|
self.from_date_calendar.setSelectedDate(Settings().value(self.plugin.settingsSection + u'/from date'))
|
||||||
from_date = Settings().value(self.plugin.settingsSection + u'/from date')
|
self.to_date_calendar.setSelectedDate(Settings().value(self.plugin.settingsSection + u'/to date'))
|
||||||
self.from_date.setSelectedDate(from_date)
|
|
||||||
self.to_date.setSelectedDate(to_date)
|
|
||||||
self.file_line_edit.setText(Settings().value(self.plugin.settingsSection + u'/last directory export'))
|
self.file_line_edit.setText(Settings().value(self.plugin.settingsSection + u'/last directory export'))
|
||||||
|
|
||||||
def define_output_location(self):
|
def define_output_location(self):
|
||||||
@ -90,14 +88,14 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
|||||||
return
|
return
|
||||||
check_directory_exists(path)
|
check_directory_exists(path)
|
||||||
file_name = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % (
|
file_name = translate('SongUsagePlugin.SongUsageDetailForm', 'usage_detail_%s_%s.txt') % (
|
||||||
self.from_date.selectedDate().toString(u'ddMMyyyy'),
|
self.from_date_calendar.selectedDate().toString(u'ddMMyyyy'),
|
||||||
self.to_date.selectedDate().toString(u'ddMMyyyy'))
|
self.to_date_calendar.selectedDate().toString(u'ddMMyyyy'))
|
||||||
Settings().setValue(u'songusage/from date', self.from_date.selectedDate())
|
Settings().setValue(self.plugin.settingsSection + u'/from date', self.from_date_calendar.selectedDate())
|
||||||
Settings().setValue(u'songusage/to date', self.to_date.selectedDate())
|
Settings().setValue(self.plugin.settingsSection + u'/to date', self.to_date_calendar.selectedDate())
|
||||||
usage = self.plugin.manager.get_all_objects(
|
usage = self.plugin.manager.get_all_objects(
|
||||||
SongUsageItem, and_(
|
SongUsageItem, and_(
|
||||||
SongUsageItem.usagedate >= self.from_date.selectedDate().toPyDate(),
|
SongUsageItem.usagedate >= self.from_date_calendar.selectedDate().toPyDate(),
|
||||||
SongUsageItem.usagedate < self.to_date.selectedDate().toPyDate()),
|
SongUsageItem.usagedate < self.to_date_calendar.selectedDate().toPyDate()),
|
||||||
[SongUsageItem.usagedate, SongUsageItem.usagetime])
|
[SongUsageItem.usagedate, SongUsageItem.usagetime])
|
||||||
report_file_name = os.path.join(path, file_name)
|
report_file_name = os.path.join(path, file_name)
|
||||||
file_handle = None
|
file_handle = None
|
||||||
|
@ -66,7 +66,7 @@ class SongUsagePlugin(Plugin):
|
|||||||
self.icon = build_icon(u':/plugins/plugin_songusage.png')
|
self.icon = build_icon(u':/plugins/plugin_songusage.png')
|
||||||
self.activeIcon = build_icon(u':/songusage/song_usage_active.png')
|
self.activeIcon = build_icon(u':/songusage/song_usage_active.png')
|
||||||
self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png')
|
self.inactiveIcon = build_icon(u':/songusage/song_usage_inactive.png')
|
||||||
self.songUsageActive = False
|
self.song_usage_active = False
|
||||||
|
|
||||||
def checkPreConditions(self):
|
def checkPreConditions(self):
|
||||||
return self.manager.session is not None
|
return self.manager.session is not None
|
||||||
@ -168,7 +168,7 @@ class SongUsagePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
self.song_usage_active_button.blockSignals(True)
|
self.song_usage_active_button.blockSignals(True)
|
||||||
self.song_usage_status.blockSignals(True)
|
self.song_usage_status.blockSignals(True)
|
||||||
if self.songUsageActive:
|
if self.song_usage_active:
|
||||||
self.song_usage_active_button.setIcon(self.activeIcon)
|
self.song_usage_active_button.setIcon(self.activeIcon)
|
||||||
self.song_usage_status.setChecked(True)
|
self.song_usage_status.setChecked(True)
|
||||||
self.song_usage_active_button.setChecked(True)
|
self.song_usage_active_button.setChecked(True)
|
||||||
@ -195,7 +195,7 @@ class SongUsagePlugin(Plugin):
|
|||||||
|
|
||||||
def _add_song_usage(self, source, item):
|
def _add_song_usage(self, source, item):
|
||||||
audit = item[0].audit
|
audit = item[0].audit
|
||||||
if self.songUsageActive and audit:
|
if self.song_usage_active and audit:
|
||||||
song_usage_item = SongUsageItem()
|
song_usage_item = SongUsageItem()
|
||||||
song_usage_item.usagedate = datetime.today()
|
song_usage_item.usagedate = datetime.today()
|
||||||
song_usage_item.usagetime = datetime.now().time()
|
song_usage_item.usagetime = datetime.now().time()
|
||||||
|
@ -28,7 +28,8 @@ class TestImageManager(TestCase):
|
|||||||
"""
|
"""
|
||||||
Delete all the C++ objects at the end so that we don't have a segfault
|
Delete all the C++ objects at the end so that we don't have a segfault
|
||||||
"""
|
"""
|
||||||
del self.app
|
#del self.app
|
||||||
|
pass
|
||||||
|
|
||||||
def basic_image_manager_test(self):
|
def basic_image_manager_test(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user