当前位置: 首页>>代码示例>>Python>>正文


Python Window.addWindowCloseListener方法代码示例

本文整理汇总了Python中pyjamas.Window.addWindowCloseListener方法的典型用法代码示例。如果您正苦于以下问题:Python Window.addWindowCloseListener方法的具体用法?Python Window.addWindowCloseListener怎么用?Python Window.addWindowCloseListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.Window的用法示例。


在下文中一共展示了Window.addWindowCloseListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: manageRootPanel

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import addWindowCloseListener [as 别名]
def manageRootPanel(panel, id=None):

    if len(rootPanels) < 1:
        panelManager = RootPanelManager()
        Window.addWindowCloseListener(panelManager)

    rootPanels[id] = panel
    return panel
开发者ID:certik,项目名称:pyjamas,代码行数:10,代码来源:RootPanel.py

示例2: __init_UI

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import addWindowCloseListener [as 别名]
    def __init_UI(self):
        ## Two-phase to mimic flex_ui class
        Window.addWindowCloseListener(self)

        self.ws_dh = WSdataHandler(self, self.callback)
        location = Window.getLocation()
        search = location.getSearch()[1:]
        params = '/'.join(search.split('&'))
        full_resource = self.resource + '/' + params
        self.ws = websocketclient.WebSocketClient(full_resource, self.ws_dh,
                                                  fallback=bool(self.fallback))
        self.ws.connect(self.server)

        self.php_dh = PHPdataHandler(self, self.callback)
        self.php_script = self.resource + '.php'
        if not isinstance(self.fallback, bool):
            self.php_script = self.fallback
开发者ID:sean-m-brennan,项目名称:pysysdevel,代码行数:19,代码来源:web_ui.py

示例3: hookWindowClosing

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import addWindowCloseListener [as 别名]
 def hookWindowClosing(cls):
     Window.addWindowCloseListener(cls)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:4,代码来源:RootPanel.py

示例4: __init__

# 需要导入模块: from pyjamas import Window [as 别名]
# 或者: from pyjamas.Window import addWindowCloseListener [as 别名]
    def __init__(self, delayMillis=0, notify=None):

        '''Called with no arguments, create a timer that will call its
        run() method when it is scheduled and fired.  This usage
        requires subclassing to implement the run() method.  This is
        GWT's interface and behaviour.

        There are two enhancements to pyjamas' implementation when
        specified with special keyword arguments, one of which
        obviates the need for subclassing::

            timer = Timer(delayMillis=ms)

        is identical to::

            timer = Timer()
            timer.schedule(ms)

        and::

            timer = Timer(notify=object_or_func)

        is the same as::

            timer = Timer()
            run = getattr(object_or_func, 'onTimer', object_or_func)
            if not callable(run): raise ValueError, msg

        i.e., the value passed to notify is checked to see if it has
        an onTimer attribute; if so, it is used as the callable, if
        not, the object itself is used as the callable.

        NOTE: when notify is specified, the function or method will be
        called with one argument: the instance of the timer.  So, this
        would be proper usage::

            def timer_cb(timer):
               ...

            timer = Timer(notify=timer_cb)

        or::

            class myclass:

                def __init__(self):
                    ...
                    self.timer = Timer(notify=self)

                def onTimer(self, timer):
                    ...
        '''

        # initialize a few house keeping vars
        self.__tid = None
        self.__onTimer = lambda: self.run()
        Window.addWindowCloseListener(Timer.__WindowCloseListener())

        # check notify
        if notify is not None:
            run = getattr(notify, 'onTimer', notify)
            if not callable(run):
                raise ValueError, 'Programming error: notify must be callable'
            self.__onTimer = lambda: run(self)

        # ugly, ugly, ugly, but there's no other way to get
        # implementation-specific initialization (without subclassing,
        # which the override system doesn't do).  The default is a
        # no-op.  We do it here, so the instance can be init'd before
        # the possible scheduling of the timer.
        self.__impl_init_hook()

        # schedule?
        if delayMillis != 0:
            self.schedule(delayMillis)
开发者ID:Afey,项目名称:pyjs,代码行数:77,代码来源:Timer.py


注:本文中的pyjamas.Window.addWindowCloseListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。