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

« back to all changes in this revision

Viewing changes to UnityTweakTool/elements/scale.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
 
        self.ticks      = controlObj['ticks']
50
 
        assert gsettings.is_valid(
51
 
            schema  = self.schema,
52
 
            path    = self.path,
53
 
            key     = self.key
54
 
            )
55
 
        for tick in self.ticks:
56
 
            self.ui.add_mark(*tick)
 
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
57
58
# TODO : Set range using min, max
58
59
        logger.debug('Initialised a scale with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self))
59
60
 
66
67
    def refresh(self):
67
68
        ''' Refresh the UI querying the backend '''
68
69
        logger.debug('Refreshing UI display for {self.id}'.format(self=self))
 
70
        if self.disabled:
 
71
            self.ui.set_sensitive(False)
 
72
            return
69
73
        self.ui.set_value(
70
74
            gsettings.get(
71
75
                schema=self.schema,
77
81
 
78
82
    def handler(self,*args,**kwargs):
79
83
        ''' Handle value_changed signals '''
 
84
        if self.disabled:
 
85
            return
80
86
        gsettings.set(
81
87
            schema=self.schema,
82
88
            path=self.path,
88
94
 
89
95
    def reset(self):
90
96
        ''' Reset the controlled key '''
 
97
        if self.disabled:
 
98
            return
91
99
        gsettings.reset(schema=self.schema,path=self.path,key=self.key)
92
100
        logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self))