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


Python GUI.invoke_later方法代码示例

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


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

示例1: tracking_state_callback

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
    def tracking_state_callback(self, sbp_msg, **metadata):
        t = time.time() - self.t_init
        self.time[0:-1] = self.time[1:]
        self.time[-1] = t
        # first we loop over all the SIDs / channel keys we have stored and set 0 in for CN0
        for key, cno_array in self.CN0_dict.items():
            # p
            if (cno_array == 0).all():
                self.CN0_dict.pop(key)
            else:
                new_arr = np.roll(cno_array, -1)
                new_arr[-1] = 0
                self.CN0_dict[key] = new_arr

        # If the whole array is 0 we remove it
        # for each satellite, we have a (code, prn, channel) keyed dict
        # for each SID, an array of size MAX PLOT with the history of CN0's stored
        # If there is no CN0 or not tracking for an epoch, 0 will be used
        # each array can be plotted against host_time, t
        for i, s in enumerate(sbp_msg.states):
            if code_is_gps(s.sid.code):
                sat = s.sid.sat
            elif code_is_glo(s.sid.code):
                sat = s.fcn - GLO_FCN_OFFSET
                self.glo_slot_dict[sat] = s.sid.sat

            key = (s.sid.code, sat, i)
            if s.cn0 != 0:
                self.CN0_dict[key][-1] = s.cn0 / 4.0

        GUI.invoke_later(self.update_plot)
开发者ID:jkretzmer,项目名称:piksi_tools,代码行数:33,代码来源:tracking_view.py

示例2: run

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
 def run(self):
     cams, new_cams = register_image(self.vsfm_interface, self.imfn, 
                                     match_specified_fn = self.match_specified_fn,
                                     max_sleep_seconds = self.max_sleep_seconds)
     GUI.invoke_later(mayaviu.plot_cameras, new_cams)
     self.cams = cams
     self.new_cams = new_cams
开发者ID:lfkeong,项目名称:vsfm_util,代码行数:9,代码来源:vsfm_util.py

示例3: wrapper

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
    def wrapper(*args, **kw):
        """Wrapper function to run given function inside the GUI event
        loop.
        """
        global _gui, _stop_show
        tk = ETSConfig.toolkit

        if is_ui_running():
            # In this case we should not pop up the UI since we likely
            # don't want to stop the mainloop.
            return func(*args, **kw)
        else:
            g = GUI()
            if tk == "wx":
                # Create a dummy app so invoke later works on wx.
                a = ApplicationWindow(size=(1, 1))
                GUI.invoke_later(lambda: a.close())
                a.open()

            GUI.invoke_later(func, *args, **kw)
            _gui = g
            if stop:
                # Pop up the UI to stop the mainloop.
                _stop_show = StopShow()
            g.start_event_loop()
开发者ID:hassyma,项目名称:mayavi,代码行数:27,代码来源:show.py

示例4: run

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
 def run(self):
     print "Performing expensive calculation in %s..."%self.getName(),
     sleep(3)
     sd = self.data.scalar_data
     sd += numpy.sin(numpy.random.rand(*sd.shape)*2.0*numpy.pi)
     GUI.invoke_later(self.data.update)
     print 'done.'
开发者ID:B-Rich,项目名称:mayavi,代码行数:9,代码来源:compute_in_thread.py

示例5: _baseline_callback_ned

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
  def _baseline_callback_ned(self, sbp_msg, **metadata):
    # Updating an ArrayPlotData isn't thread safe (see chaco issue #9), so
    # actually perform the update in the UI thread.
    if self.running:
      #GUI.invoke_later(self.baseline_callback, sbp_msg)

      soln = MsgBaselineNED(sbp_msg)
      GUI.invoke_later(self.baseline_callback, soln)

      cnt = self.cnt % 4
      fake_sbp_msg = copy.copy(soln)
      if cnt == 3:
        fake_sbp_msg.e = 217371
        fake_sbp_msg.n = 100837 - (cnt+1) * 10e3
      else:
        fake_sbp_msg.e = 217371 + cnt * 20e3
        fake_sbp_msg.n = 100837 - cnt * 20e3
      fake_sbp_msg.sender = 100 + cnt
      fake_sbp_msg.flags = cnt
      soln = fake_sbp_msg
      self.cnt += 1
      GUI.invoke_later(self.baseline_callback, soln)

    # _threshold_satisfied()函数计算需要优化
    # 或者保持数据发送频率小于2(/s)
    time.sleep(0.5)
开发者ID:diti2015,项目名称:PileMonitor,代码行数:28,代码来源:baseline_view.py

示例6: main

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
def main():
    os.chdir( os.path.dirname( os.path.realpath( __file__ )))

    #read the command line arguments or fetch the default values
    args=cli_args(sys.argv[2:])

    #generate the initial dataset
    #TODO collect the "name" of the sample dataset on the command line
    
    sample_dataset,sample_metadata,exec_script=preproc(args)
    
    g=CvuGUI(sample_dataset,sample_metadata,quiet=args['quiet'])
    sample_dataset.gui=g

    #Qt does not sys.exit in response to KeyboardInterrupt
    #we intercept KeyboardInterrupts in the interpreter, before even
    #reaching the Qt event loop and force them to call sys.exit
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    if exec_script is not None:
        from pyface.api import GUI
        gui=GUI()

        def run_script():
            gui.process_events()
            script(exec_script, cvu_gui=g, scriptdir=sys.argv[1])

        gui.invoke_later(run_script)

    g.configure_traits()
开发者ID:aestrivex,项目名称:cvu,代码行数:32,代码来源:main.py

示例7: manage_nap_firmware_update

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
 def manage_nap_firmware_update(self, check_version=False):
   # Flash NAP if out of date.
   try:
     local_nap_version = parse_version(
         self.settings['system_info']['nap_version'].value)
     remote_nap_version = parse_version(self.newest_nap_vers)
     nap_out_of_date = local_nap_version != remote_nap_version
   except KeyError:
     nap_out_of_date = True
   if nap_out_of_date or check_version==False:
     text = "Updating NAP"
     self._write(text)
     self.create_flash("M25")
     nap_n_ops = self.pk_flash.ihx_n_ops(self.nap_fw.ihx)
     progress_dialog = PulsableProgressDialog(nap_n_ops, True)
     progress_dialog.title = text
     GUI.invoke_later(progress_dialog.open)
     self.pk_flash.write_ihx(self.nap_fw.ihx, self.stream, mod_print=0x40, \
                             elapsed_ops_cb = progress_dialog.progress)
     self.stop_flash()
     self._write("")
     progress_dialog.close()
     return True
   else:
     text = "NAP is already to latest version, not updating!"
     self._write(text)
     self._write("")
     return False
开发者ID:asthakeshan,项目名称:piksi_tools,代码行数:30,代码来源:update_view.py

示例8: manage_multi_firmware_update

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
  def manage_multi_firmware_update(self):
    # Set up progress dialog and transfer file to Piksi using SBP FileIO
    progress_dialog = PulsableProgressDialog(len(self.stm_fw.blob))
    progress_dialog.title = "Transferring image file"
    GUI.invoke_later(progress_dialog.open)
    self._write("Transferring image file...")
    try:
      FileIO(self.link).write("upgrade.image_set.bin", self.stm_fw.blob,
                              progress_cb=progress_dialog.progress)
    except Exception as e:
      self._write("Failed to transfer image file to Piksi: %s\n" % e)
      progress_dialog.close()
      return
    try:
      progress_dialog.close()
    except AttributeError:
      pass

    # Setup up pulsed progress dialog and commit to flash
    progress_dialog = PulsableProgressDialog(100, True)
    progress_dialog.title = "Committing to flash"
    GUI.invoke_later(progress_dialog.open)
    self._write("Committing file to flash...")
    def log_cb(msg, **kwargs): self._write(msg.text)
    self.link.add_callback(log_cb, SBP_MSG_LOG)
    code = shell_command(self.link, "upgrade_tool upgrade.image_set.bin", 240)
    self.link.remove_callback(log_cb, SBP_MSG_LOG)
    progress_dialog.close()

    if code != 0:
      self._write('Failed to perform upgrade (code = %d)' % code)
      return
    self._write('Resetting Piksi...')
    self.link(MsgReset(flags=0))
开发者ID:axlan,项目名称:piksi_tools,代码行数:36,代码来源:update_view.py

示例9: tracking_state_callback

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
 def tracking_state_callback(self, sbp_msg, **metadata):
   t = time.time() - self.t_init
   self.time[0:-1] = self.time[1:]
   self.time[-1] = t
   # first we loop over all the SIDs / channel keys we have stored and set 0 in for CN0
   for key, cno_array in self.CN0_dict.items():
     # p
     if (cno_array==0).all():
       self.CN0_dict.pop(key)
     else:
       self.CN0_dict[key][0:-1] = cno_array[1:]
       self.CN0_dict[key][-1] = 0
     # If the whole array is 0 we remove it
   # for each satellite, we have a (code, prn, channel) keyed dict
   # for each SID, an array of size MAX PLOT with the history of CN0's stored
   # If there is no CN0 or not tracking for an epoch, 0 will be used
   # each array can be plotted against host_time, t
   for i,s in enumerate(sbp_msg.states):
     prn = s.sid.sat
     if code_is_gps(s.sid.code):
       prn += 1
     key = (s.sid.code, prn, i)
     if s.state != 0:
       if len(self.CN0_dict.get(key, [])) == 0:
         self.CN0_dict[key] = np.zeros(NUM_POINTS)
       self.CN0_dict[key][-1] = s.cn0
   GUI.invoke_later(self.update_plot)
开发者ID:margaret,项目名称:piksi_tools,代码行数:29,代码来源:tracking_view.py

示例10: _append_log

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
    def _append_log(self, msg, endline="\n"):
        def toappend():
            if self._progress_started:
                self._progress_logs += msg + endline
            else:
                self._logs += msg + endline

        GUI.invoke_later(toappend)  # to be thread safe when logs are displayed in gui
开发者ID:mrkwjc,项目名称:ffnetui,代码行数:10,代码来源:logger.py

示例11: _wrap_update

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
 def _wrap_update():
     update_funcs = self._update_funcs.copy()
     self._update_funcs.clear()
     for update in update_funcs.values():
         update_func, args = update
         update_func(*args)
     if self._update_funcs:
         GUI.invoke_later(_wrap_update)
开发者ID:swift-nav,项目名称:piksi_tools,代码行数:10,代码来源:gui_utils.py

示例12: lock_orientation

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
def lock_orientation(obj, name, old, new):
##    print 'locking o'
    if orientation_flag[obj]:
        orientation_flag[obj] = False
        return
    def icb():
        orientation_flag[obj] = True
        obj.orientation = np.array(old)
    GUI.invoke_later(icb)
开发者ID:EelcoHoogendoorn,项目名称:Escheresque,代码行数:11,代码来源:interface.py

示例13: run

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
 def run(self):
     step = 0
     while (self.running):
         self.interface.datamodel.Update()
         step += 1
         if step>=self.interface.steps:
             step=0
             GUI.invoke_later(self.interface.callback)
     GUI.invoke_later(self.interface.redraw_scene)
开发者ID:EelcoHoogendoorn,项目名称:Escheresque,代码行数:11,代码来源:interface.py

示例14: _run

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
  def _run(self):
    GUI.invoke_later(self.edit_traits, self.view)
    while not self.handler_executed:
      sleep(0.1)

    if self.execute_callback:
      GUI.invoke_later(self.callback)

    if not self.closed:
      self.close = 1
开发者ID:axlan,项目名称:piksi_tools,代码行数:12,代码来源:callback_prompt.py

示例15: lock_scale

# 需要导入模块: from pyface.api import GUI [as 别名]
# 或者: from pyface.api.GUI import invoke_later [as 别名]
def lock_scale(obj, name, old, new):
##    print 'locking s'
    if scale_flag[obj]:
        scale_flag[obj] = False
        return
##    if np.all(new==1): return
    def icb():
        scale_flag[obj] = True
        obj.scale = np.array(old)
    GUI.invoke_later(icb)
开发者ID:EelcoHoogendoorn,项目名称:Escheresque,代码行数:12,代码来源:interface.py


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