2
# -*- coding: utf-8 -*-
5
# J Phani Mahesh <phanimahesh@gmail.com>
6
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
7
# Amith KK <amithkumaran@gmail.com>
8
# Georgi Karavasilev <motorslav@gmail.com>
9
# Sam Tran <samvtran@gmail.com>
10
# Sam Hewitt <hewittsamuel@gmail.com>
11
# Angel Araya <al.arayaq@gmail.com>
14
# A One-stop configuration tool for Unity.
18
# This file is a part of Unity Tweak Tool
20
# Unity Tweak Tool is free software; you can redistribute it and/or modify it under
21
# the terms of the GNU General Public License as published by the Free Software
22
# Foundation; version 3.
24
# Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT
25
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
26
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
29
# You should have received a copy of the GNU General Public License along with
30
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
32
''' Generic option '''
33
from UnityTweakTool.backends import gsettings
36
#logger=logging.getLogger('UnityTweakTool.elements.option')
39
''' Generic class to be used for those options which
40
are not straightforward to port. Will be removed in due time.'''
41
def __init__(self,controlObj):
42
self.handler=controlObj['handler']
43
self.reset =controlObj['reset']
44
self.handlerid=controlObj['handlerid']
45
self.refresh=controlObj['refresh']
46
def register(self,handler):
47
handler[self.handlerid]=self.handler
50
def __init__(self,ho):
52
def isHandler(attrname,ho=ho,prefix='on'):
53
return attrname.startswith(prefix) and \
54
callable(getattr(ho, attrname))
55
handlers = list(filter(isHandler, dir(ho)))
56
self.hodict={key:getattr(ho,key) for key in handlers}
57
def register(self,handler):
58
handler.update(self.hodict)
59
def register_tab(self,handler):
60
handler.update(self.hodict)