forked from openlp/openlp
Dedupe media search
This commit is contained in:
parent
4280e03c47
commit
89f3929bf7
@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
|
from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \
|
||||||
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD
|
StringContent, build_icon, translate, Receiver, ListWidgetWithDnD
|
||||||
|
from openlp.core.lib.searchedit import SearchEdit
|
||||||
from openlp.core.lib.ui import UiStrings, context_menu_action, \
|
from openlp.core.lib.ui import UiStrings, context_menu_action, \
|
||||||
context_menu_separator, critical_error_message_box
|
context_menu_separator, critical_error_message_box
|
||||||
|
|
||||||
@ -301,6 +302,40 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
QtCore.SIGNAL('customContextMenuRequested(QPoint)'),
|
||||||
self.contextMenu)
|
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):
|
def addCustomContextActions(self):
|
||||||
"""
|
"""
|
||||||
Implement this method in your descendent media manager item to
|
Implement this method in your descendent media manager item to
|
||||||
|
@ -33,7 +33,6 @@ from sqlalchemy.sql import or_, func
|
|||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
check_item_selected, translate
|
check_item_selected, translate
|
||||||
from openlp.core.lib.searchedit import SearchEdit
|
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings
|
||||||
from openlp.plugins.custom.forms import EditCustomForm
|
from openlp.plugins.custom.forms import EditCustomForm
|
||||||
from openlp.plugins.custom.lib import CustomXMLParser
|
from openlp.plugins.custom.lib import CustomXMLParser
|
||||||
@ -70,35 +69,8 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def addEndHeaderBar(self):
|
def addEndHeaderBar(self):
|
||||||
self.addToolbarSeparator()
|
self.addToolbarSeparator()
|
||||||
self.searchWidget = QtGui.QWidget(self)
|
self.addSearchToToolBar()
|
||||||
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
|
# 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.QObject.connect(self.searchTextEdit,
|
||||||
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
||||||
QtCore.QObject.connect(self.searchTextEdit,
|
QtCore.QObject.connect(self.searchTextEdit,
|
||||||
|
@ -36,7 +36,6 @@ from sqlalchemy.sql import or_
|
|||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
||||||
translate, check_item_selected, PluginStatus
|
translate, check_item_selected, PluginStatus
|
||||||
from openlp.core.lib.searchedit import SearchEdit
|
|
||||||
from openlp.core.lib.ui import UiStrings, context_menu_action, \
|
from openlp.core.lib.ui import UiStrings, context_menu_action, \
|
||||||
context_menu_separator
|
context_menu_separator
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
@ -103,35 +102,8 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
## Song Maintenance Button ##
|
## Song Maintenance Button ##
|
||||||
self.maintenanceAction = self.addToolbarButton(u'', u'',
|
self.maintenanceAction = self.addToolbarButton(u'', u'',
|
||||||
':/songs/song_maintenance.png', self.onSongMaintenanceClick)
|
':/songs/song_maintenance.png', self.onSongMaintenanceClick)
|
||||||
self.searchWidget = QtGui.QWidget(self)
|
self.addSearchToToolBar()
|
||||||
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
|
# 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.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'songs_load_list'), self.onSongListLoad)
|
QtCore.SIGNAL(u'songs_load_list'), self.onSongListLoad)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
Loading…
Reference in New Issue
Block a user