Пример #1
0
def main():
    def create_filter(fn):
        regex = re.compile(fn, re.I)
        test = lambda p: regex.search(p)
        items.update_filter(test)

    with gui.Window() as w:
        with forms.NavForm() as nav:
            with forms.VerticalForm() as navbar:
                one = gui.Button()
                two = gui.Button()
                three = gui.Button()
            with forms.HeaderForm() as main:
                filter_field = QTextField()
                main_list = lists.VerticalList()

        items > bind() > main_list.collection
        items.bind.viewCount > bind() > three.bind.label
        items.bind.count > bind() > two.bind.label
        w.update_bindings()

    w.buffer = InputBuffer(w, create_filter)
    filter_field.textChanged += w.buffer.handle
    cmds.scriptJob(lj=True)
    return w
Пример #2
0
def example_Forms(*args, **kwargs):
    """
    Example:
    import mGui.examples.formExamples as formExamples
    formExamples.example_Forms()
    """
    # Defining these in here, because well, the functions don't exist yet.
    examples = [("FillForm", example_FillForm),
                ("FooterForm", example_FooterForm),
                ("HeaderForm", example_HeaderForm),
                ("HorizontalExpandForm", example_HorizontalExpandForm),
                ("HorizontalForm", example_HorizontalForm),
                ("HorizontalStretchForm", example_HorizontalStretchForm),
                ("HorizontalThreePane", example_HorizontalThreePane),
                ("VerticalExpandForm", example_VerticalExpandForm),
                ("VerticalForm", example_VerticalForm),
                ("VerticalStretchForm", example_VerticalStretchForm),
                ("VerticalThreePane", example_VerticalThreePane)]

    with gui.Window(title="Forms Examples", height=128) as window:
        with forms.FillForm(margin=(12, 12)):
            with forms.HeaderForm(width=320) as main:
                gui.ScrollField(
                    height=80,
                    text=
                    """This example shows many of the different kinds of formlayout presets in mGui.forms. Click buttons to show examples, and resize the windows to see the behavior""",
                    ww=True,
                    ed=0)
                with forms.VerticalForm(spacing=(0, 4)):
                    for example_name, example_command in examples:
                        gui.Button(
                            label=example_name).command += example_command

    window.show()
Пример #3
0
def example_HeaderForm(*args, **kwargs):
    """
    Warning: If you give this layout less than one child there will be an error.
    Example:
    import mGui.examples.formExamples as formExamples
    formExamples.example_HeaderForm()
    """
    with gui.Window(title="HeaderForm") as window:
        with forms.HeaderForm(width=320, margin=(12, 12)) as main:
            gui.Button(label='header')
            gui.ScrollField(text="expandable bottom section")

    window.show()
Пример #4
0
def example_HeaderForm():
    """
    Warning: If you give this layout less than one child there will be an error.
    Example:
    import mGui.examples.formExamples as formExamples
    formExamples.example_HorizontalThreePane()
    """
    with gui.Window(None, title="Example") as window:
        with forms.HeaderForm(None, width=320) as main:
            i = 0
            for item in commands2:
                i = i+1
                if i > 2:
                    break
                gui.Button(None, label=str(item['label'])).command += item['command']

    cmds.showWindow(window)