Vitesse UI接口函数与异常处理指南.pdfVIP

  • 0
  • 0
  • 约2.19万字
  • 约 18页
  • 2026-01-27 发布于北京
  • 举报

3.7.1通用

通过语句importkcs_ui,这些函数在Python程序中可用。然后,这些

函数被为kcs_ui.函数名。在使用新函数之前,请仔细阅读函数描述。

VitesseUI接口支持以下简单的用户界面函数:

•在Tribon应用程序的图形显示中执行交互式指示

•以与Tribon应用程序本身相同的方式弹出框

•应用程序窗口最大化、最小化、刷新显示等

函数中返回的值“UserResponse”应通过Utility接口中的适当函数进行检

查。通常情况下,当用户完成输入时,会返回kcs_util.ok();而其他响应如

kcs_util.cancel()和kcs_util.quit()则表示特定的用户中断。

注意:UserResponsekcs_util.ok()不应与函数answer_req进行比较。

在通用的Python编程环境中,还有高级的用户界面工具可用。一个这样

的工具示例是wxPython,可以从。

3.7.2异常处理

VitesseUI接口使用异常处理。这意味着如果发生运行时错误,将设置一个异

常。可以使用Python语言的“try‑except”结构捕获该异常。然后,可以通过

检查kcs_ui.error的值来确定错误类型。异常也会被写入Vitesse日志。异常

的含义可以在相应函数的文档中找到。

默认错误是kcs_Error。请注意,kcs_Error异常是一个通用异常,下面将不

再详细描述。

示例:importkcs_uimsg=请输入一个位

置coord=KcsPoint2D.Point2D()try:res=

kcs_ui.point2D_req(msg,coord)except:

3.7.1General

ThefunctionsaremadeavailableinthePythonprogrambytheinsertionofthe

statementimportkcs_ui.Thefunctionsarethenreferredtoaskcs_ui.functionname.

Beforeusinganewfunction,pleasecarefullyreadthefunctiondescription.

TheVitesseUIInterfacesupportsthefollowingsimpleUserInterfacefunctions:

•PerforminteractiveindicationinthegraphicaldisyoftheTribonapplication

•PopupdialogueboxesinthesamewayastheTribonapplicationitselfuses.

•Applicationwindowize,minimize,refreshdisyetc.

ThereturnedvalueUserResponseinthefunctionsshouldbecheckedagainstaproper

functionintheUtilityinterface.Normally,theUserResponsekcs_util.ok()isreturned

whentheuserhascompletedtheinput,whileotherresponseslikekcs_util.cancel(),

kcs_util.quit()givesthespecificuserinterruption.

Note:thattheUserResponsekcs_util.ok()should

文档评论(0)

1亿VIP精品文档

相关文档