You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
746 B
33 lines
746 B
12 years ago
|
|
||
|
|
||
|
class BasePlugin:
|
||
|
|
||
|
def get_info(self):
|
||
|
return self.fullname, self.description
|
||
|
|
||
|
def __init__(self, gui, name, fullname, description):
|
||
|
self.name = name
|
||
|
self.fullname = fullname
|
||
|
self.description = description
|
||
|
self.gui = gui
|
||
|
self.config = gui.config
|
||
|
|
||
|
def toggle(self):
|
||
|
enabled = not self.is_enabled()
|
||
|
self.set_enabled(enabled)
|
||
|
self.init_gui()
|
||
|
return enabled
|
||
|
|
||
|
def init_gui(self):
|
||
|
pass
|
||
|
|
||
|
def is_enabled(self):
|
||
|
return self.is_available() and self.config.get('use_'+self.name) is True
|
||
|
|
||
|
def is_available(self):
|
||
|
return True
|
||
|
|
||
|
def set_enabled(self, enabled):
|
||
|
self.config.set_key('use_'+self.name, enabled, True)
|
||
|
|