← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~meths/openlp/trivialfixes into lp:openlp

 

Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/87190

Unused imports

Refactor identical search function code.
-- 
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/87190
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2011-12-27 10:33:55 +0000
+++ openlp/core/lib/mediamanageritem.py	2011-12-31 13:58:28 +0000
@@ -35,6 +35,7 @@
 
 from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
     StringContent, build_icon, translate, Receiver, ListWidgetWithDnD
+from openlp.core.lib.searchedit import SearchEdit
 from openlp.core.lib.ui import UiStrings, context_menu_action, \
     context_menu_separator, critical_error_message_box
 
@@ -301,6 +302,40 @@
             QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
             self.contextMenu)
 
+    def addSearchToToolBar(self):
+        """
+        Creates a search field with button and related signal handling.
+        """
+        self.searchWidget = QtGui.QWidget(self)
+        self.searchWidget.setObjectName(u'searchWidget')
+        self.searchLayout = QtGui.QVBoxLayout(self.searchWidget)
+        self.searchLayout.setObjectName(u'searchLayout')
+        self.searchTextLayout = QtGui.QFormLayout()
+        self.searchTextLayout.setObjectName(u'searchTextLayout')
+        self.searchTextLabel = QtGui.QLabel(self.searchWidget)
+        self.searchTextLabel.setObjectName(u'searchTextLabel')
+        self.searchTextEdit = SearchEdit(self.searchWidget)
+        self.searchTextEdit.setObjectName(u'searchTextEdit')
+        self.searchTextLabel.setBuddy(self.searchTextEdit)
+        self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit)
+        self.searchLayout.addLayout(self.searchTextLayout)
+        self.searchButtonLayout = QtGui.QHBoxLayout()
+        self.searchButtonLayout.setObjectName(u'searchButtonLayout')
+        self.searchButtonLayout.addStretch()
+        self.searchTextButton = QtGui.QPushButton(self.searchWidget)
+        self.searchTextButton.setObjectName(u'searchTextButton')
+        self.searchButtonLayout.addWidget(self.searchTextButton)
+        self.searchLayout.addLayout(self.searchButtonLayout)
+        self.pageLayout.addWidget(self.searchWidget)
+        # Signals and slots
+        QtCore.QObject.connect(self.searchTextEdit,
+            QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
+        QtCore.QObject.connect(self.searchTextButton,
+            QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
+        QtCore.QObject.connect(self.searchTextEdit,
+            QtCore.SIGNAL(u'textChanged(const QString&)'),
+            self.onSearchTextEditChanged)
+
     def addCustomContextActions(self):
         """
         Implement this method in your descendent media manager item to

=== modified file 'openlp/plugins/custom/lib/mediaitem.py'
--- openlp/plugins/custom/lib/mediaitem.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/custom/lib/mediaitem.py	2011-12-31 13:58:28 +0000
@@ -33,7 +33,6 @@
 
 from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
     check_item_selected, translate
-from openlp.core.lib.searchedit import SearchEdit
 from openlp.core.lib.ui import UiStrings
 from openlp.plugins.custom.forms import EditCustomForm
 from openlp.plugins.custom.lib import CustomXMLParser
@@ -70,36 +69,9 @@
 
     def addEndHeaderBar(self):
         self.addToolbarSeparator()
-        self.searchWidget = QtGui.QWidget(self)
-        self.searchWidget.setObjectName(u'searchWidget')
-        self.searchLayout = QtGui.QVBoxLayout(self.searchWidget)
-        self.searchLayout.setObjectName(u'searchLayout')
-        self.searchTextLayout = QtGui.QFormLayout()
-        self.searchTextLayout.setObjectName(u'searchTextLayout')
-        self.searchTextLabel = QtGui.QLabel(self.searchWidget)
-        self.searchTextLabel.setObjectName(u'searchTextLabel')
-        self.searchTextEdit = SearchEdit(self.searchWidget)
-        self.searchTextEdit.setObjectName(u'searchTextEdit')
-        self.searchTextLabel.setBuddy(self.searchTextEdit)
-        self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit)
-        self.searchLayout.addLayout(self.searchTextLayout)
-        self.searchButtonLayout = QtGui.QHBoxLayout()
-        self.searchButtonLayout.setObjectName(u'searchButtonLayout')
-        self.searchButtonLayout.addStretch()
-        self.searchTextButton = QtGui.QPushButton(self.searchWidget)
-        self.searchTextButton.setObjectName(u'searchTextButton')
-        self.searchButtonLayout.addWidget(self.searchTextButton)
-        self.searchLayout.addLayout(self.searchButtonLayout)
-        self.pageLayout.addWidget(self.searchWidget)
+        self.addSearchToToolBar()
         # Signals and slots
         QtCore.QObject.connect(self.searchTextEdit,
-            QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
-        QtCore.QObject.connect(self.searchTextButton,
-            QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
-        QtCore.QObject.connect(self.searchTextEdit,
-            QtCore.SIGNAL(u'textChanged(const QString&)'),
-            self.onSearchTextEditChanged)
-        QtCore.QObject.connect(self.searchTextEdit,
             QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
         QtCore.QObject.connect(self.searchTextEdit,
             QtCore.SIGNAL(u'searchTypeChanged(int)'),

=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
--- openlp/plugins/remotes/lib/httpserver.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/remotes/lib/httpserver.py	2011-12-31 13:58:28 +0000
@@ -125,7 +125,6 @@
 from mako.template import Template
 
 from openlp.core.lib import Receiver, PluginStatus, StringContent
-from openlp.core.ui import HideMode
 from openlp.core.utils import AppLocation, translate
 
 log = logging.getLogger(__name__)

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2011-12-31 13:58:28 +0000
@@ -36,7 +36,6 @@
 
 from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
     translate, check_item_selected, PluginStatus
-from openlp.core.lib.searchedit import SearchEdit
 from openlp.core.lib.ui import UiStrings, context_menu_action, \
     context_menu_separator
 from openlp.core.utils import AppLocation
@@ -103,35 +102,8 @@
         ## Song Maintenance Button ##
         self.maintenanceAction = self.addToolbarButton(u'', u'',
             ':/songs/song_maintenance.png', self.onSongMaintenanceClick)
-        self.searchWidget = QtGui.QWidget(self)
-        self.searchWidget.setObjectName(u'searchWidget')
-        self.searchLayout = QtGui.QVBoxLayout(self.searchWidget)
-        self.searchLayout.setObjectName(u'searchLayout')
-        self.searchTextLayout = QtGui.QFormLayout()
-        self.searchTextLayout.setObjectName(u'searchTextLayout')
-        self.searchTextLabel = QtGui.QLabel(self.searchWidget)
-        self.searchTextLabel.setObjectName(u'searchTextLabel')
-        self.searchTextEdit = SearchEdit(self.searchWidget)
-        self.searchTextEdit.setObjectName(u'searchTextEdit')
-        self.searchTextLabel.setBuddy(self.searchTextEdit)
-        self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit)
-        self.searchLayout.addLayout(self.searchTextLayout)
-        self.searchButtonLayout = QtGui.QHBoxLayout()
-        self.searchButtonLayout.setObjectName(u'searchButtonLayout')
-        self.searchButtonLayout.addStretch()
-        self.searchTextButton = QtGui.QPushButton(self.searchWidget)
-        self.searchTextButton.setObjectName(u'searchTextButton')
-        self.searchButtonLayout.addWidget(self.searchTextButton)
-        self.searchLayout.addLayout(self.searchButtonLayout)
-        self.pageLayout.addWidget(self.searchWidget)
+        self.addSearchToToolBar()
         # Signals and slots
-        QtCore.QObject.connect(self.searchTextEdit,
-            QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
-        QtCore.QObject.connect(self.searchTextButton,
-            QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
-        QtCore.QObject.connect(self.searchTextEdit,
-            QtCore.SIGNAL(u'textChanged(const QString&)'),
-            self.onSearchTextEditChanged)
         QtCore.QObject.connect(Receiver.get_receiver(),
             QtCore.SIGNAL(u'songs_load_list'), self.onSongListLoad)
         QtCore.QObject.connect(Receiver.get_receiver(),

=== modified file 'openlp/plugins/songs/lib/upgrade.py'
--- openlp/plugins/songs/lib/upgrade.py	2011-12-27 10:33:55 +0000
+++ openlp/plugins/songs/lib/upgrade.py	2011-12-31 13:58:28 +0000
@@ -33,8 +33,6 @@
 from sqlalchemy.sql.expression import func
 from migrate.changeset.constraint import ForeignKeyConstraint
 
-from openlp.plugins.songs.lib.db import Song
-
 __version__ = 3
 
 def upgrade_setup(metadata):


Follow ups