Merge from trunk; A few bugfixes.

This commit is contained in:
Raoul Snyman 2009-08-09 19:58:37 +02:00
commit 29389bde13
15 changed files with 864 additions and 841 deletions

View File

@ -71,7 +71,7 @@ class OpenLP(QtGui.QApplication):
self.mainWindow = MainWindow(screens)
self.mainWindow.show()
# now kill the splashscreen
self.splash.finish(self.mainWindow.mainWindow)
self.splash.finish(self.mainWindow)
sys.exit(app.exec_())
if __name__ == u'__main__':

View File

@ -28,6 +28,7 @@ class EventType(object):
# "Default" event - a non-event
Default = 0
# General application events
Ready = 10
# Service events
LoadServiceItem = 20
# Preview events
@ -43,6 +44,7 @@ class Event(object):
"""
Provides an Event class to encapsulate events within openlp.org.
"""
def __init__(self, event_type=EventType.Default, payload=None):
def __init__(self, event_type=EventType.Default, payload=None, sender=None):
self.event_type = event_type
self.payload = payload
self.sender = sender

View File

@ -25,10 +25,10 @@ import logging
class EventManager(object):
"""
A mechanism to send events to all registered endpoints
the endpoints are registered and listen with a handle_event method
the endpoint will decide whether to do somthing with the event or ignore it
A mechanism to send events to all registered endpoints. The
endpoints are registered and listen with a handle_event method.
The endpoint will decide whether to do somthing with the event or
ignore it.
"""
global log
log = logging.getLogger(u'EventManager')

View File

@ -154,11 +154,6 @@ class Renderer(object):
text.append(line)
#print text
split_text = self.pre_render_text(text)
# print "-----------------------------"
# print split_text
# split_text = self._split_set_of_lines(text, False)
# print "-----------------------------"
# print split_text
log.debug(u'format_slide - End')
return split_text
@ -168,7 +163,7 @@ class Renderer(object):
line_width = self._rect.width() - self._right_margin
#number of lines on a page - adjust for rounding up.
#print self._rect.height() , metrics.height(), int(self._rect.height() / metrics.height())
page_length = int(self._rect.height() / metrics.height()) - 1
page_length = int(self._rect.height() / metrics.height() - 2 ) - 1
ave_line_width = line_width / metrics.averageCharWidth()
# print "A", ave_line_width
ave_line_width = int(ave_line_width + (ave_line_width * 0.5))
@ -272,113 +267,49 @@ class Renderer(object):
log.debug(u'render background %s start', self._theme.background_type)
painter = QtGui.QPainter()
painter.begin(self._bg_frame)
if self._theme.background_type == u'solid':
painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color))
elif self._theme.background_type == u'gradient':
# gradient
gradient = None
if self._theme.background_direction == u'horizontal':
w = int(self._frame.width()) / 2
# vertical
gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height())
elif self._theme.background_direction == u'vertical':
h = int(self._frame.height()) / 2
# Horizontal
gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h)
else:
w = int(self._frame.width()) / 2
h = int(self._frame.height()) / 2
# Circular
gradient = QtGui.QRadialGradient(w, h, w)
gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor))
gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor))
painter.setBrush(QtGui.QBrush(gradient))
rectPath = QtGui.QPainterPath()
max_x = self._frame.width()
max_y = self._frame.height()
rectPath.moveTo(0, 0)
rectPath.lineTo(0, max_y)
rectPath.lineTo(max_x, max_y)
rectPath.lineTo(max_x, 0)
rectPath.closeSubpath()
painter.drawPath(rectPath)
elif self._theme.background_type== u'image':
# image
painter.fillRect(self._frame.rect(), QtCore.Qt.black)
if self.bg_image is not None:
painter.drawImage(0 ,0 , self.bg_image)
if self._theme.background_mode == u'transparent':
painter.fillRect(self._frame.rect(), QtCore.Qt.transparent)
else:
if self._theme.background_type == u'solid':
painter.fillRect(self._frame.rect(), QtGui.QColor(self._theme.background_color))
elif self._theme.background_type == u'gradient':
# gradient
gradient = None
if self._theme.background_direction == u'horizontal':
w = int(self._frame.width()) / 2
# vertical
gradient = QtGui.QLinearGradient(w, 0, w, self._frame.height())
elif self._theme.background_direction == u'vertical':
h = int(self._frame.height()) / 2
# Horizontal
gradient = QtGui.QLinearGradient(0, h, self._frame.width(), h)
else:
w = int(self._frame.width()) / 2
h = int(self._frame.height()) / 2
# Circular
gradient = QtGui.QRadialGradient(w, h, w)
gradient.setColorAt(0, QtGui.QColor(self._theme.background_startColor))
gradient.setColorAt(1, QtGui.QColor(self._theme.background_endColor))
painter.setBrush(QtGui.QBrush(gradient))
rectPath = QtGui.QPainterPath()
max_x = self._frame.width()
max_y = self._frame.height()
rectPath.moveTo(0, 0)
rectPath.lineTo(0, max_y)
rectPath.lineTo(max_x, max_y)
rectPath.lineTo(max_x, 0)
rectPath.closeSubpath()
painter.drawPath(rectPath)
elif self._theme.background_type== u'image':
# image
painter.fillRect(self._frame.rect(), QtCore.Qt.black)
if self.bg_image is not None:
painter.drawImage(0 ,0 , self.bg_image)
painter.end()
self._bg_frame_small = self._bg_frame.scaled(QtCore.QSize(280, 210), QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
log.debug(u'render background End')
# def _split_set_of_lines(self, lines, footer):
# """
# Given a list of lines, decide how to split them best if they don't all
# fit on the screen. This is done by splitting at 1/2, 1/3 or 1/4 of the
# set. If it doesn't fit, even at this size, just split at each
# opportunity. We'll do this by getting the bounding box of each line,
# and then summing them appropriately.
#
# Returns a list of [lists of lines], one set for each screenful.
#
# ``lines``
# The lines of text to split.
#
# ``footer``
# The footer text.
# """
# bboxes = []
# for line in lines:
# bboxes.append(self._render_and_wrap_single_line(line, footer))
# numlines = len(lines)
# bottom = self._rect.bottom()
# for ratio in (numlines, numlines/2, numlines/3, numlines/4):
# good = 1
# startline = 0
# endline = startline + ratio
# while (endline <= numlines and endline != 0):
# by = 0
# for (x,y) in bboxes[startline:endline]:
# by += y
# if by > bottom:
# good = 0
# break
# startline += ratio
# endline = startline + ratio
# if good == 1:
# break
# retval = []
# numlines_per_page = ratio
# if good:
# c = 0
# thislines = []
# while c < numlines:
# thislines.append(lines[c])
# c += 1
# if len(thislines) == numlines_per_page:
# retval.append(thislines)
# thislines = []
# if len(thislines) > 0:
# retval.append(thislines)
# else:
# # print "Just split where you can"
# retval = []
# startline = 0
# endline = startline + 1
# while (endline <= numlines):
# by = 0
# for (x,y) in bboxes[startline:endline]:
# by += y
# if by > bottom:
# retval.append(lines[startline:endline-1])
# startline = endline-1
# # gets incremented below
# endline = startline
# by = 0
# endline += 1
# return retval
def _correctAlignment(self, rect, bbox):
"""
Corrects the vertical alignment of text.

View File

@ -331,6 +331,11 @@ class ThemeXML(object):
for element in iter:
if len(element.getchildren()) > 0:
master = element.tag + u'_'
else:
#background transparent tags have no children so special case
if element.tag == u'background':
for e in element.attrib.iteritems():
setattr(self, element.tag + u'_' + e[0], e[1])
if len(element.attrib) > 0:
for e in element.attrib.iteritems():
if master == u'font_' and e[0] == u'type':

View File

@ -108,16 +108,19 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
new_theme.new_document(theme_name)
save_from = None
save_to = None
if self.theme.background_type == u'solid':
new_theme.add_background_solid(unicode(self.theme.background_color))
elif self.theme.background_type == u'gradient':
new_theme.add_background_gradient(unicode(self.theme.background_startColor),
unicode(self.theme.background_endColor), self.theme.background_direction)
if self.theme.background_mode == u'transparent':
new_theme.add_background_transparent()
else:
(path, filename) =os.path.split(unicode(self.theme.background_filename))
new_theme.add_background_image(filename)
save_to= os.path.join(self.path, theme_name, filename )
save_from = self.theme.background_filename
if self.theme.background_type == u'solid':
new_theme.add_background_solid(unicode(self.theme.background_color))
elif self.theme.background_type == u'gradient':
new_theme.add_background_gradient(unicode(self.theme.background_startColor),
unicode(self.theme.background_endColor), self.theme.background_direction)
else:
(path, filename) =os.path.split(unicode(self.theme.background_filename))
new_theme.add_background_image(filename)
save_to= os.path.join(self.path, theme_name, filename )
save_from = self.theme.background_filename
new_theme.add_font(unicode(self.theme.font_main_name), unicode(self.theme.font_main_color),
unicode(self.theme.font_main_proportion), unicode(self.theme.font_main_override), u'main',

View File

@ -26,186 +26,28 @@ from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
ServiceManager, ThemeManager, MainDisplay, SlideController
from openlp.core.lib import translate, Plugin, MediaManagerItem, \
SettingsTab, EventManager, RenderManager, PluginConfig, \
SettingsManager, PluginManager
SettingsManager, PluginManager, EventType
class MainWindow(object):
"""
The main window.
"""
global log
log = logging.getLogger(u'MainWindow')
log.info(u'MainWindow loaded')
def __init__(self, screens):
"""
This constructor sets up the interface, the various managers, and the
plugins.
"""
self.oosNotSaved = False
self.settingsmanager = SettingsManager(screens)
self.mainWindow = QtGui.QMainWindow()
self.mainWindow.__class__.closeEvent = self.onCloseEvent
self.mainDisplay = MainDisplay(None, screens)
self.screenList = screens
self.EventManager = EventManager()
self.generalConfig = PluginConfig(u'General')
self.alertForm = AlertForm(self)
self.aboutForm = AboutForm()
self.settingsForm = SettingsForm(self.screenList, self)
# Set up the path with plugins
pluginpath = os.path.split(os.path.abspath(__file__))[0]
pluginpath = os.path.abspath(
os.path.join(pluginpath, u'..', u'..', u'plugins'))
self.plugin_manager = PluginManager(pluginpath)
self.plugin_helpers = {}
# Set up the interface
self.setupUi()
#warning cyclic dependency
#RenderManager needs to call ThemeManager and
#ThemeManager needs to call RenderManager
self.RenderManager = RenderManager(self.ThemeManagerContents,
self.screenList, self.getMonitorNumber())
log.info(u'Load Plugins')
#make the controllers available to the plugins
self.plugin_helpers[u'preview'] = self.PreviewController
self.plugin_helpers[u'live'] = self.LiveController
self.plugin_helpers[u'event'] = self.EventManager
self.plugin_helpers[u'theme'] = self.ThemeManagerContents
self.plugin_helpers[u'render'] = self.RenderManager
self.plugin_helpers[u'service'] = self.ServiceManagerContents
self.plugin_helpers[u'settings'] = self.settingsForm
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers,
self.EventManager)
# hook methods have to happen after find_plugins. Find plugins needs the
# controllers hence the hooks have moved from setupUI() to here
# Find and insert settings tabs
log.info(u'hook settings')
self.plugin_manager.hook_settings_tabs(self.settingsForm)
# Find and insert media manager items
log.info(u'hook media')
self.plugin_manager.hook_media_manager(self.MediaToolBox)
# Call the hook method to pull in import menus.
log.info(u'hook menus')
self.plugin_manager.hook_import_menu(self.FileImportMenu)
# Call the hook method to pull in export menus.
self.plugin_manager.hook_export_menu(self.FileExportMenu)
# Call the initialise method to setup plugins.
log.info(u'initialise plugins')
self.plugin_manager.initialise_plugins()
# Once all components are initialised load the Themes
log.info(u'Load Themes')
self.ThemeManagerContents.loadThemes()
def getMonitorNumber(self):
"""
Set up the default behaviour of the monitor configuration in
here. Currently it is set to default to monitor 0 if the saved
monitor number does not exist.
"""
screen_number = int(self.generalConfig.get_config(u'Monitor', 0))
if screen_number not in self.screenList:
screen_number = 0
return screen_number
def show(self):
"""
Show the main form, as well as the display form
"""
self.mainWindow.showMaximized()
screen_number = self.getMonitorNumber()
self.mainDisplay.setup(screen_number)
self.mainWindow.setFocus()
def onHelpAboutItemClicked(self):
"""
Show the About form
"""
self.aboutForm.exec_()
def onToolsAlertItemClicked(self):
"""
Show the Alert form
"""
self.alertForm.exec_()
def onOptionsSettingsItemClicked(self):
"""
Show the Settings dialog
"""
self.settingsForm.exec_()
screen_number = self.getMonitorNumber()
self.RenderManager.update_display(screen_number)
self.mainDisplay.setup(screen_number)
def onCloseEvent(self, event):
"""
Hook to close the main window and display windows on exit
"""
if self.oosNotSaved == True:
ret = QtGui.QMessageBox.question(None,
translate(u'mainWindow', u'Save Changes to Service?'),
translate(u'mainWindow', u'Your service has been changed, do you want to save those changes?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save:
self.ServiceManagerContents.onSaveService()
self.mainDisplay.close()
self.cleanUp()
event.accept()
elif ret == QtGui.QMessageBox.Discard:
self.mainDisplay.close()
self.cleanUp()
event.accept()
else:
event.ignore()
else:
self.mainDisplay.close()
self.cleanUp()
event.accept()
def cleanUp(self):
# Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins')
self.plugin_manager.initialise_plugins()
def OosChanged(self, reset=False, oosName=None):
"""
Hook to change the title if the OOS has been changed
reset - tells if the OOS has been cleared or saved
oosName - is the name of the OOS (if it has one)
"""
if not oosName:
service_name = u'(Unsaved Service)'
else:
service_name = oosName
if reset == True:
self.oosNotSaved = False
title = u'%s - %s' % (self.mainTitle, service_name)
else:
self.oosNotSaved = True
title = u'%s - %s*' % (self.mainTitle, service_name)
self.mainWindow.setWindowTitle(title)
def setupUi(self):
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
"""
Set up the user interface
"""
self.mainWindow.setObjectName(u'mainWindow')
self.mainWindow.resize(self.settingsmanager.width, self.settingsmanager.height)
MainWindow.setObjectName(u'MainWindow')
MainWindow.resize(self.settingsmanager.width, self.settingsmanager.height)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.mainWindow.sizePolicy().hasHeightForWidth())
self.mainWindow.setSizePolicy(sizePolicy)
MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
main_icon = QtGui.QIcon()
main_icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.mainWindow.setWindowIcon(main_icon)
MainWindow.setWindowIcon(main_icon)
# Set up the main container, which contains all the other form widgets
self.MainContent = QtGui.QWidget(self.mainWindow)
self.MainContent = QtGui.QWidget(MainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
@ -218,7 +60,7 @@ class MainWindow(object):
self.MainContentLayout.setSpacing(0)
self.MainContentLayout.setMargin(0)
self.MainContentLayout.setObjectName(u'MainContentLayout')
self.mainWindow.setCentralWidget(self.MainContent)
MainWindow.setCentralWidget(self.MainContent)
self.ControlSplitter = QtGui.QSplitter(self.MainContent)
self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal)
self.ControlSplitter.setObjectName(u'ControlSplitter')
@ -227,7 +69,7 @@ class MainWindow(object):
self.PreviewController = SlideController(self)
self.LiveController = SlideController(self, True)
# Create menu
self.MenuBar = QtGui.QMenuBar(self.mainWindow)
self.MenuBar = QtGui.QMenuBar(MainWindow)
self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27))
self.MenuBar.setObjectName(u'MenuBar')
self.FileMenu = QtGui.QMenu(self.MenuBar)
@ -248,12 +90,15 @@ class MainWindow(object):
self.ToolsMenu.setObjectName(u'ToolsMenu')
self.HelpMenu = QtGui.QMenu(self.MenuBar)
self.HelpMenu.setObjectName(u'HelpMenu')
self.mainWindow.setMenuBar(self.MenuBar)
self.StatusBar = QtGui.QStatusBar(self.mainWindow)
MainWindow.setMenuBar(self.MenuBar)
self.StatusBar = QtGui.QStatusBar(MainWindow)
self.StatusBar.setObjectName(u'StatusBar')
self.mainWindow.setStatusBar(self.StatusBar)
MainWindow.setStatusBar(self.StatusBar)
self.DefaultThemeLabel = QtGui.QLabel(self.StatusBar)
self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel')
self.StatusBar.addPermanentWidget(self.DefaultThemeLabel)
# Create the MediaManager
self.MediaManagerDock = QtGui.QDockWidget(self.mainWindow)
self.MediaManagerDock = QtGui.QDockWidget(MainWindow)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/system/system_mediamanager.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
@ -270,10 +115,10 @@ class MainWindow(object):
self.MediaToolBox.setObjectName(u'MediaToolBox')
self.MediaManagerLayout.addWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents)
self.mainWindow.addDockWidget(
MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
# Create the service manager
self.ServiceManagerDock = QtGui.QDockWidget(self.mainWindow)
self.ServiceManagerDock = QtGui.QDockWidget(MainWindow)
ServiceManagerIcon = QtGui.QIcon()
ServiceManagerIcon.addPixmap(
QtGui.QPixmap(u':/system/system_servicemanager.png'),
@ -285,10 +130,10 @@ class MainWindow(object):
self.ServiceManagerDock.setMinimumWidth(300)
self.ServiceManagerContents = ServiceManager(self)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
self.mainWindow.addDockWidget(
MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
# Create the theme manager
self.ThemeManagerDock = QtGui.QDockWidget(self.mainWindow)
self.ThemeManagerDock = QtGui.QDockWidget(MainWindow)
ThemeManagerIcon = QtGui.QIcon()
ThemeManagerIcon.addPixmap(
QtGui.QPixmap(u':/system/system_thememanager.png'),
@ -298,97 +143,97 @@ class MainWindow(object):
self.ThemeManagerDock.setObjectName(u'ThemeManagerDock')
self.ThemeManagerContents = ThemeManager(self)
self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
self.mainWindow.addDockWidget(
MainWindow.addDockWidget(
QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
# Create the menu items
self.FileNewItem = QtGui.QAction(self.mainWindow)
self.FileNewItem = QtGui.QAction(MainWindow)
self.FileNewItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle(u'New Service'))
self.FileNewItem.setObjectName(u'FileNewItem')
self.FileOpenItem = QtGui.QAction(self.mainWindow)
self.FileOpenItem = QtGui.QAction(MainWindow)
self.FileOpenItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle(u'Open Service'))
self.FileOpenItem.setObjectName(u'FileOpenItem')
self.FileSaveItem = QtGui.QAction(self.mainWindow)
self.FileSaveItem = QtGui.QAction(MainWindow)
self.FileSaveItem.setIcon(
self.ServiceManagerContents.Toolbar.getIconFromTitle(u'Save Service'))
self.FileSaveItem.setObjectName(u'FileSaveItem')
self.FileSaveAsItem = QtGui.QAction(self.mainWindow)
self.FileSaveAsItem = QtGui.QAction(MainWindow)
self.FileSaveAsItem.setObjectName(u'FileSaveAsItem')
self.FileExitItem = QtGui.QAction(self.mainWindow)
self.FileExitItem = QtGui.QAction(MainWindow)
ExitIcon = QtGui.QIcon()
ExitIcon.addPixmap(QtGui.QPixmap(u':/system/system_exit.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.FileExitItem.setIcon(ExitIcon)
self.FileExitItem.setObjectName(u'FileExitItem')
self.ImportThemeItem = QtGui.QAction(self.mainWindow)
self.ImportThemeItem = QtGui.QAction(MainWindow)
self.ImportThemeItem.setObjectName(u'ImportThemeItem')
self.ImportLanguageItem = QtGui.QAction(self.mainWindow)
self.ImportLanguageItem = QtGui.QAction(MainWindow)
self.ImportLanguageItem.setObjectName(u'ImportLanguageItem')
self.ExportThemeItem = QtGui.QAction(self.mainWindow)
self.ExportThemeItem = QtGui.QAction(MainWindow)
self.ExportThemeItem.setObjectName(u'ExportThemeItem')
self.ExportLanguageItem = QtGui.QAction(self.mainWindow)
self.ExportLanguageItem = QtGui.QAction(MainWindow)
self.ExportLanguageItem.setObjectName(u'ExportLanguageItem')
self.actionLook_Feel = QtGui.QAction(self.mainWindow)
self.actionLook_Feel = QtGui.QAction(MainWindow)
self.actionLook_Feel.setObjectName(u'actionLook_Feel')
self.OptionsSettingsItem = QtGui.QAction(self.mainWindow)
self.OptionsSettingsItem = QtGui.QAction(MainWindow)
SettingsIcon = QtGui.QIcon()
SettingsIcon.addPixmap(QtGui.QPixmap(u':/system/system_settings.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.OptionsSettingsItem.setIcon(SettingsIcon)
self.OptionsSettingsItem.setObjectName(u'OptionsSettingsItem')
self.ViewMediaManagerItem = QtGui.QAction(self.mainWindow)
self.ViewMediaManagerItem = QtGui.QAction(MainWindow)
self.ViewMediaManagerItem.setCheckable(True)
self.ViewMediaManagerItem.setChecked(True)
self.ViewMediaManagerItem.setIcon(icon)
self.ViewMediaManagerItem.setObjectName(u'ViewMediaManagerItem')
self.ViewThemeManagerItem = QtGui.QAction(self.mainWindow)
self.ViewThemeManagerItem = QtGui.QAction(MainWindow)
self.ViewThemeManagerItem.setCheckable(True)
self.ViewThemeManagerItem.setChecked(True)
self.ViewThemeManagerItem.setIcon(ThemeManagerIcon)
self.ViewThemeManagerItem.setObjectName(u'ViewThemeManagerItem')
self.ViewServiceManagerItem = QtGui.QAction(self.mainWindow)
self.ViewServiceManagerItem = QtGui.QAction(MainWindow)
self.ViewServiceManagerItem.setCheckable(True)
self.ViewServiceManagerItem.setChecked(True)
self.ViewServiceManagerItem.setIcon(ServiceManagerIcon)
self.ViewServiceManagerItem.setObjectName(u'ViewServiceManagerItem')
self.ToolsAlertItem = QtGui.QAction(self.mainWindow)
self.ToolsAlertItem = QtGui.QAction(MainWindow)
AlertIcon = QtGui.QIcon()
AlertIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ToolsAlertItem.setIcon(AlertIcon)
self.ToolsAlertItem.setObjectName(u'ToolsAlertItem')
self.HelpDocumentationItem = QtGui.QAction(self.mainWindow)
self.HelpDocumentationItem = QtGui.QAction(MainWindow)
ContentsIcon = QtGui.QIcon()
ContentsIcon.addPixmap(QtGui.QPixmap(u':/system/system_help_contents.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.HelpDocumentationItem.setIcon(ContentsIcon)
self.HelpDocumentationItem.setObjectName(u'HelpDocumentationItem')
self.HelpAboutItem = QtGui.QAction(self.mainWindow)
self.HelpAboutItem = QtGui.QAction(MainWindow)
AboutIcon = QtGui.QIcon()
AboutIcon.addPixmap(QtGui.QPixmap(u':/system/system_about.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.HelpAboutItem.setIcon(AboutIcon)
self.HelpAboutItem.setObjectName(u'HelpAboutItem')
self.HelpOnlineHelpItem = QtGui.QAction(self.mainWindow)
self.HelpOnlineHelpItem = QtGui.QAction(MainWindow)
self.HelpOnlineHelpItem.setObjectName(u'HelpOnlineHelpItem')
self.HelpWebSiteItem = QtGui.QAction(self.mainWindow)
self.HelpWebSiteItem = QtGui.QAction(MainWindow)
self.HelpWebSiteItem.setObjectName(u'HelpWebSiteItem')
self.LanguageTranslateItem = QtGui.QAction(self.mainWindow)
self.LanguageTranslateItem = QtGui.QAction(MainWindow)
self.LanguageTranslateItem.setObjectName(u'LanguageTranslateItem')
self.LanguageEnglishItem = QtGui.QAction(self.mainWindow)
self.LanguageEnglishItem = QtGui.QAction(MainWindow)
self.LanguageEnglishItem.setObjectName(u'LanguageEnglishItem')
self.ToolsAddToolItem = QtGui.QAction(self.mainWindow)
self.ToolsAddToolItem = QtGui.QAction(MainWindow)
AddToolIcon = QtGui.QIcon()
AddToolIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_add.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ToolsAddToolItem.setIcon(AddToolIcon)
self.ToolsAddToolItem.setObjectName(u'ToolsAddToolItem')
self.action_Preview_Panel = QtGui.QAction(self.mainWindow)
self.action_Preview_Panel = QtGui.QAction(MainWindow)
self.action_Preview_Panel.setCheckable(True)
self.action_Preview_Panel.setChecked(True)
self.action_Preview_Panel.setObjectName(u'action_Preview_Panel')
self.ModeLiveItem = QtGui.QAction(self.mainWindow)
self.ModeLiveItem = QtGui.QAction(MainWindow)
self.ModeLiveItem.setObjectName(u'ModeLiveItem')
self.FileImportMenu.addAction(self.ImportThemeItem)
self.FileImportMenu.addAction(self.ImportLanguageItem)
@ -431,43 +276,20 @@ class MainWindow(object):
self.MenuBar.addAction(self.ToolsMenu.menuAction())
self.MenuBar.addAction(self.HelpMenu.menuAction())
# Initialise the translation
self.retranslateUi()
self.retranslateUi(MainWindow)
self.MediaToolBox.setCurrentIndex(0)
# Connect up some signals and slots
QtCore.QObject.connect(self.FileExitItem,
QtCore.SIGNAL(u'triggered()'), self.mainWindow.close)
QtCore.QObject.connect(self.ImportThemeItem,
QtCore.SIGNAL(u'triggered()'), self.ThemeManagerContents.onImportTheme)
QtCore.QObject.connect(self.ExportThemeItem,
QtCore.SIGNAL(u'triggered()'), self.ThemeManagerContents.onExportTheme)
QtCore.QObject.connect(self.ViewMediaManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.MediaManagerDock.setVisible)
QtCore.QObject.connect(self.ViewServiceManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.ServiceManagerDock.setVisible)
QtCore.QObject.connect(self.ViewThemeManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.ThemeManagerDock.setVisible)
QtCore.QObject.connect(self.action_Preview_Panel,
QtCore.SIGNAL(u'toggled(bool)'), self.PreviewController.Panel.setVisible)
QtCore.QObject.connect(self.MediaManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'), self.ViewMediaManagerItem.setChecked)
QtCore.QObject.connect(self.ServiceManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'), self.ViewServiceManagerItem.setChecked)
QtCore.QObject.connect(self.ThemeManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'), self.ViewThemeManagerItem.setChecked)
QtCore.QObject.connect(self.HelpAboutItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
QtCore.QObject.connect(self.ToolsAlertItem,
QtCore.SIGNAL(u'triggered()'), self.onToolsAlertItemClicked)
QtCore.QObject.connect(self.OptionsSettingsItem,
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
QtCore.QMetaObject.connectSlotsByName(self.mainWindow)
QtCore.SIGNAL(u'triggered()'), MainWindow.close)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self):
def retranslateUi(self, MainWindow):
"""
Set up the translation system
"""
self.mainTitle = translate(u'mainWindow', u'OpenLP 2.0')
self.mainWindow.setWindowTitle(self.mainTitle)
MainWindow.mainTitle = translate(u'mainWindow', u'OpenLP 2.0')
MainWindow.defaultThemeText = translate(u'mainWindow', 'Default Theme: ')
MainWindow.setWindowTitle(MainWindow.mainTitle)
self.FileMenu.setTitle(translate(u'mainWindow', u'&File'))
self.FileImportMenu.setTitle(translate(u'mainWindow', u'&Import'))
self.FileExportMenu.setTitle(translate(u'mainWindow', u'&Export'))
@ -483,6 +305,8 @@ class MainWindow(object):
translate(u'mainWindow', u'Service Manager'))
self.ThemeManagerDock.setWindowTitle(
translate(u'mainWindow', u'Theme Manager'))
self.DefaultThemeLabel.setText(MainWindow.defaultThemeText + \
self.ThemeManagerContents.getDefault())
self.FileNewItem.setText(translate(u'mainWindow', u'&New'))
self.FileNewItem.setToolTip(translate(u'mainWindow', u'New Service'))
self.FileNewItem.setStatusTip(
@ -560,3 +384,198 @@ class MainWindow(object):
self.action_Preview_Panel.setText(
translate(u'mainWindow', u'&Preview Pane'))
self.ModeLiveItem.setText(translate(u'mainWindow', u'&Live'))
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
The main window.
"""
global log
log = logging.getLogger(u'MainWindow')
log.info(u'MainWindow loaded')
def __init__(self, screens):
"""
This constructor sets up the interface, the various managers, and the
plugins.
"""
QtGui.QMainWindow.__init__(self)
self.closeEvent = self.onCloseEvent
self.screenList = screens
self.oosNotSaved = False
self.settingsmanager = SettingsManager(screens)
self.mainDisplay = MainDisplay(None, screens)
self.EventManager = EventManager()
self.generalConfig = PluginConfig(u'General')
self.alertForm = AlertForm(self)
self.aboutForm = AboutForm()
self.settingsForm = SettingsForm(self.screenList, self)
# Set up the path with plugins
pluginpath = os.path.split(os.path.abspath(__file__))[0]
pluginpath = os.path.abspath(
os.path.join(pluginpath, u'..', u'..', u'plugins'))
self.plugin_manager = PluginManager(pluginpath)
self.plugin_helpers = {}
# Set up the interface
self.setupUi(self)
# Set up signals and slots
QtCore.QObject.connect(self.ImportThemeItem,
QtCore.SIGNAL(u'triggered()'), self.ThemeManagerContents.onImportTheme)
QtCore.QObject.connect(self.ExportThemeItem,
QtCore.SIGNAL(u'triggered()'), self.ThemeManagerContents.onExportTheme)
QtCore.QObject.connect(self.ViewMediaManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.MediaManagerDock.setVisible)
QtCore.QObject.connect(self.ViewServiceManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.ServiceManagerDock.setVisible)
QtCore.QObject.connect(self.ViewThemeManagerItem,
QtCore.SIGNAL(u'triggered(bool)'), self.ThemeManagerDock.setVisible)
QtCore.QObject.connect(self.action_Preview_Panel,
QtCore.SIGNAL(u'toggled(bool)'), self.PreviewController.Panel.setVisible)
QtCore.QObject.connect(self.MediaManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'), self.ViewMediaManagerItem.setChecked)
QtCore.QObject.connect(self.ServiceManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'), self.ViewServiceManagerItem.setChecked)
QtCore.QObject.connect(self.ThemeManagerDock,
QtCore.SIGNAL(u'visibilityChanged(bool)'), self.ViewThemeManagerItem.setChecked)
QtCore.QObject.connect(self.HelpAboutItem,
QtCore.SIGNAL(u'triggered()'), self.onHelpAboutItemClicked)
QtCore.QObject.connect(self.ToolsAlertItem,
QtCore.SIGNAL(u'triggered()'), self.onToolsAlertItemClicked)
QtCore.QObject.connect(self.OptionsSettingsItem,
QtCore.SIGNAL(u'triggered()'), self.onOptionsSettingsItemClicked)
#warning cyclic dependency
#RenderManager needs to call ThemeManager and
#ThemeManager needs to call RenderManager
self.RenderManager = RenderManager(self.ThemeManagerContents,
self.screenList, self.getMonitorNumber())
log.info(u'Load Plugins')
#make the controllers available to the plugins
self.plugin_helpers[u'preview'] = self.PreviewController
self.plugin_helpers[u'live'] = self.LiveController
self.plugin_helpers[u'event'] = self.EventManager
self.plugin_helpers[u'theme'] = self.ThemeManagerContents
self.plugin_helpers[u'render'] = self.RenderManager
self.plugin_helpers[u'service'] = self.ServiceManagerContents
self.plugin_helpers[u'settings'] = self.settingsForm
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers,
self.EventManager)
# hook methods have to happen after find_plugins. Find plugins needs the
# controllers hence the hooks have moved from setupUI() to here
# Find and insert settings tabs
log.info(u'hook settings')
self.plugin_manager.hook_settings_tabs(self.settingsForm)
# Find and insert media manager items
log.info(u'hook media')
self.plugin_manager.hook_media_manager(self.MediaToolBox)
# Call the hook method to pull in import menus.
log.info(u'hook menus')
self.plugin_manager.hook_import_menu(self.FileImportMenu)
# Call the hook method to pull in export menus.
self.plugin_manager.hook_export_menu(self.FileExportMenu)
# Call the initialise method to setup plugins.
log.info(u'initialise plugins')
self.plugin_manager.initialise_plugins()
# Once all components are initialised load the Themes
log.info(u'Load Themes')
self.ThemeManagerContents.loadThemes()
# Register the main form as an event consumer.
self.EventManager.register(self)
def getMonitorNumber(self):
"""
Set up the default behaviour of the monitor configuration in
here. Currently it is set to default to monitor 0 if the saved
monitor number does not exist.
"""
screen_number = int(self.generalConfig.get_config(u'Monitor', 0))
if screen_number not in self.screenList:
screen_number = 0
return screen_number
def show(self):
"""
Show the main form, as well as the display form
"""
self.showMaximized()
screen_number = self.getMonitorNumber()
self.mainDisplay.setup(screen_number)
self.setFocus()
def onHelpAboutItemClicked(self):
"""
Show the About form
"""
self.aboutForm.exec_()
def onToolsAlertItemClicked(self):
"""
Show the Alert form
"""
self.alertForm.exec_()
def onOptionsSettingsItemClicked(self):
"""
Show the Settings dialog
"""
self.settingsForm.exec_()
screen_number = self.getMonitorNumber()
self.RenderManager.update_display(screen_number)
self.mainDisplay.setup(screen_number)
def onCloseEvent(self, event):
"""
Hook to close the main window and display windows on exit
"""
if self.oosNotSaved == True:
ret = QtGui.QMessageBox.question(None,
translate(u'mainWindow', u'Save Changes to Service?'),
translate(u'mainWindow', u'Your service has been changed, do you want to save those changes?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
QtGui.QMessageBox.Save)
if ret == QtGui.QMessageBox.Save:
self.ServiceManagerContents.onSaveService()
self.mainDisplay.close()
self.cleanUp()
event.accept()
elif ret == QtGui.QMessageBox.Discard:
self.mainDisplay.close()
self.cleanUp()
event.accept()
else:
event.ignore()
else:
self.mainDisplay.close()
self.cleanUp()
event.accept()
def cleanUp(self):
# Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins')
self.plugin_manager.initialise_plugins()
def OosChanged(self, reset=False, oosName=None):
"""
Hook to change the title if the OOS has been changed
reset - tells if the OOS has been cleared or saved
oosName - is the name of the OOS (if it has one)
"""
if not oosName:
service_name = u'(unsaved service)'
else:
service_name = oosName
if reset == True:
self.oosNotSaved = False
title = u'%s - %s' % (self.mainTitle, service_name)
else:
self.oosNotSaved = True
title = u'%s - %s*' % (self.mainTitle, service_name)
self.setWindowTitle(title)
def handle_event(self, event):
if event.event_type == EventType.ThemeListChanged:
themes = self.ThemeManagerContents.getThemes()
self.ServiceManagerContents.updateThemeList(themes)
self.settingsForm.ThemesTab.updateThemeList(themes)
self.DefaultThemeLabel.setText(self.defaultThemeText + \
self.ThemeManagerContents.getDefault())

View File

@ -161,7 +161,7 @@ class ServiceManager(QtGui.QWidget):
# Last little bits of setting up
self.config = PluginConfig(u'ServiceManager')
self.servicePath = self.config.get_data_path()
self.service_theme = self.config.get_config(u'theme service theme', u'')
self.service_theme = unicode(self.config.get_config(u'theme service theme', u''))
def onMoveSelectionUp(self):
"""
@ -412,7 +412,11 @@ class ServiceManager(QtGui.QWidget):
def addServiceItem(self, item):
"""
Add an item to the list
Add a Service item to the list
``item``
Service Item to be added
"""
self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1, u'expanded':True})
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
@ -465,13 +469,21 @@ class ServiceManager(QtGui.QWidget):
def dragEnterEvent(self, event):
"""
Accept Drag events
``event``
Handle of the event pint passed
"""
event.accept()
def dropEvent(self, event):
"""
Handle the release of the event and trigger the plugin
to add the data
Receive drop event and trigger an internal event to get the
plugins to build and push the correct service item
The drag event payload carries the plugin name
``event``
Handle of the event pint passed
"""
link = event.mimeData()
if link.hasText():
@ -481,12 +493,16 @@ class ServiceManager(QtGui.QWidget):
def updateThemeList(self, theme_list):
"""
Called from ThemeManager when the Themes have changed
``theme_list``
A list of current themes to be displayed
"""
self.ThemeComboBox.clear()
self.ThemeComboBox.addItem(u'')
for theme in theme_list:
self.ThemeComboBox.addItem(theme)
id = self.ThemeComboBox.findText(unicode(self.service_theme), QtCore.Qt.MatchExactly)
id = self.ThemeComboBox.findText(self.service_theme, QtCore.Qt.MatchExactly)
# Not Found
if id == -1:
id = 0

View File

@ -28,7 +28,9 @@ from PyQt4 import QtCore, QtGui
from openlp.core.ui import AmendThemeForm, ServiceManager
from openlp.core.theme import Theme
from openlp.core.lib import Event, EventType, EventManager, OpenLPToolbar, ThemeXML, Renderer, translate, file_to_xml, buildIcon
from openlp.core.lib import PluginConfig, Event, EventType, \
EventManager, OpenLPToolbar, ThemeXML, Renderer, translate, \
file_to_xml, buildIcon
from openlp.core.utils import ConfigHelper
class ThemeManager(QtGui.QWidget):
@ -39,7 +41,7 @@ class ThemeManager(QtGui.QWidget):
log = logging.getLogger(u'ThemeManager')
def __init__(self, parent):
QtGui.QWidget.__init__(self)
QtGui.QWidget.__init__(self, parent)
self.parent = parent
self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0)
@ -68,10 +70,36 @@ class ThemeManager(QtGui.QWidget):
self.ThemeListWidget.setAlternatingRowColors(True)
self.ThemeListWidget.setIconSize(QtCore.QSize(88,50))
self.Layout.addWidget(self.ThemeListWidget)
#Signals
QtCore.QObject.connect(self.ThemeListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.changeGlobal)
#Variables
self.themelist = []
self.path = os.path.join(ConfigHelper.get_data_path(), u'themes')
self.checkThemesExists(self.path)
self.amendThemeForm.path = self.path
# Last little bits of setting up
self.config = PluginConfig(u'themes')
self.servicePath = self.config.get_data_path()
self.global_theme = unicode(self.config.get_config(u'theme global theme', u''))
def getDefault(self):
return self.global_theme
def changeGlobal(self, index):
for count in range (0, self.ThemeListWidget.count()):
item = self.ThemeListWidget.item(count)
oldName = item.text()
#reset the old name
if oldName != unicode(item.data(QtCore.Qt.UserRole).toString()):
self.ThemeListWidget.item(count).setText(unicode(item.data(QtCore.Qt.UserRole).toString()))
#Set the new name
if count == index.row():
self.global_theme = unicode(self.ThemeListWidget.item(count).text())
name = u'%s (%s)' % (self.global_theme, translate(u'ThemeManager', u'default'))
self.ThemeListWidget.item(count).setText(name)
self.config.set_config(u'theme global theme', self.global_theme)
self.pushThemes()
def onAddTheme(self):
self.amendThemeForm.loadTheme(None)
@ -80,30 +108,38 @@ class ThemeManager(QtGui.QWidget):
def onEditTheme(self):
item = self.ThemeListWidget.currentItem()
if item is not None:
self.amendThemeForm.loadTheme(unicode(item.text()))
self.amendThemeForm.loadTheme(unicode(item.data(QtCore.Qt.UserRole).toString()))
self.amendThemeForm.exec_()
def onDeleteTheme(self):
self.global_theme = unicode(self.config.get_config(u'theme global theme', u''))
item = self.ThemeListWidget.currentItem()
if item is not None:
theme = unicode(item.text())
th = theme + u'.png'
row = self.ThemeListWidget.row(item)
self.ThemeListWidget.takeItem(row)
try:
os.remove(os.path.join(self.path, th))
except:
#if not present do not worry
pass
try:
shutil.rmtree(os.path.join(self.path, theme))
except:
#if not present do not worry
pass
#As we do not reload the themes push out the change
self.parent.EventManager.post_event(Event(EventType.ThemeListChanged))
self.parent.ServiceManagerContents.updateThemeList(self.getThemes())
self.parent.settingsForm.ThemesTab.updateThemeList(self.getThemes())
# should be the same unless default
if theme != unicode(item.data(QtCore.Qt.UserRole).toString()):
QtGui.QMessageBox.critical(self,
translate(u'ThemeManager', u'Error'),
translate(u'ThemeManager', u'You are unable to delete the default theme!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
else:
self.themelist.remove(theme)
th = theme + u'.png'
row = self.ThemeListWidget.row(item)
self.ThemeListWidget.takeItem(row)
try:
os.remove(os.path.join(self.path, th))
except:
#if not present do not worry
pass
try:
shutil.rmtree(os.path.join(self.path, theme))
except:
#if not present do not worry
pass
#As we do not reload the themes push out the change
#Reaload the list as the internal lists and events need to be triggered
self.pushThemes()
def onExportTheme(self):
pass
@ -136,14 +172,19 @@ class ThemeManager(QtGui.QWidget):
if os.path.exists(theme):
(path, filename) = os.path.split(unicode(file))
textName = os.path.splitext(name)[0]
item_name = QtGui.QListWidgetItem(textName)
if textName == self.global_theme:
name = u'%s (%s)' % (textName, translate(u'ThemeManager', u'default'))
else:
name = textName
item_name = QtGui.QListWidgetItem(name)
item_name.setIcon(buildIcon(theme))
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(textName))
self.ThemeListWidget.addItem(item_name)
self.themelist.append(textName)
self.pushThemes()
def pushThemes(self):
self.parent.EventManager.post_event(Event(EventType.ThemeListChanged))
self.parent.ServiceManagerContents.updateThemeList(self.getThemes())
self.parent.settingsForm.ThemesTab.updateThemeList(self.getThemes())
def getThemes(self):
return self.themelist
@ -153,6 +194,7 @@ class ThemeManager(QtGui.QWidget):
xml_file = os.path.join(self.path, unicode(themename), unicode(themename) + u'.xml')
try:
xml = file_to_xml(xml_file)
#print xml
except:
newtheme = ThemeXML()
newtheme.new_document(u'New Theme')
@ -163,7 +205,9 @@ class ThemeManager(QtGui.QWidget):
unicode(0), unicode(0), unicode(0))
xml = newtheme.extract_xml()
theme = ThemeXML()
#print theme
theme.parse(xml)
#print "A ", theme
theme.extend_image_filename(self.path)
return theme
@ -211,6 +255,9 @@ class ThemeManager(QtGui.QWidget):
self.generateAndSaveImage(dir, themename, filexml)
def checkVersion1(self, xmlfile):
"""
Am I a version 1 theme
"""
log.debug(u'checkVersion1 ')
theme = xmlfile
tree = ElementTree(element=XML(theme)).getroot()
@ -220,6 +267,11 @@ class ThemeManager(QtGui.QWidget):
return True
def migrateVersion122(self, filename, fullpath, xml_data):
"""
Called by convert the xml data from version 1 format
to the current format.
New fields are defaulted but the new theme is useable
"""
log.debug(u'migrateVersion122 %s %s', filename, fullpath)
theme = Theme(xml_data)
newtheme = ThemeXML()

View File

@ -99,8 +99,6 @@ class ThemesTab(SettingsTab):
QtCore.QObject.connect(self.DefaultComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged)
#self.DefaultListView.setScaledContents(True)
def retranslateUi(self):
self.GlobalGroupBox.setTitle(translate(u'ThemesTab', u'Global theme'))
self.LevelGroupBox.setTitle(translate(u'ThemesTab', u'Theme level'))
@ -138,9 +136,9 @@ class ThemesTab(SettingsTab):
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
def onDefaultComboBoxChanged(self, value):
self.global_theme = self.DefaultComboBox.currentText()
self.global_theme = unicode(self.DefaultComboBox.currentText())
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
image = self.parent.ThemeManagerContents.getPreviewImage(unicode(self.global_theme))
image = self.parent.ThemeManagerContents.getPreviewImage(self.global_theme)
preview = QtGui.QPixmap(unicode(image))
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(display)
@ -149,17 +147,19 @@ class ThemesTab(SettingsTab):
"""
Called from ThemeManager when the Themes have changed
"""
#reload as may have been triggered by the ThemeManager
self.global_theme = self.config.get_config(u'theme global theme', u'')
self.DefaultComboBox.clear()
for theme in theme_list:
self.DefaultComboBox.addItem(theme)
id = self.DefaultComboBox.findText(unicode(self.global_theme), QtCore.Qt.MatchExactly)
id = self.DefaultComboBox.findText(self.global_theme, QtCore.Qt.MatchExactly)
if id == -1:
id = 0 # Not Found
self.global_theme = u''
self.DefaultComboBox.setCurrentIndex(id)
self.parent.RenderManager.set_global_theme(self.global_theme, self.global_style)
if self.global_theme is not u'':
image = self.parent.ThemeManagerContents.getPreviewImage(unicode(self.global_theme))
image = self.parent.ThemeManagerContents.getPreviewImage(self.global_theme)
preview = QtGui.QPixmap(unicode(image))
display = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(display)
self.DefaultListView.setPixmap(display)

View File

@ -2,140 +2,22 @@
# Form implementation generated from reading ui file 'bibleimportdialog.ui'
#
# Created: Fri Feb 20 05:45:22 2009
# Created: Fri Aug 7 06:07:06 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
class Ui_BibleImportDialog(object):
def setupUi(self, BibleImportDialog):
BibleImportDialog.setObjectName(u'BibleImportDialog')
BibleImportDialog.resize(494, 725)
BibleImportDialog.resize(500, 686)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp-logo-16x16.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon.addPixmap(QtGui.QPixmap(u':/icon/openlp.org-icon-32.bmp'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
BibleImportDialog.setWindowIcon(icon)
self.ImportToolBox = QtGui.QToolBox(BibleImportDialog)
self.ImportToolBox.setGeometry(QtCore.QRect(20, 20, 451, 401))
self.ImportToolBox.setFrameShape(QtGui.QFrame.StyledPanel)
self.ImportToolBox.setObjectName(u'ImportToolBox')
self.FileImportPage = QtGui.QWidget()
self.FileImportPage.setGeometry(QtCore.QRect(0, 0, 447, 337))
self.FileImportPage.setObjectName(u'FileImportPage')
self.OSISGroupBox = QtGui.QGroupBox(self.FileImportPage)
self.OSISGroupBox.setGeometry(QtCore.QRect(18, 65, 411, 81))
self.OSISGroupBox.setObjectName(u'OSISGroupBox')
self.gridLayout_2 = QtGui.QGridLayout(self.OSISGroupBox)
self.gridLayout_2.setMargin(8)
self.gridLayout_2.setSpacing(8)
self.gridLayout_2.setObjectName(u'gridLayout_2')
self.LocatioLabel = QtGui.QLabel(self.OSISGroupBox)
self.LocatioLabel.setObjectName(u'LocatioLabel')
self.gridLayout_2.addWidget(self.LocatioLabel, 0, 0, 1, 1)
self.OSISLocationEdit = QtGui.QLineEdit(self.OSISGroupBox)
self.OSISLocationEdit.setObjectName(u'OSISLocationEdit')
self.gridLayout_2.addWidget(self.OSISLocationEdit, 0, 1, 1, 1)
self.OsisFileButton = QtGui.QPushButton(self.OSISGroupBox)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.OsisFileButton.setIcon(icon1)
self.OsisFileButton.setObjectName(u'OsisFileButton')
self.gridLayout_2.addWidget(self.OsisFileButton, 0, 2, 1, 1)
self.CVSGroupBox = QtGui.QGroupBox(self.FileImportPage)
self.CVSGroupBox.setGeometry(QtCore.QRect(20, 170, 411, 191))
self.CVSGroupBox.setObjectName(u'CVSGroupBox')
self.gridLayout = QtGui.QGridLayout(self.CVSGroupBox)
self.gridLayout.setMargin(8)
self.gridLayout.setSpacing(8)
self.gridLayout.setObjectName(u'gridLayout')
self.BooksLocationLabel = QtGui.QLabel(self.CVSGroupBox)
self.BooksLocationLabel.setObjectName(u'BooksLocationLabel')
self.gridLayout.addWidget(self.BooksLocationLabel, 0, 0, 1, 1)
self.VerseLocationLabel = QtGui.QLabel(self.CVSGroupBox)
self.VerseLocationLabel.setObjectName(u'VerseLocationLabel')
self.gridLayout.addWidget(self.VerseLocationLabel, 4, 0, 1, 1)
self.VerseLocationEdit = QtGui.QLineEdit(self.CVSGroupBox)
self.VerseLocationEdit.setObjectName(u'VerseLocationEdit')
self.gridLayout.addWidget(self.VerseLocationEdit, 4, 1, 1, 1)
self.BooksLocationEdit = QtGui.QLineEdit(self.CVSGroupBox)
self.BooksLocationEdit.setObjectName(u'BooksLocationEdit')
self.gridLayout.addWidget(self.BooksLocationEdit, 0, 1, 1, 1)
self.BooksFileButton = QtGui.QPushButton(self.CVSGroupBox)
self.BooksFileButton.setIcon(icon1)
self.BooksFileButton.setObjectName(u'BooksFileButton')
self.gridLayout.addWidget(self.BooksFileButton, 0, 2, 1, 1)
self.VersesFileButton = QtGui.QPushButton(self.CVSGroupBox)
self.VersesFileButton.setIcon(icon1)
self.VersesFileButton.setObjectName(u'VersesFileButton')
self.gridLayout.addWidget(self.VersesFileButton, 4, 2, 1, 1)
self.BibleNameEdit = QtGui.QLineEdit(self.FileImportPage)
self.BibleNameEdit.setGeometry(QtCore.QRect(100, 20, 280, 28))
self.BibleNameEdit.setObjectName(u'BibleNameEdit')
self.BibleNameLabel = QtGui.QLabel(self.FileImportPage)
self.BibleNameLabel.setGeometry(QtCore.QRect(18, 20, 98, 22))
self.BibleNameLabel.setObjectName(u'BibleNameLabel')
self.ImportToolBox.addItem(self.FileImportPage, u'')
self.WebBiblePage = QtGui.QWidget()
self.WebBiblePage.setGeometry(QtCore.QRect(0, 0, 447, 337))
self.WebBiblePage.setObjectName(u'WebBiblePage')
self.WebBibleLayout = QtGui.QVBoxLayout(self.WebBiblePage)
self.WebBibleLayout.setSpacing(8)
self.WebBibleLayout.setMargin(8)
self.WebBibleLayout.setObjectName(u'WebBibleLayout')
self.OptionsGroupBox = QtGui.QGroupBox(self.WebBiblePage)
self.OptionsGroupBox.setObjectName(u'OptionsGroupBox')
self.formLayout_2 = QtGui.QFormLayout(self.OptionsGroupBox)
self.formLayout_2.setObjectName(u'formLayout_2')
self.LocationLabel = QtGui.QLabel(self.OptionsGroupBox)
self.LocationLabel.setObjectName(u'LocationLabel')
self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.LocationLabel)
self.LocationComboBox = QtGui.QComboBox(self.OptionsGroupBox)
self.LocationComboBox.setObjectName(u'LocationComboBox')
self.LocationComboBox.addItem(QtCore.QString())
self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.LocationComboBox)
self.BibleLabel = QtGui.QLabel(self.OptionsGroupBox)
self.BibleLabel.setObjectName(u'BibleLabel')
self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.BibleLabel)
self.BibleComboBox = QtGui.QComboBox(self.OptionsGroupBox)
self.BibleComboBox.setObjectName(u'BibleComboBox')
self.BibleComboBox.addItem(QtCore.QString())
self.BibleComboBox.setItemText(0, u'')
self.BibleComboBox.addItem(QtCore.QString())
self.BibleComboBox.addItem(QtCore.QString())
self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.BibleComboBox)
self.WebBibleLayout.addWidget(self.OptionsGroupBox)
self.ProxyGroupBox = QtGui.QGroupBox(self.WebBiblePage)
self.ProxyGroupBox.setObjectName(u'ProxyGroupBox')
self.ProxySettingsLayout = QtGui.QFormLayout(self.ProxyGroupBox)
self.ProxySettingsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.ProxySettingsLayout.setMargin(8)
self.ProxySettingsLayout.setSpacing(8)
self.ProxySettingsLayout.setObjectName(u'ProxySettingsLayout')
self.AddressLabel = QtGui.QLabel(self.ProxyGroupBox)
self.AddressLabel.setObjectName(u'AddressLabel')
self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AddressLabel)
self.AddressEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.AddressEdit.setObjectName(u'AddressEdit')
self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AddressEdit)
self.UsernameLabel = QtGui.QLabel(self.ProxyGroupBox)
self.UsernameLabel.setObjectName(u'UsernameLabel')
self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.UsernameLabel)
self.UsernameEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.UsernameEdit.setObjectName(u'UsernameEdit')
self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.UsernameEdit)
self.PasswordLabel = QtGui.QLabel(self.ProxyGroupBox)
self.PasswordLabel.setObjectName(u'PasswordLabel')
self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.PasswordLabel)
self.PasswordEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.PasswordEdit.setEchoMode(QtGui.QLineEdit.Password)
self.PasswordEdit.setObjectName(u'PasswordEdit')
self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PasswordEdit)
self.WebBibleLayout.addWidget(self.ProxyGroupBox)
self.ImportToolBox.addItem(self.WebBiblePage, u'')
self.LicenceDetailsGroupBox = QtGui.QGroupBox(BibleImportDialog)
self.LicenceDetailsGroupBox.setGeometry(QtCore.QRect(10, 435, 471, 151))
self.LicenceDetailsGroupBox.setGeometry(QtCore.QRect(10, 400, 480, 151))
self.LicenceDetailsGroupBox.setMinimumSize(QtCore.QSize(0, 123))
self.LicenceDetailsGroupBox.setObjectName(u'LicenceDetailsGroupBox')
self.formLayout = QtGui.QFormLayout(self.LicenceDetailsGroupBox)
@ -164,7 +46,7 @@ class Ui_BibleImportDialog(object):
self.MessageLabel.setGeometry(QtCore.QRect(20, 670, 271, 17))
self.MessageLabel.setObjectName(u'MessageLabel')
self.ProgressGroupBox = QtGui.QGroupBox(BibleImportDialog)
self.ProgressGroupBox.setGeometry(QtCore.QRect(10, 600, 471, 70))
self.ProgressGroupBox.setGeometry(QtCore.QRect(10, 550, 480, 70))
self.ProgressGroupBox.setObjectName(u'ProgressGroupBox')
self.gridLayout_3 = QtGui.QGridLayout(self.ProgressGroupBox)
self.gridLayout_3.setObjectName(u'gridLayout_3')
@ -174,7 +56,7 @@ class Ui_BibleImportDialog(object):
self.ProgressBar.setObjectName(u'ProgressBar')
self.gridLayout_3.addWidget(self.ProgressBar, 0, 0, 1, 1)
self.layoutWidget = QtGui.QWidget(BibleImportDialog)
self.layoutWidget.setGeometry(QtCore.QRect(300, 680, 180, 38))
self.layoutWidget.setGeometry(QtCore.QRect(310, 630, 180, 38))
self.layoutWidget.setObjectName(u'layoutWidget')
self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget)
self.horizontalLayout.setMargin(6)
@ -185,10 +67,131 @@ class Ui_BibleImportDialog(object):
self.CancelButton = QtGui.QPushButton(self.layoutWidget)
self.CancelButton.setObjectName(u'CancelButton')
self.horizontalLayout.addWidget(self.CancelButton)
self.tabWidget = QtGui.QTabWidget(BibleImportDialog)
self.tabWidget.setGeometry(QtCore.QRect(10, 30, 480, 361))
self.tabWidget.setObjectName(u'tabWidget')
self.OsisTab = QtGui.QWidget()
self.OsisTab.setObjectName(u'OsisTab')
self.OSISGroupBox = QtGui.QGroupBox(self.OsisTab)
self.OSISGroupBox.setGeometry(QtCore.QRect(10, 10, 460, 141))
self.OSISGroupBox.setObjectName(u'OSISGroupBox')
self.gridLayout_2 = QtGui.QGridLayout(self.OSISGroupBox)
self.gridLayout_2.setObjectName(u'gridLayout_2')
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(u'horizontalLayout_2')
self.BibleNameLabel = QtGui.QLabel(self.OSISGroupBox)
self.BibleNameLabel.setObjectName(u'BibleNameLabel')
self.horizontalLayout_2.addWidget(self.BibleNameLabel)
self.BibleNameEdit = QtGui.QLineEdit(self.OSISGroupBox)
self.BibleNameEdit.setObjectName(u'BibleNameEdit')
self.horizontalLayout_2.addWidget(self.BibleNameEdit)
self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(u'horizontalLayout_3')
self.LocatioLabel = QtGui.QLabel(self.OSISGroupBox)
self.LocatioLabel.setObjectName(u'LocatioLabel')
self.horizontalLayout_3.addWidget(self.LocatioLabel)
self.OSISLocationEdit = QtGui.QLineEdit(self.OSISGroupBox)
self.OSISLocationEdit.setObjectName(u'OSISLocationEdit')
self.horizontalLayout_3.addWidget(self.OSISLocationEdit)
self.OsisFileButton = QtGui.QPushButton(self.OSISGroupBox)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(u':/imports/import_load.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.OsisFileButton.setIcon(icon1)
self.OsisFileButton.setObjectName(u'OsisFileButton')
self.horizontalLayout_3.addWidget(self.OsisFileButton)
self.gridLayout_2.addLayout(self.horizontalLayout_3, 1, 0, 1, 1)
self.tabWidget.addTab(self.OsisTab, u'')
self.CsvTab = QtGui.QWidget()
self.CsvTab.setObjectName(u'CsvTab')
self.CVSGroupBox = QtGui.QGroupBox(self.CsvTab)
self.CVSGroupBox.setGeometry(QtCore.QRect(10, 10, 460, 191))
self.CVSGroupBox.setObjectName(u'CVSGroupBox')
self.gridLayout = QtGui.QGridLayout(self.CVSGroupBox)
self.gridLayout.setMargin(8)
self.gridLayout.setSpacing(8)
self.gridLayout.setObjectName(u'gridLayout')
self.BooksLocationLabel = QtGui.QLabel(self.CVSGroupBox)
self.BooksLocationLabel.setObjectName(u'BooksLocationLabel')
self.gridLayout.addWidget(self.BooksLocationLabel, 0, 0, 1, 1)
self.VerseLocationLabel = QtGui.QLabel(self.CVSGroupBox)
self.VerseLocationLabel.setObjectName(u'VerseLocationLabel')
self.gridLayout.addWidget(self.VerseLocationLabel, 4, 0, 1, 1)
self.VerseLocationEdit = QtGui.QLineEdit(self.CVSGroupBox)
self.VerseLocationEdit.setObjectName(u'VerseLocationEdit')
self.gridLayout.addWidget(self.VerseLocationEdit, 4, 1, 1, 1)
self.BooksLocationEdit = QtGui.QLineEdit(self.CVSGroupBox)
self.BooksLocationEdit.setObjectName(u'BooksLocationEdit')
self.gridLayout.addWidget(self.BooksLocationEdit, 0, 1, 1, 1)
self.BooksFileButton = QtGui.QPushButton(self.CVSGroupBox)
self.BooksFileButton.setIcon(icon1)
self.BooksFileButton.setObjectName(u'BooksFileButton')
self.gridLayout.addWidget(self.BooksFileButton, 0, 2, 1, 1)
self.VersesFileButton = QtGui.QPushButton(self.CVSGroupBox)
self.VersesFileButton.setIcon(icon1)
self.VersesFileButton.setObjectName(u'VersesFileButton')
self.gridLayout.addWidget(self.VersesFileButton, 4, 2, 1, 1)
self.tabWidget.addTab(self.CsvTab, u'')
self.HttpTab = QtGui.QWidget()
self.HttpTab.setObjectName(u'HttpTab')
self.OptionsGroupBox = QtGui.QGroupBox(self.HttpTab)
self.OptionsGroupBox.setGeometry(QtCore.QRect(10, 10, 460, 141))
self.OptionsGroupBox.setObjectName(u'OptionsGroupBox')
self.verticalLayout = QtGui.QVBoxLayout(self.OptionsGroupBox)
self.verticalLayout.setObjectName(u'verticalLayout')
self.horizontalLayout_4 = QtGui.QHBoxLayout()
self.horizontalLayout_4.setObjectName(u'horizontalLayout_4')
self.LocationLabel = QtGui.QLabel(self.OptionsGroupBox)
self.LocationLabel.setObjectName(u'LocationLabel')
self.horizontalLayout_4.addWidget(self.LocationLabel)
self.LocationComboBox = QtGui.QComboBox(self.OptionsGroupBox)
self.LocationComboBox.setObjectName(u'LocationComboBox')
self.LocationComboBox.addItem(QtCore.QString())
self.horizontalLayout_4.addWidget(self.LocationComboBox)
self.verticalLayout.addLayout(self.horizontalLayout_4)
self.horizontalLayout_5 = QtGui.QHBoxLayout()
self.horizontalLayout_5.setObjectName(u'horizontalLayout_5')
self.BibleLabel = QtGui.QLabel(self.OptionsGroupBox)
self.BibleLabel.setObjectName(u'BibleLabel')
self.horizontalLayout_5.addWidget(self.BibleLabel)
self.BibleComboBox = QtGui.QComboBox(self.OptionsGroupBox)
self.BibleComboBox.setObjectName(u'BibleComboBox')
self.BibleComboBox.addItem(QtCore.QString())
self.BibleComboBox.setItemText(0, u'')
self.BibleComboBox.addItem(QtCore.QString())
self.BibleComboBox.addItem(QtCore.QString())
self.horizontalLayout_5.addWidget(self.BibleComboBox)
self.verticalLayout.addLayout(self.horizontalLayout_5)
self.ProxyGroupBox = QtGui.QGroupBox(self.HttpTab)
self.ProxyGroupBox.setGeometry(QtCore.QRect(10, 160, 460, 161))
self.ProxyGroupBox.setObjectName(u'ProxyGroupBox')
self.ProxySettingsLayout = QtGui.QFormLayout(self.ProxyGroupBox)
self.ProxySettingsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.ProxySettingsLayout.setMargin(8)
self.ProxySettingsLayout.setSpacing(8)
self.ProxySettingsLayout.setObjectName(u'ProxySettingsLayout')
self.AddressLabel = QtGui.QLabel(self.ProxyGroupBox)
self.AddressLabel.setObjectName(u'AddressLabel')
self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AddressLabel)
self.AddressEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.AddressEdit.setObjectName(u'AddressEdit')
self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AddressEdit)
self.UsernameLabel = QtGui.QLabel(self.ProxyGroupBox)
self.UsernameLabel.setObjectName(u'UsernameLabel')
self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.UsernameLabel)
self.UsernameEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.UsernameEdit.setObjectName(u'UsernameEdit')
self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.UsernameEdit)
self.PasswordLabel = QtGui.QLabel(self.ProxyGroupBox)
self.PasswordLabel.setObjectName(u'PasswordLabel')
self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.PasswordLabel)
self.PasswordEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.PasswordEdit.setObjectName(u'PasswordEdit')
self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PasswordEdit)
self.tabWidget.addTab(self.HttpTab, u'')
self.retranslateUi(BibleImportDialog)
self.ImportToolBox.setCurrentIndex(1)
self.tabWidget.setCurrentIndex(2)
QtCore.QMetaObject.connectSlotsByName(BibleImportDialog)
BibleImportDialog.setTabOrder(self.BibleNameEdit, self.OSISLocationEdit)
BibleImportDialog.setTabOrder(self.OSISLocationEdit, self.OsisFileButton)
@ -206,30 +209,31 @@ class Ui_BibleImportDialog(object):
BibleImportDialog.setTabOrder(self.CopyrightEdit, self.PermisionEdit)
def retranslateUi(self, BibleImportDialog):
BibleImportDialog.setWindowTitle(translate(u'BibleImportDialog', u'Bible Registration'))
self.OSISGroupBox.setTitle(translate(u'BibleImportDialog', u'OSIS Bible'))
self.LocatioLabel.setText(translate(u'BibleImportDialog', u'File Location:'))
self.CVSGroupBox.setTitle(translate(u'BibleImportDialog', u'CVS Bible'))
self.BooksLocationLabel.setText(translate(u'BibleImportDialog', u'Books Location:'))
self.VerseLocationLabel.setText(translate(u'BibleImportDialog', u'Verse Location:'))
self.BibleNameLabel.setText(translate(u'BibleImportDialog', u'Bible Name:'))
self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.FileImportPage), translate(u'BibleImportDialog', u'File Import Page'))
self.OptionsGroupBox.setTitle(translate(u'BibleImportDialog', u'Download Options'))
self.LocationLabel.setText(translate(u'BibleImportDialog', u'Location:'))
self.LocationComboBox.setItemText(0, translate(u'BibleImportDialog', u'Crosswalk'))
self.BibleLabel.setText(translate(u'BibleImportDialog', u'Bible:'))
self.BibleComboBox.setItemText(1, translate(u'BibleImportDialog', u'NIV'))
self.BibleComboBox.setItemText(2, translate(u'BibleImportDialog', u'KJV'))
self.ProxyGroupBox.setTitle(translate(u'BibleImportDialog', u'Proxy Settings (Optional)'))
self.AddressLabel.setText(translate(u'BibleImportDialog', u'Proxy Address:'))
self.UsernameLabel.setText(translate(u'BibleImportDialog', u'Username:'))
self.PasswordLabel.setText(translate(u'BibleImportDialog', u'Password:'))
self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.WebBiblePage), translate(u'BibleImportDialog', u'Web Bible Import page'))
self.LicenceDetailsGroupBox.setTitle(translate(u'BibleImportDialog', u'Licence Details'))
self.VersionNameLabel.setText(translate(u'BibleImportDialog', u'Version Name:'))
self.CopyrightLabel.setText(translate(u'BibleImportDialog', u'Copyright:'))
self.PermisionLabel.setText(translate(u'BibleImportDialog', u'Permission:'))
self.ProgressGroupBox.setTitle(translate(u'BibleImportDialog', u'Import Progress'))
self.ProgressBar.setFormat(translate(u'BibleImportDialog', u'%p'))
self.ImportButton.setText(translate(u'BibleImportDialog', u'Import'))
self.CancelButton.setText(translate(u'BibleImportDialog', u'Cancel'))
BibleImportDialog.setWindowTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible Registration', None, QtGui.QApplication.UnicodeUTF8))
self.LicenceDetailsGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Licence Details', None, QtGui.QApplication.UnicodeUTF8))
self.VersionNameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Version Name:', None, QtGui.QApplication.UnicodeUTF8))
self.CopyrightLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Copyright:', None, QtGui.QApplication.UnicodeUTF8))
self.PermisionLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Permission:', None, QtGui.QApplication.UnicodeUTF8))
self.ProgressGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Import Progress', None, QtGui.QApplication.UnicodeUTF8))
self.ProgressBar.setFormat(QtGui.QApplication.translate(u'BibleImportDialog', u'%p', None, QtGui.QApplication.UnicodeUTF8))
self.ImportButton.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Import', None, QtGui.QApplication.UnicodeUTF8))
self.CancelButton.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Cancel', None, QtGui.QApplication.UnicodeUTF8))
self.OSISGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'OSIS Bible', None, QtGui.QApplication.UnicodeUTF8))
self.BibleNameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible Name:', None, QtGui.QApplication.UnicodeUTF8))
self.LocatioLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'File Location:', None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.OsisTab), QtGui.QApplication.translate(u'BibleImportDialog', u'Osis (Sword) Imports', None, QtGui.QApplication.UnicodeUTF8))
self.CVSGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'CVS Bible', None, QtGui.QApplication.UnicodeUTF8))
self.BooksLocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Books Location:', None, QtGui.QApplication.UnicodeUTF8))
self.VerseLocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Verse Location:', None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.CsvTab), QtGui.QApplication.translate(u'BibleImportDialog', u'CSV File Imports', None, QtGui.QApplication.UnicodeUTF8))
self.OptionsGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Download Options', None, QtGui.QApplication.UnicodeUTF8))
self.LocationLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Location:', None, QtGui.QApplication.UnicodeUTF8))
self.LocationComboBox.setItemText(0, QtGui.QApplication.translate(u'BibleImportDialog', u'Crosswalk', None, QtGui.QApplication.UnicodeUTF8))
self.BibleLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Bible:', None, QtGui.QApplication.UnicodeUTF8))
self.BibleComboBox.setItemText(1, QtGui.QApplication.translate(u'BibleImportDialog', u'NIV', None, QtGui.QApplication.UnicodeUTF8))
self.BibleComboBox.setItemText(2, QtGui.QApplication.translate(u'BibleImportDialog', u'KJV', None, QtGui.QApplication.UnicodeUTF8))
self.ProxyGroupBox.setTitle(QtGui.QApplication.translate(u'BibleImportDialog', u'Proxy Settings (Optional)', None, QtGui.QApplication.UnicodeUTF8))
self.AddressLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Proxy Address:', None, QtGui.QApplication.UnicodeUTF8))
self.UsernameLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Username:', None, QtGui.QApplication.UnicodeUTF8))
self.PasswordLabel.setText(QtGui.QApplication.translate(u'BibleImportDialog', u'Password:', None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.HttpTab), QtGui.QApplication.translate(u'BibleImportDialog', u'Web Downloads', None, QtGui.QApplication.UnicodeUTF8))

View File

@ -93,7 +93,7 @@ class ImageToolbar(MasterToolbar):
Go to the last slide.
"""
if self.PreviewListWidget.rowCount() > 1:
self.timer_id = self.startTimer(int(self.TimeoutSpinBox.value()) * 1000)
self.timer_id = self.startTimer(int(self.TimeoutSpinBox.value()) * 1000)
def onStopLoop(self):
"""

View File

@ -380,11 +380,10 @@ class Ui_EditSongDialog(object):
self.verticalLayout.addWidget(self.ButtonBox)
self.retranslateUi(EditSongDialog)
self.SongTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), EditSongDialog.close)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'accepted()'), EditSongDialog.close)
QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog)
EditSongDialog.setTabOrder(self.SongTabWidget, self.TitleEditItem)
EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit)

View File

@ -122,6 +122,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def newSong(self):
log.debug(u'New Song')
self.SongTabWidget.setCurrentIndex(0)
self.song = Song()
self.TitleEditItem.setText(u'')
self.AlternativeEdit.setText(u'')
@ -140,6 +141,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def loadSong(self, id):
log.debug(u'Load Song')
self.SongTabWidget.setCurrentIndex(0)
self.loadAuthors()
self.loadTopics()
self.loadBooks()
@ -341,8 +343,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadBooks()
self.loadTopics()
def onAccept(self):
log.debug(u'OnAccept')
def accept(self):
log.debug(u'accept')
if not self._validate_song():
return
self.song.title = unicode(self.TitleEditItem.displayText())

View File

@ -6,307 +6,23 @@
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>725</height>
<width>500</width>
<height>686</height>
</rect>
</property>
<property name="windowTitle">
<string>Bible Registration</string>
</property>
<property name="windowIcon">
<iconset resource="../images/openlp-2.qrc">
<iconset>
<normaloff>:/icon/openlp.org-icon-32.bmp</normaloff>:/icon/openlp.org-icon-32.bmp</iconset>
</property>
<widget class="QToolBox" name="ImportToolBox">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>451</width>
<height>401</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="FileImportPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>447</width>
<height>337</height>
</rect>
</property>
<attribute name="label">
<string>File Import Page</string>
</attribute>
<widget class="QGroupBox" name="OSISGroupBox">
<property name="geometry">
<rect>
<x>18</x>
<y>65</y>
<width>411</width>
<height>81</height>
</rect>
</property>
<property name="title">
<string>OSIS Bible</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>8</number>
</property>
<property name="spacing">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="LocatioLabel">
<property name="text">
<string>File Location:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="OSISLocationEdit"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="OsisFileButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="CVSGroupBox">
<property name="geometry">
<rect>
<x>20</x>
<y>170</y>
<width>411</width>
<height>191</height>
</rect>
</property>
<property name="title">
<string>CVS Bible</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>8</number>
</property>
<property name="spacing">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="BooksLocationLabel">
<property name="text">
<string>Books Location:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="VerseLocationLabel">
<property name="text">
<string>Verse Location:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="VerseLocationEdit"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="BooksLocationEdit"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="BooksFileButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="VersesFileButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLineEdit" name="BibleNameEdit">
<property name="geometry">
<rect>
<x>100</x>
<y>20</y>
<width>280</width>
<height>28</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="BibleNameLabel">
<property name="geometry">
<rect>
<x>18</x>
<y>20</y>
<width>98</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Bible Name:</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="WebBiblePage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>447</width>
<height>337</height>
</rect>
</property>
<attribute name="label">
<string>Web Bible Import page</string>
</attribute>
<layout class="QVBoxLayout" name="WebBibleLayout">
<property name="spacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item>
<widget class="QGroupBox" name="OptionsGroupBox">
<property name="title">
<string>Download Options</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="LocationLabel">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="LocationComboBox">
<item>
<property name="text">
<string>Crosswalk</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="BibleLabel">
<property name="text">
<string>Bible:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="BibleComboBox">
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>NIV</string>
</property>
</item>
<item>
<property name="text">
<string>KJV</string>
</property>
</item>
</widget>
</item>
</layout>
<zorder>BibleComboBox</zorder>
<zorder>LocationLabel</zorder>
<zorder>BibleLabel</zorder>
<zorder>LocationComboBox</zorder>
</widget>
</item>
<item>
<widget class="QGroupBox" name="ProxyGroupBox">
<property name="title">
<string>Proxy Settings (Optional)</string>
</property>
<layout class="QFormLayout" name="ProxySettingsLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="AddressLabel">
<property name="text">
<string>Proxy Address:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="AddressEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="UsernameLabel">
<property name="text">
<string>Username:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="UsernameEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="PasswordLabel">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="PasswordEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="LicenceDetailsGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>435</y>
<width>471</width>
<y>400</y>
<width>480</width>
<height>151</height>
</rect>
</property>
@ -375,8 +91,8 @@
<property name="geometry">
<rect>
<x>10</x>
<y>600</y>
<width>471</width>
<y>550</y>
<width>480</width>
<height>70</height>
</rect>
</property>
@ -402,8 +118,8 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>300</x>
<y>680</y>
<x>310</x>
<y>630</y>
<width>180</width>
<height>38</height>
</rect>
@ -428,6 +144,280 @@
</item>
</layout>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>480</width>
<height>361</height>
</rect>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="OsisTab">
<attribute name="title">
<string>Osis (Sword) Imports</string>
</attribute>
<widget class="QGroupBox" name="OSISGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>460</width>
<height>141</height>
</rect>
</property>
<property name="title">
<string>OSIS Bible</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="BibleNameLabel">
<property name="text">
<string>Bible Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="BibleNameEdit"/>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="LocatioLabel">
<property name="text">
<string>File Location:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="OSISLocationEdit"/>
</item>
<item>
<widget class="QPushButton" name="OsisFileButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="CsvTab">
<attribute name="title">
<string>CSV File Imports</string>
</attribute>
<widget class="QGroupBox" name="CVSGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>460</width>
<height>191</height>
</rect>
</property>
<property name="title">
<string>CVS Bible</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>8</number>
</property>
<property name="spacing">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="BooksLocationLabel">
<property name="text">
<string>Books Location:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="VerseLocationLabel">
<property name="text">
<string>Verse Location:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="VerseLocationEdit"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="BooksLocationEdit"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="BooksFileButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="VersesFileButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images/openlp-2.qrc">
<normaloff>:/imports/import_load.png</normaloff>:/imports/import_load.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="HttpTab">
<attribute name="title">
<string>Web Downloads</string>
</attribute>
<widget class="QGroupBox" name="OptionsGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>460</width>
<height>141</height>
</rect>
</property>
<property name="title">
<string>Download Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="LocationLabel">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="LocationComboBox">
<item>
<property name="text">
<string>Crosswalk</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="BibleLabel">
<property name="text">
<string>Bible:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="BibleComboBox">
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>NIV</string>
</property>
</item>
<item>
<property name="text">
<string>KJV</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
<zorder>BibleComboBox</zorder>
<zorder>LocationLabel</zorder>
<zorder>BibleLabel</zorder>
<zorder>LocationComboBox</zorder>
</widget>
<widget class="QGroupBox" name="ProxyGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>460</width>
<height>161</height>
</rect>
</property>
<property name="title">
<string>Proxy Settings (Optional)</string>
</property>
<layout class="QFormLayout" name="ProxySettingsLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>8</number>
</property>
<property name="verticalSpacing">
<number>8</number>
</property>
<property name="margin">
<number>8</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="AddressLabel">
<property name="text">
<string>Proxy Address:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="AddressEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="UsernameLabel">
<property name="text">
<string>Username:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="UsernameEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="PasswordLabel">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="PasswordEdit"/>
</item>
</layout>
</widget>
<zorder>OptionsGroupBox</zorder>
<zorder>OptionsGroupBox</zorder>
<zorder>ProxyGroupBox</zorder>
</widget>
</widget>
</widget>
<tabstops>
<tabstop>BibleNameEdit</tabstop>