~ubuntu-branches/ubuntu/saucy/unity-tweak-tool/saucy-proposed

« back to all changes in this revision

Viewing changes to UnityTweakTool/elements/spin.py

  • Committer: Package Import Robot
  • Author(s): Barneedhar Vigneshwar, Barneedhar Vigneshwar, J Phani Mahesh, Sam Hewitt
  • Date: 2013-04-05 23:05:49 UTC
  • Revision ID: package-import@ubuntu.com-20130405230549-tizel3514r09ke7l
Tags: 0.0.4
[ Barneedhar Vigneshwar ]
* New upstream release (LP: #1165141)
* data/windowmanager.ui
  - Fix missing signal in the auto-raise switch (LP: #1160782)
* UnityTweakTool/section/sphagetti/theme.py
  - Fix KeyError when fetching window themes (LP: #1146122)
* UnityTweakTool/section/unity.py
  - Fix show-desktop switch (LP: #1156266)
  - Fix 'switch between workspace' switch (LP: #1156236)

[ J Phani Mahesh ]
* debian/source_unity-tweak-tool.py  
  - Update Apport hook to file crash bugs against the package by default
* setup.py
  - Install translated pot files
* unity-tweak-tool
  - Fixed and renamed -r parameter to --reset-unity in the wrapper
* UnityTweakTool/__init__.py
  - Prevent multiple instances using dbus
* UnityTweakTool/elements/radio.py
  - Fix AssertionError in __init__() (LP: #1156201)
  - Fix AssertionError due to missing overlay-scrollbar package (LP: #1156337)
* UnityTweakTool/section/sphagetti/compiz.py
  - Fix resetting transparency values (LP: #1099067)
* UnityTweakTool/section/sphagetti/unity.py
  - Fix AttributeError in refresh(): 'NoneType' object has no attribute 'get_boolean' (LP: #1155331)

[Sam Hewitt]
* debian/control
  - Added dependency on python3-cairo (LP: #1156789)
* UnityTweakTool/section/sphagetti/unity.py
  - Fixed unresponsive 'battery-life' switch (LP: #1129262)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        self.type       = controlObj['type']
47
47
        self.min        = controlObj['min']
48
48
        self.max        = controlObj['max']
49
 
        assert gsettings.is_valid(
50
 
            schema=self.schema,
51
 
            path=self.path,
52
 
            key=self.key
53
 
            )
 
49
        self.disabled   = False
 
50
        try:
 
51
            assert gsettings.is_valid(
 
52
                schema=self.schema,
 
53
                path=self.path,
 
54
                key=self.key
 
55
                )
 
56
        except AssertionError as e:
 
57
            self.disabled = True
54
58
# TODO : set the range mased on the config min-max
55
59
#        self.ui.
56
60
        logger.debug('Initialised a spin with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self))
64
68
    def refresh(self):
65
69
        ''' Refresh the UI querying the backend '''
66
70
        logger.debug('Refreshing UI display for {self.id}'.format(self=self))
 
71
        if self.disabled:
 
72
            self.ui.set_sensitive(False)
 
73
            return
67
74
        self.ui.set_value(
68
75
            gsettings.get(
69
76
                schema= self.schema,
75
82
 
76
83
    def handler(self,*args,**kwargs):
77
84
        ''' Handle notify::active signals '''
 
85
        if self.disabled:
 
86
            return
78
87
        gsettings.set(
79
88
            schema  = self.schema,
80
89
            path    = self.path,
86
95
 
87
96
    def reset(self):
88
97
        ''' Reset the controlled key '''
 
98
        if self.disabled:
 
99
            return
89
100
        gsettings.reset(schema=self.schema,path=self.path,key=self.key)
90
101
        logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self))