示例#1
0
    def __init__(self, collection):

        # this is the collection of stuff to manage
        self.Collection = observable.ViewCollection(*collection)

        with gui.BindingWindow(
                None, title='bound collection example') as self.window:
            with forms.VerticalExpandForm('main') as main:
                gui.Separator(None, style='none', height=12)
                gui.Text(None, label="Here's stuff in my list")
                gui.Separator(None, style='none', height=12)

                with forms.HorizontalStretchForm('filter') as flt:
                    gui.TextField('filtertext', width=480)
                    gui.Separator(None,
                                  horizontal=False,
                                  style='none',
                                  width=4)
                    with forms.HorizontalExpandForm('display',
                                                    width=32) as hmm:
                        gui.Text('shown').bind.label < bind(
                        ) < self.Collection.bind.ViewCount
                        gui.Text(None, '/')
                        gui.Text('total').bind.label < bind(
                        ) < self.Collection.bind.Count

                self.Collection > bind() > lists.VerticalList(
                    'itemList', itemTemplate=ExampleTemplate).Collection

        self.window.main.itemList.NewWidget += self.hook_widget_events
        flt.filtertext.enterCommand += self.update_filter
        self.KEEPALIVE = self
示例#2
0
文件: modMgr.py 项目: alfsici/mGui
    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()
示例#3
0
    def widget(self, item):
        with forms.HorizontalExpandForm(tag=item) as root:
            delete_button = gui.IconTextButton(width=48,
                                               style='iconOnly',
                                               image='deleteShader')
            name_field = gui.NameField(object=item, width=256)
            gui.Separator(style='none', width=16)

            tx = gui.FloatField(width=48, pre=2)
            ty = gui.FloatField(width=48, pre=2)
            tz = gui.FloatField(width=48, pre=2)
            gui.Separator(style='none', width=16)

            # using 'connectControl' here is a good alternative to binding
            cmds.connectControl(tx, item + ".tx")
            cmds.connectControl(ty, item + ".ty")
            cmds.connectControl(tz, item + ".tz")

        delete_button.tag = root
        return lists.Templated(item,
                               root,
                               request_delete=delete_button.command)
示例#4
0
    def __init__(self, collection):

        # this is the collection of stuff to manage
        self.collection = observable.ViewCollection(*collection)

        with gui.BindingWindow(title='bound collection example',
                               height=512,
                               width=512) as self.window:
            with forms.VerticalExpandForm(margin=(16, ),
                                          spacing=(8, 12)) as main:
                gui.Text(label="Type a filter and [enter] to limit the list")

                with forms.HorizontalExpandForm(width=512, ) as flt:
                    filter_text = gui.TextField(width=400)
                    filter_text.alwaysInvokeEnterCommandOnReturn = True
                    gui.Separator(horizontal=False, style='none', width=4)
                    with forms.HorizontalExpandForm(width=100) as display:
                        gui.Text("showing")
                        shown = gui.Text(width=24)
                        shown.bind.label < bind(
                        ) < self.collection.bind.viewCount
                        gui.Text(label='/')
                        total = gui.Text(width=24)
                        total.bind.label < bind() < self.collection.bind.count

                with forms.HorizontalExpandForm() as labels:
                    gui.Separator(style=None, width=48)
                    gui.Text("item", width=256, align='center')
                    gui.Separator(style=None, width=16)
                    gui.Text("translation", width=128, align='center')
                    gui.Separator(style=None, width=16)

                item_list = lists.VerticalList(itemTemplate=ExampleTemplate)
                self.collection > bind() > item_list.collection

        item_list.onWidgetCreated += self.hook_widget_events
        filter_text.enterCommand += self.update_filter
        self.KEEPALIVE = self
示例#5
0
文件: modMgr.py 项目: Narinyir/mGui
    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()