Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Created February 18, 2014 12:43
Show Gist options
  • Save Eugeny/9070215 to your computer and use it in GitHub Desktop.
Save Eugeny/9070215 to your computer and use it in GitHub Desktop.
from ajenti.api import *
from ajenti.plugins.main.api import SectionPlugin
from ajenti.ui import on
from ajenti.ui.binder import Binder
@plugin
class GLSlideShowPrefs (SectionPlugin):
default_classconfig = {
'option_1_enable': True # etc
}
classconfig_root = True
def init(self):
self.title = 'Screensaver'
self.icon = 'picture'
self.category = 'Sanickiosk'
self.append(self.ui.inflate('glslideshow_flags:main'))
self.binder = Binder(self, self)
self.binder.populate()
@on('save', 'click')
def save(self):
self.binder.update()
self.save_classconfig()
cmdline = ''
print self.classconfig
for option in ['option_1', 'option_2']:
if self.classconfig.get(option + '_enable', False):
cmdline += '--%s ' % option
value = self.classconfig.get(option + '_value', False)
if value:
cmdline += '%s ' % value
print cmdline # save
<vc>
<body>
<pad>
<bind:dict bind="classconfig">
<vc>
<formline text="Option 1">
<checkbox bind="option_1_enable" />
</formline>
<formline text="Option 2">
<hc>
<checkbox bind="option_2_enable" />
<textbox bind="option_2_value" />
</hc>
</formline>
</vc>
</bind:dict>
</pad>
</body>
<button id="save" text="{Save}" icon="ok" />
</vc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment