Ejemplo n.º 1
0
 def start_elem(self, name, attrs):
     if name == 'menus': return
     if name == 'menu':
         self.menu_depth += 1
         label = misc._encode(attrs['label'])
         if self.menu_depth == 1:
             t = MenuTree(attrs['name'], label,
                          attrs.get('itemid', ''),
                          attrs.get('help_str', ''),
                          handler=attrs.get('handler', ''))
             self.curr_menu.append( (t.root,) )
             self.owner.menus.append(t)
             return
         node = MenuTree.Node(label=label, name=attrs['name'],
                              id=attrs.get('itemid', ''),
                              help_str=attrs.get('help_str', ''),
                              handler=attrs.get('handler', ''))
         cm = self.curr_menu[-1]
         cm[0].children.append(node)
         node.parent = cm[0]
         menu = wx.Menu()
         self.curr_menu.append( (node, menu) )
     elif name == 'item':
         self.curr_item = MenuTree.Node()
     else:
         try: self.curr_index = self.itemattrs.index(name)
         except ValueError:
             # ignore unknown attributes...
             self.curr_index = -1
             pass
Ejemplo n.º 2
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditRadioButton objects.
    """
    label = "radio_btn_%d" % number[0]
    while common.app_tree.has_name(label):
        number[0] += 1
        label = "radio_btn_%d" % number[0]
    radio = EditRadioButton(label, parent, wx.NewId(), misc._encode(label), sizer, pos, common.property_panel)
    node = Tree.Node(radio)
    radio.node = node
    radio.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos - 1)
Ejemplo n.º 3
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditRadioButton objects.
    """
    label = 'radio_btn_%d' % number[0]
    while common.app_tree.has_name(label):
        number[0] += 1
        label = 'radio_btn_%d' % number[0]
    radio = EditRadioButton(label, parent, wx.NewId(), misc._encode(label),
                            sizer, pos, common.property_panel)
    node = Tree.Node(radio)
    radio.node = node
    radio.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos-1)
Ejemplo n.º 4
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditToggleButton objects.
    """
    label = 'button_%d' % number[0]
    while common.app_tree.has_name(label):
        number[0] += 1
        label = 'button_%d' % number[0]
    button = EditToggleButton(label, parent, wx.NewId(), misc._encode(label),
                              sizer, pos, common.property_panel)
    node = Tree.Node(button)
    button.node = node
    button.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos-1)
Ejemplo n.º 5
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditHyperlinkCtrl objects.
    """
    name = 'hyperlink_%d' % number[0]
    while common.app_tree.has_name(name):
        number[0] += 1
        name = 'hyperlink_%d' % number[0]
    hyperlink_ctrl = EditHyperlinkCtrl(name, parent, wx.NewId(),
                                 misc._encode(name), sizer, pos,
                                 common.property_panel)
    node = Tree.Node(hyperlink_ctrl)
    hyperlink_ctrl.node = node
    hyperlink_ctrl.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos - 1)
Ejemplo n.º 6
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditStaticText objects.
    """
    label = 'label_%d' % number[0]
    while common.app_tree.has_name(label):
        number[0] += 1
        label = 'label_%d' % number[0]
    static_text = EditStaticText(label, parent, wx.NewId(),
                                 misc._encode(label), sizer, pos,
                                 common.property_panel)
    node = Tree.Node(static_text)
    static_text.node = node
    static_text.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos - 1)
Ejemplo n.º 7
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditStaticText objects.
    """
    label = 'label_%d' % number[0]
    while common.app_tree.has_name(label):
        number[0] += 1
        label = 'label_%d' % number[0]
    static_text = EditStaticText(label, parent, wx.NewId(),
                                 misc._encode(label), sizer, pos,
                                 common.property_panel)
    node = Tree.Node(static_text)
    static_text.node = node
    static_text.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos-1)
Ejemplo n.º 8
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditRadioBox objects.
    """
    label = 'radio_box_%d' % number[0]
    while common.app_tree.has_name(label):
        number[0] += 1
        label = 'radio_box_%d' % number[0]
    radio_box = EditRadioBox(label, parent, wx.NewId(), label,
                             [misc._encode('choice 1')], 0, 0, sizer, pos,
                             common.property_panel)
    #sizer.set_item(pos, 0, 0, size=radio_box.GetSize())
    node = Tree.Node(radio_box)
    radio_box.node = node
    radio_box.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos - 1)
Ejemplo n.º 9
0
def builder(parent, sizer, pos, number=[1]):
    """\
    factory function for EditRadioBox objects.
    """
    label = 'radio_box_%d' % number[0]
    while common.app_tree.has_name(label):
        number[0] += 1
        label = 'radio_box_%d' % number[0]
    radio_box = EditRadioBox(label, parent, wx.NewId(), label,
                             [misc._encode('choice 1')],
                             0, 0, sizer, pos, common.property_panel)
    #sizer.set_item(pos, 0, 0, size=radio_box.GetSize())
    node = Tree.Node(radio_box)
    radio_box.node = node
    radio_box.show_widget(True)
    common.app_tree.insert(node, sizer.node, pos-1)