Exemple #1
0
    def widget(self, item):
        with BindingContext() as bc:
            with forms.HorizontalExpandForm('root',
                                            parent=self.Parent,
                                            height=60) as root:
                with forms.VerticalExpandForm('cb', width=60) as cbf:
                    gui.CheckBox(
                        'enabled', label='', tag=item,
                        value=item.enabled).bind.value > bind() > (item,
                                                                   'enabled')
                    cbf.dock(cbf.enabled, left=20, top=10, bottom=40, right=5)
                with forms.FillForm('path', width=300):
                    with gui.ColumnLayout('x'):
                        gui.Text('displayName',
                                 font='boldLabelFont').bind.label < bind() < (
                                     item, 'name')
                        gui.Text('path', font='smallObliqueLabelFont'
                                 ).bind.label < bind() < (item, 'path')
                with gui.GridLayout('btns', width=140, numberOfColumns=2):
                    edit = gui.Button('edit', label='Edit', tag=item)
                    show = gui.Button('show', label='Show', tag=item)

        root.cb.enabled.changeCommand += self.update_status
        root.btns.show.command += self.show_item
        root.btns.edit.command += self.edit

        return lists.Templated(item,
                               root,
                               edit=edit.command,
                               show=show.command)
Exemple #2
0
 def binding_context(self):
     """
     createa BindingContext if needed
     """
     if not hasattr(self, '_bind_ctx'):
         self._bind_ctx = BindingContext()
     return self._bind_ctx
Exemple #3
0
    def _layout(self):
        with forms.LayoutDialogForm() as base:
            with BindingContext() as bc:
                with forms.VerticalThreePane(width=512,
                                             margin=(4, 4),
                                             spacing=(0, 8)) as main:
                    with forms.VerticalForm() as header:
                        gui.Text(label='Installed Modules')

                    with forms.FillForm() as body:
                        mod_list = lists.VerticalList(
                            itemTemplate=ModuleTemplate)
                        mod_list.collection < bind() < (self._manager.modules,
                                                        'values')
                        # binds the 'values' method of the ModuleManager's modules{} dictionary

                    with forms.HorizontalStretchForm() as footer:
                        cancel = gui.Button(label='Cancel')
                        cancel.command += self._cancel
                        gui.Separator(style=None)
                        save = gui.Button(label='Save')
                        save.command += self._save

        base.fill(main, 5)
        mod_list.update_bindings()
Exemple #4
0
    def widget(self, item):
        with BindingContext() as bc:
            with forms.HorizontalExpandForm(height=60,
                                            margin=(12, 0),
                                            backgroundColor=(.2, .2,
                                                             .2)) as root:
                with forms.VerticalExpandForm(width=60) as cbf:
                    enabled = gui.CheckBox(label='',
                                           tag=item,
                                           value=item.enabled)
                    enabled.bind.value > bind() > (item, 'enabled')
                    cbf.dock(enabled, left=20, top=10, bottom=40, right=5)
                with forms.FillForm(width=300) as path:
                    with gui.ColumnLayout() as cl:
                        display_name = gui.Text(font='boldLabelFont')
                        display_name.bind.label < bind() < (item, 'name')
                        path = gui.Text(font='smallObliqueLabelFont')
                        path.bind.label < bind() < (item, 'path')
                with gui.GridLayout(width=200, numberOfColumns=2) as btns:
                    edit = gui.Button(label='Edit', tag=item)
                    show = gui.Button(label='Show', tag=item)
        enabled.changeCommand += self.update_status
        show.command += self.show_item
        edit.command += self.edit

        return lists.Templated(item,
                               root,
                               edit=edit.command,
                               show=show.command)
Exemple #5
0
 def __init__(self, key=None, **kwargs):
     if key is None:
         for i in count(1):
             key = 'WorkspaceControl{!s}'.format(i)
             if not self.CMD(key, exists=True):
                 break
     super(WorkspaceControl, self).__init__(key, **kwargs)
     self.bindingContext = BindingContext()
Exemple #6
0
    def _layout(self):
        with forms.LayoutDialogForm('base') as base:
            with BindingContext() as bc:
                with forms.VerticalThreePane('root', width=512) as main:
                    with forms.VerticalForm('header'):
                        gui.Text('x', 'Installed modules')

                    with forms.FillForm('middle'):
                        mod_list = lists.VerticalList(
                            'xxx', itemTemplate=ModuleTemplate)
                        mod_list.Collection < bind() < (self.ModMgr.Modules,
                                                        'values')
                        # binds the 'values' method of the ModuleManager's Modules{} dictionary

                    with forms.HorizontalStretchForm('footer'):
                        gui.Button('Cancel',
                                   label='cancel').command += self._cancel
                        gui.Separator(None, style='none')
                        gui.Button('Save', label='save').command += self._save
        base.fill(main, 5)
        mod_list.update_bindings()
Exemple #7
0
 def __init__(self, key=None, **kwargs):
     super(BindingWindow, self).__init__(key, **kwargs)
     self.bindingContext = BindingContext()