openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06370
[Merge] lp:~crichter/openlp/testing into lp:openlp
rimach has proposed merging lp:~crichter/openlp/testing into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Andreas Preikschat (googol-hush)
For more details, see:
https://code.launchpad.net/~crichter/openlp/testing/+merge/50461
I tried to implement the new settings appearance.
What do you think about this?
Known problems:
1. Icons are missing at all
- may we could use svg images in general instead of png's?
-> we could start a graphics contest for all the items stuff?
(hopefully now complete)
--
https://code.launchpad.net/~crichter/openlp/testing/+merge/50461
Your team OpenLP Core is requested to review the proposed merge of lp:~crichter/openlp/testing into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2011-02-18 03:15:09 +0000
+++ openlp/core/lib/__init__.py 2011-02-19 19:16:21 +0000
@@ -336,6 +336,7 @@
build_lyrics_outline_css
from toolbar import OpenLPToolbar
from dockwidget import OpenLPDockWidget
+from tabwidget import OpenLPTabWidget
from renderer import Renderer
from rendermanager import RenderManager
from mediamanageritem import MediaManagerItem
=== added file 'openlp/core/lib/tabwidget.py'
--- openlp/core/lib/tabwidget.py 1970-01-01 00:00:00 +0000
+++ openlp/core/lib/tabwidget.py 2011-02-19 19:16:21 +0000
@@ -0,0 +1,209 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2011 Raoul Snyman #
+# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael #
+# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
+# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
+# Carsten Tinggaard, Frode Woldsund #
+# --------------------------------------------------------------------------- #
+# 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 #
+###############################################################################
+"""
+Provide common tabwidget handling for OpenLP
+"""
+import logging
+
+from PyQt4 import QtCore, QtGui
+from openlp.core.lib import SettingsTab
+
+#from openlp.core.lib import build_icon
+
+log = logging.getLogger(__name__)
+
+class OpenLPTabWidget(QtGui.QWidget):
+ """
+ This is the base TabWidget class OpenLP configuration dialogs.
+ """
+ def __init__(self, parent=None):
+ """
+ Initialise the toolbar.
+ """
+ QtGui.QWidget.__init__(self, parent)
+ self.orientation = 0
+ self.icons = {}
+ self.iconSize = QtCore.QSize(40, 40)
+ self.tabs = {}
+ self.buttons = {}
+ self.initWidgets(self)
+ log.debug(u'Init done')
+
+ def initWidgets(self, Form):
+ Form.setObjectName("Form")
+ self.horizontalLayout = QtGui.QHBoxLayout(Form)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.buttonPanelLayout = QtGui.QVBoxLayout()
+ self.buttonPanelLayout.setObjectName("buttonPanelLayout")
+ self.buttonsLayout = QtGui.QVBoxLayout()
+ self.buttonsLayout.setObjectName("buttonsLayout")
+ self.scrollArea = QtGui.QScrollArea(Form)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth())
+ self.scrollArea.setSizePolicy(sizePolicy)
+ self.scrollArea.setMinimumSize(QtCore.QSize(120, 0))
+ self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+ self.scrollArea.setWidgetResizable(True)
+ self.scrollArea.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.scrollArea.setObjectName("scrollArea")
+ self.buttonContainer = QtGui.QWidget(self.scrollArea)
+ #self.buttonContainer.setGeometry(QtCore.QRect(0, 0, 118, 288))
+ self.buttonContainer.setObjectName("buttonContainer")
+ self.verticalLayout = QtGui.QVBoxLayout(self.buttonContainer)
+ self.verticalLayout.setObjectName("verticalLayout")
+ icon = QtGui.QIcon()
+ icon.addPixmap(QtGui.QPixmap("Layer/openlp-splash-screen.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
+ self.scrollArea.setWidget(self.buttonContainer)
+ self.buttonsLayout.addWidget(self.scrollArea)
+ self.buttonPanelLayout.addLayout(self.buttonsLayout)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ #self.buttonPanelLayout.addItem(spacerItem)
+ self.horizontalLayout.addLayout(self.buttonPanelLayout)
+ self.mainLayout = QtGui.QVBoxLayout()
+ self.mainLayout.setObjectName("mainLayout")
+ self.tabTitleLayout = QtGui.QHBoxLayout()
+ self.tabTitleLayout.setObjectName("tabTitleLayout")
+ self.tabTitle = QtGui.QLabel(Form)
+ font = QtGui.QFont()
+ font.setPointSize(12)
+ font.setWeight(75)
+ font.setBold(True)
+ self.tabTitle.setFont(font)
+ self.tabTitle.setObjectName("tabTitle")
+ self.tabTitleLayout.addWidget(self.tabTitle)
+ self.tabIcon = QtGui.QLabel(Form)
+ self.tabIcon.setMaximumSize(QtCore.QSize(20, 20))
+ self.tabIcon.setText("")
+ self.tabIcon.setPixmap(QtGui.QPixmap("Layer/openlp-splash-screen.svg"))
+ self.tabIcon.setScaledContents(True)
+ self.tabIcon.setObjectName("tabIcon")
+ self.tabTitleLayout.addWidget(self.tabIcon)
+ self.mainLayout.addLayout(self.tabTitleLayout)
+ self.tabLine = QtGui.QFrame(Form)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.tabLine.sizePolicy().hasHeightForWidth())
+ self.tabLine.setSizePolicy(sizePolicy)
+ self.tabLine.setFrameShape(QtGui.QFrame.HLine)
+ self.tabLine.setFrameShadow(QtGui.QFrame.Sunken)
+ self.tabLine.setObjectName("tabLine")
+ self.mainLayout.addWidget(self.tabLine)
+ self.stackedTabWidget = QtGui.QStackedWidget(Form)
+ self.stackedTabWidget.setObjectName("stackedTabWidget")
+ self.mainLayout.addWidget(self.stackedTabWidget)
+ self.horizontalLayout.addLayout(self.mainLayout)
+
+ def setButton(self, tab, title, icon, index=-1):
+ button = QtGui.QToolButton()
+ button.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon)
+ button.setAutoRaise(True)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Maximum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(button.sizePolicy().hasHeightForWidth())
+ button.setSizePolicy(sizePolicy)
+ button.setText(title)
+ if icon:
+ button.setIcon(icon)
+ button.setIconSize(self.iconSize)
+ button.setCheckable(True)
+ button.setChecked(False)
+ button.setAutoExclusive(True)
+ button.setObjectName(tab.objectName())
+ if len(self.buttons) == 0:
+ button.setChecked(True)
+ self.buttons[tab.objectName()] = button
+ #self.scrollArea.insertWidget(index, self.buttons[tab.tabTitle])
+ self.verticalLayout.insertWidget(index, self.buttons[tab.objectName()])
+ QtCore.QObject.connect(button,
+ QtCore.SIGNAL(u'clicked(bool)'), self.onButtonClick)
+
+
+ def setPage(self, tab, title, index=None):
+ if index:
+ self.stackedTabWidget.insertWidget(index, tab)
+ else:
+ self.stackedTabWidget.addWidget(tab)
+ self.tabs[tab.objectName()] = tab
+
+ def addTab(self, tab, title, icon=None):
+ """
+ Add a tab to the form
+ """
+ log.info(u'Adding %s tab' % title)
+ self.setPage(tab, title)
+ icon = QtGui.QIcon()
+ if len(self.buttons) == 0:
+ icon.addFile(u'F:/Computer/Platform/pythonDev/openlp/branches/OpenLP-1.9.4-bzr1304/resources/images/openlp-logo.svg', self.iconSize)
+ else:
+ icon.addFile(u'F:/Computer/Platform/pythonDev/openlp/branches/OpenLP-1.9.4-bzr1304/resources/images/openlp-splash-screen.svg', self.iconSize)
+ self.setButton(tab, title, icon)
+
+ def insertTab(self, location, tab, title, icon=None):
+ """
+ Add a tab to the form at a specific location
+ """
+ log.debug(u'Inserting %s tab' % title)
+ self.buttons[tab.objectName()].setVisible(True)
+
+ def removeTab(self, index):
+ """
+ Remove a tab from the form
+ """
+ title = self.stackedTabWidget.widget(index).objectName()
+ self.buttons[title].setVisible(False)
+
+ def count(self):
+ return len(self.tabs)
+
+ def setTabText(self, index, text):
+ self.buttons[self.stackedTabWidget.widget(index).objectName()].setText(text)
+
+ def setCurrentIndex(self, index):
+ button = self.buttons[self.widget(index).objectName()]
+ widget = self.widget(index)
+ text = button.text()
+ icon = button.icon()
+ self.setCurrentTab(widget, text, icon)
+
+ def indexOf(self, tab):
+ return self.stackedTabWidget.indexOf(tab)
+
+ def widget(self, index):
+ return self.stackedTabWidget.widget(index)
+
+ def setCurrentTab(self, widget, text, icon):
+ self.stackedTabWidget.setCurrentWidget(widget)
+ self.tabTitle.setText(text)
+ self.tabIcon.setPixmap(icon.pixmap(QtCore.QSize(20, 20)))
+
+ def onButtonClick(self, val):
+ title = self.sender().objectName()
+ self.setCurrentTab(self.tabs[title], self.sender().text(), self.sender().icon())
+
=== modified file 'openlp/core/ui/settingsdialog.py'
--- openlp/core/ui/settingsdialog.py 2011-02-15 14:19:57 +0000
+++ openlp/core/ui/settingsdialog.py 2011-02-19 19:16:21 +0000
@@ -26,7 +26,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import translate, build_icon
+from openlp.core.lib import translate, build_icon, OpenLPTabWidget
from openlp.core.lib.ui import create_accept_reject_button_box
class Ui_SettingsDialog(object):
@@ -37,7 +37,7 @@
build_icon(u':/system/system_settings.png'))
self.settingsLayout = QtGui.QVBoxLayout(settingsDialog)
self.settingsLayout.setObjectName(u'settingsLayout')
- self.settingsTabWidget = QtGui.QTabWidget(settingsDialog)
+ self.settingsTabWidget = OpenLPTabWidget(settingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget')
self.settingsLayout.addWidget(self.settingsTabWidget)
self.buttonBox = create_accept_reject_button_box(settingsDialog, True)
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2011-02-18 01:07:55 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2011-02-19 19:16:21 +0000
@@ -26,7 +26,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import build_icon, translate
+from openlp.core.lib import build_icon, translate, OpenLPTabWidget
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
from openlp.plugins.songs.lib.ui import SongStrings
@@ -39,7 +39,7 @@
editSongDialog.setModal(True)
self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
- self.songTabWidget = QtGui.QTabWidget(editSongDialog)
+ self.songTabWidget = OpenLPTabWidget(editSongDialog)
self.songTabWidget.setObjectName(u'songTabWidget')
# lyrics tab
self.lyricsTab = QtGui.QWidget()
Follow ups
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: rimach, 2011-02-24
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Raoul Snyman, 2011-02-24
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: rimach, 2011-02-23
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Tim Bentley, 2011-02-22
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Raoul Snyman, 2011-02-22
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Raoul Snyman, 2011-02-22
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Raoul Snyman, 2011-02-22
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Andreas Preikschat, 2011-02-20
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Tim Bentley, 2011-02-19
-
Re: [Merge] lp:~crichter/openlp/testing into lp:openlp
From: Tim Bentley, 2011-02-19