2008-11-28 14:05:41 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
|
|
|
2009-09-08 19:58:05 +00:00
|
|
|
###############################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# --------------------------------------------------------------------------- #
|
2009-12-31 12:52:01 +00:00
|
|
|
# Copyright (c) 2008-2010 Raoul Snyman #
|
|
|
|
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
2010-03-21 23:58:01 +00:00
|
|
|
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
|
|
|
# Thompson, Jon Tibble, Carsten Tinggaard #
|
2009-09-08 19:58:05 +00:00
|
|
|
# --------------------------------------------------------------------------- #
|
|
|
|
# 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 #
|
|
|
|
###############################################################################
|
2008-11-28 14:05:41 +00:00
|
|
|
|
2009-02-28 23:19:45 +00:00
|
|
|
import logging
|
2008-11-28 14:05:41 +00:00
|
|
|
|
2009-09-25 00:43:42 +00:00
|
|
|
from PyQt4 import QtGui
|
2008-11-28 14:05:41 +00:00
|
|
|
|
2010-02-11 18:39:28 +00:00
|
|
|
from openlp.core.ui import GeneralTab, ThemesTab
|
2009-02-28 23:19:45 +00:00
|
|
|
from settingsdialog import Ui_SettingsDialog
|
|
|
|
|
2010-03-04 22:09:03 +00:00
|
|
|
log = logging.getLogger(__name__)
|
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
|
|
|
|
2010-04-02 18:12:54 +00:00
|
|
|
def __init__(self, screens, mainWindow, parent=None):
|
2009-10-19 14:56:44 +00:00
|
|
|
QtGui.QDialog.__init__(self, parent)
|
2009-02-28 23:19:45 +00:00
|
|
|
self.setupUi(self)
|
|
|
|
# General tab
|
2010-04-02 18:12:54 +00:00
|
|
|
self.GeneralTab = GeneralTab(screens)
|
2009-10-07 05:09:35 +00:00
|
|
|
self.addTab(u'General', 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-10-07 05:09:35 +00:00
|
|
|
self.addTab(u'Themes', self.ThemesTab)
|
2009-02-28 23:19:45 +00:00
|
|
|
|
2010-03-14 23:22:44 +00:00
|
|
|
def addTab(self, name, tab):
|
2009-10-28 21:52:13 +00:00
|
|
|
log.info(u'Adding %s tab' % tab.tabTitle)
|
|
|
|
self.SettingsTabWidget.addTab(tab, tab.tabTitleVisible)
|
2009-10-03 19:02:40 +00:00
|
|
|
|
2009-10-10 04:56:06 +00:00
|
|
|
def insertTab(self, tab, location):
|
2009-10-28 21:52:13 +00:00
|
|
|
log.debug(u'Inserting %s tab' % tab.tabTitle)
|
2009-10-29 06:24:53 +00:00
|
|
|
#13 : There are 3 tables currently and locations starts at -10
|
2009-11-03 18:14:25 +00:00
|
|
|
self.SettingsTabWidget.insertTab(
|
|
|
|
location + 13, tab, tab.tabTitleVisible)
|
2009-10-03 19:02:40 +00:00
|
|
|
|
2009-10-07 05:09:35 +00:00
|
|
|
def removeTab(self, name):
|
|
|
|
log.debug(u'remove %s tab' % name)
|
|
|
|
for tab_index in range(0, self.SettingsTabWidget.count()):
|
2009-11-03 18:14:25 +00:00
|
|
|
if self.SettingsTabWidget.widget(tab_index):
|
2009-10-28 21:52:13 +00:00
|
|
|
if self.SettingsTabWidget.widget(tab_index).tabTitle == name:
|
2009-10-10 04:56:06 +00:00
|
|
|
self.SettingsTabWidget.removeTab(tab_index)
|
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()):
|
2010-02-11 18:39:28 +00:00
|
|
|
self.SettingsTabWidget.widget(tab_index).postSetUp()
|