2011-01-23 16:05:46 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# Copyright (c) 2008-2011 Raoul Snyman #
|
|
|
|
# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
|
|
|
|
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
|
|
|
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
|
|
|
# Carsten Tinggaard, Frode Woldsund #
|
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# This program is free software; you can redistribute it and/or modify it #
|
|
|
|
# under the terms of the GNU General Public License as published by the Free #
|
|
|
|
# Software Foundation; version 2 of the License. #
|
|
|
|
# #
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT #
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
|
|
|
# more details. #
|
|
|
|
# #
|
|
|
|
# You should have received a copy of the GNU General Public License along #
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
|
|
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
|
|
|
###############################################################################
|
|
|
|
"""
|
2011-01-27 15:13:11 +00:00
|
|
|
The :mod:`songexportform` module provides the wizard for exporting songs to the
|
|
|
|
OpenLyrics format.
|
2011-01-23 16:05:46 +00:00
|
|
|
"""
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from PyQt4 import QtCore, QtGui
|
|
|
|
|
2011-02-08 17:05:09 +00:00
|
|
|
from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
|
2011-02-03 15:57:36 +00:00
|
|
|
from openlp.core.lib.ui import critical_error_message_box
|
2011-01-23 16:05:46 +00:00
|
|
|
from openlp.core.ui.wizard import OpenLPWizard
|
|
|
|
from openlp.plugins.songs.lib.db import Song
|
|
|
|
from openlp.plugins.songs.lib.openlyricsexport import OpenLyricsExport
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
class SongExportForm(OpenLPWizard):
|
|
|
|
"""
|
2011-01-27 15:13:11 +00:00
|
|
|
This is the Song Export Wizard, which allows easy exporting of Songs to the
|
|
|
|
OpenLyrics format.
|
2011-01-23 16:05:46 +00:00
|
|
|
"""
|
|
|
|
log.info(u'SongExportForm loaded')
|
|
|
|
|
|
|
|
def __init__(self, parent, plugin):
|
|
|
|
"""
|
|
|
|
Instantiate the wizard, and run any extra setup we need to.
|
|
|
|
|
|
|
|
``parent``
|
|
|
|
The QWidget-derived parent of the wizard.
|
|
|
|
|
|
|
|
``plugin``
|
|
|
|
The songs plugin.
|
|
|
|
"""
|
|
|
|
self.plugin = plugin
|
|
|
|
OpenLPWizard.__init__(self, parent, plugin, u'songExportWizard',
|
2011-01-27 15:13:11 +00:00
|
|
|
u':/wizards/wizard_exportsong.bmp')
|
2011-01-24 19:27:59 +00:00
|
|
|
self.stop_export_flag = False
|
|
|
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
|
|
QtCore.SIGNAL(u'openlp_stop_wizard'), self.stop_export)
|
|
|
|
|
|
|
|
def stop_export(self):
|
|
|
|
"""
|
2011-01-26 19:12:14 +00:00
|
|
|
Sets the flag for the exporter to stop the export.
|
2011-01-24 19:27:59 +00:00
|
|
|
"""
|
|
|
|
log.debug(u'Stopping songs export')
|
|
|
|
self.stop_export_flag = True
|
2011-01-23 16:05:46 +00:00
|
|
|
|
|
|
|
def setupUi(self, image):
|
|
|
|
"""
|
|
|
|
Set up the song wizard UI.
|
|
|
|
"""
|
|
|
|
OpenLPWizard.setupUi(self, image)
|
|
|
|
|
|
|
|
def customInit(self):
|
|
|
|
"""
|
|
|
|
Song wizard specific initialisation.
|
|
|
|
"""
|
2011-01-24 19:27:59 +00:00
|
|
|
pass
|
2011-01-23 16:05:46 +00:00
|
|
|
|
|
|
|
def customSignals(self):
|
|
|
|
"""
|
|
|
|
Song wizard specific signals.
|
|
|
|
"""
|
2011-02-09 19:36:13 +00:00
|
|
|
QtCore.QObject.connect(self.availableListWidget,
|
|
|
|
QtCore.SIGNAL(u'itemPressed(QListWidgetItem*)'), self.onItemPressed)
|
|
|
|
QtCore.QObject.connect(self.searchLineEdit,
|
|
|
|
QtCore.SIGNAL(u'textEdited(const QString&)'),
|
|
|
|
self.onSearchLineEditChanged)
|
|
|
|
QtCore.QObject.connect(self.uncheckButton,
|
|
|
|
QtCore.SIGNAL(u'clicked()'), self.onUncheckButtonClicked)
|
|
|
|
QtCore.QObject.connect(self.checkButton,
|
|
|
|
QtCore.SIGNAL(u'clicked()'), self.onCheckButtonClicked)
|
2011-01-27 15:13:11 +00:00
|
|
|
QtCore.QObject.connect(self.directoryButton,
|
|
|
|
QtCore.SIGNAL(u'clicked()'), self.onDirectoryButtonClicked)
|
2011-01-23 16:05:46 +00:00
|
|
|
|
|
|
|
def addCustomPages(self):
|
|
|
|
"""
|
|
|
|
Add song wizard specific pages.
|
|
|
|
"""
|
2011-02-06 17:21:32 +00:00
|
|
|
# The page with all available songs.
|
|
|
|
self.availableSongsPage = QtGui.QWizardPage()
|
|
|
|
self.availableSongsPage.setObjectName(u'availableSongsPage')
|
|
|
|
self.availableSongsLayout = QtGui.QHBoxLayout(self.availableSongsPage)
|
|
|
|
self.availableSongsLayout.setObjectName(u'availableSongsLayout')
|
2011-02-09 19:36:13 +00:00
|
|
|
self.verticalLayout = QtGui.QVBoxLayout()
|
|
|
|
self.verticalLayout.setObjectName(u'verticalLayout')
|
2011-02-06 17:21:32 +00:00
|
|
|
self.availableListWidget = QtGui.QListWidget(self.availableSongsPage)
|
|
|
|
self.availableListWidget.setObjectName(u'availableListWidget')
|
2011-02-09 19:36:13 +00:00
|
|
|
self.verticalLayout.addWidget(self.availableListWidget)
|
|
|
|
self.horizontalLayout = QtGui.QHBoxLayout()
|
|
|
|
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
|
|
|
self.searchLabel = QtGui.QLabel(self.availableSongsPage)
|
|
|
|
self.searchLabel.setObjectName(u'searchLabel')
|
|
|
|
self.horizontalLayout.addWidget(self.searchLabel)
|
|
|
|
self.searchLineEdit = QtGui.QLineEdit(self.availableSongsPage)
|
|
|
|
self.searchLineEdit.setObjectName(u'searchLineEdit')
|
|
|
|
self.horizontalLayout.addWidget(self.searchLineEdit)
|
|
|
|
spacerItem = QtGui.QSpacerItem(40, 20,
|
|
|
|
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
|
|
|
self.horizontalLayout.addItem(spacerItem)
|
|
|
|
self.uncheckButton = QtGui.QPushButton(self.availableSongsPage)
|
|
|
|
self.uncheckButton.setObjectName(u'uncheckButton')
|
|
|
|
self.horizontalLayout.addWidget(self.uncheckButton)
|
|
|
|
self.checkButton = QtGui.QPushButton(self.availableSongsPage)
|
|
|
|
self.checkButton.setObjectName(u'selectButton')
|
|
|
|
self.horizontalLayout.addWidget(self.checkButton)
|
|
|
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
|
|
|
self.availableSongsLayout.addLayout(self.verticalLayout)
|
2011-02-06 17:21:32 +00:00
|
|
|
self.addPage(self.availableSongsPage)
|
|
|
|
# The page with the selected songs.
|
|
|
|
self.exportSongPage = QtGui.QWizardPage()
|
|
|
|
self.exportSongPage.setObjectName(u'availableSongsPage')
|
|
|
|
self.exportSongLayout = QtGui.QHBoxLayout(self.exportSongPage)
|
|
|
|
self.exportSongLayout.setObjectName(u'exportSongLayout')
|
2011-01-27 15:13:11 +00:00
|
|
|
self.gridLayout = QtGui.QGridLayout()
|
|
|
|
self.gridLayout.setObjectName(u'gridLayout')
|
2011-02-06 17:21:32 +00:00
|
|
|
self.selectedListWidget = QtGui.QListWidget(self.exportSongPage)
|
2011-01-27 15:13:11 +00:00
|
|
|
self.selectedListWidget.setObjectName(u'selectedListWidget')
|
2011-02-06 17:21:32 +00:00
|
|
|
self.gridLayout.addWidget(self.selectedListWidget, 1, 0, 1, 1)
|
|
|
|
self.horizontalLayout = QtGui.QHBoxLayout()
|
|
|
|
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
|
|
|
self.directoryLabel = QtGui.QLabel(self.exportSongPage)
|
|
|
|
self.directoryLabel.setObjectName(u'directoryLabel')
|
|
|
|
self.horizontalLayout.addWidget(self.directoryLabel)
|
|
|
|
self.directoryLineEdit = QtGui.QLineEdit(self.exportSongPage)
|
|
|
|
self.directoryLineEdit.setObjectName(u'directoryLineEdit')
|
|
|
|
self.horizontalLayout.addWidget(self.directoryLineEdit)
|
|
|
|
self.directoryButton = QtGui.QToolButton(self.exportSongPage)
|
2011-02-08 17:05:09 +00:00
|
|
|
self.directoryButton.setIcon(build_icon(u':/exports/export_load.png'))
|
2011-01-27 15:13:11 +00:00
|
|
|
self.directoryButton.setObjectName(u'directoryButton')
|
2011-02-06 17:21:32 +00:00
|
|
|
self.horizontalLayout.addWidget(self.directoryButton)
|
|
|
|
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
|
|
|
|
self.exportSongLayout.addLayout(self.gridLayout)
|
|
|
|
self.addPage(self.exportSongPage)
|
2011-01-23 16:05:46 +00:00
|
|
|
|
|
|
|
def retranslateUi(self):
|
|
|
|
"""
|
|
|
|
Song wizard localisation.
|
|
|
|
"""
|
|
|
|
self.setWindowTitle(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Song Export Wizard'))
|
2011-01-23 16:05:46 +00:00
|
|
|
self.titleLabel.setText(
|
2011-02-09 19:36:13 +00:00
|
|
|
u'<span style="font-size:14pt; font-weight:600;">%s</span>' %
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
2011-01-24 19:27:59 +00:00
|
|
|
'Welcome to the Song Export Wizard'))
|
2011-01-23 16:05:46 +00:00
|
|
|
self.informationLabel.setText(
|
2011-02-09 19:36:13 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm', 'This wizard will help to'
|
|
|
|
' export your songs to the open and free OpenLyrics worship song '
|
2011-01-27 15:13:11 +00:00
|
|
|
'format.'))
|
2011-02-06 17:21:32 +00:00
|
|
|
self.availableSongsPage.setTitle(
|
2011-01-24 19:27:59 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Select Songs'))
|
2011-02-06 17:21:32 +00:00
|
|
|
self.availableSongsPage.setSubTitle(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
2011-02-06 17:21:32 +00:00
|
|
|
'Check the songs, you want to export.'))
|
2011-02-09 19:36:13 +00:00
|
|
|
self.searchLabel.setText(
|
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Search:'))
|
|
|
|
self.uncheckButton.setText(
|
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Deselect All'))
|
|
|
|
self.checkButton.setText(
|
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Select All'))
|
2011-02-06 17:21:32 +00:00
|
|
|
self.exportSongPage.setTitle(
|
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Select Directory'))
|
|
|
|
self.exportSongPage.setSubTitle(
|
2011-02-09 19:36:13 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
|
|
|
'Select the directory you want the songs to be saved.'))
|
2011-02-06 17:21:32 +00:00
|
|
|
self.directoryLabel.setText(
|
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Directory:'))
|
2011-01-23 16:05:46 +00:00
|
|
|
self.progressPage.setTitle(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Exporting'))
|
2011-01-23 16:05:46 +00:00
|
|
|
self.progressPage.setSubTitle(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
2011-01-24 19:27:59 +00:00
|
|
|
'Please wait while your songs are exported.'))
|
2011-01-23 16:05:46 +00:00
|
|
|
self.progressLabel.setText(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Ready.'))
|
2011-01-23 16:05:46 +00:00
|
|
|
self.progressBar.setFormat(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm', '%p%'))
|
2011-01-23 16:05:46 +00:00
|
|
|
|
|
|
|
def validateCurrentPage(self):
|
|
|
|
"""
|
|
|
|
Validate the current page before moving on to the next page.
|
|
|
|
"""
|
|
|
|
if self.currentPage() == self.welcomePage:
|
|
|
|
return True
|
2011-02-06 17:21:32 +00:00
|
|
|
elif self.currentPage() == self.availableSongsPage:
|
2011-02-09 19:36:13 +00:00
|
|
|
items = [
|
|
|
|
item for item in self._findListWidgetItems(
|
|
|
|
self.availableListWidget) if item.checkState()
|
|
|
|
]
|
2011-02-08 17:05:09 +00:00
|
|
|
if not items:
|
2011-02-03 15:57:36 +00:00
|
|
|
critical_error_message_box(
|
2011-01-24 19:27:59 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
|
|
|
'No Song Selected'),
|
2011-01-27 15:13:11 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
2011-01-24 19:27:59 +00:00
|
|
|
'You need to add at least one Song to export.'))
|
|
|
|
return False
|
2011-02-06 17:21:32 +00:00
|
|
|
self.selectedListWidget.clear()
|
2011-02-08 17:05:09 +00:00
|
|
|
# Add the songs to the list of selected songs.
|
|
|
|
for item in items:
|
|
|
|
song = QtGui.QListWidgetItem(item.text())
|
|
|
|
song.setData(QtCore.Qt.UserRole,
|
|
|
|
QtCore.QVariant(item.data(QtCore.Qt.UserRole).toPyObject()))
|
|
|
|
song.setFlags(QtCore.Qt.ItemIsEnabled)
|
|
|
|
self.selectedListWidget.addItem(song)
|
2011-02-06 17:21:32 +00:00
|
|
|
return True
|
|
|
|
elif self.currentPage() == self.exportSongPage:
|
|
|
|
if not self.directoryLineEdit.text():
|
2011-02-03 15:57:36 +00:00
|
|
|
critical_error_message_box(
|
2011-01-27 15:13:11 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
|
|
|
'No Save Location specified'),
|
|
|
|
translate('SongsPlugin.ExportWizardForm',
|
|
|
|
'You need to specified a directory to save the songs in.'))
|
|
|
|
return False
|
2011-01-23 16:05:46 +00:00
|
|
|
return True
|
|
|
|
elif self.currentPage() == self.progressPage:
|
2011-01-24 19:27:59 +00:00
|
|
|
self.availableListWidget.clear()
|
|
|
|
self.selectedListWidget.clear()
|
2011-01-23 16:05:46 +00:00
|
|
|
return True
|
|
|
|
|
|
|
|
def registerFields(self):
|
|
|
|
"""
|
|
|
|
Register song export wizard fields.
|
|
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def setDefaults(self):
|
|
|
|
"""
|
|
|
|
Set default form values for the song export wizard.
|
|
|
|
"""
|
|
|
|
self.restart()
|
|
|
|
self.finishButton.setVisible(False)
|
|
|
|
self.cancelButton.setVisible(True)
|
2011-01-27 15:13:11 +00:00
|
|
|
self.availableListWidget.clear()
|
|
|
|
self.selectedListWidget.clear()
|
|
|
|
self.directoryLineEdit.clear()
|
|
|
|
# Load the list of songs.
|
|
|
|
Receiver.send_message(u'cursor_busy')
|
|
|
|
songs = self.plugin.manager.get_all_objects(Song)
|
|
|
|
for song in songs:
|
|
|
|
authors = u', '.join([author.display_name
|
|
|
|
for author in song.authors])
|
2011-02-06 17:21:32 +00:00
|
|
|
title = u'%s (%s)' % (unicode(song.title), authors)
|
2011-02-08 17:05:09 +00:00
|
|
|
item = QtGui.QListWidgetItem(title)
|
|
|
|
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(song))
|
|
|
|
item.setFlags(QtCore.Qt.ItemIsSelectable|
|
2011-02-06 17:21:32 +00:00
|
|
|
QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
|
2011-02-09 19:36:13 +00:00
|
|
|
item.setCheckState(QtCore.Qt.Unchecked)
|
2011-02-08 17:05:09 +00:00
|
|
|
self.availableListWidget.addItem(item)
|
2011-01-27 15:13:11 +00:00
|
|
|
Receiver.send_message(u'cursor_normal')
|
2011-01-23 16:05:46 +00:00
|
|
|
|
|
|
|
def preWizard(self):
|
|
|
|
"""
|
2011-01-27 15:13:11 +00:00
|
|
|
Perform pre export tasks.
|
2011-01-23 16:05:46 +00:00
|
|
|
"""
|
|
|
|
OpenLPWizard.preWizard(self)
|
|
|
|
self.progressLabel.setText(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Starting export...'))
|
2011-01-23 16:05:46 +00:00
|
|
|
Receiver.send_message(u'openlp_process_events')
|
|
|
|
|
|
|
|
def performWizard(self):
|
|
|
|
"""
|
2011-01-27 15:13:11 +00:00
|
|
|
Perform the actual export. This creates an *openlyricsexport* instance
|
|
|
|
and calls the *do_export* method.
|
2011-01-23 16:05:46 +00:00
|
|
|
"""
|
2011-02-09 19:36:13 +00:00
|
|
|
songs = [
|
|
|
|
song.data(QtCore.Qt.UserRole).toPyObject()
|
|
|
|
for song in self._findListWidgetItems(self.selectedListWidget)
|
|
|
|
]
|
2011-01-27 15:13:11 +00:00
|
|
|
exporter = OpenLyricsExport(
|
|
|
|
self, songs, unicode(self.directoryLineEdit.text()))
|
2011-01-23 16:05:46 +00:00
|
|
|
if exporter.do_export():
|
|
|
|
self.progressLabel.setText(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.SongExportForm', 'Finished export.'))
|
2011-01-23 16:05:46 +00:00
|
|
|
else:
|
|
|
|
self.progressLabel.setText(
|
2011-01-23 18:04:38 +00:00
|
|
|
translate('SongsPlugin.SongExportForm',
|
2011-01-23 16:05:46 +00:00
|
|
|
'Your song export failed.'))
|
2011-01-24 19:27:59 +00:00
|
|
|
|
2011-02-09 19:36:13 +00:00
|
|
|
def _findListWidgetItems(self, listWidget, text=u''):
|
|
|
|
"""
|
|
|
|
Returns a list of *QListWidgetItem*s of the ``listWidget``. Note, that
|
|
|
|
hidden items are included.
|
|
|
|
|
|
|
|
``listWidget``
|
|
|
|
The widget to get all items from. (QListWidget)
|
|
|
|
|
|
|
|
``text``
|
|
|
|
The text to search for. (unicode string)
|
|
|
|
"""
|
|
|
|
return [item for item in listWidget.findItems(
|
|
|
|
QtCore.QString(unicode(text)), QtCore.Qt.MatchContains)
|
|
|
|
]
|
|
|
|
|
|
|
|
def onItemPressed(self, item):
|
|
|
|
"""
|
|
|
|
Called, when an item in the *availableListWidget* has been pressed. Thes
|
|
|
|
item is check if it was not checked, whereas it is unchecked when it was
|
|
|
|
checked.
|
|
|
|
|
|
|
|
``item``
|
|
|
|
The *QListWidgetItem* which was pressed.
|
|
|
|
"""
|
|
|
|
return
|
|
|
|
item.setCheckState(
|
|
|
|
QtCore.Qt.Unchecked if item.checkState() else QtCore.Qt.Checked)
|
|
|
|
|
|
|
|
def onSearchLineEditChanged(self, text):
|
|
|
|
"""
|
|
|
|
The *searchLineEdit*'s text has been changed. Update the list of
|
|
|
|
available songs. Note that any song, which does not match the ``text``
|
|
|
|
will be hidden, but not unchecked!
|
|
|
|
|
|
|
|
``text``
|
|
|
|
The text of the *searchLineEdit*. (QString)
|
|
|
|
"""
|
|
|
|
search_result = [
|
|
|
|
song for song in self._findListWidgetItems(
|
|
|
|
self.availableListWidget, unicode(text))
|
|
|
|
]
|
|
|
|
for item in self._findListWidgetItems(self.availableListWidget):
|
|
|
|
item.setHidden(False if item in search_result else True)
|
|
|
|
|
|
|
|
def onUncheckButtonClicked(self):
|
|
|
|
"""
|
|
|
|
The *uncheckButton* has been clicked. Set all songs unchecked.
|
|
|
|
"""
|
|
|
|
for row in range(self.availableListWidget.count()):
|
|
|
|
item = self.availableListWidget.item(row)
|
|
|
|
item.setCheckState(QtCore.Qt.Unchecked)
|
|
|
|
|
|
|
|
def onCheckButtonClicked(self):
|
|
|
|
"""
|
|
|
|
The *checkButton* has been clicked. Set all songs checked.
|
|
|
|
"""
|
|
|
|
for row in range(self.availableListWidget.count()):
|
|
|
|
item = self.availableListWidget.item(row)
|
|
|
|
item.setCheckState(QtCore.Qt.Checked)
|
2011-01-27 15:34:52 +00:00
|
|
|
|
2011-01-27 15:13:11 +00:00
|
|
|
def onDirectoryButtonClicked(self):
|
|
|
|
"""
|
2011-02-03 13:41:42 +00:00
|
|
|
Called when the *directoryButton* was clicked. Opens a dialog and writes
|
2011-01-27 15:13:11 +00:00
|
|
|
the path to *directoryLineEdit*.
|
|
|
|
"""
|
|
|
|
path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
|
|
|
|
translate('SongsPlugin.ExportWizardForm', 'Selecte to Folder'),
|
|
|
|
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
|
|
|
|
options=QtGui.QFileDialog.ShowDirsOnly))
|
|
|
|
SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1)
|
|
|
|
self.directoryLineEdit.setText(path)
|