~ubuntu-branches/ubuntu/vivid/frescobaldi/vivid

« back to all changes in this revision

Viewing changes to frescobaldi_app/guistyle.py

  • Committer: Package Import Robot
  • Author(s): Ryan Kavanagh
  • Date: 2012-01-03 16:20:11 UTC
  • mfrom: (1.4.1)
  • Revision ID: package-import@ubuntu.com-20120103162011-tsjkwl4sntwmprea
Tags: 2.0.0-1
* New upstream release 
* Drop the following uneeded patches:
  + 01_checkmodules_no_python-kde4_build-dep.diff
  + 02_no_pyc.diff
  + 04_no_binary_lilypond_upgrades.diff
* Needs new dependency python-poppler-qt4
* Update debian/watch for new download path
* Update copyright file with new holders and years

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
 
2
#
 
3
# Copyright (c) 2008 - 2011 by Wilbert Berendsen
 
4
#
 
5
# This program is free software; you can redistribute it and/or
 
6
# modify it under the terms of the GNU General Public License
 
7
# as published by the Free Software Foundation; either version 2
 
8
# of the License, or (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program; if not, write to the Free Software
 
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
# See http://www.gnu.org/licenses/ for more information.
 
19
 
 
20
"""
 
21
Sets the user interface style.
 
22
"""
 
23
 
 
24
from __future__ import unicode_literals
 
25
 
 
26
 
 
27
from PyQt4.QtCore import QSettings
 
28
from PyQt4.QtGui import QStyleFactory
 
29
 
 
30
import app
 
31
 
 
32
_system_default = app.qApp.style().objectName()
 
33
 
 
34
 
 
35
def keys():
 
36
    return [name.lower() for name in QStyleFactory.keys()]
 
37
 
 
38
 
 
39
def setStyle():
 
40
    style = QSettings().value("guistyle", "").lower()
 
41
    if style not in keys():
 
42
        style = _system_default
 
43
    if style != app.qApp.style().objectName():
 
44
        app.qApp.setStyle(QStyleFactory.create(style))
 
45
 
 
46
 
 
47
app.settingsChanged.connect(setStyle)
 
48
setStyle()