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


Python GUI.invoke_later方法代码示例

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


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

示例1: _execute_seek

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]
    def _execute_seek(self, controller, pattern):

        duration = pattern.duration
        total_duration = pattern.total_duration

        lm = self.laser_manager
        sm = lm.stage_manager
        ld = sm.lumen_detector

        ld.mask_kind = pattern.mask_kind
        ld.custom_mask = pattern.custom_mask_radius

        osdp = sm.canvas.show_desired_position
        sm.canvas.show_desired_position = False

        st = time.time()
        self.debug('Pre seek delay {}'.format(pattern.pre_seek_delay))
        time.sleep(pattern.pre_seek_delay)

        self.debug('starting seek')
        self.debug('total duration {}'.format(total_duration))
        self.debug('dwell duration {}'.format(duration))

        if pattern.kind == 'DragonFlyPeakPattern':
            try:
                self._dragonfly_peak(st, pattern, lm, controller)
            except BaseException as e:
                self.critical('Dragonfly exception. {}'.format(e))
        else:
            self._hill_climber(st, controller, pattern)

        sm.canvas.show_desired_position = osdp

        from pyface.gui import GUI
        GUI.invoke_later(self._info.dispose)
开发者ID:NMGRL,项目名称:pychron,代码行数:37,代码来源:pattern_executor.py

示例2: execute

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]
 def execute(self):
     url = 'http://' + self._host + self._url % self._tile_args
     try:
         r = requests.get(url)
         if r.status_code == 200:
             GUI.invoke_later(self.handler, self._tile_args, r.content)
     except requests.exceptions.RequestException as ex:
         print("Exception in request '{}': {}".format(self, ex))
开发者ID:enthought,项目名称:enable-mapping,代码行数:10,代码来源:http_tile_manager.py

示例3: do_callback

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]
def do_callback(dispatch, callback, *args):
    """Invoke the callback with a suitable dispatch.
    """
    if dispatch == 'ui':
        from pyface.gui import GUI
        GUI.invoke_later(callback, *args)
    else:
        callback(*args)
开发者ID:r0k3,项目名称:jigna,代码行数:10,代码来源:concurrent.py

示例4: handle_response

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]
 def handle_response(self):
     if self.response.status == 200:
         GUI.invoke_later(self.handler, self._tile_args, self.response.body)
     self.close()
开发者ID:nmichaud,项目名称:enable-mapping,代码行数:6,代码来源:http_tile_manager.py

示例5: run

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]

#.........这里部分代码省略.........
                try:
                    server, address = accept_no_intr(sock)
                    try:
                        command, arguments = receive(server)
                        if command == "__port__":
                            self.client._server_port = int(arguments)
                        else:
                            raise socket.error
                    finally:
                        # Use try...except to handle timeouts
                        try:
                            server.shutdown(socket.SHUT_RD)
                        except:
                            pass
                except socket.error as e:
                    logger.error(repr(e))
                    logger.error("Client spawned a non-responsive Server! " \
                                     "Unregistering...")
                    self.client.error = True
                    self.client.unregister()
                    return
                finally:
                    sock.close()

            else:
                logger.error("Client could not contact the Server and no " \
                                 "spawn command is defined. Unregistering...")
                self.client.error = True
                self.client.unregister()
                return
        else:
            self.client._server_port = server_port

        # Create the socket that will receive commands from the server
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.bind(('localhost', 0))
        sock.listen(1)
        self.client._port = sock.getsockname()[1]

        # Register with the server
        port = str(self.client._port)
        arguments = MESSAGE_SEP.join((port, self.client.self_type,
                                      self.client.other_type))
        self.client.error = not send_port(self.client._server_port, 'register',
                                          arguments)
        self.client.registered = True

        # Send queued commands (these can only exist if we spawned the server)
        for command, args in self.client._queue:
            arguments = MESSAGE_SEP.join((port, command, args))
            self.client.error = not send_port(self.client._server_port, 'send',
                                              arguments)
        self.client._queue = []

        # Start the loop to listen for commands from the Server
        logger.info("Client listening on port %i..." % self.client._port)
        try:
            while not self._finished:
                server, address = accept_no_intr(sock)

                # Reject non-local connections
                if address[0] != '127.0.0.1':
                    msg = "Client on port %s received connection from a " \
                        "non-local party (port %s). Ignoring..."
                    logger.warning(msg % (port, address[0]))
                    continue

                # Receive the command from the server
                self.client.error = False
                command, arguments = receive(server)
                msg = r"Client on port %s received: %s %s"
                logger.debug(msg, port, command, arguments)

                # Handle special commands from the server
                if command == "__orphaned__":
                    self.client.orphaned = bool(int(arguments))

                elif command == "__error__":
                    error_status = arguments[0]
                    error_message = ''
                    if len(arguments) > 0:
                        error_message = arguments[1:]
                    logger.warning("Error status received from the server: " \
                                       "%s\n%s" % (error_status, error_message))
                    self.client.error = bool(int(error_status))

                # Handle other commands through Client interface
                else:
                    if self.client.ui_dispatch == 'off':
                        self.client.handle_command(command, arguments)
                    else:
                        if self.client.ui_dispatch == 'auto':
                            from pyface.gui import GUI
                        else:
                            exec('from pyface.ui.%s.gui import GUI' %
                                 self.client.ui_dispatch)
                        GUI.invoke_later(self.client.handle_command,
                                         command, arguments)
        finally:
            self.client.unregister()
开发者ID:robmcmullen,项目名称:envisage,代码行数:104,代码来源:client.py

示例6: invoke_in_main_thread

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]
def invoke_in_main_thread(fn, *args, **kw):
    from pyface.gui import GUI
    GUI.invoke_later(fn, *args, **kw)
开发者ID:NMGRL,项目名称:pychron,代码行数:5,代码来源:gui.py

示例7: bool

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]
                        error_message = arguments[1:]
                    logger.warning("Error status received from the server: " \
                                       "%s\n%s" % (error_status, error_message))
                    self.client.error = bool(int(error_status))

                # Handle other commands through Client interface
                else:
                    if self.client.ui_dispatch == 'off':
                        self.client.handle_command(command, arguments)
                    else:
                        if self.client.ui_dispatch == 'auto':
                            from pyface.gui import GUI
                        else:
                            exec('from pyface.ui.%s.gui import GUI' %
                                 self.client.ui_dispatch)
                        GUI.invoke_later(self.client.handle_command,
                                         command, arguments)
        finally:
            self.client.unregister()

    def stop(self):
        self._finished = True


class Client(HasTraits):
    """ An object that communicates with another object through a Server.
    """

    # The preferences file path and node path to use for spawning a Server. If
    # this is not specified it will not be possible for this Client to spawn
    # the server.
    server_prefs = Tuple((os.path.join(remote_editor.__path__[0],
开发者ID:LRFrank,项目名称:envisage,代码行数:34,代码来源:client.py

示例8: _stderr_pattern_matched

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]
 def _stderr_pattern_matched(self, pattern_index, match):
     pattern = match.group()
     self._errors += "\n%s" % pattern.strip()
     if pattern_index == 5:
         groupdict = match.groupdict()
         GUI.invoke_later(self.open_file_at_erroneous_line, groupdict)
开发者ID:jvb,项目名称:infobiotics-dashboard,代码行数:8,代码来源:dashboard_experiment.py

示例9: GUIApplication

# 需要导入模块: from pyface.gui import GUI [as 别名]
# 或者: from pyface.gui.GUI import invoke_later [as 别名]

#.........这里部分代码省略.........
            if self.gui is Undefined:
                self.gui = GUI(splash_screen=self.splash_screen)

            # create the initial windows to show
            self._create_windows()

        return ok

    # -------------------------------------------------------------------------
    # 'GUIApplication' Private interface
    # -------------------------------------------------------------------------

    def _create_windows(self):
        """ Create the initial windows to display.

        By default calls :py:meth:`create_window` once. Subclasses can
        override this method.
        """
        window = self.create_window()
        self.add_window(window)

    # -------------------------------------------------------------------------
    # 'Application' private interface
    # -------------------------------------------------------------------------

    def _run(self):
        """ Actual implementation of running the application: starting the GUI
        event loop.
        """
        # Fire a notification that the app is running.  This is guaranteed to
        # happen after all initialization has occurred and the event loop has
        # started.  A listener for this event is a good place to do things
        # where you want the event loop running.
        self.gui.invoke_later(
            self._fire_application_event, 'application_initialized'
        )

        # start the GUI - script blocks here
        self.gui.start_event_loop()
        return True

    # Destruction methods -----------------------------------------------------

    def _can_exit(self):
        """ Check with each window to see if it can be closed

        The fires closing events for each window, and returns False if any
        listener vetos.
        """
        if not super(GUIApplication, self)._can_exit():
            return False

        for window in reversed(self.windows):
            window.closing = event = Vetoable()
            if event.veto:
                return False
        else:
            return True

    def _prepare_exit(self):
        """ Close each window """
        # ensure copy of list, as we modify original list while closing
        for window in list(reversed(self.windows)):
            window.destroy()
            window.closed = window
开发者ID:bergtholdt,项目名称:pyface,代码行数:69,代码来源:gui_application.py


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