forked from openlp/openlp
continued with QVariant
This commit is contained in:
parent
b07fab7ff0
commit
b124481ea2
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
import sip
|
import sip
|
||||||
sip.setapi(u'QString', 2)
|
sip.setapi(u'QString', 2)
|
||||||
|
sip.setapi(u'QVariant', 2)
|
||||||
|
|
||||||
from openlp.core import main
|
from openlp.core import main
|
||||||
|
|
||||||
|
@ -64,23 +64,6 @@ class ServiceItemAction(object):
|
|||||||
Next = 3
|
Next = 3
|
||||||
|
|
||||||
|
|
||||||
class MissingTypeConversion(Exception):
|
|
||||||
"""
|
|
||||||
A exception class which is used when a setting is not converted.
|
|
||||||
"""
|
|
||||||
def __init__(self, msg):
|
|
||||||
"""
|
|
||||||
Constructor
|
|
||||||
"""
|
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
"""
|
|
||||||
Returns a string representation.
|
|
||||||
"""
|
|
||||||
return repr(self.msg)
|
|
||||||
|
|
||||||
|
|
||||||
class Settings(QtCore.QSettings):
|
class Settings(QtCore.QSettings):
|
||||||
"""
|
"""
|
||||||
This class customises the ``QSettings`` class. You must use this class
|
This class customises the ``QSettings`` class. You must use this class
|
||||||
@ -109,25 +92,17 @@ class Settings(QtCore.QSettings):
|
|||||||
**Note**, this method only converts a few types and might need to be
|
**Note**, this method only converts a few types and might need to be
|
||||||
extended if a certain type is missing!
|
extended if a certain type is missing!
|
||||||
"""
|
"""
|
||||||
setting = super(Settings, self).value(key, defaultValue)
|
# FIXME
|
||||||
|
if key == u'recent files':
|
||||||
|
return []
|
||||||
|
setting = super(Settings, self).value(key, defaultValue)
|
||||||
# Convert the setting to the correct type.
|
# Convert the setting to the correct type.
|
||||||
if isinstance(defaultValue, bool):
|
if isinstance(defaultValue, bool):
|
||||||
return setting.toBool()
|
return bool(setting)
|
||||||
if isinstance(defaultValue, QtCore.QByteArray):
|
|
||||||
return setting.toByteArray()
|
|
||||||
# Enumerations are also taken care of.
|
# Enumerations are also taken care of.
|
||||||
if isinstance(defaultValue, int):
|
if isinstance(defaultValue, int):
|
||||||
return setting.toInt()[0]
|
return int(setting)
|
||||||
if isinstance(defaultValue, basestring):
|
return setting
|
||||||
return setting.toString()
|
|
||||||
if isinstance(defaultValue, list):
|
|
||||||
return setting.toStringList()
|
|
||||||
if isinstance(defaultValue, QtCore.QPoint):
|
|
||||||
return setting.toPoint()
|
|
||||||
if isinstance(defaultValue, (datetime.date, QtCore.QDate)):
|
|
||||||
return setting.toDate()
|
|
||||||
print u'No!', type(defaultValue)
|
|
||||||
raise MissingTypeConversion(u'Setting could not be converted')
|
|
||||||
|
|
||||||
|
|
||||||
def translate(context, text, comment=None,
|
def translate(context, text, comment=None,
|
||||||
|
@ -622,11 +622,11 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
if item is None:
|
if item is None:
|
||||||
return False
|
return False
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = item.data(QtCore.Qt.UserRole)
|
||||||
else:
|
else:
|
||||||
item_id = remoteItem
|
item_id = remoteItem
|
||||||
else:
|
else:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = item.data(QtCore.Qt.UserRole)
|
||||||
return item_id
|
return item_id
|
||||||
|
|
||||||
def saveAutoSelectId(self):
|
def saveAutoSelectId(self):
|
||||||
@ -637,7 +637,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
if self.autoSelectId == -1:
|
if self.autoSelectId == -1:
|
||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
if item:
|
if item:
|
||||||
self.autoSelectId = item.data(QtCore.Qt.UserRole).toInt()[0]
|
self.autoSelectId = item.data(QtCore.Qt.UserRole)
|
||||||
|
|
||||||
def search(self, string, showError=True):
|
def search(self, string, showError=True):
|
||||||
"""
|
"""
|
||||||
|
@ -121,7 +121,7 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
"""
|
"""
|
||||||
menu = self.menuButton.menu()
|
menu = self.menuButton.menu()
|
||||||
for action in menu.actions():
|
for action in menu.actions():
|
||||||
if identifier == action.data().toInt()[0]:
|
if identifier == action.data():
|
||||||
# setPlaceholderText has been implemented in Qt 4.7 and in at
|
# setPlaceholderText has been implemented in Qt 4.7 and in at
|
||||||
# least PyQt 4.9 (I am not sure, if it was implemented in
|
# least PyQt 4.9 (I am not sure, if it was implemented in
|
||||||
# PyQt 4.8).
|
# PyQt 4.8).
|
||||||
@ -209,7 +209,7 @@ class SearchEdit(QtGui.QLineEdit):
|
|||||||
for action in self.menuButton.menu().actions():
|
for action in self.menuButton.menu().actions():
|
||||||
action.setChecked(False)
|
action.setChecked(False)
|
||||||
self.menuButton.setDefaultAction(sender)
|
self.menuButton.setDefaultAction(sender)
|
||||||
self._currentSearchType = sender.data().toInt()[0]
|
self._currentSearchType = sender.data()
|
||||||
# setPlaceholderText has been implemented in Qt 4.7 and in at least
|
# setPlaceholderText has been implemented in Qt 4.7 and in at least
|
||||||
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
|
# PyQt 4.9 (I am not sure, if it was implemented in PyQt 4.8).
|
||||||
try:
|
try:
|
||||||
|
@ -407,9 +407,9 @@ class WebkitPlayer(MediaPlayer):
|
|||||||
controller = display.controller
|
controller = display.controller
|
||||||
if controller.media_info.is_flash:
|
if controller.media_info.is_flash:
|
||||||
currentTime = display.frame.evaluateJavaScript( \
|
currentTime = display.frame.evaluateJavaScript( \
|
||||||
u'show_flash("currentTime");').toInt()[0]
|
u'show_flash("currentTime");')
|
||||||
length = display.frame.evaluateJavaScript( \
|
length = display.frame.evaluateJavaScript( \
|
||||||
u'show_flash("length");').toInt()[0]
|
u'show_flash("length");')
|
||||||
else:
|
else:
|
||||||
if display.frame.evaluateJavaScript( \
|
if display.frame.evaluateJavaScript( \
|
||||||
u'show_video("isEnded");').toString() == 'true':
|
u'show_video("isEnded");').toString() == 'true':
|
||||||
|
@ -737,9 +737,9 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if item is None:
|
if item is None:
|
||||||
return
|
return
|
||||||
if item.parent():
|
if item.parent():
|
||||||
pos = item.parent().data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = item.parent().data(0, QtCore.Qt.UserRole)
|
||||||
else:
|
else:
|
||||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = item.data(0, QtCore.Qt.UserRole)
|
||||||
serviceItem = self.serviceItems[pos - 1]
|
serviceItem = self.serviceItems[pos - 1]
|
||||||
self.editAction.setVisible(False)
|
self.editAction.setVisible(False)
|
||||||
self.maintainAction.setVisible(False)
|
self.maintainAction.setVisible(False)
|
||||||
@ -841,7 +841,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
while serviceIterator.value():
|
while serviceIterator.value():
|
||||||
if serviceIterator.value() == selected:
|
if serviceIterator.value() == selected:
|
||||||
if message == u'last slide' and prevItemLastSlide:
|
if message == u'last slide' and prevItemLastSlide:
|
||||||
pos = prevItem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = prevItem.data(0, QtCore.Qt.UserRole)
|
||||||
check_expanded = self.serviceItems[pos - 1][u'expanded']
|
check_expanded = self.serviceItems[pos - 1][u'expanded']
|
||||||
self.serviceManagerList.setCurrentItem(prevItemLastSlide)
|
self.serviceManagerList.setCurrentItem(prevItemLastSlide)
|
||||||
if not check_expanded:
|
if not check_expanded:
|
||||||
@ -908,7 +908,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
Record if an item is collapsed. Used when repainting the list to get the
|
Record if an item is collapsed. Used when repainting the list to get the
|
||||||
correct state.
|
correct state.
|
||||||
"""
|
"""
|
||||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = item.data(0, QtCore.Qt.UserRole)
|
||||||
self.serviceItems[pos - 1][u'expanded'] = False
|
self.serviceItems[pos - 1][u'expanded'] = False
|
||||||
|
|
||||||
def onExpandAll(self):
|
def onExpandAll(self):
|
||||||
@ -924,7 +924,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
Record if an item is collapsed. Used when repainting the list to get the
|
Record if an item is collapsed. Used when repainting the list to get the
|
||||||
correct state.
|
correct state.
|
||||||
"""
|
"""
|
||||||
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = item.data(0, QtCore.Qt.UserRole)
|
||||||
self.serviceItems[pos - 1][u'expanded'] = True
|
self.serviceItems[pos - 1][u'expanded'] = True
|
||||||
|
|
||||||
def onServiceTop(self):
|
def onServiceTop(self):
|
||||||
@ -1133,10 +1133,9 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
serviceIterator += 1
|
serviceIterator += 1
|
||||||
if selectedItem is not None:
|
if selectedItem is not None:
|
||||||
if selectedItem.parent() is None:
|
if selectedItem.parent() is None:
|
||||||
pos = selectedItem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
pos = selectedItem.data(0, QtCore.Qt.UserRole)
|
||||||
else:
|
else:
|
||||||
pos = selectedItem.parent().data(0, QtCore.Qt.UserRole). \
|
pos = selectedItem.parent().data(0, QtCore.Qt.UserRole)
|
||||||
toInt()[0]
|
|
||||||
self.serviceItems[pos - 1][u'selected'] = True
|
self.serviceItems[pos - 1][u'selected'] = True
|
||||||
tempServiceItems = self.serviceItems
|
tempServiceItems = self.serviceItems
|
||||||
self.serviceManagerList.clear()
|
self.serviceManagerList.clear()
|
||||||
@ -1321,10 +1320,10 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
for item in items:
|
for item in items:
|
||||||
parentitem = item.parent()
|
parentitem = item.parent()
|
||||||
if parentitem is None:
|
if parentitem is None:
|
||||||
serviceItem = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
serviceItem = item.data(0, QtCore.Qt.UserRole)
|
||||||
else:
|
else:
|
||||||
serviceItem = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
serviceItem = parentitem.data(0, QtCore.Qt.UserRole)
|
||||||
serviceItemChild = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
serviceItemChild = item.data(0, QtCore.Qt.UserRole)
|
||||||
# Adjust for zero based arrays.
|
# Adjust for zero based arrays.
|
||||||
serviceItem -= 1
|
serviceItem -= 1
|
||||||
# Only process the first item on the list for this method.
|
# Only process the first item on the list for this method.
|
||||||
@ -1441,9 +1440,9 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
def _getParentItemData(self, item):
|
def _getParentItemData(self, item):
|
||||||
parentitem = item.parent()
|
parentitem = item.parent()
|
||||||
if parentitem is None:
|
if parentitem is None:
|
||||||
return item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
return item.data(0, QtCore.Qt.UserRole)
|
||||||
else:
|
else:
|
||||||
return parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
return parentitem.data(0, QtCore.Qt.UserRole)
|
||||||
|
|
||||||
def printServiceOrder(self):
|
def printServiceOrder(self):
|
||||||
"""
|
"""
|
||||||
|
@ -551,40 +551,34 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
log.debug(u'updateTheme')
|
log.debug(u'updateTheme')
|
||||||
# main page
|
# main page
|
||||||
self.theme.font_main_name = self.mainFontComboBox.currentFont().family()
|
self.theme.font_main_name = self.mainFontComboBox.currentFont().family()
|
||||||
self.theme.font_main_size = self.field(u'mainSizeSpinBox').toInt()[0]
|
self.theme.font_main_size = self.field(u'mainSizeSpinBox')
|
||||||
self.theme.font_main_line_adjustment = \
|
self.theme.font_main_line_adjustment = self.field(u'lineSpacingSpinBox')
|
||||||
self.field(u'lineSpacingSpinBox').toInt()[0]
|
self.theme.font_main_outline_size = self.field(u'outlineSizeSpinBox')
|
||||||
self.theme.font_main_outline_size = \
|
self.theme.font_main_shadow_size = self.field(u'shadowSizeSpinBox')
|
||||||
self.field(u'outlineSizeSpinBox').toInt()[0]
|
|
||||||
self.theme.font_main_shadow_size = \
|
|
||||||
self.field(u'shadowSizeSpinBox').toInt()[0]
|
|
||||||
self.theme.font_main_bold = self.field(u'mainBoldCheckBox').toBool()
|
self.theme.font_main_bold = self.field(u'mainBoldCheckBox').toBool()
|
||||||
|
# FIXME ?
|
||||||
self.theme.font_main_italics = \
|
self.theme.font_main_italics = \
|
||||||
self.field(u'mainItalicsCheckBox').toBool()
|
self.field(u'mainItalicsCheckBox').toBool()
|
||||||
# footer page
|
# footer page
|
||||||
self.theme.font_footer_name = \
|
self.theme.font_footer_name = \
|
||||||
self.footerFontComboBox.currentFont().family()
|
self.footerFontComboBox.currentFont().family()
|
||||||
self.theme.font_footer_size = \
|
self.theme.font_footer_size = self.field(u'footerSizeSpinBox')
|
||||||
self.field(u'footerSizeSpinBox').toInt()[0]
|
|
||||||
# position page
|
# position page
|
||||||
self.theme.font_main_x = self.field(u'mainPositionX').toInt()[0]
|
self.theme.font_main_x = self.field(u'mainPositionX')
|
||||||
self.theme.font_main_y = self.field(u'mainPositionY').toInt()[0]
|
self.theme.font_main_y = self.field(u'mainPositionY')
|
||||||
self.theme.font_main_height = \
|
self.theme.font_main_height = self.field(u'mainPositionHeight')
|
||||||
self.field(u'mainPositionHeight').toInt()[0]
|
self.theme.font_main_width = self.field(u'mainPositionWidth')
|
||||||
self.theme.font_main_width = self.field(u'mainPositionWidth').toInt()[0]
|
#print self.field(u'footerPositionX')
|
||||||
self.theme.font_footer_x = self.field(u'footerPositionX').toInt()[0]
|
self.theme.font_footer_x = self.field(u'footerPositionX')
|
||||||
self.theme.font_footer_y = self.field(u'footerPositionY').toInt()[0]
|
self.theme.font_footer_y = self.field(u'footerPositionY')
|
||||||
self.theme.font_footer_height = \
|
self.theme.font_footer_height = self.field(u'footerPositionHeight')
|
||||||
self.field(u'footerPositionHeight').toInt()[0]
|
self.theme.font_footer_width = self.field(u'footerPositionWidth')
|
||||||
self.theme.font_footer_width = \
|
|
||||||
self.field(u'footerPositionWidth').toInt()[0]
|
|
||||||
# position page
|
# position page
|
||||||
self.theme.display_horizontal_align = \
|
self.theme.display_horizontal_align = \
|
||||||
self.horizontalComboBox.currentIndex()
|
self.horizontalComboBox.currentIndex()
|
||||||
self.theme.display_vertical_align = \
|
self.theme.display_vertical_align = self.verticalComboBox.currentIndex()
|
||||||
self.verticalComboBox.currentIndex()
|
# TODO Check
|
||||||
self.theme.display_slide_transition = \
|
self.theme.display_slide_transition = self.field(u'slideTransition').toBool()
|
||||||
self.field(u'slideTransition').toBool()
|
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
"""
|
"""
|
||||||
|
@ -93,7 +93,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
"""
|
"""
|
||||||
item = self.alertListWidget.currentItem()
|
item = self.alertListWidget.currentItem()
|
||||||
if item:
|
if item:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = item.data(QtCore.Qt.UserRole)
|
||||||
self.manager.delete_object(AlertItem, item_id)
|
self.manager.delete_object(AlertItem, item_id)
|
||||||
row = self.alertListWidget.row(item)
|
row = self.alertListWidget.row(item)
|
||||||
self.alertListWidget.takeItem(row)
|
self.alertListWidget.takeItem(row)
|
||||||
@ -147,7 +147,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
bitem = self.alertListWidget.item(item.row())
|
bitem = self.alertListWidget.item(item.row())
|
||||||
self.triggerAlert(bitem.text())
|
self.triggerAlert(bitem.text())
|
||||||
self.alertTextEdit.setText(bitem.text())
|
self.alertTextEdit.setText(bitem.text())
|
||||||
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
|
self.item_id = bitem.data(QtCore.Qt.UserRole)
|
||||||
self.saveButton.setEnabled(False)
|
self.saveButton.setEnabled(False)
|
||||||
|
|
||||||
def onSingleClick(self):
|
def onSingleClick(self):
|
||||||
@ -158,7 +158,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
|
|||||||
item = self.alertListWidget.selectedIndexes()[0]
|
item = self.alertListWidget.selectedIndexes()[0]
|
||||||
bitem = self.alertListWidget.item(item.row())
|
bitem = self.alertListWidget.item(item.row())
|
||||||
self.alertTextEdit.setText(bitem.text())
|
self.alertTextEdit.setText(bitem.text())
|
||||||
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
|
self.item_id = bitem.data(QtCore.Qt.UserRole)
|
||||||
# If the alert does not contain '<>' we clear the ParameterEdit field.
|
# If the alert does not contain '<>' we clear the ParameterEdit field.
|
||||||
if self.alertTextEdit.text().find(u'<>') == -1:
|
if self.alertTextEdit.text().find(u'<>') == -1:
|
||||||
self.parameterEdit.setText(u'')
|
self.parameterEdit.setText(u'')
|
||||||
|
@ -432,13 +432,13 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
if self.currentPage() == self.welcomePage:
|
if self.currentPage() == self.welcomePage:
|
||||||
return True
|
return True
|
||||||
elif self.currentPage() == self.selectPage:
|
elif self.currentPage() == self.selectPage:
|
||||||
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
|
if self.field(u'source_format') == BibleFormat.OSIS:
|
||||||
if not self.field(u'osis_location').toString():
|
if not self.field(u'osis_location').toString():
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
WizardStrings.YouSpecifyFile % WizardStrings.OSIS)
|
||||||
self.osisFileEdit.setFocus()
|
self.osisFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.CSV:
|
elif self.field(u'source_format') == BibleFormat.CSV:
|
||||||
if not self.field(u'csv_booksfile').toString():
|
if not self.field(u'csv_booksfile').toString():
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -453,19 +453,19 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
'verses to import.'))
|
'verses to import.'))
|
||||||
self.csvVersesEdit.setFocus()
|
self.csvVersesEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == \
|
elif self.field(u'source_format') == \
|
||||||
BibleFormat.OpenSong:
|
BibleFormat.OpenSong:
|
||||||
if not self.field(u'opensong_file').toString():
|
if not self.field(u'opensong_file').toString():
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
WizardStrings.YouSpecifyFile % WizardStrings.OS)
|
||||||
self.openSongFileEdit.setFocus()
|
self.openSongFileEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
elif self.field(u'source_format').toInt()[0] == \
|
elif self.field(u'source_format') == \
|
||||||
BibleFormat.WebDownload:
|
BibleFormat.WebDownload:
|
||||||
self.versionNameEdit.setText(
|
self.versionNameEdit.setText(
|
||||||
self.webTranslationComboBox.currentText())
|
self.webTranslationComboBox.currentText())
|
||||||
return True
|
return True
|
||||||
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
|
elif self.field(u'source_format') == BibleFormat.OpenLP1:
|
||||||
if not self.field(u'openlp1_location').toString():
|
if not self.field(u'openlp1_location').toString():
|
||||||
critical_error_message_box(UiStrings().NFSs,
|
critical_error_message_box(UiStrings().NFSs,
|
||||||
WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
|
WizardStrings.YouSpecifyFile % UiStrings().OLPV1)
|
||||||
@ -643,7 +643,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
Prepare the UI for the import.
|
Prepare the UI for the import.
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
bible_type = self.field(u'source_format').toInt()[0]
|
bible_type = self.field(u'source_format')
|
||||||
if bible_type == BibleFormat.WebDownload:
|
if bible_type == BibleFormat.WebDownload:
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate(
|
||||||
'BiblesPlugin.ImportWizardForm',
|
'BiblesPlugin.ImportWizardForm',
|
||||||
@ -656,7 +656,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
Perform the actual import.
|
Perform the actual import.
|
||||||
"""
|
"""
|
||||||
bible_type = self.field(u'source_format').toInt()[0]
|
bible_type = self.field(u'source_format')
|
||||||
license_version = self.field(u'license_version').toString()
|
license_version = self.field(u'license_version').toString()
|
||||||
license_copyright = self.field(u'license_copyright').toString()
|
license_copyright = self.field(u'license_copyright').toString()
|
||||||
license_permissions = self.field(u'license_permissions').toString()
|
license_permissions = self.field(u'license_permissions').toString()
|
||||||
@ -683,7 +683,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
elif bible_type == BibleFormat.WebDownload:
|
elif bible_type == BibleFormat.WebDownload:
|
||||||
# Import a bible from the web.
|
# Import a bible from the web.
|
||||||
self.progressBar.setMaximum(1)
|
self.progressBar.setMaximum(1)
|
||||||
download_location = self.field(u'web_location').toInt()[0]
|
download_location = self.field(u'web_location')
|
||||||
bible_version = self.webTranslationComboBox.currentText()
|
bible_version = self.webTranslationComboBox.currentText()
|
||||||
bible = self.web_bible_list[download_location][bible_version]
|
bible = self.web_bible_list[download_location][bible_version]
|
||||||
importer = self.manager.import_bible(
|
importer = self.manager.import_bible(
|
||||||
|
@ -160,7 +160,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
||||||
item = self.listView.currentItem()
|
item = self.listView.currentItem()
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = item.data(QtCore.Qt.UserRole)
|
||||||
self.edit_custom_form.loadCustom(item_id, False)
|
self.edit_custom_form.loadCustom(item_id, False)
|
||||||
self.edit_custom_form.exec_()
|
self.edit_custom_form.exec_()
|
||||||
self.autoSelectId = -1
|
self.autoSelectId = -1
|
||||||
@ -184,7 +184,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
return
|
return
|
||||||
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
row_list = [item.row() for item in self.listView.selectedIndexes()]
|
||||||
row_list.sort(reverse=True)
|
row_list.sort(reverse=True)
|
||||||
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
id_list = [(item.data(QtCore.Qt.UserRole))
|
||||||
for item in self.listView.selectedIndexes()]
|
for item in self.listView.selectedIndexes()]
|
||||||
for id in id_list:
|
for id in id_list:
|
||||||
self.plugin.manager.delete_object(CustomSlide, id)
|
self.plugin.manager.delete_object(CustomSlide, id)
|
||||||
|
@ -372,7 +372,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
elif item > 0:
|
elif item > 0:
|
||||||
item_id = (self.authorsComboBox.itemData(item)).toInt()[0]
|
item_id = (self.authorsComboBox.itemData(item))
|
||||||
author = self.manager.get_object(Author, item_id)
|
author = self.manager.get_object(Author, item_id)
|
||||||
if self.authorsListView.findItems(unicode(author.display_name),
|
if self.authorsListView.findItems(unicode(author.display_name),
|
||||||
QtCore.Qt.MatchExactly):
|
QtCore.Qt.MatchExactly):
|
||||||
@ -427,7 +427,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
elif item > 0:
|
elif item > 0:
|
||||||
item_id = (self.topicsComboBox.itemData(item)).toInt()[0]
|
item_id = (self.topicsComboBox.itemData(item))
|
||||||
topic = self.manager.get_object(Topic, item_id)
|
topic = self.manager.get_object(Topic, item_id)
|
||||||
if self.topicsListView.findItems(unicode(topic.name),
|
if self.topicsListView.findItems(unicode(topic.name),
|
||||||
QtCore.Qt.MatchExactly):
|
QtCore.Qt.MatchExactly):
|
||||||
@ -858,12 +858,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.song.authors = []
|
self.song.authors = []
|
||||||
for row in xrange(self.authorsListView.count()):
|
for row in xrange(self.authorsListView.count()):
|
||||||
item = self.authorsListView.item(row)
|
item = self.authorsListView.item(row)
|
||||||
authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
authorId = (item.data(QtCore.Qt.UserRole))
|
||||||
self.song.authors.append(self.manager.get_object(Author, authorId))
|
self.song.authors.append(self.manager.get_object(Author, authorId))
|
||||||
self.song.topics = []
|
self.song.topics = []
|
||||||
for row in xrange(self.topicsListView.count()):
|
for row in xrange(self.topicsListView.count()):
|
||||||
item = self.topicsListView.item(row)
|
item = self.topicsListView.item(row)
|
||||||
topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
topicId = (item.data(QtCore.Qt.UserRole))
|
||||||
self.song.topics.append(self.manager.get_object(Topic, topicId))
|
self.song.topics.append(self.manager.get_object(Topic, topicId))
|
||||||
# Save the song here because we need a valid id for the audio files.
|
# Save the song here because we need a valid id for the audio files.
|
||||||
clean_song(self.manager, self.song)
|
clean_song(self.manager, self.song)
|
||||||
|
@ -741,7 +741,7 @@ class SongImportForm(OpenLPWizard):
|
|||||||
self.finishButton.setVisible(False)
|
self.finishButton.setVisible(False)
|
||||||
self.cancelButton.setVisible(True)
|
self.cancelButton.setVisible(True)
|
||||||
last_import_type = Settings().value(
|
last_import_type = Settings().value(
|
||||||
u'songs/last import type').toInt()[0]
|
u'songs/last import type')
|
||||||
if last_import_type < 0 or \
|
if last_import_type < 0 or \
|
||||||
last_import_type >= self.formatComboBox.count():
|
last_import_type >= self.formatComboBox.count():
|
||||||
last_import_type = 0
|
last_import_type = 0
|
||||||
|
@ -98,7 +98,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
def _getCurrentItemId(self, listWidget):
|
def _getCurrentItemId(self, listWidget):
|
||||||
item = listWidget.currentItem()
|
item = listWidget.currentItem()
|
||||||
if item:
|
if item:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole))
|
||||||
return item_id
|
return item_id
|
||||||
else:
|
else:
|
||||||
return -1
|
return -1
|
||||||
|
@ -381,7 +381,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
log.debug(u'onEditClick')
|
log.debug(u'onEditClick')
|
||||||
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
||||||
self.editItem = self.listView.currentItem()
|
self.editItem = self.listView.currentItem()
|
||||||
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = self.editItem.data(QtCore.Qt.UserRole)
|
||||||
self.editSongForm.loadSong(item_id, False)
|
self.editSongForm.loadSong(item_id, False)
|
||||||
self.editSongForm.exec_()
|
self.editSongForm.exec_()
|
||||||
self.autoSelectId = -1
|
self.autoSelectId = -1
|
||||||
@ -406,7 +406,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
self.plugin.formParent.displayProgressBar(len(items))
|
self.plugin.formParent.displayProgressBar(len(items))
|
||||||
for item in items:
|
for item in items:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = item.data(QtCore.Qt.UserRole)
|
||||||
media_files = self.plugin.manager.get_all_objects(MediaFile,
|
media_files = self.plugin.manager.get_all_objects(MediaFile,
|
||||||
MediaFile.song_id == item_id)
|
MediaFile.song_id == item_id)
|
||||||
for media_file in media_files:
|
for media_file in media_files:
|
||||||
@ -435,7 +435,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
log.debug(u'onCloneClick')
|
log.debug(u'onCloneClick')
|
||||||
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
||||||
self.editItem = self.listView.currentItem()
|
self.editItem = self.listView.currentItem()
|
||||||
item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = self.editItem.data(QtCore.Qt.UserRole)
|
||||||
old_song = self.plugin.manager.get_object(Song, item_id)
|
old_song = self.plugin.manager.get_object(Song, item_id)
|
||||||
song_xml = self.openLyrics.song_to_xml(old_song)
|
song_xml = self.openLyrics.song_to_xml(old_song)
|
||||||
new_song = self.openLyrics.xml_to_song(song_xml)
|
new_song = self.openLyrics.xml_to_song(song_xml)
|
||||||
|
Loading…
Reference in New Issue
Block a user