def builder(parent, sizer, pos, number=[1]):
    "factory function for editor objects from GUI"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices)
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    label = '%s_%d' % (tmpl_label, number[0])
    while common.app_tree.has_name(label):
        number[0] += 1
        label = '%s_%d' % (tmpl_label, number[0])
    with parent.frozen():
        widget = editor_class(label, parent, wx.ID_ANY, style, sizer, pos)
        import edit_sizers
        if isinstance(sizer, edit_sizers.edit_sizers.BoxSizerBase):
            if ( (sizer.orient & wx.VERTICAL   and style=="wxLI_HORIZONTAL") or 
                 (sizer.orient & wx.HORIZONTAL and style=="wxLI_VERTICAL") ):
                widget.properties["flag"].add("wxEXPAND")
        node = Node(widget)
        widget.node = node
        if parent.widget: widget.create()
    common.app_tree.insert(node, sizer.node, pos-1)
Пример #2
0
def builder(parent, pos):
    "Factory function for EditSplitterWindow objects"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices,
                                                 ["Create panels"], [True])
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    orientation = dialog.get_selection().split(" ")[0]
    create_panels = dialog.get_options()[0]
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    name = parent.toplevel_parent.get_next_contained_name('window_%d')
    with parent.frozen():
        editor = EditSplitterWindow(name, parent, orientation, pos)
        editor.properties["style"].set_to_default()
        if create_panels:
            pane1 = EditPanel(name + '_pane_1', editor, 0)
            pane2 = EditPanel(name + '_pane_2', editor, 1)

        editor.properties["proportion"].set(1)
        editor.properties["flag"].set("wxEXPAND")

        if parent.widget: editor.create()

        return editor
Пример #3
0
def builder(parent, sizer, pos, number=[1]):
    "Factory function for EditSplitterWindow objects"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices,
                                                 ["Create panels"], [True])
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    orientation = dialog.get_selection().split(" ")[0]
    create_panels = dialog.get_options()[0]
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    label = '%s_%d' % (tmpl_label, number[0])
    while common.app_tree.has_name(label):
        number[0] += 1
        label = '%s_%d' % (tmpl_label, number[0])

    with parent.frozen():
        widget = editor_class(label, parent, -1, None, None, orientation,
                              sizer, pos)
        widget.properties["style"].set_to_default()
        if create_panels:
            widget._window_1 = pane1 = EditPanel(label + '_pane_1', widget,
                                                 wx.NewId(),
                                                 widget.virtual_sizer, 1)
            widget._window_2 = pane2 = EditPanel(label + '_pane_2', widget,
                                                 wx.NewId(),
                                                 widget.virtual_sizer, 2)

        node = Node(widget)
        widget.node = node
        widget.virtual_sizer.node = node

        widget.properties["proportion"].set(1)
        widget.properties["flag"].set("wxEXPAND")

        common.app_tree.insert(node, sizer.node, pos - 1)

        if create_panels:
            node2 = Node(widget._window_1)
            node3 = Node(widget._window_2)
        else:
            node2 = SlotNode(widget._window_1)
            node3 = SlotNode(widget._window_2)
        widget._window_1.node = node2
        common.app_tree.add(node2, widget.node)
        widget._window_2.node = node3
        common.app_tree.add(node3, widget.node)

        if parent.widget: widget.create()
Пример #4
0
def builder(parent, pos):
    "Factory function for editor objects from GUI"
    dialog = wcodegen.WidgetStyleSelectionDialog( _('wxGauge'), _('Orientation'), 'wxGA_HORIZONTAL|wxGA_VERTICAL')
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK: return

    name = parent.toplevel_parent.get_next_contained_name('gauge_%d')
    with parent.frozen():
        editor = EditGauge(name, parent, style, pos)
        editor.properties["flag"].set("wxEXPAND")
        if parent.widget: editor.create()
    return editor
Пример #5
0
def builder(parent, pos):
    "Factory function for editor objects from GUI"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices)
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    name = common.root.get_next_name('gauge_%d', parent)
    with parent.frozen():
        editor = editor_class(name, parent, style, pos)
        editor.properties["flag"].set("wxEXPAND")
        if parent.widget: editor.create()
    return editor
Пример #6
0
def builder(parent, sizer, pos, number=[1]):
    "factory function for editor objects from GUI"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices)
    res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    label = '%s_%d' % (tmpl_label, number[0])
    while common.app_tree.has_name(label):
        number[0] += 1
        label = '%s_%d' % (tmpl_label, number[0])
    widget = editor_class(label, parent, wx.ID_ANY, style, sizer, pos)
    node = Node(widget)
    widget.node = node
    if parent.widget: widget.create()
    common.app_tree.insert(node, sizer.node, pos - 1)
Пример #7
0
def builder(parent, sizer, pos, number=[1]):
    "Factory function for editor objects from GUI"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices)
    res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK:
        return
    with parent.frozen():
        widget = editor_class(None, parent, wx.ID_ANY, style, sizer, pos)
        node = Node(widget)
        widget.node = node
        widget.virtual_sizer.node = node
        widget.properties["proportion"].set(1)
        widget.properties["flag"].set("wxEXPAND")
        if parent.widget: widget.create()
        common.app_tree.insert(node, sizer.node, pos-1)
    
        widget.insert_tab(0, widget.next_pane_name()) # next_pane_name will be used as label and as pane name, if possible
Пример #8
0
def builder(parent, pos):
    "factory function for editor objects from GUI"
    dialog = wcodegen.WidgetStyleSelectionDialog(
        _('wxStaticLine'), _('Orientation'), 'wxLI_HORIZONTAL|wxLI_VERTICAL')
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    name = common.root.get_next_name('static_line_%d', parent)
    with parent.frozen():
        editor = EditStaticLine(name, parent, style, pos)
        if parent.IS_SIZER and "orient" in parent.properties and parent.orient:
            if ((parent.orient & wx.VERTICAL and style == "wxLI_HORIZONTAL") or
                (parent.orient & wx.HORIZONTAL and style == "wxLI_VERTICAL")):
                editor.properties["flag"].add("wxEXPAND")
        if parent.widget: editor.create()
    return editor
Пример #9
0
def builder(parent, sizer, pos, number=[1]):
    "factory function for editor objects from GUI"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices)
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    label = '%s_%d' % (tmpl_label, number[0])
    while common.app_tree.has_name(label):
        number[0] += 1
        label = '%s_%d' % (tmpl_label, number[0])
    with parent.frozen():
        widget = editor_class(label, parent, wx.ID_ANY, style, sizer, pos)
        node = Node(widget)
        widget.node = node
        widget.properties["flag"].set("wxEXPAND")
        if parent.widget: widget.create()
    common.app_tree.insert(node, sizer.node, pos - 1)
Пример #10
0
def builder(parent, pos):
    "Factory function for editor objects from GUI"
    choices = 'wxNB_TOP|wxNB_BOTTOM|wxNB_LEFT|wxNB_RIGHT'
    dialog = wcodegen.WidgetStyleSelectionDialog(_('wxNotebook'),
                                                 _('Orientation'), choices)
    with misc.disable_stay_on_top(common.adding_window or parent):
        res = dialog.ShowModal()
    style = dialog.get_selection()
    dialog.Destroy()
    if res != wx.ID_OK: return

    name = parent.toplevel_parent.get_next_contained_name('notebook_%d')
    with parent.frozen():
        editor = EditNotebook(name, parent, style, pos)
        editor.properties["proportion"].set(1)
        editor.properties["flag"].set("wxEXPAND")
        if parent.widget: editor.create()
        editor._insert_tab(
            0, editor.next_pane_name()
        )  # next_pane_name will be used as label and as pane name, if possible
    return editor
Пример #11
0
def builder(parent, sizer, pos, number=[1]):
    "Factory function for EditSplitterWindow objects"
    dialog = wcodegen.WidgetStyleSelectionDialog(dlg_title, box_title, choices)
    res = dialog.ShowModal()
    orientation = dialog.get_selection().split(" ")[0]
    dialog.Destroy()
    if res != wx.ID_OK:
        return

    label = '%s_%d' % (tmpl_label, number[0])
    while common.app_tree.has_name(label):
        number[0] += 1
        label = '%s_%d' % (tmpl_label, number[0])

    widget = editor_class(label, parent, -1, None, None, None, orientation,
                          sizer, pos)
    widget._window_1 = pane1 = EditPanel(label + '_pane_1', widget, wx.NewId(),
                                         widget.virtual_sizer, 1)
    widget._window_2 = pane2 = EditPanel(label + '_pane_2', widget, wx.NewId(),
                                         widget.virtual_sizer, 2)

    node = Node(widget)
    widget.node = node
    widget.virtual_sizer.node = node

    widget.properties["proportion"].set(1)
    widget.properties["flag"].set("wxEXPAND")

    common.app_tree.insert(node, sizer.node, pos - 1)

    node2 = Node(widget._window_1)
    widget._window_1.node = node2
    common.app_tree.add(node2, widget.node)

    node3 = Node(widget._window_2)
    widget._window_2.node = node3
    common.app_tree.add(node3, widget.node)

    sizer.set_item(widget.pos, 1, wx.EXPAND)