Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Created February 17, 2014 20:23
Show Gist options
  • Save Eugeny/9058367 to your computer and use it in GitHub Desktop.
Save Eugeny/9058367 to your computer and use it in GitHub Desktop.
class Option (object):
def __init__(self, value):
self.value = value
...in plugin:
def init(self):
....
self.binder = Binder(None, self)
def on_page_load(self):
self.options = [Option(x) for x in open('....').read().strip().split()]
self.binder.setup(self)
self.binder.populate()
...in save button handler
...
self.binder.update()
cmdline = ' '.join(x.value for x in self.options)
open('....', 'w').write(cmdline)
<body> <--- bound to self
....
<bind:collection bind="options"> <--- bound to self.options
<vc bind="__items" />
...
<bind:template> <--- bound to self.options[x]
...
<textbox bind="value" /> <--- bound to self.options[x].value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment