Created
February 17, 2014 20:23
-
-
Save Eugeny/9058367 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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