forked from openlp/openlp
Add Context Menus,
Fix results for Songs. bzr-revno: 253
This commit is contained in:
parent
5d920e8fc6
commit
33c43f8dfe
@ -173,6 +173,7 @@ class BiblePlugin(Plugin):
|
|||||||
self.listView = QtGui.QListWidget()
|
self.listView = QtGui.QListWidget()
|
||||||
self.listView.setGeometry(QtCore.QRect(10, 200, 256, 391))
|
self.listView.setGeometry(QtCore.QRect(10, 200, 256, 391))
|
||||||
self.listView.setObjectName("listView")
|
self.listView.setObjectName("listView")
|
||||||
|
self.listView.setAlternatingRowColors(True)
|
||||||
self.MediaManagerItem.PageLayout.addWidget(self.listView)
|
self.MediaManagerItem.PageLayout.addWidget(self.listView)
|
||||||
|
|
||||||
#QtCore.QObject.connect(self.QuickTab, QtCore.SIGNAL("triggered()"), self.onQuickTabClick)
|
#QtCore.QObject.connect(self.QuickTab, QtCore.SIGNAL("triggered()"), self.onQuickTabClick)
|
||||||
@ -185,7 +186,13 @@ class BiblePlugin(Plugin):
|
|||||||
|
|
||||||
QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.SIGNAL("pressed()"), self.onAdvancedSearchButton)
|
QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.SIGNAL("pressed()"), self.onAdvancedSearchButton)
|
||||||
QtCore.QObject.connect(self.QuickSearchButton, QtCore.SIGNAL("pressed()"), self.onQuickSearchButton)
|
QtCore.QObject.connect(self.QuickSearchButton, QtCore.SIGNAL("pressed()"), self.onQuickSearchButton)
|
||||||
|
|
||||||
|
#define and add the context menu
|
||||||
|
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
|
|
||||||
|
self.listView.addAction(self.pluginutils.add_to_context_menu(self.listView, ':/system/system_preview.png', "&Preview Verse", self.onBiblePreviewClick))
|
||||||
|
self.listView.addAction(self.pluginutils.add_to_context_menu(self.listView, ':/system/system_live.png', "&Show Live", self.onBibleLiveClick))
|
||||||
|
self.listView.addAction(self.pluginutils.add_to_context_menu(self.listView, ':/system/system_add.png', "&Add to Service", self.onBibleAddClick))
|
||||||
return self.MediaManagerItem
|
return self.MediaManagerItem
|
||||||
|
|
||||||
def add_import_menu_item(self, import_menu):
|
def add_import_menu_item(self, import_menu):
|
||||||
|
@ -108,6 +108,8 @@ class SongsPlugin(Plugin):
|
|||||||
self.SongListView = QtGui.QTableWidget()
|
self.SongListView = QtGui.QTableWidget()
|
||||||
self.SongListView.setColumnCount(2)
|
self.SongListView.setColumnCount(2)
|
||||||
self.SongListView.setShowGrid(False)
|
self.SongListView.setShowGrid(False)
|
||||||
|
self.SongListView.setSortingEnabled(False)
|
||||||
|
self.SongListView.setAlternatingRowColors(True)
|
||||||
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["Song Name","Author"]))
|
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["Song Name","Author"]))
|
||||||
self.SongListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
|
self.SongListView.setGeometry(QtCore.QRect(10, 100, 256, 591))
|
||||||
self.SongListView.setObjectName("listView")
|
self.SongListView.setObjectName("listView")
|
||||||
@ -116,23 +118,16 @@ class SongsPlugin(Plugin):
|
|||||||
QtCore.QObject.connect(self.SearchTextButton, QtCore.SIGNAL("pressed()"), self.onSearchTextButton)
|
QtCore.QObject.connect(self.SearchTextButton, QtCore.SIGNAL("pressed()"), self.onSearchTextButton)
|
||||||
QtCore.QObject.connect(self.ClearTextButton, QtCore.SIGNAL("pressed()"), self.onClearTextButton)
|
QtCore.QObject.connect(self.ClearTextButton, QtCore.SIGNAL("pressed()"), self.onClearTextButton)
|
||||||
QtCore.QObject.connect(self.SearchTextEdit, QtCore.SIGNAL("textChanged(const QString&)"), self.onSearchTextEdit)
|
QtCore.QObject.connect(self.SearchTextEdit, QtCore.SIGNAL("textChanged(const QString&)"), self.onSearchTextEdit)
|
||||||
|
|
||||||
editAct = QtGui.QAction("&Edit", self.SongListView)
|
|
||||||
QtCore.QObject.connect(editAct, QtCore.SIGNAL("triggered()"), self.onSongEditClick)
|
|
||||||
prevAct = QtGui.QAction("&Preview", self.SongListView)
|
|
||||||
QtCore.QObject.connect(prevAct, QtCore.SIGNAL("triggered()"), self.onSongPreviewClick)
|
|
||||||
liveAct = QtGui.QAction("&Live", self.SongListView)
|
|
||||||
QtCore.QObject.connect(liveAct, QtCore.SIGNAL("triggered()"), self.onSongLiveClick)
|
|
||||||
serviceAct = QtGui.QAction("&Service", self.SongListView)
|
|
||||||
QtCore.QObject.connect(serviceAct, QtCore.SIGNAL("triggered()"), self.onSongAddClick)
|
|
||||||
|
|
||||||
|
|
||||||
|
#define and add the context menu
|
||||||
self.SongListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
self.SongListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
|
||||||
self.SongListView.addAction(editAct)
|
|
||||||
#self.SongListView.addSeparator()
|
self.SongListView.addAction(self.pluginutils.add_to_context_menu(self.SongListView, ':/songs/song_new.png', "&Edit Song", self.onSongEditClick))
|
||||||
self.SongListView.addAction(prevAct)
|
self.SongListView.addAction(self.pluginutils.add_separator(self.SongListView))
|
||||||
self.SongListView.addAction(liveAct)
|
self.SongListView.addAction(self.pluginutils.add_to_context_menu(self.SongListView, ':/system/system_preview.png', "&Preview Song", self.onSongPreviewClick))
|
||||||
self.SongListView.addAction(serviceAct)
|
self.SongListView.addAction(self.pluginutils.add_to_context_menu(self.SongListView, ':/system/system_live.png', "&Show Live", self.onSongLiveClick))
|
||||||
|
self.SongListView.addAction(self.pluginutils.add_to_context_menu(self.SongListView, ':/system/system_add.png', "&Add to Service", self.onSongEditClick))
|
||||||
|
|
||||||
return self.MediaManagerItem
|
return self.MediaManagerItem
|
||||||
|
|
||||||
def add_import_menu_item(self, import_menu):
|
def add_import_menu_item(self, import_menu):
|
||||||
@ -188,8 +183,8 @@ class SongsPlugin(Plugin):
|
|||||||
QtCore.QObject.connect(self.ExportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onExportOpenSongItemClicked)
|
QtCore.QObject.connect(self.ExportOpenSongItem, QtCore.SIGNAL("triggered()"), self.onExportOpenSongItemClicked)
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
self.SearchTypeComboBox.addItem("Lyrics")
|
|
||||||
self.SearchTypeComboBox.addItem("Titles")
|
self.SearchTypeComboBox.addItem("Titles")
|
||||||
|
self.SearchTypeComboBox.addItem("Lyrics")
|
||||||
self.SearchTypeComboBox.addItem("Authors")
|
self.SearchTypeComboBox.addItem("Authors")
|
||||||
|
|
||||||
def onClearTextButton(self):
|
def onClearTextButton(self):
|
||||||
@ -248,7 +243,8 @@ class SongsPlugin(Plugin):
|
|||||||
|
|
||||||
def _display_results(self):
|
def _display_results(self):
|
||||||
self.SongListView.clear() # clear the results
|
self.SongListView.clear() # clear the results
|
||||||
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["Song Name","Author"]))
|
self.SongListView.setHorizontalHeaderLabels(QtCore.QStringList(["Song Name","Author"]))
|
||||||
|
self.SongListView.setVerticalHeaderLabels(QtCore.QStringList([""]))
|
||||||
self.SongListView.setRowCount(0)
|
self.SongListView.setRowCount(0)
|
||||||
for id, txt, name in self.searchresults:
|
for id, txt, name in self.searchresults:
|
||||||
c = self.SongListView.rowCount()
|
c = self.SongListView.rowCount()
|
||||||
@ -257,4 +253,5 @@ class SongsPlugin(Plugin):
|
|||||||
self.SongListView.setItem(c , 0, twi)
|
self.SongListView.setItem(c , 0, twi)
|
||||||
twi = QtGui.QTableWidgetItem(str(name))
|
twi = QtGui.QTableWidgetItem(str(name))
|
||||||
self.SongListView.setItem(c , 1, twi)
|
self.SongListView.setItem(c , 1, twi)
|
||||||
|
self.SongListView.setRowHeight(c, 20)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user