Exemplo n.º 1
0
 def create_draggable_element(self, widgetname, touch):
     # create the element, and make it draggable until the touch is released
     # search default args if exist
     default_args = {}
     for options in widgets:
         if len(options) > 2:
             default_args = options[2]
     widget = getattr(Factory, widgetname)(**default_args)
     container = PlaygroundDragElement(playground=self.root.playground)
     container.add_widget(widget)
     touch.grab(container)
     self.root.add_widget(container)
Exemplo n.º 2
0
    def create_draggable_element(self, widgetname, touch, widget=None):
        '''Create PlagroundDragElement and make it draggable
           until the touch is released also search default args if exist
        '''
        container = None
        if not widget:
            default_args = {}
            for options in widgets:
                if len(options) > 2:
                    default_args = options[2]

            container = self.root.ui_creator.playground.\
                get_playground_drag_element(widgetname, touch, **default_args)

        else:
            container = PlaygroundDragElement(
                playground=self.root.ui_creator.playground, child=widget)
            touch.grab(container)
            touch.grab_current = container
            container.on_touch_move(touch)
            container.center_x = touch.x
            container.y = touch.y + 20

        if container:
            self.root.add_widget(container)
        else:
            self.root.statusbar.show_message("Cannot create %s" % widgetname)

        container.widgettree = self.root.ui_creator.widgettree
        return container
Exemplo n.º 3
0
    def create_draggable_element(self, widgetname, touch, widget=None):
        '''Create PlagroundDragElement and make it draggable 
           until the touch is released also search default args if exist
        '''
        container = None
        if not widget:
            default_args = {}
            for options in widgets:
                if len(options) > 2:
                    default_args = options[2]
            
            container = self.root.ui_creator.playground.\
                get_playground_drag_element(widgetname, touch, **default_args)

        else:
            container = PlaygroundDragElement(
                playground=self.root.ui_creator.playground, child=widget)
            touch.grab(container)
            touch.grab_current = container
            container.on_touch_move(touch)
            container.center_x = touch.x
            container.y = touch.y + 20

        if container:
            self.root.add_widget(container)
        else:
            self.root.statusbar.show_message("Cannot create %s"%widgetname)

        container.widgettree = self.root.ui_creator.widgettree
        return container