

def on_title_changed(self, title):
    if (title == 'null'):
        return
    print('MSG:', title)
    if title.startswith('got-a-move:test-widget'):
        xy = title.split('-')[(- 1)]
        (x, y) = [(int(i) - 20) for i in xy.split(',')]
        msg = ('document.getElementById("test-widget").style.left = "%ipx";' % x)
        msg += ('document.getElementById("test-widget").style.top = "%ipx";' % y)
        self.web_send(msg)
        print(title)
    if (title == 'got-a-click:messages'):
        self.web_send('\n                        $(document.body).append("<div id=\'test-widget\' class=\'draggable\'>This is a paragraph</div>");\n                        $("#test-widget").css({   "width": "100px", \n                                                    "height": "35px",\n                                                    "position":"absolute",\n                                                    "top":"100px",\n                                                    "left":"100px",\n                                                    "background": "red",\n                                                    "overflow":"hidden",\n                                                    "user-select": "none",\n                                                    "handle": "",\n                                                    "cursor": "move",\n                                                });\n                        // Implement some dragging (sort of)\n                        $("#test-widget")._down = false;\n                        $("#test-widget").mousedown(function(e){this._down=true});\n                        $("#test-widget").mouseup(function(e){this._down=false});\n                        $("#test-widget").mouseleave(function(e){this._down=false});\n                        $("#test-widget").mousemove(function(e){if (this._down) {got_a_move(e);}});\n                        \n                        ')

dataset/ETHPy150Open zoofIO/flexx/exp/wgui.py Main.on_title_changed/original