2008-11-28 14:05:41 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
|
|
"""
|
|
|
|
OpenLP - Open Source Lyrics Projection
|
|
|
|
Copyright (c) 2008 Raoul Snyman
|
|
|
|
Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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 the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
"""
|
2009-02-28 23:19:45 +00:00
|
|
|
import logging
|
2008-11-28 14:05:41 +00:00
|
|
|
|
|
|
|
from PyQt4 import QtCore, QtGui
|
|
|
|
|
2009-02-28 23:19:45 +00:00
|
|
|
from openlp.core.lib import SettingsTab
|
2008-11-28 14:05:41 +00:00
|
|
|
from openlp.core.resources import *
|
2009-02-28 23:19:45 +00:00
|
|
|
from openlp.core.ui import GeneralTab, ThemesTab, AlertsTab
|
|
|
|
from settingsdialog import Ui_SettingsDialog
|
|
|
|
|
2009-06-16 18:21:24 +00:00
|
|
|
log = logging.getLogger(u'SettingsForm')
|
2009-02-28 23:19:45 +00:00
|
|
|
|
2009-05-01 11:50:09 +00:00
|
|
|
class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
2008-11-28 14:05:41 +00:00
|
|
|
|
2009-05-18 19:04:25 +00:00
|
|
|
def __init__(self, screen_list, mainWindow, parent=None):
|
|
|
|
QtGui.QDialog.__init__(self, None)
|
2009-02-28 23:19:45 +00:00
|
|
|
self.setupUi(self)
|
|
|
|
# General tab
|
2009-04-09 18:50:20 +00:00
|
|
|
self.GeneralTab = GeneralTab(screen_list)
|
2009-02-28 23:19:45 +00:00
|
|
|
self.addTab(self.GeneralTab)
|
2009-03-23 19:17:07 +00:00
|
|
|
# Themes tab
|
2009-05-18 19:04:25 +00:00
|
|
|
self.ThemesTab = ThemesTab(mainWindow)
|
2009-03-23 19:17:07 +00:00
|
|
|
self.addTab(self.ThemesTab)
|
|
|
|
# Alert tab
|
|
|
|
self.AlertsTab = AlertsTab()
|
2009-04-09 18:50:20 +00:00
|
|
|
self.addTab(self.AlertsTab)
|
2009-02-28 23:19:45 +00:00
|
|
|
|
|
|
|
def addTab(self, tab):
|
|
|
|
log.info(u'Inserting %s' % tab.title())
|
|
|
|
self.SettingsTabWidget.addTab(tab, tab.title())
|
2008-11-28 14:05:41 +00:00
|
|
|
|
2009-03-01 20:21:57 +00:00
|
|
|
def accept(self):
|
2009-08-06 13:17:36 +00:00
|
|
|
for tab_index in range(0, self.SettingsTabWidget.count()):
|
2009-03-05 20:31:17 +00:00
|
|
|
self.SettingsTabWidget.widget(tab_index).save()
|
2009-08-06 13:17:36 +00:00
|
|
|
return QtGui.QDialog.accept(self)
|
2009-08-29 07:17:56 +00:00
|
|
|
|
|
|
|
def postSetUp(self):
|
|
|
|
for tab_index in range(0, self.SettingsTabWidget.count()):
|
|
|
|
self.SettingsTabWidget.widget(tab_index).postSetUp()
|