2008-11-29 05:36:16 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
2009-07-14 13:51:27 +00:00
|
|
|
|
2009-09-29 02:54:32 +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-29 02:54:32 +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-10-23 19:49:13 +00:00
|
|
|
|
2010-04-26 16:41:31 +00:00
|
|
|
from PyQt4 import QtCore
|
2009-09-07 16:46:20 +00:00
|
|
|
|
2008-10-23 19:41:22 +00:00
|
|
|
class SettingsManager(object):
|
2009-07-08 17:18:48 +00:00
|
|
|
"""
|
2009-07-14 13:51:27 +00:00
|
|
|
Class to control the size of the UI components so they size correctly.
|
|
|
|
This class is created by the main window and then calculates the size of
|
|
|
|
individual components.
|
2009-07-08 17:18:48 +00:00
|
|
|
"""
|
|
|
|
def __init__(self, screen):
|
2010-04-26 16:41:31 +00:00
|
|
|
self.settings = QtCore.QSettings()
|
2010-01-16 07:22:50 +00:00
|
|
|
self.screen = screen.current
|
2009-07-09 05:15:26 +00:00
|
|
|
self.width = self.screen[u'size'].width()
|
|
|
|
self.height = self.screen[u'size'].height()
|
|
|
|
self.mainwindow_height = self.height * 0.8
|
2009-09-11 19:29:57 +00:00
|
|
|
mainwindow_docbars = self.width / 5
|
|
|
|
self.mainwindow_left = 0
|
|
|
|
self.mainwindow_right = 0
|
|
|
|
if mainwindow_docbars > 300:
|
|
|
|
self.mainwindow_left = 300
|
|
|
|
self.mainwindow_right = 300
|
2009-09-14 22:10:08 +00:00
|
|
|
else:
|
|
|
|
self.mainwindow_left = mainwindow_docbars
|
|
|
|
self.mainwindow_right = mainwindow_docbars
|
|
|
|
self.slidecontroller = (self.width - (
|
|
|
|
self.mainwindow_left + self.mainwindow_right) - 100 ) / 2
|
2009-09-07 19:14:01 +00:00
|
|
|
self.slidecontroller_image = self.slidecontroller - 50
|
|
|
|
|
2010-04-26 16:41:31 +00:00
|
|
|
self.showPreviewPanel = self.settings.value(
|
|
|
|
u'user interface/preview panel', True).toBool()
|
2009-09-07 16:46:20 +00:00
|
|
|
|
|
|
|
def togglePreviewPanel(self, isVisible):
|
2010-04-26 16:41:31 +00:00
|
|
|
self.settings.setValue(u'user interface/preview panel',
|
|
|
|
QtCore.QVariant(isVisible))
|