forked from openlp/openlp
First add and delete buttons working!
This commit is contained in:
parent
197fe4cb08
commit
d992fb1e07
@ -37,12 +37,12 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
||||||
"""
|
"""
|
||||||
This is the Bible Import Wizard, which allows easy importing of Bibles
|
This is the Song Import Wizard, which allows easy importing of Songs
|
||||||
into OpenLP from other formats like OSIS, CSV and OpenSong.
|
into OpenLP from other formats like OpenLyrics, OpenSong and CCLI.
|
||||||
"""
|
"""
|
||||||
log.info(u'BibleImportForm loaded')
|
log.info(u'SongImportForm loaded')
|
||||||
|
|
||||||
def __init__(self, parent, manager, songsplugin):
|
def __init__(self, parent, manager, plugin):
|
||||||
"""
|
"""
|
||||||
Instantiate the wizard, and run any extra setup we need to.
|
Instantiate the wizard, and run any extra setup we need to.
|
||||||
|
|
||||||
@ -53,10 +53,10 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
The configuration object for storing and retrieving settings.
|
The configuration object for storing and retrieving settings.
|
||||||
|
|
||||||
``manager``
|
``manager``
|
||||||
The Bible manager.
|
The songs manager.
|
||||||
|
|
||||||
``bibleplugin``
|
``plugin``
|
||||||
The Bible plugin.
|
The songs plugin.
|
||||||
"""
|
"""
|
||||||
QtGui.QWizard.__init__(self, parent)
|
QtGui.QWizard.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
@ -64,11 +64,14 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
self.finishButton = self.button(QtGui.QWizard.FinishButton)
|
||||||
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
self.cancelButton = self.button(QtGui.QWizard.CancelButton)
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
self.songsplugin = songsplugin
|
self.plugin = plugin
|
||||||
#self.manager.set_process_dialog(self)
|
#self.manager.set_process_dialog(self)
|
||||||
# QtCore.QObject.connect(self.OsisFileButton,
|
QtCore.QObject.connect(self.OpenLyricsAddButton,
|
||||||
# QtCore.SIGNAL(u'clicked()'),
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
# self.onOsisFileButtonClicked)
|
self.onOpenLyricsAddButtonClicked)
|
||||||
|
QtCore.QObject.connect(self.OpenLyricsRemoveButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
|
self.onOpenLyricsRemoveButtonClicked)
|
||||||
# QtCore.QObject.connect(self.BooksFileButton,
|
# QtCore.QObject.connect(self.BooksFileButton,
|
||||||
# QtCore.SIGNAL(u'clicked()'),
|
# QtCore.SIGNAL(u'clicked()'),
|
||||||
# self.onBooksFileButtonClicked)
|
# self.onBooksFileButtonClicked)
|
||||||
@ -146,6 +149,29 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
# Progress page
|
# Progress page
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def getFiles(self, title, listbox):
|
||||||
|
filenames = QtGui.QFileDialog.getOpenFileNames(self, title,
|
||||||
|
SettingsManager.get_last_dir(self.plugin.settingsSection, 1))
|
||||||
|
if filenames:
|
||||||
|
listbox.addItems(filenames)
|
||||||
|
#SettingsManager.set_last_dir(
|
||||||
|
# self.plugin.settingsSection,
|
||||||
|
# os.path.split(unicode(filenames[0]))[0], 1)
|
||||||
|
|
||||||
|
def removeSelectedItems(self, listbox):
|
||||||
|
for item in listbox.selectedItems():
|
||||||
|
item = listbox.takeItem(listbox.row(item))
|
||||||
|
del item
|
||||||
|
|
||||||
|
def onOpenLyricsAddButtonClicked(self):
|
||||||
|
self.getFiles(
|
||||||
|
translate('SongsPlugin.ImportWizard', 'Select OpenLyrics Files'),
|
||||||
|
self.OpenLyricsFileListWidget
|
||||||
|
)
|
||||||
|
|
||||||
|
def onOpenLyricsRemoveButtonClicked(self):
|
||||||
|
self.removeSelectedItems(self.OpenLyricsFileListWidget)
|
||||||
|
|
||||||
def onCancelButtonClicked(self, checked):
|
def onCancelButtonClicked(self, checked):
|
||||||
"""
|
"""
|
||||||
Stop the import on pressing the cancel button.
|
Stop the import on pressing the cancel button.
|
||||||
|
@ -104,6 +104,8 @@ class Ui_SongImportWizard(object):
|
|||||||
self.OpenLyricsLayout.setMargin(0)
|
self.OpenLyricsLayout.setMargin(0)
|
||||||
self.OpenLyricsLayout.setObjectName(u'OpenLyricsLayout')
|
self.OpenLyricsLayout.setObjectName(u'OpenLyricsLayout')
|
||||||
self.OpenLyricsFileListWidget = QtGui.QListWidget(self.OpenLyricsPage)
|
self.OpenLyricsFileListWidget = QtGui.QListWidget(self.OpenLyricsPage)
|
||||||
|
self.OpenLyricsFileListWidget.setSelectionMode(
|
||||||
|
QtGui.QAbstractItemView.ExtendedSelection)
|
||||||
self.OpenLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget')
|
self.OpenLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget')
|
||||||
self.OpenLyricsLayout.addWidget(self.OpenLyricsFileListWidget)
|
self.OpenLyricsLayout.addWidget(self.OpenLyricsFileListWidget)
|
||||||
self.OpenLyricsButtonLayout = QtGui.QHBoxLayout()
|
self.OpenLyricsButtonLayout = QtGui.QHBoxLayout()
|
||||||
|
Loading…
Reference in New Issue
Block a user