Example #1
0
 def add_child(self, ctrl, mouse_pos=None):
     new_id = wx.NewId()
     obj = ctrl(self.obj,
                name="%s_%s" % (ctrl._meta.name.lower(), new_id),
                id=new_id,
                designer=self.designer)
     # in design mode set drag & drop target for the toolbox:
     if self.designer and obj._meta.container and self.obj.drop_target:
         set_drop_target(obj, self.root_obj, self.designer, self)
     # move the new object to the mouse position of the click evt (if given)
     if mouse_pos:
         x, y = self.obj.wx_obj.ScreenToClient(mouse_pos)
         obj.pos = (x, y)
     # update the object at the inspector (to show the new control)
     wx.CallAfter(self.inspect, obj)
Example #2
0
 def add_child(self, ctrl, mouse_pos=None):
     new_id = wx.NewId()
     obj = ctrl(self.obj, 
            name="%s_%s" % (ctrl._meta.name.lower(), new_id),
            id=new_id, 
            designer=self.designer)
     # in design mode set drag & drop target for the toolbox: 
     if self.designer and obj._meta.container and self.obj.drop_target:
         set_drop_target(obj, self.root_obj, self.designer, self)
     # move the new object to the mouse position of the click evt (if given)
     if mouse_pos:
         x, y = self.obj.wx_obj.ScreenToClient(mouse_pos)
         obj.pos = (x, y)
     # update the object at the inspector (to show the new control)
     wx.CallAfter(self.inspect, obj)
Example #3
0
        execfile(filename, vars)
        root = None
        objs = vars.values()
    for value in objs:
        if not isinstance(value, gui.Window):
            continue
        root = value       # TODO: support many windows
        # load the window in the widget inspector
        inspector.load_object(root)
        # associate the window with the designer: 
        # (override mouse events to allow moving and resizing)
        designer = BasicDesigner(root, inspector)
        # associate the window with the toolbox:
        # (this will allow to drop new controls on the window)
        obj = root
        set_drop_target(root, root, designer, inspector)
        # link the designer (context menu) and toolbox (tool click)
        inspector.set_designer(designer)
        tb.set_default_tlw(root, designer, inspector)
        root.show()

    if root:
        designer.onclose = save 
        designer.filename = filename
        
        frame.Show()
        tb.Show()
        
        wellcome_tip(root.wx_obj)

        f1.Move((root.pos[0] + root.size[0] + 50, 25))
Example #4
0
        execfile(filename, vars)
        root = None
        objs = vars.values()
    for value in objs:
        if not isinstance(value, gui.Window):
            continue
        root = value       # TODO: support many windows
        # load the window in the widget inspector
        inspector.load_object(root)
        # associate the window with the designer: 
        # (override mouse events to allow moving and resizing)
        designer = BasicDesigner(root, inspector)
        # associate the window with the toolbox:
        # (this will allow to drop new controls on the window)
        obj = root
        set_drop_target(root, root, designer, inspector)
        # link the designer (context menu) and toolbox (tool click)
        inspector.set_designer(designer)
        tb.set_default_tlw(root, designer, inspector)
        root.show()

    if root:
        designer.onclose = save 
        designer.filename = filename
        
        frame.Show()
        tb.Show()
        
        wellcome_tip(root.wx_obj)

        f1.Move((root.pos[0] + root.size[0] + 50, 25))