forked from openlp/openlp
Phase2 Operation Cleanup.
This commit is contained in:
parent
da0acea229
commit
2dfbe1dcfc
@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
OpenLP - Open Source Lyrics Projection
|
OpenLP - Open Source Lyrics Projection
|
||||||
Copyright (c) 2008 Raoul Snyman
|
Copyright (c) 2008 Raoul Snyman
|
||||||
Portions copyright (c) 2008 Martin Thompson, Tim Bentley
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
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
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
@ -22,4 +22,3 @@ from openlp.core.lib.pluginmanager import PluginManager
|
|||||||
|
|
||||||
__all__ = ['SettingsManager', 'PluginManager' ]
|
__all__ = ['SettingsManager', 'PluginManager' ]
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,31 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
import types
|
import types
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
def translate(context, text):
|
||||||
|
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
|
||||||
|
|
||||||
|
def file_to_xml(xmlfile):
|
||||||
|
return open(xmlfile).read()
|
||||||
|
|
||||||
|
def str_to_bool(stringvalue):
|
||||||
|
return stringvalue.strip().lower() in (u'true', u'yes', u'y')
|
||||||
|
|
||||||
|
def buildIcon(icon):
|
||||||
|
ButtonIcon = None
|
||||||
|
if type(icon) is QtGui.QIcon:
|
||||||
|
ButtonIcon = icon
|
||||||
|
elif type(icon) is types.StringType or type(icon) is types.UnicodeType:
|
||||||
|
ButtonIcon = QtGui.QIcon()
|
||||||
|
if icon.startswith(u':/'):
|
||||||
|
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
||||||
|
QtGui.QIcon.Off)
|
||||||
|
else:
|
||||||
|
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QImage(icon)),
|
||||||
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
return ButtonIcon
|
||||||
|
|
||||||
|
|
||||||
from pluginconfig import PluginConfig
|
from pluginconfig import PluginConfig
|
||||||
from plugin import Plugin
|
from plugin import Plugin
|
||||||
from settingstab import SettingsTab
|
from settingstab import SettingsTab
|
||||||
@ -41,27 +66,7 @@ from rendermanager import RenderManager
|
|||||||
# 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder',
|
# 'XmlRootClass', 'ServiceItem', 'Receiver', 'OpenLPToolbar', 'SongXMLBuilder',
|
||||||
# 'SongXMLParser', 'EventManager', 'ThemeXML', 'RenderManager']
|
# 'SongXMLParser', 'EventManager', 'ThemeXML', 'RenderManager']
|
||||||
|
|
||||||
__all__ = [ 'translate', 'fileToXML', 'convertStringToBoolean','buildIcon' ]
|
__all__ = [ 'translate', 'file_to_xml', 'str_to_bool']
|
||||||
|
|
||||||
def translate(context, text):
|
|
||||||
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
|
|
||||||
|
|
||||||
def fileToXML(xmlfile):
|
|
||||||
return open(xmlfile).read()
|
|
||||||
|
|
||||||
def convertStringToBoolean(stringvalue):
|
|
||||||
return stringvalue.strip().lower() in (u'true', u'yes', u'y')
|
|
||||||
|
|
||||||
def buildIcon(icon):
|
|
||||||
ButtonIcon = None
|
|
||||||
if type(icon) is QtGui.QIcon:
|
|
||||||
ButtonIcon = icon
|
|
||||||
elif type(icon) is types.StringType or type(icon) is types.UnicodeType:
|
|
||||||
ButtonIcon = QtGui.QIcon()
|
|
||||||
if icon.startswith(u':/'):
|
|
||||||
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
|
||||||
QtGui.QIcon.Off)
|
|
||||||
else:
|
|
||||||
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QImage(icon)),
|
|
||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
||||||
return ButtonIcon
|
|
||||||
|
@ -22,7 +22,7 @@ from xml.etree.ElementTree import ElementTree, XML, dump
|
|||||||
For XML Schema see wiki.openlp.org
|
For XML Schema see wiki.openlp.org
|
||||||
"""
|
"""
|
||||||
import os, os.path
|
import os, os.path
|
||||||
from openlp import convertStringToBoolean
|
from openlp.core.lib import str_to_bool
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
from xml.etree.ElementTree import ElementTree, XML, dump
|
from xml.etree.ElementTree import ElementTree, XML, dump
|
||||||
|
|
||||||
@ -231,14 +231,14 @@ class ThemeXML():
|
|||||||
master += e[1] + u'_'
|
master += e[1] + u'_'
|
||||||
elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'):
|
elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'):
|
||||||
#print "b", master, element.tag, element.text, e[0], e[1]
|
#print "b", master, element.tag, element.text, e[0], e[1]
|
||||||
et = convertStringToBoolean(element.text)
|
et = str_to_bool(element.text)
|
||||||
setattr(self, master + element.tag , et)
|
setattr(self, master + element.tag , et)
|
||||||
setattr(self, master + element.tag +u'_'+ e[0], e[1])
|
setattr(self, master + element.tag +u'_'+ e[0], e[1])
|
||||||
else:
|
else:
|
||||||
field = master + e[0]
|
field = master + e[0]
|
||||||
e1 = e[1]
|
e1 = e[1]
|
||||||
if e[1] == u'True' or e[1] == u'False':
|
if e[1] == u'True' or e[1] == u'False':
|
||||||
e1 = convertStringToBoolean(e[1])
|
e1 = str_to_bool(e[1])
|
||||||
setattr(self, field, e1)
|
setattr(self, field, e1)
|
||||||
else:
|
else:
|
||||||
#print "c", element.tag, element.text
|
#print "c", element.tag, element.text
|
||||||
|
@ -21,7 +21,7 @@ import logging
|
|||||||
import os, os.path
|
import os, os.path
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import ThemeXML, Renderer, fileToXML, translate
|
from openlp.core.lib import ThemeXML, Renderer, file_to_xml, translate
|
||||||
|
|
||||||
from amendthemedialog import Ui_AmendThemeDialog
|
from amendthemedialog import Ui_AmendThemeDialog
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
|
|||||||
self.theme.parse(self.baseTheme())
|
self.theme.parse(self.baseTheme())
|
||||||
else:
|
else:
|
||||||
xml_file = os.path.join(self.path, theme, theme + u'.xml')
|
xml_file = os.path.join(self.path, theme, theme + u'.xml')
|
||||||
xml = fileToXML(xml_file)
|
xml = file_to_xml(xml_file)
|
||||||
self.theme.parse(xml)
|
self.theme.parse(xml)
|
||||||
self.allowPreview = False
|
self.allowPreview = False
|
||||||
self.paintUi(self.theme)
|
self.paintUi(self.theme)
|
||||||
|
@ -21,8 +21,7 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, RenderManager, Event, EventType, EventManager, translate
|
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, RenderManager, Event, EventType, EventManager, translate, buildIcon
|
||||||
from openlp import buildIcon
|
|
||||||
|
|
||||||
class ServiceManager(QtGui.QWidget):
|
class ServiceManager(QtGui.QWidget):
|
||||||
|
|
||||||
|
@ -21,10 +21,8 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from PyQt4.QtCore import *
|
from PyQt4.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, Event
|
from openlp.core.lib import Plugin, Event, EventType, translate
|
||||||
from openlp.core.lib import EventType
|
|
||||||
|
|
||||||
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
|
||||||
from openlp.plugins.bibles.lib.tables import *
|
from openlp.plugins.bibles.lib.tables import *
|
||||||
@ -59,7 +57,7 @@ class BiblePlugin(Plugin):
|
|||||||
self.ImportBibleItem = QtGui.QAction(import_menu)
|
self.ImportBibleItem = QtGui.QAction(import_menu)
|
||||||
self.ImportBibleItem.setObjectName("ImportBibleItem")
|
self.ImportBibleItem.setObjectName("ImportBibleItem")
|
||||||
import_menu.addAction(self.ImportBibleItem)
|
import_menu.addAction(self.ImportBibleItem)
|
||||||
self.ImportBibleItem.setText(QtGui.QApplication.translate("main_window", "&Bible", None, QtGui.QApplication.UnicodeUTF8))
|
self.ImportBibleItem.setText(translate("BiblePlugin", "&Bible"))
|
||||||
# Signals and slots
|
# Signals and slots
|
||||||
QtCore.QObject.connect(self.ImportBibleItem, QtCore.SIGNAL("triggered()"), self.onBibleNewClick)
|
QtCore.QObject.connect(self.ImportBibleItem, QtCore.SIGNAL("triggered()"), self.onBibleNewClick)
|
||||||
|
|
||||||
@ -67,8 +65,7 @@ class BiblePlugin(Plugin):
|
|||||||
self.ExportBibleItem = QtGui.QAction(export_menu)
|
self.ExportBibleItem = QtGui.QAction(export_menu)
|
||||||
self.ExportBibleItem.setObjectName("ExportBibleItem")
|
self.ExportBibleItem.setObjectName("ExportBibleItem")
|
||||||
export_menu.addAction(self.ExportBibleItem)
|
export_menu.addAction(self.ExportBibleItem)
|
||||||
self.ExportBibleItem.setText(
|
self.ExportBibleItem.setText(translate("BiblePlugin", u'&Bible'))
|
||||||
QtGui.QApplication.translate("main_window", u'&Bible', None, QtGui.QApplication.UnicodeUTF8))
|
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
pass
|
pass
|
||||||
|
@ -20,8 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
from PyQt4 import Qt, QtCore, QtGui
|
from PyQt4 import Qt, QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core import translate
|
from openlp.core.lib import translate, str_to_bool
|
||||||
from openlp import convertStringToBoolean
|
|
||||||
from openlp.core.lib import SettingsTab
|
from openlp.core.lib import SettingsTab
|
||||||
|
|
||||||
class BiblesTab(SettingsTab):
|
class BiblesTab(SettingsTab):
|
||||||
@ -187,11 +186,11 @@ class BiblesTab(SettingsTab):
|
|||||||
self.bible_search = True
|
self.bible_search = True
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
self.paragraph_style = convertStringToBoolean(self.config.get_config(u'paragraph style', u'True'))
|
self.paragraph_style = str_to_bool(self.config.get_config(u'paragraph style', u'True'))
|
||||||
self.show_new_chapters = convertStringToBoolean(self.config.get_config(u'display new chapter', u"False"))
|
self.show_new_chapters = str_to_bool(self.config.get_config(u'display new chapter', u"False"))
|
||||||
self.display_style = int(self.config.get_config(u'display brackets', u'0'))
|
self.display_style = int(self.config.get_config(u'display brackets', u'0'))
|
||||||
self.bible_theme = self.config.get_config(u'bible theme', u'0')
|
self.bible_theme = self.config.get_config(u'bible theme', u'0')
|
||||||
self.bible_search = convertStringToBoolean(self.config.get_config(u'search as type', u'True'))
|
self.bible_search = str_to_bool(self.config.get_config(u'search as type', u'True'))
|
||||||
if self.paragraph_style:
|
if self.paragraph_style:
|
||||||
self.ParagraphRadioButton.setChecked(True)
|
self.ParagraphRadioButton.setChecked(True)
|
||||||
else:
|
else:
|
||||||
|
@ -21,10 +21,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core import translate
|
from openlp.core.lib import ServiceItem, MediaManagerItem, Receiver, translate
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver
|
|
||||||
from openlp.core.lib import ServiceItem
|
|
||||||
|
|
||||||
from openlp.plugins.bibles.forms import BibleImportForm
|
from openlp.plugins.bibles.forms import BibleImportForm
|
||||||
from openlp.plugins.bibles.lib import TextListData
|
from openlp.plugins.bibles.lib import TextListData
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ import os
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core import translate
|
from openlp.core.lib import MediaManagerItem, translate
|
||||||
from openlp.core.lib import MediaManagerItem
|
|
||||||
|
|
||||||
from openlp.plugins.media.lib import MediaTab
|
from openlp.plugins.media.lib import MediaTab
|
||||||
from openlp.plugins.media.lib import FileListData
|
from openlp.plugins.media.lib import FileListData
|
||||||
|
@ -20,9 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core import translate
|
from openlp.core.lib import SettingsTab, str_to_bool, translate
|
||||||
from openlp import convertStringToBoolean
|
|
||||||
from openlp.core.lib import SettingsTab
|
|
||||||
|
|
||||||
class MediaTab(SettingsTab):
|
class MediaTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
@ -67,11 +65,12 @@ class MediaTab(SettingsTab):
|
|||||||
def onVMRCheckBoxChanged(self):
|
def onVMRCheckBoxChanged(self):
|
||||||
use_vmr_mode = self.UseVMRCheckBox.checkState()
|
use_vmr_mode = self.UseVMRCheckBox.checkState()
|
||||||
self.use_vmr_mode = False
|
self.use_vmr_mode = False
|
||||||
if use_vmr_mode == 2: # we have a set value convert to True/False
|
if use_vmr_mode == 2:
|
||||||
|
# we have a set value convert to True/False
|
||||||
self.use_vmr_mode = True
|
self.use_vmr_mode = True
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
self.use_vmr_mode = convertStringToBoolean(self.config.get_config(u'use mode layout', u'False'))
|
self.use_vmr_mode = str_to_bool(self.config.get_config(u'use mode layout', u'False'))
|
||||||
if self.use_vmr_mode :
|
if self.use_vmr_mode :
|
||||||
self.UseVMRCheckBox.setChecked(True)
|
self.UseVMRCheckBox.setChecked(True)
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
import os
|
import os
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.resources import *
|
|
||||||
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
|
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
|
||||||
from openlp.plugins.media.lib import MediaTab,MediaMediaItem
|
from openlp.plugins.media.lib import MediaTab,MediaMediaItem
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user