User interface tweaks

This commit is contained in:
Jon Tibble 2009-09-15 19:56:56 +01:00
parent 51f4c329ec
commit ccb1289c14
5 changed files with 123 additions and 77 deletions

View File

@ -1,6 +1,5 @@
*.pyc *.pyc
*.*~ *.*~
*.log
\#*\# \#*\#
*.eric4project *.eric4project
*.ropeproject *.ropeproject
@ -10,3 +9,4 @@ list
openlp.org 2.0.e4* openlp.org 2.0.e4*
documentation/build/html documentation/build/html
documentation/build/doctrees documentation/build/doctrees
*.log*

View File

@ -39,11 +39,13 @@ class OpenLPToolbar(QtGui.QToolBar):
QtGui.QToolBar.__init__(self, None) QtGui.QToolBar.__init__(self, None)
# useful to be able to reuse button icons... # useful to be able to reuse button icons...
self.icons = {} self.icons = {}
self.setIconSize(QtCore.QSize(20, 20))
self.actions = {} self.actions = {}
self.log = logging.getLogger(u'OpenLPToolbar') self.log = logging.getLogger(u'OpenLPToolbar')
self.log.debug(u'Init done') self.log.debug(u'Init done')
def addToolbarButton(self, title, icon, tooltip=None, slot=None, objectname=None): def addToolbarButton(self, title, icon, tooltip=None, slot=None,
objectname=None):
""" """
A method to help developers easily add a button to the toolbar. A method to help developers easily add a button to the toolbar.
@ -73,8 +75,8 @@ class OpenLPToolbar(QtGui.QToolBar):
ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal, ButtonIcon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
QtGui.QIcon.Off) QtGui.QIcon.Off)
else: else:
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)), ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(
QtGui.QIcon.Normal, QtGui.QIcon.Off) QtGui.QImage(icon)), QtGui.QIcon.Normal, QtGui.QIcon.Off)
if ButtonIcon is not None: if ButtonIcon is not None:
if slot is not None: if slot is not None:
ToolbarButton = self.addAction(ButtonIcon, title, slot) ToolbarButton = self.addAction(ButtonIcon, title, slot)

View File

@ -157,13 +157,13 @@ class SlideController(QtGui.QWidget):
self.DelaySpinBox.setSuffix(translate(u'SlideController', u's')) self.DelaySpinBox.setSuffix(translate(u'SlideController', u's'))
self.ControllerLayout.addWidget(self.Toolbar) self.ControllerLayout.addWidget(self.Toolbar)
sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, #sizeToolbarPolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed) # QtGui.QSizePolicy.Fixed)
sizeToolbarPolicy.setHorizontalStretch(0) #sizeToolbarPolicy.setHorizontalStretch(0)
sizeToolbarPolicy.setVerticalStretch(0) #sizeToolbarPolicy.setVerticalStretch(0)
sizeToolbarPolicy.setHeightForWidth( #sizeToolbarPolicy.setHeightForWidth(
self.Toolbar.sizePolicy().hasHeightForWidth()) # self.Toolbar.sizePolicy().hasHeightForWidth())
self.Toolbar.setSizePolicy(sizeToolbarPolicy) #self.Toolbar.setSizePolicy(sizeToolbarPolicy)
# Screen preview area # Screen preview area
self.PreviewFrame = QtGui.QFrame(self.Splitter) self.PreviewFrame = QtGui.QFrame(self.Splitter)
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, self.settingsmanager.slidecontroller_image, 225)) self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, self.settingsmanager.slidecontroller_image, 225))

View File

@ -59,42 +59,43 @@ class BibleMediaItem(MediaManagerItem):
self.addToolbar() self.addToolbar()
# Create buttons for the toolbar # Create buttons for the toolbar
## New Bible Button ## ## New Bible Button ##
self.addToolbarButton( self.addToolbarButton(translate(u'BibleMediaItem', u'New Bible'),
translate(u'BibleMediaItem',u'New Bible'), translate(u'BibleMediaItem', u'Register a new Bible'),
translate(u'BibleMediaItem',u'Register a new Bible'),
u':/themes/theme_import.png', self.onBibleNewClick, u'BibleNewItem') u':/themes/theme_import.png', self.onBibleNewClick, u'BibleNewItem')
## Separator Line ## ## Separator Line ##
self.addToolbarSeparator() self.addToolbarSeparator()
## Preview Bible Button ## ## Preview Bible Button ##
self.addToolbarButton( self.addToolbarButton(translate(u'BibleMediaItem', u'Preview Bible'),
translate(u'BibleMediaItem',u'Preview Bible'), translate(u'BibleMediaItem', u'Preview the selected Bible Verse'),
translate(u'BibleMediaItem',u'Preview the selected Bible Verse'), u':/system/system_preview.png', self.onPreviewClick,
u':/system/system_preview.png', self.onPreviewClick, u'BiblePreviewItem') u'BiblePreviewItem')
## Live Bible Button ## ## Live Bible Button ##
self.addToolbarButton( self.addToolbarButton(translate(u'BibleMediaItem',u'Go Live'),
translate(u'BibleMediaItem',u'Go Live'), translate(u'BibleMediaItem',
translate(u'BibleMediaItem',u'Send the selected Bible Verse(s) live'), u'Send the selected Bible Verse(s) live'),
u':/system/system_live.png', self.onLiveClick, u'BibleLiveItem') u':/system/system_live.png', self.onLiveClick, u'BibleLiveItem')
## Add Bible Button ## ## Add Bible Button ##
self.addToolbarButton( self.addToolbarButton(
translate(u'BibleMediaItem',u'Add Bible Verse(s) To Service'), translate(u'BibleMediaItem', u'Add Bible Verse(s) To Service'),
translate(u'BibleMediaItem',u'Add the selected Bible(s) to the service'), translate(u'BibleMediaItem',
u':/system/system_add.png', u'Add the selected Bible(s) to the service'),
self.onAddClick, u'BibleAddItem') u':/system/system_add.png', self.onAddClick, u'BibleAddItem')
# Create the tab widget # Create the tab widget
self.SearchTabWidget = QtGui.QTabWidget(self) self.SearchTabWidget = QtGui.QTabWidget(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.SearchTabWidget.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(
self.SearchTabWidget.sizePolicy().hasHeightForWidth())
self.SearchTabWidget.setSizePolicy(sizePolicy) self.SearchTabWidget.setSizePolicy(sizePolicy)
self.SearchTabWidget.setObjectName(u'SearchTabWidget') self.SearchTabWidget.setObjectName(u'SearchTabWidget')
# Add the Quick Search tab # Add the Quick Search tab
self.QuickTab = QtGui.QWidget() self.QuickTab = QtGui.QWidget()
self.QuickTab.setObjectName(u'QuickTab') self.QuickTab.setObjectName(u'QuickTab')
self.QuickLayout = QtGui.QGridLayout(self.QuickTab) self.QuickLayout = QtGui.QGridLayout(self.QuickTab)
self.QuickLayout.setMargin(8) self.QuickLayout.setMargin(5)
self.QuickLayout.setSpacing(8) self.QuickLayout.setSpacing(4)
self.QuickLayout.setObjectName(u'QuickLayout') self.QuickLayout.setObjectName(u'QuickLayout')
self.QuickVersionLabel = QtGui.QLabel(self.QuickTab) self.QuickVersionLabel = QtGui.QLabel(self.QuickTab)
self.QuickVersionLabel.setObjectName(u'QuickVersionLabel') self.QuickVersionLabel.setObjectName(u'QuickVersionLabel')
@ -115,6 +116,7 @@ class BibleMediaItem(MediaManagerItem):
self.QuickSearchEdit.setObjectName(u'QuickSearchEdit') self.QuickSearchEdit.setObjectName(u'QuickSearchEdit')
self.QuickLayout.addWidget(self.QuickSearchEdit, 2, 1, 1, 2) self.QuickLayout.addWidget(self.QuickSearchEdit, 2, 1, 1, 2)
self.QuickSearchButton = QtGui.QPushButton(self.QuickTab) self.QuickSearchButton = QtGui.QPushButton(self.QuickTab)
self.QuickSearchButton.setMaximumHeight(20)
self.QuickSearchButton.setObjectName(u'QuickSearchButton') self.QuickSearchButton.setObjectName(u'QuickSearchButton')
self.QuickLayout.addWidget(self.QuickSearchButton, 3, 2, 1, 1) self.QuickLayout.addWidget(self.QuickSearchButton, 3, 2, 1, 1)
self.QuickClearLabel = QtGui.QLabel(self.QuickTab) self.QuickClearLabel = QtGui.QLabel(self.QuickTab)
@ -137,8 +139,8 @@ class BibleMediaItem(MediaManagerItem):
self.AdvancedTab = QtGui.QWidget() self.AdvancedTab = QtGui.QWidget()
self.AdvancedTab.setObjectName(u'AdvancedTab') self.AdvancedTab.setObjectName(u'AdvancedTab')
self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab) self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab)
self.AdvancedLayout.setMargin(8) self.AdvancedLayout.setMargin(5)
self.AdvancedLayout.setSpacing(8) self.AdvancedLayout.setSpacing(4)
self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.AdvancedLayout.setObjectName(u'AdvancedLayout')
self.AdvancedVersionLabel = QtGui.QLabel(self.AdvancedTab) self.AdvancedVersionLabel = QtGui.QLabel(self.AdvancedTab)
self.AdvancedVersionLabel.setObjectName(u'AdvancedVersionLabel') self.AdvancedVersionLabel.setObjectName(u'AdvancedVersionLabel')
@ -180,9 +182,12 @@ class BibleMediaItem(MediaManagerItem):
self.AdvancedClearLabel.setObjectName(u'QuickSearchLabel') self.AdvancedClearLabel.setObjectName(u'QuickSearchLabel')
self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 5, 0, 1, 1) self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 5, 0, 1, 1)
self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab) self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab)
self.ClearAdvancedSearchComboBox.setObjectName(u'ClearAdvancedSearchComboBox') self.ClearAdvancedSearchComboBox.setObjectName(
self.AdvancedLayout.addWidget(self.ClearAdvancedSearchComboBox, 5, 2, 1, 1) u'ClearAdvancedSearchComboBox')
self.AdvancedLayout.addWidget(
self.ClearAdvancedSearchComboBox, 5, 2, 1, 1)
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab) self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab)
self.AdvancedSearchButton.setMaximumHeight(20)
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton') self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton')
self.AdvancedLayout.addWidget(self.AdvancedSearchButton, 5, 3, 1, 1) self.AdvancedLayout.addWidget(self.AdvancedSearchButton, 5, 3, 1, 1)
self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced') self.SearchTabWidget.addTab(self.AdvancedTab, u'Advanced')
@ -190,7 +195,8 @@ class BibleMediaItem(MediaManagerItem):
self.PageLayout.addWidget(self.SearchTabWidget) self.PageLayout.addWidget(self.SearchTabWidget)
self.ListView = BibleListView() self.ListView = BibleListView()
self.ListView.setAlternatingRowColors(True) self.ListView.setAlternatingRowColors(True)
self.ListView.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.ListView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection)
self.ListView.setDragEnabled(True) self.ListView.setDragEnabled(True)
self.PageLayout.addWidget(self.ListView) self.PageLayout.addWidget(self.ListView)
# Combo Boxes # Combo Boxes
@ -215,7 +221,8 @@ class BibleMediaItem(MediaManagerItem):
self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.ListView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.ListView.addAction(contextMenuAction( self.ListView.addAction(contextMenuAction(
self.ListView, u':/system/system_preview.png', self.ListView, u':/system/system_preview.png',
translate(u'BibleMediaItem',u'&Preview Verse'), self.onPreviewClick)) translate(u'BibleMediaItem',u'&Preview Verse'),
self.onPreviewClick))
self.ListView.addAction(contextMenuAction( self.ListView.addAction(contextMenuAction(
self.ListView, u':/system/system_live.png', self.ListView, u':/system/system_live.png',
translate(u'BibleMediaItem',u'&Show Live'), self.onLiveClick)) translate(u'BibleMediaItem',u'&Show Live'), self.onLiveClick))
@ -225,25 +232,37 @@ class BibleMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
log.debug(u'retranslateUi') log.debug(u'retranslateUi')
self.QuickVersionLabel.setText(translate(u'BibleMediaItem', u'Version:')) self.QuickVersionLabel.setText(
self.QuickSearchLabel.setText(translate(u'BibleMediaItem', u'Search Type:')) translate(u'BibleMediaItem', u'Version:'))
self.QuickSearchLabel.setText(
translate(u'BibleMediaItem', u'Search Type:'))
self.QuickSearchLabel.setText(translate(u'BibleMediaItem', u'Find:')) self.QuickSearchLabel.setText(translate(u'BibleMediaItem', u'Find:'))
self.QuickSearchButton.setText(translate(u'BibleMediaItem', u'Search')) self.QuickSearchButton.setText(translate(u'BibleMediaItem', u'Search'))
self.QuickClearLabel.setText(translate(u'BibleMediaItem', u'Results:')) self.QuickClearLabel.setText(translate(u'BibleMediaItem', u'Results:'))
self.AdvancedVersionLabel.setText(translate(u'BibleMediaItem', u'Version:')) self.AdvancedVersionLabel.setText(
translate(u'BibleMediaItem', u'Version:'))
self.AdvancedBookLabel.setText(translate(u'BibleMediaItem', u'Book:')) self.AdvancedBookLabel.setText(translate(u'BibleMediaItem', u'Book:'))
self.AdvancedChapterLabel.setText(translate(u'BibleMediaItem', u'Chapter:')) self.AdvancedChapterLabel.setText(
translate(u'BibleMediaItem', u'Chapter:'))
self.AdvancedVerseLabel.setText(translate(u'BibleMediaItem', u'Verse:')) self.AdvancedVerseLabel.setText(translate(u'BibleMediaItem', u'Verse:'))
self.AdvancedFromLabel.setText(translate(u'BibleMediaItem', u'From:')) self.AdvancedFromLabel.setText(translate(u'BibleMediaItem', u'From:'))
self.AdvancedToLabel.setText(translate(u'BibleMediaItem', u'To:')) self.AdvancedToLabel.setText(translate(u'BibleMediaItem', u'To:'))
self.AdvancedClearLabel.setText(translate(u'BibleMediaItem', u'Results:')) self.AdvancedClearLabel.setText(
self.AdvancedSearchButton.setText(translate(u'BibleMediaItem', u'Search')) translate(u'BibleMediaItem', u'Results:'))
self.QuickSearchComboBox.addItem(translate(u'BibleMediaItem', u'Verse Search')) self.AdvancedSearchButton.setText(
self.QuickSearchComboBox.addItem(translate(u'BibleMediaItem', u'Text Search')) translate(u'BibleMediaItem', u'Search'))
self.ClearQuickSearchComboBox.addItem(translate(u'BibleMediaItem', u'Clear')) self.QuickSearchComboBox.addItem(
self.ClearQuickSearchComboBox.addItem(translate(u'BibleMediaItem', u'Keep')) translate(u'BibleMediaItem', u'Verse Search'))
self.ClearAdvancedSearchComboBox.addItem(translate(u'BibleMediaItem', u'Clear')) self.QuickSearchComboBox.addItem(
self.ClearAdvancedSearchComboBox.addItem(translate(u'BibleMediaItem', u'Keep')) translate(u'BibleMediaItem', u'Text Search'))
self.ClearQuickSearchComboBox.addItem(
translate(u'BibleMediaItem', u'Clear'))
self.ClearQuickSearchComboBox.addItem(
translate(u'BibleMediaItem', u'Keep'))
self.ClearAdvancedSearchComboBox.addItem(
translate(u'BibleMediaItem', u'Clear'))
self.ClearAdvancedSearchComboBox.addItem(
translate(u'BibleMediaItem', u'Keep'))
def initialise(self): def initialise(self):
log.debug(u'initialise') log.debug(u'initialise')
@ -279,14 +298,17 @@ class BibleMediaItem(MediaManagerItem):
self.initialiseBible(bible) self.initialiseBible(bible)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
self.initialiseBible(unicode(self.AdvancedVersionComboBox.currentText())) self.initialiseBible(
unicode(self.AdvancedVersionComboBox.currentText()))
def onAdvancedBookComboBox(self): def onAdvancedBookComboBox(self):
self.initialiseChapterVerse(unicode(self.AdvancedVersionComboBox.currentText()), self.initialiseChapterVerse(
unicode(self.AdvancedVersionComboBox.currentText()),
unicode(self.AdvancedBookComboBox.currentText())) unicode(self.AdvancedBookComboBox.currentText()))
def onBibleNewClick(self): def onBibleNewClick(self):
self.bibleimportform = BibleImportForm(self.parent.config, self.parent.biblemanager, self) self.bibleimportform = BibleImportForm(
self.parent.config, self.parent.biblemanager, self)
self.bibleimportform.exec_() self.bibleimportform.exec_()
self.reloadBibles() self.reloadBibles()
@ -301,8 +323,9 @@ class BibleMediaItem(MediaManagerItem):
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.AdvancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.AdvancedBookComboBox.currentText())
# get the verse count for new chapter # get the verse count for new chapter
vse = self.parent.biblemanager.get_book_verse_count(bible, book, int(t2))[0] verses = self.parent.biblemanager.get_book_verse_count(
self.adjustComboBox(1, vse, self.AdvancedToVerse) bible, book, int(t2))[0]
self.adjustComboBox(1, verses, self.AdvancedToVerse)
def onAdvancedSearchButton(self): def onAdvancedSearchButton(self):
log.debug(u'Advanced Search Button pressed') log.debug(u'Advanced Search Button pressed')
@ -312,8 +335,8 @@ class BibleMediaItem(MediaManagerItem):
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.AdvancedToChapter.currentText())
verse_from = int(self.AdvancedFromVerse.currentText()) verse_from = int(self.AdvancedFromVerse.currentText())
verse_to = int(self.AdvancedToVerse.currentText()) verse_to = int(self.AdvancedToVerse.currentText())
self.search_results = self.parent.biblemanager.get_verse_text(bible, book, self.search_results = self.parent.biblemanager.get_verse_text(
chapter_from, chapter_to, verse_from, verse_to) bible, book, chapter_from, chapter_to, verse_from, verse_to)
if self.ClearAdvancedSearchComboBox.currentIndex() == 0: if self.ClearAdvancedSearchComboBox.currentIndex() == 0:
self.ListView.clear() self.ListView.clear()
self.displayResults(bible) self.displayResults(bible)

View File

@ -50,7 +50,8 @@ class SongMediaItem(MediaManagerItem):
self.ConfigSection = u'song' self.ConfigSection = u'song'
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, icon, title)
self.edit_song_form = EditSongForm(self.parent.songmanager, self) self.edit_song_form = EditSongForm(self.parent.songmanager, self)
self.song_maintenance_form = SongMaintenanceForm(self.parent.songmanager, self) self.song_maintenance_form = SongMaintenanceForm(
self.parent.songmanager, self)
def setupUi(self): def setupUi(self):
# Add a toolbar # Add a toolbar
@ -73,30 +74,39 @@ class SongMediaItem(MediaManagerItem):
## Preview Song Button ## ## Preview Song Button ##
self.addToolbarButton(translate(u'SongMediaItem', u'Preview Song'), self.addToolbarButton(translate(u'SongMediaItem', u'Preview Song'),
translate(u'SongMediaItem', u'Preview the selected song'), translate(u'SongMediaItem', u'Preview the selected song'),
':/system/system_preview.png', self.onPreviewClick, 'SongPreviewItem') ':/system/system_preview.png', self.onPreviewClick,
'SongPreviewItem')
## Live Song Button ## ## Live Song Button ##
self.addToolbarButton(translate(u'SongMediaItem', u'Go Live'), self.addToolbarButton(translate(u'SongMediaItem', u'Go Live'),
translate(u'SongMediaItem', u'Send the selected song live'), translate(u'SongMediaItem', u'Send the selected song live'),
':/system/system_live.png', self.onLiveClick, 'SongLiveItem') ':/system/system_live.png', self.onLiveClick, 'SongLiveItem')
## Add Song Button ## ## Add Song Button ##
self.addToolbarButton(translate(u'SongMediaItem', u'Add Song To Service'), self.addToolbarButton(
translate(u'SongMediaItem', u'Add the selected song(s) to the service'), translate(u'SongMediaItem', u'Add Song To Service'),
translate(u'SongMediaItem',
u'Add the selected song(s) to the service'),
':/system/system_add.png', self.onAddClick, 'SongAddItem') ':/system/system_add.png', self.onAddClick, 'SongAddItem')
self.addToolbarSeparator() self.addToolbarSeparator()
## Song Maintenance Button ## ## Song Maintenance Button ##
self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'), self.addToolbarButton(translate(u'SongMediaItem', u'Song Maintenance'),
translate(u'SongMediaItem', u'Maintain the lists of authors, topics and books'), translate(u'SongMediaItem',
':/songs/song_maintenance.png', self.onSongMaintenanceClick, 'SongMaintenanceItem') u'Maintain the lists of authors, topics and books'),
':/songs/song_maintenance.png', self.onSongMaintenanceClick,
'SongMaintenanceItem')
## Add the SongListView widget ## ## Add the SongListView widget ##
# Create the tab widget # Create the tab widget
self.SongWidget = QtGui.QWidget(self) self.SongWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.SongWidget.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(
self.SongWidget.sizePolicy().hasHeightForWidth())
self.SongWidget.setSizePolicy(sizePolicy) self.SongWidget.setSizePolicy(sizePolicy)
self.SongWidget.setObjectName(u'SongWidget') self.SongWidget.setObjectName(u'SongWidget')
self.SearchLayout = QtGui.QGridLayout(self.SongWidget) self.SearchLayout = QtGui.QGridLayout(self.SongWidget)
self.SearchLayout.setMargin(5)
self.SearchLayout.setSpacing(4)
self.SearchLayout.setObjectName(u'SearchLayout') self.SearchLayout.setObjectName(u'SearchLayout')
self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget) self.SearchTypeComboBox = QtGui.QComboBox(self.SongWidget)
self.SearchTypeComboBox.setObjectName(u'SearchTypeComboBox') self.SearchTypeComboBox.setObjectName(u'SearchTypeComboBox')
@ -111,9 +121,11 @@ class SongMediaItem(MediaManagerItem):
self.SearchTextEdit.setObjectName(u'SearchTextEdit') self.SearchTextEdit.setObjectName(u'SearchTextEdit')
self.SearchLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2) self.SearchLayout.addWidget(self.SearchTextEdit, 2, 1, 1, 2)
self.ClearTextButton = QtGui.QPushButton(self.SongWidget) self.ClearTextButton = QtGui.QPushButton(self.SongWidget)
self.ClearTextButton.setMaximumHeight(20)
self.ClearTextButton.setObjectName(u'ClearTextButton') self.ClearTextButton.setObjectName(u'ClearTextButton')
self.SearchLayout.addWidget(self.ClearTextButton, 3, 1, 1, 1) self.SearchLayout.addWidget(self.ClearTextButton, 3, 1, 1, 1)
self.SearchTextButton = QtGui.QPushButton(self.SongWidget) self.SearchTextButton = QtGui.QPushButton(self.SongWidget)
self.SearchTextButton.setMaximumHeight(20)
self.SearchTextButton.setObjectName(u'SearchTextButton') self.SearchTextButton.setObjectName(u'SearchTextButton')
self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1) self.SearchLayout.addWidget(self.SearchTextButton, 3, 2, 1, 1)
# Add the song widget to the page layout # Add the song widget to the page layout
@ -130,7 +142,8 @@ class SongMediaItem(MediaManagerItem):
QtCore.QObject.connect(self.ClearTextButton, QtCore.QObject.connect(self.ClearTextButton,
QtCore.SIGNAL(u'pressed()'), self.onClearTextButtonClick) QtCore.SIGNAL(u'pressed()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.SearchTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged) QtCore.SIGNAL(u'textChanged(const QString&)'),
self.onSearchTextEditChanged)
QtCore.QObject.connect(self.ListView, QtCore.QObject.connect(self.ListView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick) QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -143,18 +156,20 @@ class SongMediaItem(MediaManagerItem):
self.onSongEditClick)) self.onSongEditClick))
self.ListView.addAction(contextMenuSeparator(self.ListView)) self.ListView.addAction(contextMenuSeparator(self.ListView))
self.ListView.addAction(contextMenuAction(self.ListView, self.ListView.addAction(contextMenuAction(self.ListView,
':/system/system_preview.png', translate(u'SongMediaItem', u'&Preview Song'), ':/system/system_preview.png',
self.onPreviewClick)) translate(u'SongMediaItem', u'&Preview Song'), self.onPreviewClick))
self.ListView.addAction(contextMenuAction(self.ListView, self.ListView.addAction(contextMenuAction(self.ListView,
':/system/system_live.png', translate(u'SongMediaItem', u'&Show Live'), ':/system/system_live.png',
self.onLiveClick)) translate(u'SongMediaItem', u'&Show Live'), self.onLiveClick))
self.ListView.addAction(contextMenuAction(self.ListView, self.ListView.addAction(contextMenuAction(self.ListView,
':/system/system_add.png', translate(u'SongMediaItem', u'&Add to Service'), ':/system/system_add.png',
self.onAddClick)) translate(u'SongMediaItem', u'&Add to Service'), self.onAddClick))
def retranslateUi(self): def retranslateUi(self):
self.SearchTypeLabel.setText(translate(u'SongMediaItem', u'Search Type:')) self.SearchTypeLabel.setText(
self.SearchTextLabel.setText(translate(u'SongMediaItem', u'Search Text:')) translate(u'SongMediaItem', u'Search Type:'))
self.SearchTextLabel.setText(
translate(u'SongMediaItem', u'Search Text:'))
self.ClearTextButton.setText(translate(u'SongMediaItem', u'Clear')) self.ClearTextButton.setText(translate(u'SongMediaItem', u'Clear'))
self.SearchTextButton.setText(translate(u'SongMediaItem', u'Search')) self.SearchTextButton.setText(translate(u'SongMediaItem', u'Search'))
@ -169,15 +184,18 @@ class SongMediaItem(MediaManagerItem):
search_type = self.SearchTypeComboBox.currentIndex() search_type = self.SearchTypeComboBox.currentIndex()
if search_type == 0: if search_type == 0:
log.debug(u'Titles Search') log.debug(u'Titles Search')
search_results = self.parent.songmanager.search_song_title(search_keywords) search_results = self.parent.songmanager.search_song_title(
search_keywords)
self.displayResultsSong(search_results) self.displayResultsSong(search_results)
elif search_type == 1: elif search_type == 1:
log.debug(u'Lyrics Search') log.debug(u'Lyrics Search')
search_results = self.parent.songmanager.search_song_lyrics(search_keywords) search_results = self.parent.songmanager.search_song_lyrics(
search_keywords)
self.displayResultsSong(search_results) self.displayResultsSong(search_results)
elif search_type == 2: elif search_type == 2:
log.debug(u'Authors Search') log.debug(u'Authors Search')
search_results = self.parent.songmanager.get_song_from_author(search_keywords) search_results = self.parent.songmanager.get_song_from_author(
search_keywords)
self.displayResultsAuthor(search_results) self.displayResultsAuthor(search_results)
def displayResultsSong(self, searchresults): def displayResultsSong(self, searchresults):
@ -190,7 +208,8 @@ class SongMediaItem(MediaManagerItem):
if author_list != u'': if author_list != u'':
author_list = author_list + u', ' author_list = author_list + u', '
author_list = author_list + author.display_name author_list = author_list + author.display_name
song_detail = unicode(u'%s (%s)' % (unicode(song.title), unicode(author_list))) song_detail = unicode(u'%s (%s)' % \
(unicode(song.title), unicode(author_list)))
song_name = QtGui.QListWidgetItem(song_detail) song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name) self.ListView.addItem(song_name)
@ -200,7 +219,8 @@ class SongMediaItem(MediaManagerItem):
self.ListView.clear() self.ListView.clear()
for author in searchresults: for author in searchresults:
for song in author.songs: for song in author.songs:
song_detail = unicode(u'%s (%s)' % (unicode(author.display_name), unicode(song.title))) song_detail = unicode(u'%s (%s)' % \
(unicode(author.display_name), unicode(song.title)))
song_name = QtGui.QListWidgetItem(song_detail) song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.ListView.addItem(song_name) self.ListView.addItem(song_name)
@ -291,7 +311,8 @@ class SongMediaItem(MediaManagerItem):
raw_footer.append(song.title) raw_footer.append(song.title)
raw_footer.append(author_list) raw_footer.append(author_list)
raw_footer.append(song.copyright ) raw_footer.append(song.copyright )
raw_footer.append(unicode(translate(u'SongMediaItem', u'CCL Licence: ') + ccl )) raw_footer.append(unicode(
translate(u'SongMediaItem', u'CCL Licence: ') + ccl ))
service_item.raw_footer = raw_footer service_item.raw_footer = raw_footer
return True return True