Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Last active December 27, 2015 11:39
Show Gist options
  • Save Eugeny/7320615 to your computer and use it in GitHub Desktop.
Save Eugeny/7320615 to your computer and use it in GitHub Desktop.
from ajenti.api import plugin
from ajenti.plugins.main.api import SectionPlugin
from ajenti.ui import on, p, UIElement
from ajenti.ui.binder import Binder
@plugin
class Test (SectionPlugin):
def init(self):
self.title = 'Controls 2'
self.icon = 'smile'
self.category = 'Demo'
self.append(self.ui.inflate('test_new_dropdown:main'))
self.find('dropdown').labels = ['None', 'Int', 'Object']
self.find('dropdown').values = [None, 1, object()]
self.value = None
self.binder = Binder(self, self)
self.binder.autodiscover().populate()
@on('check', 'click')
def on_show(self):
self.binder.update()
print repr(self.value)
self.binder.reset().populate()
<body>
<pad>
<vc>
<formline text="Dropdown">
<dropdown id="dropdown" bind:value="value" />
</formline>
<formline>
<button icon="ok" id="check" text="Get value" />
</formline>
</vc>
</pad>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment