def clear_AllowableCurve(self): """ 清除所有的许用值曲线 :return: """ from OperatingControls.enterModule import specialWay_OperatingControls, ctrW_AeroAerochcek from config.relative_location import path from PIL import Image from PIL import ImageChops relativeAddress = path.location() # 获取相对位置 operationWindow = "编辑材料许用值" self.dict["所在模块"] = "材料信息->定义复合材料参数" module = "Aerobook-Aerocheck" aero_window, son_window = pywin_openAProgram(module).menuOpen( self.dict) specialWay_OperatingControls(operationWindow).uia_OperatingControls() module_window = ctrW_AeroAerochcek( son_window).workField_composite_information() dlg_spec = module_window.child_window(title="GridWindow", class_name="wxWindowNR") # 进行图片对比,来判断材料许用值曲线表是否为空 # 预期截图位置location_expect location_expect = relativeAddress + r"src\testCase\d_useCase_screenshot\Aerocheck\expectScreenshots\aaa.png" # 实际截图位置 location_actual = relativeAddress + r"src\testCase\d_useCase_screenshot\Aerocheck\ActualScreenshots\\" + "实际材料许用值曲线表截图.png" while True: # 判断实际值截图是否存在,如果存在就删掉 result = os.path.exists(location_actual) if result: # 如果存在就删除实际图片 os.remove(location_actual) dlg_spec.capture_as_image().save(location_actual) # 截取实际值图片 # 对比截图 image_one = Image.open(location_expect) image_two = Image.open(location_actual) diff = ImageChops.difference(image_one, image_two) if diff.getbbox() is None: # 如果图片一样,就说明材料许用值曲线表里没有内容 break else: # 如果不图片一样,就说明材料许用值曲线表里有内容,就删除内容 i = 1 dlg_spec.right_click_input(coords=(10, 10)) # 点击鼠标右键 from pykeyboard import PyKeyboard # 选择删除按钮 # 选择右键下拉框的“独立显示” k = PyKeyboard() while i <= 2: k.press_key(k.down_key) time.sleep(0.5) i = i + 1 k.press_key(k.enter_key) # 删除实际截图 result = os.path.exists(location_actual) if result: # 如果存在就删除实际图片 os.remove(location_actual)
from OperatingControls.enterModule import ctrW_AeroAerochcek import sys,os,time text=r"F:\Aerobook\demo\pywin_ToFindControl" testdicts ={"所在模块":"求解计算->求解计算"} module="Aerobook-Aerocheck" aero_window, son_window = pywin_openAProgram(module).menuOpen(testdicts) dlg_spec=ctrW_AeroAerochcek(son_window).workField_general() dlg_spec.print_control_identifiers() # 属性更新对应的路径的文本框 # dlg_spec.Edit.set_text(text) # 载荷提取对应的路径文本框 # dlg_spec.Edit2.set_text(text) # 点击属性更新路径对应的浏览按钮 # dlg_spec.Button2.click()
WindowTop("Aerobook v1.0.4").EnumWindows() time.sleep(1) # 连接到被测程序,并且通过菜单栏打开被测模块 testCase_dict={"所在模块":"复材结构强度校核->复合材料强度校核"} operationWindow="二维单元" # operationWindow="杆柱单元" module="Aerobook-Aerocheck" aero_window, son_window = pywin_openAProgram(module).menuOpen_switchingWin_UIA(testCase_dict,operationWindow) aero_window, son_window=ctrW_AeroAerochcek(son_window).workField_intensityCheck() aero_window.print_control_identifiers() """二维单元""" # 点击复合强度校核工作栏的二维单元按钮 # open_module().menu_compositeMaterial(Aero_window,"二维单元") # 进入二维单元工作栏
# 向双剪许用值文本框中输入数据 # workField1.Edit4.set_text("cc") # 打开编辑参数弹窗 # workField1.Button2.click() """切换到编辑参数弹窗""" # import win32gui # # hwnd=win32gui.FindWindow("#32770",None) # 获取窗体的句柄 # # print("hwnd:",hwnd) # # # app = Application().connect(handle=hwnd,timeout=20) # dlg_spec = app.window(handle=hwnd) # 切换到选择文件弹窗窗口 # # dlg_spec.print_control_identifiers() """判断弹窗是否存在""" from OperatingControls.enterModule import BeingMeasured_popupWin, ctrW_AeroAerochcek, specialWay_OperatingControls module = "Aerobook-Aerocheck" aero_window, module_window = pywin_openAProgram(module).menuOpen(testdicts) window_one = ctrW_AeroAerochcek(module_window).workField_Open_EditArgument() window_one.Edit4.set_text("cc")
# 尺寸定义 from OperatingControls.enterModule import ctrW_AeroAerochcek from src.utils.otherMethods.initialize import pywin_openAProgram testCase_attribute = {"所在模块": "尺寸信息->一维单元尺寸定义(模板)"} module = "Aerobook-Aerocheck" aero_window, son_window = pywin_openAProgram(module).menuOpen( testCase_attribute) print(1) # 切入铺层数据库工具弹窗中 module_window = ctrW_AeroAerochcek(son_window).workField_sizeInfo() print(2) module_window.print_control_identifiers() # 材料类型单选框,勾选金属材料 # module_window.RadioButton2.click() # # #材料类型单选框,勾选复合材料 # # module_window.RadioButton.click() # 选择路径按钮 module_window.Button.click() # 选择路径文本框
from src.utils.otherMethods.initialize import pywin_openAProgram from OperatingControls.enterModule import BeingMeasured_popupWin, ctrW_AeroAerochcek import time from src.utils.OperatingControls.moduleControlOperation import OperatingControls testCase_dict = {"所在模块": "材料信息->定义复合材料参数"} operationWindow = "定义材料许用值" module = "Aerobook-Aerocheck" aero_window, son_window = pywin_openAProgram(module).menuOpen_switchingWin_UIA( testCase_dict, operationWindow) window_one = ctrW_AeroAerochcek(son_window).workField_composite_information() # # # 打开“编辑材料许用值曲线弹窗”弹框 # # # window_one.print_control_identifiers() # # window_one.Button5.click() # # dlg_spec= OperatingControls(window_one).ExpressionAssembly("Button1") # # # dlg_spec.click() time.sleep(5)