This commit is contained in:
Andreas Preikschat 2011-03-04 17:10:56 +01:00
commit ba68d0ddb5
27 changed files with 39692 additions and 30008 deletions

View File

@ -24,7 +24,6 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import os
import sys
import logging
@ -179,14 +178,8 @@ class OpenLP(QtGui.QApplication):
self.splash.show()
# make sure Qt really display the splash screen
self.processEvents()
screens = ScreenList()
# Decide how many screens we have and their size
for screen in xrange(0, self.desktop().numScreens()):
size = self.desktop().screenGeometry(screen)
screens.add_screen({u'number': screen,
u'size': size,
u'primary': (self.desktop().primaryScreen() == screen)})
log.info(u'Screen %d found with resolution %s', screen, size)
screens = ScreenList(self.desktop())
# start the main app window
self.appClipboard = self.clipboard()
self.mainWindow = MainWindow(screens, app_version, self.appClipboard)

View File

@ -220,8 +220,6 @@ class MediaManagerItem(QtGui.QWidget):
if self.hasDeleteIcon:
toolbar_actions.append([StringContent.Delete,
u':/general/general_delete.png', self.onDeleteClick])
## Separator Line ##
self.addToolbarSeparator()
## Preview ##
toolbar_actions.append([StringContent.Preview,
u':/general/general_preview.png', self.onPreviewClick])
@ -232,6 +230,8 @@ class MediaManagerItem(QtGui.QWidget):
toolbar_actions.append([StringContent.Service,
u':/general/general_add.png', self.onAddClick])
for action in toolbar_actions:
if action[0] == StringContent.Preview:
self.addToolbarSeparator()
self.addToolbarButton(
self.plugin.getString(action[0])[u'title'],
self.plugin.getString(action[0])[u'tooltip'],

View File

@ -162,9 +162,7 @@ class ServiceItem(object):
line_break = True
if self.is_capable(ItemCapabilities.NoLineBreaks):
line_break = False
theme = None
if self.theme:
theme = self.theme
theme = self.theme if self.theme else None
self.main, self.footer = \
self.render_manager.set_override_theme(theme, useOverride)
self.themedata = self.render_manager.renderer._theme
@ -187,11 +185,7 @@ class ServiceItem(object):
self.title = clean_tags(self.title)
self.foot_text = None
if self.raw_footer:
for foot in self.raw_footer:
if not self.foot_text:
self.foot_text = foot
else:
self.foot_text = u'%s<br>%s' % (self.foot_text, foot)
self.foot_text = u'<br>'.join(self.raw_footer)
def add_from_image(self, path, title):
"""
@ -204,8 +198,7 @@ class ServiceItem(object):
A title for the slide in the service item.
"""
self.service_item_type = ServiceItemType.Image
self._raw_frames.append(
{u'title': title, u'path': path})
self._raw_frames.append({u'title': title, u'path': path})
self.render_manager.image_manager.add_image(title, path)
self._new_item()

View File

@ -106,38 +106,36 @@ class Ui_AboutDialog(object):
))
self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.aboutTab), UiStrings.About)
self.creditsTextEdit.setPlainText(translate('OpenLP.AboutForm',
lead = u'Raoul "superfly" Snyman'
developers = [u'Tim "TRB143" Bentley', u'Jonathan "gushie" Corwin',
u'Michael "cocooncrash" Gorven', u'Scott "sguerrieri" Guerrieri',
u'Raoul "superfly" Snyman', u'Martin "mijiti" Thompson',
u'Jon "Meths" Tibble<']
contributors = [u'Meinert "m2j" Jordan', u'Andreas "googol" Preikschat',
u'Christian "crichter" Richter', u'Philip "Phill" Ridout',
u'Maikel Stuivenberg', u'Carsten "catini" Tingaard',
u'Frode "frodus" Woldsund']
testers = [u'Philip "Phill" Ridout', u'Wesley "wrst" Stout (lead)']
packagers = [u'Thomas "tabthorpe" Abthorpe (FreeBSD)',
u'Tim "TRB143" Bentley (Fedora)',
u'Michael "cocooncrash" Gorven (Ubuntu)',
u'Matthias "matthub" Hub (Mac OS X)',
u'Raoul "superfly" Snyman (Windows, Ubuntu)']
self.creditsTextEdit.setPlainText(unicode(translate('OpenLP.AboutForm',
'Project Lead\n'
' Raoul "superfly" Snyman\n'
' %s\n'
'\n'
'Developers\n'
' Tim "TRB143" Bentley\n'
' Jonathan "gushie" Corwin\n'
' Michael "cocooncrash" Gorven\n'
' Scott "sguerrieri" Guerrieri\n'
' Raoul "superfly" Snyman\n'
' Martin "mijiti" Thompson\n'
' Jon "Meths" Tibble\n'
' %s\n'
'\n'
'Contributors\n'
' Meinert "m2j" Jordan\n'
' Andreas "googol" Preikschat\n'
' Christian "crichter" Richter\n'
' Philip "Phill" Ridout\n'
' Maikel Stuivenberg\n'
' Carsten "catini" Tingaard\n'
' Frode "frodus" Woldsund\n'
' %s\n'
'\n'
'Testers\n'
' Philip "Phill" Ridout\n'
' Wesley "wrst" Stout (lead)\n'
' %s\n'
'\n'
'Packagers\n'
' Thomas "tabthorpe" Abthorpe (FreeBSD)\n'
' Tim "TRB143" Bentley (Fedora)\n'
' Michael "cocooncrash" Gorven (Ubuntu)\n'
' Matthias "matthub" Hub (Mac OS X)\n'
' Raoul "superfly" Snyman (Windows, Ubuntu)\n'
' %s\n'
'\n'
'Built With\n'
' Python: http://www.python.org/\n'
@ -155,31 +153,30 @@ class Ui_AboutDialog(object):
' God our Father, for sending His Son to die\n'
' on the cross, setting us free from sin. We\n'
' bring this software to you for free because\n'
' He has set us free.'
))
' He has set us free.')) % (lead, u'\n '.join(developers),
u'\n '.join(contributors), u'\n '.join(testers),
u'\n '.join(packagers)))
self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.creditsTab),
translate('OpenLP.AboutForm', 'Credits'))
self.licenseTextEdit.setPlainText(translate('OpenLP.AboutForm',
copyright = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2011 Raoul Snyman\n'
'Portions copyright \xa9 2004-2011 '
'Tim Bentley, Jonathan Corwin, Michael Gorven, Scott Guerrieri,\n'
'Meinert Jordan, Andreas Preikschat, Christian Richter, Philip\n'
'Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, Carstenn'
'Tinggaard, Frode Woldsund\n'
'\n'
'Tinggaard, Frode Woldsund')
licence = translate('OpenLP.AboutForm',
'This program is free software; you can redistribute it and/or '
'modify it under the terms of the GNU General Public License as '
'published by the Free Software Foundation; version 2 of the '
'License.\n'
'\n'
'License.')
disclaimer = translate('OpenLP.AboutForm',
'This program is distributed in the hope that it will be useful, '
'but WITHOUT ANY WARRANTY; without even the implied warranty of '
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See below '
'for more details.\n'
'\n'
'\n'
'GNU GENERAL PUBLIC LICENSE\n'
'for more details.')
gpltext = ('GNU GENERAL PUBLIC LICENSE\n'
'Version 2, June 1991\n'
'\n'
'Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 '
@ -549,7 +546,9 @@ class Ui_AboutDialog(object):
'subroutine library, you may consider it more useful to permit '
'linking proprietary applications with the library. If this is '
'what you want to do, use the GNU Lesser General Public License '
'instead of this License.'))
'instead of this License.')
self.licenseTextEdit.setPlainText(u'%s\n\n%s\n\n%s\n\n\n%s' %
(copyright, licence, disclaimer, gpltext))
self.aboutNotebook.setTabText(
self.aboutNotebook.indexOf(self.licenseTab),
translate('OpenLP.AboutForm', 'License'))

View File

@ -234,6 +234,9 @@ class GeneralTab(SettingsTab):
QtCore.QObject.connect(self.customXValueEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onDisplayPositionChanged)
# Reload the tab, as the screen resolution/count may have changed.
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_screen_changed'), self.load)
def retranslateUi(self):
"""
@ -300,13 +303,9 @@ class GeneralTab(SettingsTab):
"""
settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection)
for screen in self.screens.screen_list:
screen_name = u'%s %d' % (translate('OpenLP.GeneralTab', 'Screen'),
screen[u'number'] + 1)
if screen[u'primary']:
screen_name = u'%s (%s)' % (screen_name,
translate('OpenLP.GeneralTab', 'primary'))
self.monitorComboBox.addItem(screen_name)
self.monitorComboBox.clear()
for screen in self.screens.get_screen_list():
self.monitorComboBox.addItem(screen)
self.numberEdit.setText(unicode(settings.value(
u'ccli number', QtCore.QVariant(u'')).toString()))
self.usernameEdit.setText(unicode(settings.value(

View File

@ -158,6 +158,7 @@ class MainDisplay(DisplayWidget):
self.webView.setHtml(build_html(serviceItem, self.screen,
self.alertTab, self.isLive, None))
self.initialFrame = True
self.__hideMouse()
# To display or not to display?
if not self.screen[u'primary']:
self.show()
@ -434,15 +435,7 @@ class MainDisplay(DisplayWidget):
# if was hidden keep it hidden
if self.hideMode and self.isLive:
self.hideDisplay(self.hideMode)
# Hide mouse cursor when moved over display if enabled in settings
settings = QtCore.QSettings()
if settings.value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool():
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:
self.setCursor(QtCore.Qt.ArrowCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
self.__hideMouse()
def footer(self, text):
"""
@ -492,6 +485,16 @@ class MainDisplay(DisplayWidget):
# Trigger actions when display is active again
Receiver.send_message(u'maindisplay_active')
def __hideMouse(self):
# Hide mouse cursor when moved over display if enabled in settings
if QtCore.QSettings().value(u'advanced/hide mouse',
QtCore.QVariant(False)).toBool():
self.setCursor(QtCore.Qt.BlankCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
else:
self.setCursor(QtCore.Qt.ArrowCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
class AudioPlayer(QtCore.QObject):
"""

View File

@ -25,11 +25,15 @@
###############################################################################
"""
The :mod:`screen` module provides management functionality for a machines'
displays
displays.
"""
import logging
import copy
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
log = logging.getLogger(__name__)
class ScreenList(object):
@ -38,7 +42,14 @@ class ScreenList(object):
"""
log.info(u'Screen loaded')
def __init__(self):
def __init__(self, desktop):
"""
Initialise the screen list.
``desktop``
A ``QDesktopWidget`` object.
"""
self.desktop = desktop
self.preview = None
self.current = None
self.override = None
@ -48,19 +59,120 @@ class ScreenList(object):
self.current_display = 0
# save config display number
self.monitor_number = 0
self.screen_count_changed()
QtCore.QObject.connect(desktop,
QtCore.SIGNAL(u'resized(int)'), self.screen_resolution_changed)
QtCore.QObject.connect(desktop,
QtCore.SIGNAL(u'screenCountChanged(int)'),
self.screen_count_changed)
def screen_resolution_changed(self, number):
"""
Called when the resolution of a screen has changed.
``number``
The number of the screen, which size has changed.
"""
log.info(u'screenResolutionChanged %d' % number)
for screen in self.screen_list:
if number == screen[u'number']:
newScreen = {
u'number': number,
u'size': self.desktop.screenGeometry(number),
u'primary': self.desktop.primaryScreen() == number
}
self.remove_screen(number)
self.add_screen(newScreen)
# The screen's default size is used, that is why we have to
# update the override screen.
if screen == self.override:
self.override = copy.deepcopy(newScreen)
self.set_override_display()
Receiver.send_message(u'config_screen_changed')
break
def screen_count_changed(self, changed_screen=-1):
"""
Called when a screen has been added or removed.
``changed_screen``
The screen's number which has been (un)plugged.
"""
# Remove unplugged screens.
for screen in copy.deepcopy(self.screen_list):
if screen[u'number'] == self.desktop.numScreens():
self.remove_screen(screen[u'number'])
# Add new screens.
for number in xrange(0, self.desktop.numScreens()):
if not self.screen_exists(number):
self.add_screen({
u'number': number,
u'size': self.desktop.screenGeometry(number),
u'primary': (self.desktop.primaryScreen() == number)
})
# We do not want to send this message, when the method is called the
# first time.
if changed_screen != -1:
# Reload setting tabs to apply possible changes.
Receiver.send_message(u'config_screen_changed')
def get_screen_list(self):
"""
Returns a list with the screens. This should only be used to display
available screens to the user::
[u'Screen 1 (primary)', u'Screen 2']
"""
screen_list= []
for screen in self.screen_list:
screen_name = u'%s %d' % (translate('OpenLP.ScreenList', 'Screen'),
screen[u'number'] + 1)
if screen[u'primary']:
screen_name = u'%s (%s)' % (screen_name,
translate('OpenLP.ScreenList', 'primary'))
screen_list.append(screen_name)
return screen_list
def add_screen(self, screen):
"""
Add a screen to the list of known screens
Add a screen to the list of known screens.
``screen``
A dict with the screen properties::
{
u'primary': True,
u'number': 0,
u'size': PyQt4.QtCore.QRect(0, 0, 1024, 768)
}
"""
log.info(u'Screen %d found with resolution %s',
screen[u'number'], screen[u'size'])
if screen[u'primary']:
self.current = screen
self.screen_list.append(screen)
self.display_count += 1
def remove_screen(self, number):
"""
Remove a screen from the list of known screens.
``number``
The screen number (int).
"""
log.info(u'remove_screen %d' % number)
for screen in self.screen_list:
if screen[u'number'] == number:
self.screen_list.remove(screen)
self.display_count -= 1
break
def screen_exists(self, number):
"""
Confirms a screen is known
Confirms a screen is known.
``number``
The screen number (int).
"""
for screen in self.screen_list:
if screen[u'number'] == number:
@ -69,7 +181,10 @@ class ScreenList(object):
def set_current_display(self, number):
"""
Set up the current screen dimensions
Set up the current screen dimensions.
``number``
The screen number (int).
"""
log.debug(u'set_current_display %s', number)
if number + 1 > self.display_count:
@ -86,8 +201,8 @@ class ScreenList(object):
def set_override_display(self):
"""
replace the current size with the override values
user wants to have their own screen attributes
Replace the current size with the override values, as the user wants to
have their own screen attributes.
"""
log.debug(u'set_override_display')
self.current = copy.deepcopy(self.override)
@ -95,8 +210,8 @@ class ScreenList(object):
def reset_current_display(self):
"""
replace the current values with the correct values
user wants to use the correct screen attributes
Replace the current values with the correct values, as the user wants to
use the correct screen attributes.
"""
log.debug(u'reset_current_display')
self.set_current_display(self.current_display)

View File

@ -163,7 +163,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# We found '<>' in the alert text, but the ParameterEdit field is empty.
if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Parameter found'),
translate('AlertPlugin.AlertForm', 'No Parameter Found'),
translate('AlertPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
@ -174,9 +174,9 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
# in the alert text.
elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Placeholder found'),
translate('AlertPlugin.AlertForm', 'No Placeholder Found'),
translate('AlertPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo want to continue anyway?'),
' contain \'<>\'.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.parameterEdit.setFocus()

View File

@ -98,7 +98,10 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
match = self.verse_regex.match(text)
if match:
verse_tag = match.group(1)
verse_num = int(match.group(2))
try:
verse_num = int(match.group(2))
except ValueError:
verse_num = 1
verse_type_index = VerseType.from_loose_input(verse_tag)
if verse_type_index is not None:
self.verseNumberBox.setValue(verse_num)
@ -127,7 +130,10 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
if match:
verse_type = match.group(1)
verse_type_index = VerseType.from_loose_input(verse_type)
verse_number = int(match.group(2))
try:
verse_number = int(match.group(2))
except ValueError:
verse_number = 1
if verse_type_index is not None:
self.verseTypeComboBox.setCurrentIndex(verse_type_index)
self.verseNumberBox.setValue(verse_number)

View File

@ -226,7 +226,7 @@ class SongExportForm(OpenLPWizard):
translate('SongsPlugin.ExportWizardForm',
'No Save Location specified'),
translate('SongsPlugin.ExportWizardForm',
'You need to specified a directory to save the songs in.'))
'You need to specify a directory.'))
return False
return True
elif self.currentPage() == self.progressPage:
@ -355,7 +355,7 @@ class SongExportForm(OpenLPWizard):
the path to *directoryLineEdit*.
"""
path = unicode(QtGui.QFileDialog.getExistingDirectory(self,
translate('SongsPlugin.ExportWizardForm', 'Selecte to Folder'),
translate('SongsPlugin.ExportWizardForm', 'Select Destination Folder'),
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
options=QtGui.QFileDialog.ShowDirsOnly))
SettingsManager.set_last_dir(self.plugin.settingsSection, path, 1)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4832
resources/i18n/fr.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4825
resources/i18n/id.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4828
resources/i18n/ru.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff