This commit is contained in:
Tim Bentley 2011-02-07 17:27:40 +00:00
commit 4257bc2e4a
8 changed files with 108 additions and 53 deletions

View File

@ -158,7 +158,7 @@ class MediaManagerItem(QtGui.QWidget):
``icon``
The icon of the button. This can be an instance of QIcon, or a
string cotaining either the absolute path to the image, or an
string containing either the absolute path to the image, or an
internal resource path starting with ':/'.
``slot``

View File

@ -61,7 +61,7 @@ class OpenLPToolbar(QtGui.QToolBar):
``icon``
The icon of the button. This can be an instance of QIcon, or a
string cotaining either the absolute path to the image, or an
string containing either the absolute path to the image, or an
internal resource path starting with ':/'.
``tooltip``

View File

@ -72,7 +72,7 @@ class MainDisplay(DisplayWidget):
self.setWindowIcon(mainIcon)
self.retranslateUi()
self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;')
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool |
QtCore.Qt.WindowStaysOnTopHint)
if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(),

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginStatus, StringContent, translate
from openlp.core.lib import PluginStatus, Receiver, StringContent, translate
from plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__)
@ -129,7 +129,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
if self.programaticChange:
return
if status == 0:
Receiver.send_message(u'cursor_busy')
self.activePlugin.toggleStatus(PluginStatus.Active)
Receiver.send_message(u'cursor_normal')
else:
self.activePlugin.toggleStatus(PluginStatus.Inactive)
status_text = unicode(

View File

@ -334,9 +334,8 @@ class ThemeManager(QtGui.QWidget):
row = self.themeListWidget.row(item)
self.themeListWidget.takeItem(row)
self.deleteTheme(theme)
# As we do not reload the themes, push out the change
# Reaload the list as the internal lists and events need
# to be triggered
# As we do not reload the themes, push out the change. Reload the
# list as the internal lists and events need to be triggered.
self._pushThemes()
def deleteTheme(self, theme):

View File

@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \
ItemCapabilities, translate, check_item_selected
ItemCapabilities, translate, check_item_selected, PluginStatus
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm
from openlp.plugins.songs.lib import OpenLyrics, SongXML
@ -378,10 +378,12 @@ class SongMediaItem(MediaManagerItem):
raw_footer.append(song.title)
raw_footer.append(author_list)
raw_footer.append(song.copyright)
raw_footer.append(unicode(
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString()))
if QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString():
raw_footer.append(unicode(
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString()))
service_item.raw_footer = raw_footer
service_item.audit = [
song.title, author_audit, song.copyright, unicode(song.ccli_number)
@ -396,46 +398,46 @@ class SongMediaItem(MediaManagerItem):
Triggered by a song being loaded by the service item
"""
log.debug(u'serviceLoad')
if item.data_string:
search_results = self.parent.manager.get_all_objects(Song,
Song.search_title == re.compile(r'\W+', re.UNICODE).sub(u' ',
item.data_string[u'title'].split(u'@')[0].lower()).strip(),
Song.search_title.asc())
author_list = item.data_string[u'authors'].split(u', ')
# The service item always has an author (at least it has u'' as
# author). However, songs saved in the database do not have to have
# an author.
if u'' in author_list:
author_list.remove(u'')
editId = 0
add_song = True
if search_results:
for song in search_results:
same_authors = True
# If the author counts are different, we do not have to do
# any further checking. This is also important when a song
# does not have any author (because we can not loop over an
# empty list).
if len(song.authors) == len(author_list):
for author in song.authors:
if author.display_name not in author_list:
same_authors = False
else:
same_authors = False
# All authors are the same, so we can stop here and the song
# does not have to be saved.
if same_authors:
add_song = False
editId = song.id
break
if add_song:
if self.addSongFromService:
editId = self.openLyrics.xml_to_song(item.xml_version)
self.onSearchTextButtonClick()
# Update service with correct song id.
if editId:
Receiver.send_message(u'service_item_update',
u'%s:%s' % (editId, item._uuid))
if self.plugin.status != PluginStatus.Active or not item.data_string:
return
search_results = self.parent.manager.get_all_objects(Song,
Song.search_title == re.compile(r'\W+', re.UNICODE).sub(u' ',
item.data_string[u'title'].split(u'@')[0].lower()).strip(),
Song.search_title.asc())
author_list = item.data_string[u'authors'].split(u', ')
# The service item always has an author (at least it has u'' as
# author). However, songs saved in the database do not have to have
# an author.
if u'' in author_list:
author_list.remove(u'')
editId = 0
add_song = True
if search_results:
for song in search_results:
same_authors = True
# If the author counts are different, we do not have to do any
# further checking. This is also important when a song does not
# have any author (because we can not loop over an empty list).
if len(song.authors) == len(author_list):
for author in song.authors:
if author.display_name not in author_list:
same_authors = False
else:
same_authors = False
# All authors are the same, so we can stop here and the song
# does not have to be saved.
if same_authors:
add_song = False
editId = song.id
break
if add_song:
if self.addSongFromService:
editId = self.openLyrics.xml_to_song(item.xml_version)
self.onSearchTextButtonClick()
# Update service with correct song id.
if editId:
Receiver.send_message(u'service_item_update',
u'%s:%s' % (editId, item._uuid))
def collateSongTitles(self, song_1, song_2):
"""

View File

@ -83,6 +83,58 @@ Root: HKCU; SubKey: Software\OpenLP\OpenLP\custom; ValueType: dword; ValueName:
Root: HKCU; SubKey: Software\OpenLP\OpenLP\images; ValueType: dword; ValueName: status; ValueData: $00000001
Root: HKCU; SubKey: Software\OpenLP\OpenLP\media; ValueType: dword; ValueName: status; ValueData: $00000001
Root: HKCU; SubKey: Software\OpenLP\OpenLP\presentations; ValueType: dword; ValueName: status; ValueData: $00000001
Root: HKCU; SubKey: Software\OpenLP\OpenLP\remotes; ValueType: dword; ValueName: status; ValueData: $00000001
Root: HKCU; SubKey: Software\OpenLP\OpenLP\remotes; ValueType: dword; ValueName: status; ValueData: $00000000
Root: HKCU; SubKey: Software\OpenLP\OpenLP\songs; ValueType: dword; ValueName: status; ValueData: $00000001
Root: HKCU; SubKey: Software\OpenLP\OpenLP\songusage; ValueType: dword; ValueName: status; ValueData: $00000001
[Code]
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
Result := 0;
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then
begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end
else
Result := 1;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;

Binary file not shown.