From 190a371f566db0614305bf2ae207bf74e610277d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 21 May 2009 17:07:01 +0100 Subject: [PATCH] More from Operation Cleanup Fix spelling of Maintenance --- openlp/core/ui/amendthemedialog.py | 2 +- openlp/plugins/custom/customplugin.py | 4 +- .../plugins/custom/forms/editcustomdialog.py | 2 +- .../plugins/custom/lib/customserviceitem.py | 17 ++++---- openlp/plugins/custom/lib/customtab.py | 4 +- openlp/plugins/custom/lib/mediaitem.py | 6 +-- openlp/plugins/custom/lib/textlistdata.py | 42 ++++++++----------- openlp/plugins/images/imageplugin.py | 6 +-- openlp/plugins/images/lib/mediaitem.py | 5 +-- openlp/plugins/presentations/lib/mediaitem.py | 4 +- openlp/plugins/songs/lib/mediaitem.py | 4 +- openlp/plugins/songs/lib/songstab.py | 4 +- 12 files changed, 37 insertions(+), 63 deletions(-) diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index 819324eb0..f448ec0c2 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -517,7 +517,7 @@ class Ui_AmendThemeDialog(object): AmendThemeDialog.setTabOrder(self.HorizontalComboBox, self.VerticalComboBox) def retranslateUi(self, AmendThemeDialog): - AmendThemeDialog.setWindowTitle(QtGui.QApplication.translate("AmendThemeDialog", "Theme Maintance", None, QtGui.QApplication.UnicodeUTF8)) + AmendThemeDialog.setWindowTitle(QtGui.QApplication.translate("AmendThemeDialog", "Theme Maintenance", None, QtGui.QApplication.UnicodeUTF8)) self.ThemeNameLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Theme Name:", None, QtGui.QApplication.UnicodeUTF8)) self.BackgroundLabel.setText(QtGui.QApplication.translate("AmendThemeDialog", "Background:", None, QtGui.QApplication.UnicodeUTF8)) self.BackgroundComboBox.setItemText(0, QtGui.QApplication.translate("AmendThemeDialog", "Opaque", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index afa7ec87d..d4b6cd754 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -21,10 +21,8 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.resources import * -from openlp.core.lib import Plugin, Event -from openlp.core.lib import EventType from forms import EditCustomForm +from openlp.core.lib import Plugin, Event, EventType from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem, CustomServiceItem diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index d005054f9..22362f3fd 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -8,7 +8,7 @@ # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui -from openlp.core import translate +from openlp.core.lib import translate class Ui_customEditDialog(object): def setupUi(self, customEditDialog): diff --git a/openlp/plugins/custom/lib/customserviceitem.py b/openlp/plugins/custom/lib/customserviceitem.py index dfd41c246..3fd9d6b6d 100644 --- a/openlp/plugins/custom/lib/customserviceitem.py +++ b/openlp/plugins/custom/lib/customserviceitem.py @@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtCore, QtGui import logging + from openlp.core.lib import ServiceItem from openlp.plugins.custom.lib import TextListData @@ -40,12 +41,12 @@ class CustomServiceItem(ServiceItem): it simply tells the slide controller to use it??? It contains 1 or more images - + """ global log log=logging.getLogger(u'CustomServiceItem') log.info(u'CustomServiceItem loaded') - + def __init__(self, controller): """ Init Method @@ -58,7 +59,7 @@ class CustomServiceItem(ServiceItem): # c.uniformItemSizes=True # c.setModel(self.imgs) # c.setGeometry(0,0,200,200) - + def render(self): """ The render method is what the plugin uses to render its meda to the @@ -66,7 +67,7 @@ class CustomServiceItem(ServiceItem): """ # render the "image chooser first" # for f in self.imgs: -# fl , nm = os.path.split(str(f)) +# fl , nm = os.path.split(str(f)) # c = self.slide_controller.rowCount() # self.slide_controller.setRowCount(c+1) # twi = QtGui.QTableWidgetItem(str(f)) @@ -74,7 +75,7 @@ class CustomServiceItem(ServiceItem): # twi = QtGui.QTableWidgetItem(str(nm)) # self.slide_controller.setItem(c , 1, twi) # self.slide_controller.setRowHeight(c, 80) - + # render the preview screen here def get_parent_node(self): @@ -83,7 +84,7 @@ class CustomServiceItem(ServiceItem): Manager. """ pass - + def add(self, data): """ append an image to the list @@ -95,7 +96,7 @@ class CustomServiceItem(ServiceItem): log.info("add Item..."+str(data)) for filename in data.imgs.get_file_list(): self.add(filename) - + def get_oos_text(self): """ @@ -114,4 +115,4 @@ class CustomServiceItem(ServiceItem): files=text.split('\n') for f in files: self.imgs.addRow(f) - + diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 1f7531e3e..77161ae07 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -20,9 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtCore, QtGui -from openlp.core import translate -from openlp.core.lib import SettingsTab -from openlp.core.resources import * +from openlp.core.lib import SettingsTab, translate class CustomTab(SettingsTab): """ diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 313c2bff4..b81124994 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -21,11 +21,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core import translate -from openlp.core.lib import MediaManagerItem -from openlp.core.lib import SongXMLParser -from openlp.core.lib import ServiceItem - +from openlp.core.lib import MediaManagerItem, SongXMLParser, ServiceItem, translate from openlp.plugins.custom.lib import TextListData class CustomList(QtGui.QListView): diff --git a/openlp/plugins/custom/lib/textlistdata.py b/openlp/plugins/custom/lib/textlistdata.py index 4900aaef1..6774b230c 100644 --- a/openlp/plugins/custom/lib/textlistdata.py +++ b/openlp/plugins/custom/lib/textlistdata.py @@ -1,55 +1,50 @@ import logging -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from PyQt4 import QtCore, QtGui - -class TextListData(QAbstractListModel): +class TextListData(QtCore.QAbstractListModel): """ - An abstract list of strings + An abstract list of strings """ global log log=logging.getLogger(u'TextListData') log.info(u'started') def __init__(self): - QAbstractListModel.__init__(self) + QtCore.QAbstractListModel.__init__(self) self.items=[] # will be a list of (database id , title) tuples def resetStore(self): #reset list so can be reloaded - self.items=[] - + self.items=[] + def rowCount(self, parent): return len(self.items) def insertRow(self, row, id, title): - self.beginInsertRows(QModelIndex(),row,row) - log.debug("insert row %d:%s for id %d"%(row,title, id)) + self.beginInsertRows(QtCore.QModelIndex(),row,row) + log.debug("insert row %d:%s for id %d" % (row,title, id)) self.items.insert(row, (id, title)) self.endInsertRows() def removeRow(self, row): - self.beginRemoveRows(QModelIndex(), row,row) + self.beginRemoveRows(QtCore.QModelIndex(), row,row) self.items.pop(row) self.endRemoveRows() def addRow(self, id, title): self.insertRow(len(self.items), id, title) - + def data(self, index, role): row=index.row() if row > len(self.items): # if the last row is selected and deleted, we then get called with an empty row! - return QVariant() - if role==Qt.DisplayRole: - retval= self.items[row][1] -# elif role == Qt.ToolTipRole: #not sure if need as it shows the database row number -# retval= self.items[row][0] + return QtCore.QVariant() + if role == QtCore.Qt.DisplayRole: + retval = self.items[row][1] else: - retval= QVariant() -# log.info("Returning"+ str(retval)) - if type(retval) is not type(QVariant): - return QVariant(retval) + retval = QtCore.QVariant() + if type(retval) is not type(QtCore.QVariant): + return QtCore.QVariant(retval) else: return retval @@ -60,10 +55,7 @@ class TextListData(QAbstractListModel): def getId(self, index): row = index.row() return self.items[row][0] - + def deleteRow(self, index): row = index.row() self.removeRow(row) - -if __name__=="__main__": - sxml=TextListData() diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 4c9e9a058..47365d054 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -21,14 +21,12 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import Plugin, Event -from openlp.core.lib import EventType - +from openlp.core.lib import Plugin, Event, EventType from openlp.plugins.images.lib import ImageMediaItem, ImageServiceItem class ImagePlugin(Plugin): global log - log=logging.getLogger(u'ImagePlugin') + log = logging.getLogger(u'ImagePlugin') log.info(u'Image Plugin loaded') def __init__(self, plugin_helpers): diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 823cabd0d..67cf86d9f 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -22,10 +22,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core import translate -from openlp.core.lib import MediaManagerItem -from openlp.core.lib import ServiceItem - +from openlp.core.lib import MediaManagerItem, ServiceItem, translate from openlp.plugins.images.lib import ListWithPreviews class ImageList(QtGui.QListView): diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 9e4e6e70e..5901b889a 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -22,9 +22,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core import translate -from openlp.core.lib import MediaManagerItem -from openlp.core.resources import * +from openlp.core.lib import MediaManagerItem, translate from openlp.plugins.presentations.lib import FileListData diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index f52aee184..aaa926d9d 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -21,9 +21,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core import translate -from openlp.core.lib import MediaManagerItem -from openlp.core.resources import * +from openlp.core.lib import MediaManagerItem, translate from openlp.plugins.songs.forms import EditSongForm diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index eee359fd5..e270b97bc 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -20,9 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtCore, QtGui -from openlp.core import translate -from openlp.core.lib import SettingsTab -from openlp.core.resources import * +from openlp.core.lib import SettingsTab, translate class SongsTab(SettingsTab): """