use build_icon, bug fix

This commit is contained in:
Andreas Preikschat 2011-02-08 18:05:09 +01:00
parent d74e7d1807
commit 9b1a190869
1 changed files with 17 additions and 21 deletions

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.lib import build_icon, Receiver, SettingsManager, translate
from openlp.core.lib.ui import critical_error_message_box from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard from openlp.core.ui.wizard import OpenLPWizard
from openlp.plugins.songs.lib.db import Song from openlp.plugins.songs.lib.db import Song
@ -112,7 +112,6 @@ class SongExportForm(OpenLPWizard):
# self.availableSongsLayout.addLayout(self.gridLayout) # self.availableSongsLayout.addLayout(self.gridLayout)
self.availableSongsLayout.addWidget(self.availableListWidget) self.availableSongsLayout.addWidget(self.availableListWidget)
self.addPage(self.availableSongsPage) self.addPage(self.availableSongsPage)
# The page with the selected songs. # The page with the selected songs.
self.exportSongPage = QtGui.QWizardPage() self.exportSongPage = QtGui.QWizardPage()
self.exportSongPage.setObjectName(u'availableSongsPage') self.exportSongPage.setObjectName(u'availableSongsPage')
@ -132,10 +131,7 @@ class SongExportForm(OpenLPWizard):
self.directoryLineEdit.setObjectName(u'directoryLineEdit') self.directoryLineEdit.setObjectName(u'directoryLineEdit')
self.horizontalLayout.addWidget(self.directoryLineEdit) self.horizontalLayout.addWidget(self.directoryLineEdit)
self.directoryButton = QtGui.QToolButton(self.exportSongPage) self.directoryButton = QtGui.QToolButton(self.exportSongPage)
icon = QtGui.QIcon() self.directoryButton.setIcon(build_icon(u':/exports/export_load.png'))
icon.addPixmap(QtGui.QPixmap(u':/exports/export_load.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.directoryButton.setIcon(icon)
self.directoryButton.setObjectName(u'directoryButton') self.directoryButton.setObjectName(u'directoryButton')
self.horizontalLayout.addWidget(self.directoryButton) self.horizontalLayout.addWidget(self.directoryButton)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
@ -185,10 +181,10 @@ class SongExportForm(OpenLPWizard):
if self.currentPage() == self.welcomePage: if self.currentPage() == self.welcomePage:
return True return True
elif self.currentPage() == self.availableSongsPage: elif self.currentPage() == self.availableSongsPage:
songs = [song for song in self.availableListWidget.findItems( items = [item for item in self.availableListWidget.findItems(
QtCore.QString(u''), QtCore.Qt.MatchContains) QtCore.QString(u''), QtCore.Qt.MatchContains)
if song.checkState() == QtCore.Qt.Checked] if item.checkState() == QtCore.Qt.Checked]
if not songs: if not items:
critical_error_message_box( critical_error_message_box(
translate('SongsPlugin.ExportWizardForm', translate('SongsPlugin.ExportWizardForm',
'No Song Selected'), 'No Song Selected'),
@ -196,13 +192,13 @@ class SongExportForm(OpenLPWizard):
'You need to add at least one Song to export.')) 'You need to add at least one Song to export.'))
return False return False
self.selectedListWidget.clear() self.selectedListWidget.clear()
# Add the songs to the list of selectd songs. # Add the songs to the list of selected songs.
for song in songs: for item in items:
title = song.text() song = QtGui.QListWidgetItem(item.text())
new_song = QtGui.QListWidgetItem(title) song.setData(QtCore.Qt.UserRole,
new_song.setData(QtCore.Qt.UserRole, QtCore.QVariant(song)) QtCore.QVariant(item.data(QtCore.Qt.UserRole).toPyObject()))
new_song.setFlags(QtCore.Qt.ItemIsEnabled) song.setFlags(QtCore.Qt.ItemIsEnabled)
self.selectedListWidget.addItem(new_song) self.selectedListWidget.addItem(song)
return True return True
elif self.currentPage() == self.exportSongPage: elif self.currentPage() == self.exportSongPage:
if not self.directoryLineEdit.text(): if not self.directoryLineEdit.text():
@ -241,12 +237,12 @@ class SongExportForm(OpenLPWizard):
authors = u', '.join([author.display_name authors = u', '.join([author.display_name
for author in song.authors]) for author in song.authors])
title = u'%s (%s)' % (unicode(song.title), authors) title = u'%s (%s)' % (unicode(song.title), authors)
song = QtGui.QListWidgetItem(title) item = QtGui.QListWidgetItem(title)
song.setData(QtCore.Qt.UserRole, QtCore.QVariant(song)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(song))
song.setFlags(QtCore.Qt.ItemIsSelectable| item.setFlags(QtCore.Qt.ItemIsSelectable|
QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
song.setCheckState(QtCore.Qt.Checked) item.setCheckState(QtCore.Qt.Checked)
self.availableListWidget.addItem(song) self.availableListWidget.addItem(item)
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
def preWizard(self): def preWizard(self):