工控上位机控制系统通用UI框架

This commit is contained in:
2026-03-09 16:29:32 +08:00
parent 19af6e2b4e
commit a00e13b11a
54 changed files with 11356 additions and 0 deletions

View File

@ -0,0 +1,96 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## @~chinese 设备类型定义 @~english Device Type Definition
MV_UNKNOW_DEVICE = 0x00000000 ## @~chinese 未知设备类型,保留意义 @~english Unknown Device Type, Reserved
MV_GIGE_DEVICE = 0x00000001 ## @~chinese GigE设备 @~english GigE Device
MV_1394_DEVICE = 0x00000002 ## @~chinese 1394-a/b 设备 @~english 1394-a/b Device
MV_USB_DEVICE = 0x00000004 ## @~chinese USB 设备 @~english USB Device
MV_CAMERALINK_DEVICE = 0x00000008 ## @~chinese CameraLink设备 @~english CameraLink Device
MV_VIR_GIGE_DEVICE = 0x00000010 ## @~chinese 虚拟GigE设备 @~english Virtual GigE Device
MV_VIR_USB_DEVICE = 0x00000020 ## @~chinese 虚拟USB设备 @~english Virtual USB Device
MV_GENTL_GIGE_DEVICE = 0x00000040 ## @~chinese 自研网卡下GigE设备 @~english GenTL GigE Device
MV_GENTL_CAMERALINK_DEVICE = 0x00000080 ## @~chinese CameraLink设备 @~english GenTL CameraLink Device
MV_GENTL_CXP_DEVICE = 0x00000100 ## @~chinese CoaXPress设备 @~english GenTL CoaXPress Device
MV_GENTL_XOF_DEVICE = 0x00000200 ## @~chinese XoF设备 @~english GenTL XoF Device
MV_GENTL_VIR_DEVICE = 0x00000800 ## @~chinese 虚拟采集卡下的设备不支持虚拟GEV采集卡下的设备 @~english GenTL Virtual Device,not supports GenTL virtual GigE device
## @~chinese 采集卡类型 @~english Interface type
MV_GIGE_INTERFACE = 0x00000001 ## @~chinese GigE Vision采集卡 @~english GigE Vision interface
MV_CAMERALINK_INTERFACE = 0x00000004 ## @~chinese Camera Link采集卡 @~english Camera Link interface
MV_CXP_INTERFACE = 0x00000008 ## @~chinese CoaXPress采集卡 @~english CoaXPress interface
MV_XOF_INTERFACE = 0x00000010 ## @~chinese XoFLink采集卡 @~english XoFLink interface
MV_VIR_INTERFACE = 0x00000020 ## @~chinese 虚拟采集卡 @~english Virtual interface
MV_LC_INTERFACE = 0x00000040 ## @~chinese 光源控制卡 @~english Light Controller interface
INFO_MAX_BUFFER_SIZE = 64 ## @~chinese 最大的数据信息大小 @~english Maximum data information size
MV_MAX_TLS_NUM = 8 ## @~chinese 最多支持的传输层实例个数 @~english The maximum number of supported transport layer instances
MV_MAX_DEVICE_NUM = 256 ## @~chinese 最大支持的设备个数 @~english The maximum number of supported devices
MV_MAX_INTERFACE_NUM = 64 #< \~chinese 最大支持的采集卡数量 @~english The maximum number of Frame Grabber interface supported
MV_MAX_SERIAL_PORT_NUM = 64 ## @~chinese 最大支持的串口数量 @~english The maximum number of serial port supported
MV_MAX_GENTL_IF_NUM = 256 ## @~chinese 最大支持的GenTL数量 @~english The maximum number of GenTL supported
MV_MAX_GENTL_DEV_NUM = 256 ## @~chinese 最大支持的GenTL设备数量 @~english The maximum number of GenTL devices supported
## @~chinese 设备的访问模式 @~english Device Access Mode
## @~chinese 独占权限其他APP只允许读CCP寄存器 @~english Exclusive authority, other APP is only allowed to read the CCP register
MV_ACCESS_Exclusive = 1
## @~chinese 可以从5模式下抢占权限然后以独占权限打开 @~english You can seize the authority from the 5 mode, and then open with exclusive authority
MV_ACCESS_ExclusiveWithSwitch = 2
## @~chinese 控制权限其他APP允许读所有寄存器 @~english Control authority, allows other APP reading all registers
MV_ACCESS_Control = 3
## @~chinese 可以从5的模式下抢占权限然后以控制权限打开 @~english You can seize the authority from the 5 mode, and then open with control authority
MV_ACCESS_ControlWithSwitch = 4
## @~chinese 以可被抢占的控制权限打开 @~english Open with seized control authority
MV_ACCESS_ControlSwitchEnable = 5
## @~chinese 可以从5的模式下抢占权限然后以可被抢占的控制权限打开 @~english You can seize the authority from the 5 mode, and then open with seized control authority
MV_ACCESS_ControlSwitchEnableWithKey = 6
## @~chinese 读模式打开设备,适用于控制权限下 @~english Open with read mode and is available under control authority
MV_ACCESS_Monitor = 7
## @~chinese 信息类型 @~english Information Type
MV_MATCH_TYPE_NET_DETECT = 0x00000001 ## @~chinese 网络流量和丢包信息 @~english Network traffic and packet loss information
MV_MATCH_TYPE_USB_DETECT = 0x00000002 ## @~chinese host接收到来自U3V设备的字节总数 @~english The total number of bytes host received from U3V device
## @~chinese GigEVision IP配置 @~english GigEVision IP Configuration
MV_IP_CFG_STATIC = 0x05000000 ## @~chinese 静态 @~english Static
MV_IP_CFG_DHCP = 0x06000000 ## @~chinese DHCP @~english DHCP
MV_IP_CFG_LLA = 0x04000000 ## @~chinese LLA @~english LLA
## @~chinese GigEVision网络传输模式 @~english GigEVision Net Transfer Mode
MV_NET_TRANS_DRIVER = 0x00000001 ## @~chinese 驱动 @~english Driver
MV_NET_TRANS_SOCKET = 0x00000002 ## @~chinese Socket @~english Socket
## @~chinese CameraLink波特率 @~english CameraLink Baud Rates (CLUINT32)
MV_CAML_BAUDRATE_9600 = 0x00000001 ## @~chinese 9600 @~english 9600
MV_CAML_BAUDRATE_19200 = 0x00000002 ## @~chinese 19200 @~english 19200
MV_CAML_BAUDRATE_38400 = 0x00000004 ## @~chinese 38400 @~english 38400
MV_CAML_BAUDRATE_57600 = 0x00000008 ## @~chinese 57600 @~english 57600
MV_CAML_BAUDRATE_115200 = 0x00000010 ## @~chinese 115200 @~english 115200
MV_CAML_BAUDRATE_230400 = 0x00000020 ## @~chinese 230400 @~english 230400
MV_CAML_BAUDRATE_460800 = 0x00000040 ## @~chinese 460800 @~english 460800
MV_CAML_BAUDRATE_921600 = 0x00000080 ## @~chinese 921600 @~english 921600
MV_CAML_BAUDRATE_AUTOMAX = 0x40000000 ## @~chinese 最大值 @~english Auto Max
## @~chinese 异常消息类型 @~english Exception message type
MV_EXCEPTION_DEV_DISCONNECT = 0x00008001 ## @~chinese 设备断开连接 @~english The device is disconnected
MV_EXCEPTION_VERSION_CHECK = 0x00008002 ## @~chinese SDK与驱动版本不匹配 @~english SDK does not match the driver version
MAX_EVENT_NAME_SIZE = 128 ## @~chinese 设备Event事件名称最大长度 @~english Max length of event name
MV_MAX_NODE_NUM = 1024 ## @~chinese 最大节点个数 @~english Max Number of Nodes
MV_MAX_NODE_NAME_LEN = 64 ## @~chinese 节点名称的最大长度 @~english Max Length of a Node Name
MV_MAX_NODE_ERROR_NUM = 64 ## @~chinese 最大错误个数 @~english Max Number of Error
MV_MAX_XML_SYMBOLIC_NUM = 64 ## @~chinese 最大XML符号数 @~english Max XML Symbolic Number
MV_MAX_ENUM_SYMBOLIC_NUM = 256 ## @~chinese 最大枚举条目对应的符号数量 @~english Max Enum Entry Symbolic Number
MV_MAX_SYMBOLIC_LEN = 64 ## @~chinese 最大枚举条目对应的符号长度 @~english Max Enum Entry Symbolic Number
MV_MAX_SPLIT_NUM = 8 ## @~chinese 分时曝光时最多将源图像拆分的个数 @~english The maximum number of source image to be split in time-division exposure

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
MV_OK = 0x00000000 ## @~chinese 成功,无错误 @~english Successed, no error
## @~chinese 通用错误码定义:范围0x80000000-0x800000FF
MV_E_HANDLE = 0x80000000 ## @~chinese 错误或无效的句柄 @~english Error or invalid handle
MV_E_SUPPORT = 0x80000001 ## @~chinese 不支持的功能 @~english Not supported function
MV_E_BUFOVER = 0x80000002 ## @~chinese 缓存已满 @~english Buffer overflow
MV_E_CALLORDER = 0x80000003 ## @~chinese 函数调用顺序错误 @~english Function calling order error
MV_E_PARAMETER = 0x80000004 ## @~chinese 错误的参数 @~english Incorrect parameter
MV_E_RESOURCE = 0x80000006 ## @~chinese 资源申请失败 @~english Applying resource failed
MV_E_NODATA = 0x80000007 ## @~chinese 无数据 @~english No data
MV_E_PRECONDITION = 0x80000008 ## @~chinese 前置条件有误,或运行环境已发生变化 @~english Precondition error, or running environment changed
MV_E_VERSION = 0x80000009 ## @~chinese 版本不匹配 @~english Version mismatches
MV_E_NOENOUGH_BUF = 0x8000000A ## @~chinese 传入的内存空间不足 @~english Insufficient memory
MV_E_ABNORMAL_IMAGE = 0x8000000B ## @~chinese 异常图像,可能是丢包导致图像不完整 @~english Abnormal image, maybe incomplete image because of lost packet
MV_E_LOAD_LIBRARY = 0x8000000C ## @~chinese 动态导入DLL失败 @~english Load library failed
MV_E_NOOUTBUF = 0x8000000D ## @~chinese 没有可输出的缓存 @~english No Avaliable Buffer
MV_E_ENCRYPT = 0x8000000E ## @~chinese 加密错误 @~english Encryption error
MV_E_OPENFILE = 0x8000000F ## @~chinese 打开文件出现错误 @~english open file error
MV_E_BUF_IN_USE = 0x80000010 ## @~chinese 缓存地址已使用 @~english Buffer already in use
MV_E_BUF_INVALID = 0x80000011 ## @~chinese 无效的缓存地址 @~english Buffer address invalid
MV_E_NOALIGN_BUF = 0x80000012 ## @~chinese 缓存对齐异常 @~english Buffer alignmenterror error
MV_E_NOENOUGH_BUF_NUM = 0x80000013 ## @~chinese 缓存个数不足 @~english Insufficient cache count
MV_E_PORT_IN_USE = 0x80000014 ## @~chinese 串口被占用 @~english Port is in use
MV_E_IMAGE_DECODEC = 0x80000015 ## @~chinese 解码错误(SDK校验图像异常)@~english Decoding error (SDK verification image exception)
MV_E_UINT32_LIMIT = 0x80000016 ## @~chinese 图像大小超过unsigned int返回接口不支持 @~english Image size exceeds unsigned int range - interface unsupported
MV_E_IMAGE_HEIGHT = 0x80000017 ## @~chinese 图像高度异常(残帧丢弃) @~english image height anomaly (discard incomplete images)
MV_E_NOENOUGH_DDR = 0x80000018 ## @~chinese DDR缓存不足 @~english The DDR cache is Insufficient
MV_E_NOENOUGH_STREAM = 0x80000019 ## @~chinese 流通道不足 @~english The stream channel is Insufficient
MV_E_NORESPONSE = 0x8000001A ## @~chinese 设备无响应 @~english No response from device
MV_E_UNKNOW = 0x800000FF ## @~chinese 未知的错误 @~english Unknown error
## @~chinese GenICam系列错误:范围0x80000100-0x800001FF
MV_E_GC_GENERIC = 0x80000100 ## @~chinese 通用错误 @~english General error
MV_E_GC_ARGUMENT = 0x80000101 ## @~chinese 参数非法 @~english Illegal parameters
MV_E_GC_RANGE = 0x80000102 ## @~chinese 值超出范围 @~english The value is out of range
MV_E_GC_PROPERTY = 0x80000103 ## @~chinese 属性 @~english Property
MV_E_GC_RUNTIME = 0x80000104 ## @~chinese 运行环境有问题 @~english Running environment error
MV_E_GC_LOGICAL = 0x80000105 ## @~chinese 逻辑错误 @~english Logical error
MV_E_GC_ACCESS = 0x80000106 ## @~chinese 节点访问条件有误 @~english Node accessing condition error
MV_E_GC_TIMEOUT = 0x80000107 ## @~chinese 超时 @~english Timeout
MV_E_GC_DYNAMICCAST = 0x80000108 ## @~chinese 转换异常 @~english Transformation exception
MV_E_GC_UNKNOW = 0x800001FF ## @~chinese GenICam未知错误 @~english GenICam unknown error
## @~chinese GigE_STATUS对应的错误码:范围0x80000200-0x800002FF
MV_E_NOT_IMPLEMENTED = 0x80000200 ## @~chinese 命令不被设备支持 @~english The command is not supported by device
MV_E_INVALID_ADDRESS = 0x80000201 ## @~chinese 访问的目标地址不存在 @~english The target address being accessed does not exist
MV_E_WRITE_PROTECT = 0x80000202 ## @~chinese 目标地址不可写 @~english The target address is not writable
MV_E_ACCESS_DENIED = 0x80000203 ## @~chinese 设备无访问权限 @~english No permission
MV_E_BUSY = 0x80000204 ## @~chinese 设备忙,或网络断开 @~english Device is busy, or network disconnected
MV_E_PACKET = 0x80000205 ## @~chinese 网络包数据错误 @~english Network data packet error
MV_E_NETER = 0x80000206 ## @~chinese 网络相关错误 @~english Network error
MV_E_SUPPORT_MODIFY_DEVICE_IP = 0x8000020E # < 在固定IP模式下不支持修改设备IP模式 @~english Current Mode Not Support Modify Ip
MV_E_KEY_VERIFICATION = 0x8000020F ## @~chinese 秘钥校验错误 @~english SwitchKey error
MV_E_IP_CONFLICT = 0x80000221 ## @~chinese 设备IP冲突 @~english Device IP conflict
## @~chinese USB_STATUS对应的错误码:范围0x80000300-0x800003FF
MV_E_USB_READ = 0x80000300 ## @~chinese 读usb出错 @~english Reading USB error
MV_E_USB_WRITE = 0x80000301 ## @~chinese 写usb出错 @~english Writing USB error
MV_E_USB_DEVICE = 0x80000302 ## @~chinese 设备异常 @~english Device exception
MV_E_USB_GENICAM = 0x80000303 ## @~chinese GenICam相关错误 @~english GenICam error
MV_E_USB_BANDWIDTH = 0x80000304 ## @~chinese 带宽不足 @~english Insufficient bandwidth
MV_E_USB_DRIVER = 0x80000305 ## @~chinese 驱动不匹配或者未装驱动 @~english Driver mismatch or unmounted drive
MV_E_USB_UNKNOW = 0x800003FF ## @~chinese USB未知的错误 @~english USB unknown error
## @~chinese 升级时对应的错误码:范围0x80000400-0x800004FF
MV_E_UPG_FILE_MISMATCH = 0x80000400 ## @~chinese 升级固件不匹配 @~english Firmware mismatches
MV_E_UPG_LANGUSGE_MISMATCH = 0x80000401 ## @~chinese 升级固件语言不匹配 @~english Firmware language mismatches
MV_E_UPG_CONFLICT = 0x80000402 ## @~chinese 升级冲突(设备已经在升级了再次请求升级即返回此错误) @~english Upgrading conflicted (repeated upgrading requests during device upgrade)
MV_E_UPG_INNER_ERR = 0x80000403 ## @~chinese 升级时设备内部出现错误 @~english Camera internal error during upgrade
MV_E_UPG_UNKNOW = 0x800004FF ## @~chinese 升级时未知错误 @~english Unknown error during upgrade

View File

@ -0,0 +1,94 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## @~chinese 通用类型
MV_ALG_OK = 0x00000000 ## @~chinese处理正确
MV_ALG_ERR = 0x10000000 ## @~chinese不确定类型错误
## @~chinese 能力检查
MV_ALG_E_ABILITY_ARG = 0x10000001 ## @~chinese能力集中存在无效参数
## @~chinese 内存检查
MV_ALG_E_MEM_NULL = 0x10000002 ## @~chinese内存地址为空
MV_ALG_E_MEM_ALIGN = 0x10000003 ## @~chinese内存对齐不满足要求
MV_ALG_E_MEM_LACK = 0x10000004 ## @~chinese内存空间大小不够
MV_ALG_E_MEM_SIZE_ALIGN = 0x10000005 ## @~chinese内存空间大小不满足对齐要求
MV_ALG_E_MEM_ADDR_ALIGN = 0x10000006 ## @~chinese内存地址不满足对齐要求
## @~chinese 图像检查
MV_ALG_E_IMG_FORMAT = 0x10000007 ## @~chinese图像格式不正确或者不支持
MV_ALG_E_IMG_SIZE = 0x10000008 ## @~chinese图像宽高不正确或者超出范围
MV_ALG_E_IMG_STEP = 0x10000009 ## @~chinese图像宽高与step参数不匹配
MV_ALG_E_IMG_DATA_NULL = 0x1000000A ## @~chinese图像数据存储地址为空
## @~chinese 输入输出参数检查
MV_ALG_E_CFG_TYPE = 0x1000000B ## @~chinese设置或者获取参数类型不正确
MV_ALG_E_CFG_SIZE = 0x1000000C ## @~chinese设置或者获取参数的输入、输出结构体大小不正确
MV_ALG_E_PRC_TYPE = 0x1000000D ## @~chinese处理类型不正确
MV_ALG_E_PRC_SIZE = 0x1000000E ## @~chinese处理时输入、输出参数大小不正确
MV_ALG_E_FUNC_TYPE = 0x1000000F ## @~chinese子处理类型不正确
MV_ALG_E_FUNC_SIZE = 0x10000010 ## @~chinese子处理时输入、输出参数大小不正确
## @~chinese 运行参数检查
MV_ALG_E_PARAM_INDEX = 0x10000011 ## @~chineseindex参数不正确
MV_ALG_E_PARAM_VALUE = 0x10000012 ## @~chinesevalue参数不正确或者超出范围
MV_ALG_E_PARAM_NUM = 0x10000013 ## @~chineseparam_num参数不正确
## @~chinese 接口调用检查
MV_ALG_E_NULL_PTR = 0x10000014 ## @~chinese函数参数指针为空
MV_ALG_E_OVER_MAX_MEM = 0x10000015 ## @~chinese超过限定的最大内存
MV_ALG_E_CALL_BACK = 0x10000016 ## @~chinese回调函数出错
## @~chinese 算法库加密相关检查
MV_ALG_E_ENCRYPT = 0x10000017 ## @~chinese加密错误
MV_ALG_E_EXPIRE = 0x10000018 ## @~chinese算法库使用期限错误
## @~chinese 内部模块返回的基本错误类型
MV_ALG_E_BAD_ARG = 0x10000019 ## @~chinese参数范围不正确
MV_ALG_E_DATA_SIZE = 0x1000001A ## @~chinese数据大小不正确
MV_ALG_E_STEP = 0x1000001B ## @~chinese数据step不正确
## @~chinese cpu指令集支持错误码
MV_ALG_E_CPUID = 0x1000001C ## @~chinesecpu不支持优化代码中的指令集
MV_ALG_WARNING = 0x1000001D ## @~chinese警告
MV_ALG_E_TIME_OUT = 0x1000001E ## @~chinese算法库超时
MV_ALG_E_LIB_VERSION = 0x1000001F ## @~chinese算法版本号出错
MV_ALG_E_MODEL_VERSION = 0x10000020 ## @~chinese模型版本号出错
MV_ALG_E_GPU_MEM_ALLOC = 0x10000021 ## @~chineseGPU内存分配错误
MV_ALG_E_FILE_NON_EXIST = 0x10000022 ## @~chinese文件不存在
MV_ALG_E_NONE_STRING = 0x10000023 ## @~chinese字符串为空
MV_ALG_E_IMAGE_CODEC = 0x10000024 ## @~chinese图像解码器错误
MV_ALG_E_FILE_OPEN = 0x10000025 ## @~chinese打开文件错误
MV_ALG_E_FILE_READ = 0x10000026 ## @~chinese文件读取错误
MV_ALG_E_FILE_WRITE = 0x10000027 ## @~chinese文件写错误
MV_ALG_E_FILE_READ_SIZE = 0x10000028 ## @~chinese文件读取大小错误
MV_ALG_E_FILE_TYPE = 0x10000029 ## @~chinese文件类型错误
MV_ALG_E_MODEL_TYPE = 0x1000002A ## @~chinese模型类型错误
MV_ALG_E_MALLOC_MEM = 0x1000002B ## @~chinese分配内存错误
MV_ALG_E_BIND_CORE_FAILED = 0x1000002C ## @~chinese线程绑核失败
## @~chinese 降噪特有错误码
MV_ALG_E_DENOISE_NE_IMG_FORMAT = 0x10402001 ## @~chinese噪声特性图像格式错误
MV_ALG_E_DENOISE_NE_FEATURE_TYPE = 0x10402002 ## @~chinese噪声特性类型错误
MV_ALG_E_DENOISE_NE_PROFILE_NUM = 0x10402003 ## @~chinese噪声特性个数错误
MV_ALG_E_DENOISE_NE_GAIN_NUM = 0x10402004 ## @~chinese噪声特性增益个数错误
MV_ALG_E_DENOISE_NE_GAIN_VAL = 0x10402005 ## @~chinese噪声曲线增益值输入错误
MV_ALG_E_DENOISE_NE_BIN_NUM = 0x10402006 ## @~chinese噪声曲线柱数错误
MV_ALG_E_DENOISE_NE_INIT_GAIN = 0x10402007 ## @~chinese噪声估计初始化增益设置错误
MV_ALG_E_DENOISE_NE_NOT_INIT = 0x10402008 ## @~chinese噪声估计未初始化
MV_ALG_E_DENOISE_COLOR_MODE = 0x10402009 ## @~chinese颜色空间模式错误
MV_ALG_E_DENOISE_ROI_NUM = 0x1040200a ## @~chinese图像ROI个数错误
MV_ALG_E_DENOISE_ROI_ORI_PT = 0x1040200b ## @~chinese图像ROI原点错误
MV_ALG_E_DENOISE_ROI_SIZE = 0x1040200c ## @~chinese图像ROI大小错误
MV_ALG_E_DENOISE_GAIN_NOT_EXIST = 0x1040200d ## @~chinese输入的相机增益不存在(增益个数已达上限)
MV_ALG_E_DENOISE_GAIN_BEYOND_RANGE = 0x1040200e ## @~chinese输入的相机增益不在范围内
MV_ALG_E_DENOISE_NP_BUF_SIZE = 0x1040200f ## @~chinese输入的噪声特性内存大小错误
## @~chinese 去紫边特有错误码
MV_ALG_E_PFC_ROI_PT = 0x10405000 ## @~chinese去紫边算法ROI原点错误
MV_ALG_E_PFC_ROI_SIZE = 0x10405001 ## @~chinese去紫边算法ROI大小错误
MV_ALG_E_PFC_KERNEL_SIZE = 0x10405002 ## @~chinese去紫边算法滤波核尺寸错误

View File

@ -0,0 +1,291 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ctypes import *
PixelType_Gvsp_Undefined = -1
PixelType_Gvsp_Mono1p = 16842807
PixelType_Gvsp_Mono2p = 16908344
PixelType_Gvsp_Mono4p = 17039417
PixelType_Gvsp_Mono8 = 17301505
PixelType_Gvsp_Mono8_Signed = 17301506
PixelType_Gvsp_Mono10 = 17825795
PixelType_Gvsp_Mono10_Packed = 17563652
PixelType_Gvsp_Mono12 = 17825797
PixelType_Gvsp_Mono12_Packed = 17563654
PixelType_Gvsp_Mono14 = 17825829
PixelType_Gvsp_Mono16 = 17825799
PixelType_Gvsp_BayerGR8 = 17301512
PixelType_Gvsp_BayerRG8 = 17301513
PixelType_Gvsp_BayerGB8 = 17301514
PixelType_Gvsp_BayerBG8 = 17301515
PixelType_Gvsp_BayerRBGG8 = 17301574
PixelType_Gvsp_BayerGR10 = 17825804
PixelType_Gvsp_BayerRG10 = 17825805
PixelType_Gvsp_BayerGB10 = 17825806
PixelType_Gvsp_BayerBG10 = 17825807
PixelType_Gvsp_BayerGR12 = 17825808
PixelType_Gvsp_BayerRG12 = 17825809
PixelType_Gvsp_BayerGB12 = 17825810
PixelType_Gvsp_BayerBG12 = 17825811
PixelType_Gvsp_BayerGR10_Packed = 17563686
PixelType_Gvsp_BayerRG10_Packed = 17563687
PixelType_Gvsp_BayerGB10_Packed = 17563688
PixelType_Gvsp_BayerBG10_Packed = 17563689
PixelType_Gvsp_BayerGR12_Packed = 17563690
PixelType_Gvsp_BayerRG12_Packed = 17563691
PixelType_Gvsp_BayerGB12_Packed = 17563692
PixelType_Gvsp_BayerBG12_Packed = 17563693
PixelType_Gvsp_BayerGR16 = 17825838
PixelType_Gvsp_BayerRG16 = 17825839
PixelType_Gvsp_BayerGB16 = 17825840
PixelType_Gvsp_BayerBG16 = 17825841
PixelType_Gvsp_RGB8_Packed = 35127316
PixelType_Gvsp_BGR8_Packed = 35127317
PixelType_Gvsp_RGBA8_Packed = 35651606
PixelType_Gvsp_BGRA8_Packed = 35651607
PixelType_Gvsp_RGB10_Packed = 36700184
PixelType_Gvsp_BGR10_Packed = 36700185
PixelType_Gvsp_RGB12_Packed = 36700186
PixelType_Gvsp_BGR12_Packed = 36700187
PixelType_Gvsp_RGB16_Packed = 36700211
PixelType_Gvsp_BGR16_Packed = 36700235
PixelType_Gvsp_RGBA16_Packed = 37748836
PixelType_Gvsp_BGRA16_Packed = 37748817
PixelType_Gvsp_RGB10V1_Packed = 35651612
PixelType_Gvsp_RGB10V2_Packed = 35651613
PixelType_Gvsp_RGB12V1_Packed = 35913780
PixelType_Gvsp_RGB565_Packed = 34603061
PixelType_Gvsp_BGR565_Packed = 34603062
PixelType_Gvsp_YUV411_Packed = 34340894
PixelType_Gvsp_YUV422_Packed = 34603039
PixelType_Gvsp_YUV422_YUYV_Packed = 34603058
PixelType_Gvsp_YUV444_Packed = 35127328
PixelType_Gvsp_YCBCR8_CBYCR = 35127354
PixelType_Gvsp_YCBCR422_8 = 34603067
PixelType_Gvsp_YCBCR422_8_CBYCRY = 34603075
PixelType_Gvsp_YCBCR411_8_CBYYCRYY = 34340924
PixelType_Gvsp_YCBCR601_8_CBYCR = 35127357
PixelType_Gvsp_YCBCR601_422_8 = 34603070
PixelType_Gvsp_YCBCR601_422_8_CBYCRY = 34603076
PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY = 34340927
PixelType_Gvsp_YCBCR709_8_CBYCR = 35127360
PixelType_Gvsp_YCBCR709_422_8 = 34603073
PixelType_Gvsp_YCBCR709_422_8_CBYCRY = 34603077
PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY = 34340930
PixelType_Gvsp_YUV420SP_NV12 = 34373633
PixelType_Gvsp_YUV420SP_NV21 = 34373634
PixelType_Gvsp_RGB8_Planar = 35127329
PixelType_Gvsp_RGB10_Planar = 36700194
PixelType_Gvsp_RGB12_Planar = 36700195
PixelType_Gvsp_RGB16_Planar = 36700196
PixelType_Gvsp_Jpeg = -2145910783
PixelType_Gvsp_Coord3D_ABC32f = 39846080
PixelType_Gvsp_Coord3D_ABC32f_Planar = 39846081
PixelType_Gvsp_Coord3D_AC32f = 36176066
PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK = -2112094207
PixelType_Gvsp_Coord3D_ABC32 = -2107625471
PixelType_Gvsp_Coord3D_AB32f = -2109722622
PixelType_Gvsp_Coord3D_AB32 = -2109722621
PixelType_Gvsp_Coord3D_AC32f_64 = 37748930
PixelType_Gvsp_Coord3D_AC32f_Planar = 37748931
PixelType_Gvsp_Coord3D_AC32 = -2109722620
PixelType_Gvsp_Coord3D_A32f = 18874557
PixelType_Gvsp_Coord3D_A32 = -2128596987
PixelType_Gvsp_Coord3D_C32f = 18874559
PixelType_Gvsp_Coord3D_C32 = -2128596986
PixelType_Gvsp_Coord3D_ABC16 = 36700345
PixelType_Gvsp_Coord3D_C16 = 17825976
PixelType_Gvsp_HB_Mono8 = 0x81080001 #-2130182143
PixelType_Gvsp_HB_Mono10 = 0x81100003 #-2129657853
PixelType_Gvsp_HB_Mono10_Packed = 0x810C0004 #-2129919996
PixelType_Gvsp_HB_Mono12 = 0x81100005#-2129657851
PixelType_Gvsp_HB_Mono12_Packed = 0x810C0006 #-2129919994
PixelType_Gvsp_HB_Mono16 = 0x81100007 #-2129657849
PixelType_Gvsp_HB_BayerGR8 = 0x81080008#-2130182136
PixelType_Gvsp_HB_BayerRG8 = 0x81080009 #-2130182135
PixelType_Gvsp_HB_BayerGB8 = 0x8108000A #-2130182134
PixelType_Gvsp_HB_BayerBG8 = 0x8108000B #-2130182133
PixelType_Gvsp_HB_BayerRBGG8 = 0x81080046#-2130182074
PixelType_Gvsp_HB_BayerGR10 = 0x8110000C #-2129657844
PixelType_Gvsp_HB_BayerRG10 = 0x8110000D #-2129657843
PixelType_Gvsp_HB_BayerGB10 = 0x8110000E#-2129657842
PixelType_Gvsp_HB_BayerBG10 = 0x8110000F#-2129657841
PixelType_Gvsp_HB_BayerGR12 = 0x81100010 #-2129657840
PixelType_Gvsp_HB_BayerRG12 = 0x81100011 #-2129657839
PixelType_Gvsp_HB_BayerGB12 = 0x81100012 #-2129657838
PixelType_Gvsp_HB_BayerBG12 = 0x81100013 #-2129657837
PixelType_Gvsp_HB_BayerGR10_Packed = 0x810C0026 #-2129919962
PixelType_Gvsp_HB_BayerRG10_Packed = 0x810C0027 #-2129919961
PixelType_Gvsp_HB_BayerGB10_Packed = 0x810C0028 #-2129919960
PixelType_Gvsp_HB_BayerBG10_Packed = 0x810C0029 #-2129919959
PixelType_Gvsp_HB_BayerGR12_Packed = 0x810C002A #-2129919958
PixelType_Gvsp_HB_BayerRG12_Packed = 0x810C002B #-2129919957
PixelType_Gvsp_HB_BayerGB12_Packed = 0x810C002C #-2129919956
PixelType_Gvsp_HB_BayerBG12_Packed = 0x810C002D #-2129919955
PixelType_Gvsp_HB_YUV422_Packed = 0x8210001F #-2112880609
PixelType_Gvsp_HB_YUV422_YUYV_Packed = 0x82100032 #-2112880590
PixelType_Gvsp_HB_RGB8_Packed = 0x82180014 #-2112356332
PixelType_Gvsp_HB_BGR8_Packed = 0x82180015 #-2112356331
PixelType_Gvsp_HB_RGBA8_Packed = 0x82200016 #-2111832042
PixelType_Gvsp_HB_BGRA8_Packed = 0x82200017 #-2111832041
PixelType_Gvsp_HB_RGB16_Packed = 0x82300033 #-2110783437
PixelType_Gvsp_HB_BGR16_Packed = 0x8230004B #-2110783413
PixelType_Gvsp_HB_RGBA16_Packed = 0x82400064 #-2109734812
PixelType_Gvsp_HB_BGRA16_Packed = 0x82400051 #-2109734831
__all__ = ['PixelType_Gvsp_BayerRG8',
'PixelType_Gvsp_YCBCR422_8',
'PixelType_Gvsp_Coord3D_ABC32',
'PixelType_Gvsp_Coord3D_AB32f',
'PixelType_Gvsp_COORD3D_DEPTH_PLUS_MASK',
'PixelType_Gvsp_RGB10_Packed',
'PixelType_Gvsp_RGB10V1_Packed',
'PixelType_Gvsp_RGB8_Planar',
'PixelType_Gvsp_RGBA8_Packed',
'PixelType_Gvsp_RGB8_Packed',
'PixelType_Gvsp_BayerBG12',
'PixelType_Gvsp_Coord3D_AC32f_Planar',
'PixelType_Gvsp_BayerBG10_Packed',
'PixelType_Gvsp_YCBCR709_422_8_CBYCRY',
'PixelType_Gvsp_Coord3D_A32f',
'PixelType_Gvsp_YUV411_Packed',
'PixelType_Gvsp_BayerBG12_Packed',
'PixelType_Gvsp_RGB16_Packed',
'PixelType_Gvsp_BGR16_Packed',
'PixelType_Gvsp_RGBA16_Packed',
'PixelType_Gvsp_BGRA16_Packed',
'PixelType_Gvsp_BayerRG12',
'PixelType_Gvsp_BayerRG10',
'PixelType_Gvsp_BayerRG16',
'PixelType_Gvsp_YCBCR709_411_8_CBYYCRYY',
'PixelType_Gvsp_BayerGB12_Packed',
'PixelType_Gvsp_Coord3D_AC32f',
'PixelType_Gvsp_BayerRG12_Packed',
'PixelType_Gvsp_Coord3D_AB32',
'PixelType_Gvsp_BGR12_Packed',
'PixelType_Gvsp_BayerGR10_Packed',
'PixelType_Gvsp_Coord3D_AC32',
'PixelType_Gvsp_RGB12_Planar',
'PixelType_Gvsp_YCBCR709_422_8',
'PixelType_Gvsp_BGR8_Packed',
'PixelType_Gvsp_Jpeg',
'PixelType_Gvsp_Coord3D_AC32f_64',
'PixelType_Gvsp_YUV422_Packed',
'PixelType_Gvsp_Mono8_Signed',
'PixelType_Gvsp_BayerBG10',
'PixelType_Gvsp_BayerBG16',
'PixelType_Gvsp_BayerGR8',
'PixelType_Gvsp_RGB16_Planar',
'PixelType_Gvsp_Mono4p',
'PixelType_Gvsp_BayerRG10_Packed',
'PixelType_Gvsp_Mono8',
'PixelType_Gvsp_BayerGR16',
'PixelType_Gvsp_BayerGR10',
'PixelType_Gvsp_BGRA8_Packed',
'PixelType_Gvsp_BayerGR12',
'PixelType_Gvsp_Mono12_Packed',
'PixelType_Gvsp_YCBCR709_8_CBYCR',
'PixelType_Gvsp_Coord3D_A32',
'PixelType_Gvsp_YCBCR601_422_8',
'PixelType_Gvsp_Coord3D_C32',
'PixelType_Gvsp_YCBCR411_8_CBYYCRYY',
'PixelType_Gvsp_Undefined',
'PixelType_Gvsp_BayerGR12_Packed',
'PixelType_Gvsp_YCBCR601_411_8_CBYYCRYY',
'PixelType_Gvsp_RGB10_Planar',
'PixelType_Gvsp_BayerGB16',
'PixelType_Gvsp_BayerGB10',
'PixelType_Gvsp_BayerGB12',
'PixelType_Gvsp_BGR565_Packed',
'PixelType_Gvsp_Mono1p',
'PixelType_Gvsp_Coord3D_ABC16',
'PixelType_Gvsp_YUV444_Packed',
'PixelType_Gvsp_YUV422_YUYV_Packed',
'PixelType_Gvsp_BayerBG8',
'PixelType_Gvsp_Coord3D_C32f',
'PixelType_Gvsp_BGR10_Packed',
'PixelType_Gvsp_BayerGB10_Packed',
'PixelType_Gvsp_Coord3D_ABC32f_Planar',
'PixelType_Gvsp_Coord3D_ABC32f',
'PixelType_Gvsp_YCBCR422_8_CBYCRY',
'PixelType_Gvsp_RGB12_Packed',
'PixelType_Gvsp_Mono12',
'PixelType_Gvsp_Mono10',
'PixelType_Gvsp_Mono16',
'PixelType_Gvsp_Mono2p',
'PixelType_Gvsp_Mono14',
'PixelType_Gvsp_RGB10V2_Packed',
'PixelType_Gvsp_RGB12V1_Packed',
'PixelType_Gvsp_Mono10_Packed',
'PixelType_Gvsp_YCBCR601_8_CBYCR',
'PixelType_Gvsp_BayerGB8',
'PixelType_Gvsp_YCBCR8_CBYCR',
'PixelType_Gvsp_RGB565_Packed',
'PixelType_Gvsp_YCBCR601_422_8_CBYCRY',
'PixelType_Gvsp_YUV420SP_NV12',
'PixelType_Gvsp_YUV420SP_NV21',
'PixelType_Gvsp_Coord3D_C16',
'PixelType_Gvsp_BayerRBGG8',
'PixelType_Gvsp_HB_Mono8',
'PixelType_Gvsp_HB_Mono10',
'PixelType_Gvsp_HB_Mono10_Packed',
'PixelType_Gvsp_HB_Mono12',
'PixelType_Gvsp_HB_Mono12_Packed',
'PixelType_Gvsp_HB_Mono16',
'PixelType_Gvsp_HB_BayerGR8',
'PixelType_Gvsp_HB_BayerRG8',
'PixelType_Gvsp_HB_BayerGB8',
'PixelType_Gvsp_HB_BayerBG8',
'PixelType_Gvsp_HB_BayerRBGG8',
'PixelType_Gvsp_HB_BayerGR10',
'PixelType_Gvsp_HB_BayerRG10',
'PixelType_Gvsp_HB_BayerGB10',
'PixelType_Gvsp_HB_BayerBG10',
'PixelType_Gvsp_HB_BayerGR12',
'PixelType_Gvsp_HB_BayerRG12',
'PixelType_Gvsp_HB_BayerGB12',
'PixelType_Gvsp_HB_BayerBG12',
'PixelType_Gvsp_HB_BayerGR10_Packed',
'PixelType_Gvsp_HB_BayerRG10_Packed',
'PixelType_Gvsp_HB_BayerGB10_Packed',
'PixelType_Gvsp_HB_BayerBG10_Packed',
'PixelType_Gvsp_HB_BayerGR12_Packed',
'PixelType_Gvsp_HB_BayerRG12_Packed',
'PixelType_Gvsp_HB_BayerGB12_Packed',
'PixelType_Gvsp_HB_BayerBG12_Packed',
'PixelType_Gvsp_HB_YUV422_Packed',
'PixelType_Gvsp_HB_YUV422_YUYV_Packed',
'PixelType_Gvsp_HB_RGB8_Packed',
'PixelType_Gvsp_HB_BGR8_Packed',
'PixelType_Gvsp_HB_RGBA8_Packed',
'PixelType_Gvsp_HB_BGRA8_Packed',
'PixelType_Gvsp_HB_RGB16_Packed',
'PixelType_Gvsp_HB_BGR16_Packed',
'PixelType_Gvsp_HB_RGBA16_Packed',
'PixelType_Gvsp_HB_BGRA16_Packed']

View File

@ -0,0 +1,25 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
# -*-mode:python ; tab-width:4 -*- ex:set tabstop=4 shiftwidth=4 expandtab: -*-
import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
if current_dir not in sys.path:
sys.path.append(current_dir)
parent_dir = os.path.dirname(current_dir)
if parent_dir not in sys.path:
sys.path.append(parent_dir)
from .MvErrorDefine_const import *
from .MvISPErrorDefine_const import *
from .PixelType_header import *
from .CameraParams_const import *
from .CameraParams_header import *
from .MvCameraControl_class import *
__all__ = ["MvErrorDefine_const", "MvISPErrorDefine_const","PixelType_header", "CameraParams_const", "CameraParams_header", "MvCameraControl_class"]
__version__ = '4.6.0.1'

226
wndMain/camera_img_get.py Normal file
View File

@ -0,0 +1,226 @@
import sys
import os
# import cv2
import time
import numpy as np
from ctypes import *
from .MvImport.MvCameraControl_class import *
class Camera:
def __init__(self):
"""
初始化相机类
"""
self.cam = MvCamera()
self.device_list = MV_CC_DEVICE_INFO_LIST()
self.handle_created = False
self.device_opened = False
self.is_grabbing = False
# 统计信息
self.frame_count = 0
self.start_time = 0
# 缓冲区变量 (将在打开设备后初始化)
self.data_buf = None
self.payload_size = 0
self.frame_info = MV_FRAME_OUT_INFO_EX()
def _open(self):
"""
枚举并打开相机
:return: bool, 成功返回 True失败返回 False
"""
# 1. 枚举设备
ret = MvCamera.MV_CC_EnumDevices(MV_GIGE_DEVICE | MV_USB_DEVICE, self.device_list)
if ret != 0 or self.device_list.nDeviceNum == 0:
print("[Error] No device found!")
return False
print(f"[Info] Found {self.device_list.nDeviceNum} device(s). Using the first one.")
# 2. 选择第一个设备并创建句柄
st_device = cast(self.device_list.pDeviceInfo[0], POINTER(MV_CC_DEVICE_INFO)).contents
ret = self.cam.MV_CC_CreateHandle(st_device)
if ret != 0:
print(f"[Error] Create handle failed, ret={ret}")
return False
self.handle_created = True
# 3. 打开设备
ret = self.cam.MV_CC_OpenDevice(MV_ACCESS_Exclusive, 0)
if ret != 0:
print(f"[Error] Open device failed, ret={ret}")
self._close()
return False
self.device_opened = True
# 4. 配置采集模式 (连续采集)
self.cam.MV_CC_SetEnumValue("AcquisitionMode", 2)
self.cam.MV_CC_SetEnumValue("TriggerMode", 0)
# 5. 开始取流
ret = self.cam.MV_CC_StartGrabbing()
if ret != 0:
print(f"[Error] Start grabbing failed, ret={ret}")
self._close()
return False
self.is_grabbing = True
# 6. 获取 PayloadSize 并分配缓冲区
st_payload = MVCC_INTVALUE_EX()
ret = self.cam.MV_CC_GetIntValueEx("PayloadSize", st_payload)
if ret == 0:
self.payload_size = st_payload.nCurValue
self.data_buf = (c_ubyte * self.payload_size)()
print(f"[Info] Camera opened successfully. PayloadSize: {self.payload_size}")
else:
print("[Error] Failed to get PayloadSize")
self._close()
return False
return True
def _close(self):
"""
停止采集并关闭相机资源
"""
if self.is_grabbing:
self.cam.MV_CC_StopGrabbing()
self.is_grabbing = False
if self.device_opened:
self.cam.MV_CC_CloseDevice()
self.device_opened = False
if self.handle_created:
self.cam.MV_CC_DestroyHandle()
self.handle_created = False
print("[Info] Camera resources released.")
def get_img(self, timeout_ms=1000):
"""
获取一帧图像并进行像素转换
:param timeout_ms: 获取帧的超时时间 (毫秒)
:return: numpy array (BGR格式) 或 None (如果获取失败)
"""
if not self.is_grabbing or self.data_buf is None:
return None
ret = self.cam.MV_CC_GetOneFrameTimeout(self.data_buf, self.payload_size, self.frame_info, timeout_ms)
if ret != 0:
return None
# 更新统计
self.frame_count += 1
if self.frame_count == 1:
self.start_time = time.time()
w, h = self.frame_info.nWidth, self.frame_info.nHeight
# 像素转换参数设置
convert = MV_CC_PIXEL_CONVERT_PARAM()
memset(byref(convert), 0, sizeof(convert))
convert.nWidth = w
convert.nHeight = h
convert.pSrcData = self.data_buf
convert.nSrcDataLen = self.frame_info.nFrameLen
convert.enSrcPixelType = self.frame_info.enPixelType
convert.enDstPixelType = PixelType_Gvsp_BGR8_Packed
convert.nDstBufferSize = w * h * 3
dst = (c_ubyte * convert.nDstBufferSize)()
convert.pDstBuffer = dst
ret_conv = self.cam.MV_CC_ConvertPixelType(convert)
if ret_conv != 0:
return None
# 转换为 numpy 数组
img = np.frombuffer(dst, dtype=np.uint8).reshape(h, w, 3)
return img
def get_fps_stats(self):
"""获取当前的 FPS 统计信息便于观察打印取流fps"""
if self.frame_count == 0 or self.start_time == 0:
return 0.0, 0, 0.0
total_time = time.time() - self.start_time
fps = self.frame_count / total_time if total_time > 0 else 0
return fps, self.frame_count, total_time
# ---------对外接口---------
def show_img():
try:
# 1. 实例化相机
cam_obj = Camera()
# 2. 非正常打开报警
if not cam_obj._open():
print("Failed to open camera. Exiting.")
sys.exit(1)
print("Capturing one frame...")
while(True):
# 3. 获取图像
img = cam_obj.get_img()
return img
except Exception as e:
print(f"Error: {e}")
finally:
# 4. 关闭相机
cam_obj._close()
print("Camera closed.")
# if img is not None:
# # 生成带时间戳的文件名,防止覆盖
# timestamp = time.strftime("%Y%m%d_%H%M%S")
# filename = f"capture_{timestamp}.jpg"
# # 保存图像
# # ret = cv2.imwrite(filename, img)
# # if ret:
# # print(f"Success! Image saved as: {filename}")
# # else:
# # print("Error: Failed to save image.")
# else:
# print("Error: Failed to capture any valid frame.")
# =====================================================
# 主程序示例
# =====================================================
if __name__ == "__main__":
# 1. 实例化相机
cam_obj = Camera()
# 2. 非正常打开报警
if not cam_obj._open():
print("Failed to open camera. Exiting.")
sys.exit(1)
print("Capturing one frame...")
# 3. 获取图像
img = cam_obj.get_img()
if img is not None:
# 生成带时间戳的文件名,防止覆盖
timestamp = time.strftime("%Y%m%d_%H%M%S")
filename = f"capture_{timestamp}.jpg"
# 保存图像
# ret = cv2.imwrite(filename, img)
# if ret:
# print(f"Success! Image saved as: {filename}")
# else:
# print("Error: Failed to save image.")
else:
print("Error: Failed to capture any valid frame.")
# 4. 关闭相机
cam_obj._close()
print("Camera closed.")

View File

@ -0,0 +1,33 @@
# 该视图类用于更新主界面的状态栏
from msg_dict import g_uiCtrlScript
class CFunctionBarView:
# public:
def __init__(self, objList: list):
self._m_objArr = objList
# 根据传入参数,更新功能区的控件使能状态
def setCtrlsEnabled(self, whichOne: str):
if whichOne == g_uiCtrlScript['CTRL_USER_TYPE_TECH']:
# 技术员允许自动作业,设备调试,参数设置,数据查询和配方管理
if not self._m_objArr[0].isEnabled(): self._m_objArr[0].setEnabled(True) # 自动作业
if not self._m_objArr[1].isEnabled(): self._m_objArr[1].setEnabled(True) # 设备调试
if not self._m_objArr[2].isEnabled(): self._m_objArr[2].setEnabled(True) # 参数设置
if not self._m_objArr[3].isEnabled(): self._m_objArr[3].setEnabled(True) # 数据查询
if not self._m_objArr[4].isEnabled(): self._m_objArr[4].setEnabled(True) # 配方管理
if self._m_objArr[5].isEnabled(): self._m_objArr[5].setEnabled(False) # 用户管理
else: # 管理员或操作员
if self._m_objArr[1].isEnabled(): self._m_objArr[1].setEnabled(False) # 设备调试
if self._m_objArr[2].isEnabled(): self._m_objArr[2].setEnabled(False) # 参数设置
if not self._m_objArr[3].isEnabled(): self._m_objArr[3].setEnabled(True) # 数据查询
if self._m_objArr[4].isEnabled(): self._m_objArr[4].setEnabled(False) # 配方管理
if whichOne == g_uiCtrlScript['CTRL_USER_TYPE_ADMIN']:
# 管理员仅允许查询数据和用户管理
if self._m_objArr[0].isEnabled(): self._m_objArr[0].setEnabled(False) # 自动作业
if not self._m_objArr[5].isEnabled(): self._m_objArr[5].setEnabled(True) # 用户管理
else:
# 操作员允许自动作业,查询数据
if not self._m_objArr[0].isEnabled(): self._m_objArr[0].setEnabled(True) # 自动作业
if self._m_objArr[5].isEnabled(): self._m_objArr[5].setEnabled(False) # 用户管理

View File

@ -0,0 +1,223 @@
# 自动作业内嵌页面子类
from PySide6.QtCore import Slot, Qt, QTimer
from PySide6.QtWidgets import QWidget, QMessageBox, QLabel
from PySide6.QtGui import QImage, QPixmap
from wndCtrl.stateCtrl.clsSysState_autoproc import CStateAutoProc
from .uiSub_AutoPage import Ui_pageAutoProc
from msg_dict import g_uiCtrlScript, g_uiGeometrySize, g_errMsgText
from ..camera_img_get import Camera
import cv2 # 确保导入OpenCV
class CSubPageAutoProc(QWidget):
# public:
def __init__(self, widgetSize: tuple[int, int], parent=None):
super().__init__(parent)
# 挂载UI界面将当前业务类实例传入setupUiUI组件成为实例属性
self.ui = Ui_pageAutoProc()
self.ui.setupUi(self)
# 按需声明对应的成员变量
self.szStack = widgetSize
# 摄像头相关变量
self.cam0 = None # 第一个摄像头
self.cam1 = None # 第二个摄像头
self.timer = None # 定时器
self.camera_label = None # 专门用于显示摄像头的Label避免重复创建
pass
# 界面初始化
def uiInit(self) -> None:
self._editCtrlTitle()
self._screenAdapter() # 界面自适应
# 添加其他和界面或控件初始化相关的操作
self._changeWndStyle() # 设置成无框架边框
self._centerWidget() # 居中显示
# ---------------------------------------------------------------
self._setupSignalSlotMapping()
# 添加摄像头实时图片
self._camera_show()
pass
# -----------------------------------------
# private:
# 初始化修改页面控件文字
def _editCtrlTitle(self) -> None:
# 修改tab页面文字
self.ui.tabProc.setTabText(0, g_uiCtrlScript['PAGE_AUTOPROC_TAB_0'])
self.ui.tabProc.setTabText(1, g_uiCtrlScript['PAGE_AUTOPROC_TAB_1'])
# 界面自适应
def _screenAdapter(self) -> None:
self.resize(self.szStack[0], self.szStack[1])
self.ui.tabProc.setGeometry(g_uiGeometrySize['WND_MARGIN_HORI'], g_uiGeometrySize['WND_MARGIN_VERT'],
self.szStack[0] - g_uiGeometrySize['WND_MARGIN_HORI'] * 2,
self.szStack[1] - g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
self._adjustTabCtrls() # 调整tab页内控件的位置及大小
pass
# 窗口居中显示
def _centerWidget(self) -> None:
pass
# 修改窗体属性
def _changeWndStyle(self) -> None:
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
pass
# 调整tab页面控件
def _adjustTabCtrls(self):
rctTemp = self.ui.grpCamera0.geometry()
nSize = (rctTemp.width(), rctTemp.height())
self.ui.grpCamera0.setGeometry(g_uiGeometrySize['WND_MARGIN_HORI'], 0, nSize[0], nSize[1])
# -------------------------------------------
# 建立信号槽连接
def _setupSignalSlotMapping(self) -> None:
# self.ui.btnProcStart.clicked.connect(self._onBtnProcStart)
self.ui.btnProcStop.clicked.connect(self._onBtnProcStop)
self.ui.btnReset.clicked.connect(self._onBtnReset)
pass
# ----------槽函数----------
# @Slot()
# def _onBtnProcStart(self):
# # 启动自动作业
# if g_warnState.checkSysWarning():
# QMessageBox.information(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_errMsgText['ERR_SYS_WARNING'])
# else:
#
# tProcJob = CProcThread()
# CStateAutoProc.setProcState(True)
# tProcJob.runProc()
# # 更新作业按钮的使能状态
# self.ui.btnProcStart.setEnabled(False)
# self.ui.btnProcStop.setEnabled(True)
# pass
@Slot()
def _onBtnProcStop(self):
# 停止自动作业
pass
@Slot()
def _onBtnReset(self):
pass
def _camera_show(self):
"""
初始化摄像头并启动实时显示
"""
try:
# 1. 初始化摄像头(保持打开状态)
self.cam0 = Camera()
if not self.cam0._open():
print("[Error] Failed to open camera")
QMessageBox.warning(self, "摄像头错误", "无法打开摄像头,请检查设备连接!")
return
# 2. 初始化显示用的Label
self._init_camera_label()
# 3. 创建定时器每50毫秒更新一次图像
self.timer = QTimer(self)
self.timer.timeout.connect(self._update_camera_image)
self.timer.start(10) # 50ms约20fps
print("[Info] Camera started successfully")
except Exception as e:
error_msg = f"摄像头初始化失败: {str(e)}"
print(f"[Error] {error_msg}")
QMessageBox.critical(self, "摄像头错误", error_msg)
def _init_camera_label(self):
"""
初始化摄像头显示用的Label只创建一次
"""
# 如果Label已存在直接返回
if self.camera_label is not None:
return
# 创建Label并设置属性
self.camera_label = QLabel(self.ui.fraCamera0)
# 设置Label充满父容器fraCamera0
self.camera_label.setGeometry(0, 0, self.ui.fraCamera0.width(), self.ui.fraCamera0.height())
# 设置图像自适应缩放
self.camera_label.setScaledContents(True)
# 设置对齐方式
self.camera_label.setAlignment(Qt.AlignCenter)
# 确保Label在最上层显示
self.camera_label.raise_()
def _update_camera_image(self):
"""
定时更新摄像头图像(修复版)
"""
try:
if self.cam0 is None or self.camera_label is None:
return
# 1. 获取摄像头图像
img = self.cam0.get_img()
if img is None or img.size == 0:
print("[Warning] 获取到空图像")
return
# 2. OpenCV图像是BGR格式需要转换为RGB
# 先检查图像通道数
if len(img.shape) == 3 and img.shape[2] == 3:
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
else:
# 灰度图像处理
img_rgb = img
# 3. 转换为QImage
h, w = img_rgb.shape[:2]
ch = 3 if len(img_rgb.shape) == 3 else 1
bytes_per_line = ch * w
if ch == 3:
q_img = QImage(img_rgb.data, w, h, bytes_per_line, QImage.Format_RGB888)
else:
q_img = QImage(img_rgb.data, w, h, bytes_per_line, QImage.Format_Grayscale8)
# 4. 转换为QPixmap并显示
pixmap = QPixmap.fromImage(q_img)
if not pixmap.isNull():
self.camera_label.setPixmap(pixmap)
except Exception as e:
print(f"[Error] 更新摄像头图像失败: {e}")
# 不中断程序,继续尝试
def resizeEvent(self, event):
"""
窗口大小变化时同步调整摄像头显示Label的大小
"""
super().resizeEvent(event)
if self.camera_label is not None and self.ui.fraCamera0 is not None:
self.camera_label.setGeometry(0, 0, self.ui.fraCamera0.width(), self.ui.fraCamera0.height())
def closeEvent(self, event):
"""
关闭窗口时释放摄像头资源(增强版)
"""
# 停止定时器
if self.timer is not None and self.timer.isActive():
self.timer.stop()
self.timer.deleteLater()
self.timer = None
# 释放摄像头资源
if self.cam0 is not None:
self.cam0._close()
self.cam0 = None
if self.cam1 is not None:
self.cam1._close()
self.cam1 = None
event.accept()

View File

@ -0,0 +1,162 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiSub_AutoPage.ui'
##
## Created by: Qt User Interface Compiler version 6.9.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QFrame, QGroupBox, QHBoxLayout,
QLabel, QProgressBar, QPushButton, QSizePolicy,
QTabWidget, QTextEdit, QVBoxLayout, QWidget)
class Ui_pageAutoProc(object):
def setupUi(self, pageAutoProc):
if not pageAutoProc.objectName():
pageAutoProc.setObjectName(u"pageAutoProc")
pageAutoProc.resize(1696, 1262)
self.tabProc = QTabWidget(pageAutoProc)
self.tabProc.setObjectName(u"tabProc")
self.tabProc.setGeometry(QRect(10, 10, 1041, 691))
self.tab_8 = QWidget()
self.tab_8.setObjectName(u"tab_8")
self.widget = QWidget(self.tab_8)
self.widget.setObjectName(u"widget")
self.widget.setGeometry(QRect(30, 50, 951, 571))
self.verticalLayout = QVBoxLayout(self.widget)
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.grpCamera0 = QGroupBox(self.widget)
self.grpCamera0.setObjectName(u"grpCamera0")
self.fraCamera0 = QFrame(self.grpCamera0)
self.fraCamera0.setObjectName(u"fraCamera0")
self.fraCamera0.setGeometry(QRect(20, 40, 421, 231))
self.fraCamera0.setFrameShape(QFrame.Shape.StyledPanel)
self.fraCamera0.setFrameShadow(QFrame.Shadow.Raised)
self.horizontalLayout.addWidget(self.grpCamera0)
self.grpCamera1 = QGroupBox(self.widget)
self.grpCamera1.setObjectName(u"grpCamera1")
self.fraCamera1 = QFrame(self.grpCamera1)
self.fraCamera1.setObjectName(u"fraCamera1")
self.fraCamera1.setGeometry(QRect(20, 40, 441, 231))
self.fraCamera1.setFrameShape(QFrame.Shape.StyledPanel)
self.fraCamera1.setFrameShadow(QFrame.Shadow.Raised)
self.horizontalLayout.addWidget(self.grpCamera1)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.grpOperate = QGroupBox(self.widget)
self.grpOperate.setObjectName(u"grpOperate")
self.btnProcStart = QPushButton(self.grpOperate)
self.btnProcStart.setObjectName(u"btnProcStart")
self.btnProcStart.setGeometry(QRect(60, 41, 110, 50))
self.btnProcStart.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.btnProcStop = QPushButton(self.grpOperate)
self.btnProcStop.setObjectName(u"btnProcStop")
self.btnProcStop.setEnabled(False)
self.btnProcStop.setGeometry(QRect(60, 110, 110, 50))
self.btnProcStop.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.btnReset = QPushButton(self.grpOperate)
self.btnReset.setObjectName(u"btnReset")
self.btnReset.setGeometry(QRect(60, 180, 110, 50))
self.btnReset.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.horizontalLayout_2.addWidget(self.grpOperate)
self.grpWaste = QGroupBox(self.widget)
self.grpWaste.setObjectName(u"grpWaste")
self.lblWaste = QLabel(self.grpWaste)
self.lblWaste.setObjectName(u"lblWaste")
self.lblWaste.setGeometry(QRect(20, 60, 81, 16))
self.editWaste = QTextEdit(self.grpWaste)
self.editWaste.setObjectName(u"editWaste")
self.editWaste.setGeometry(QRect(110, 50, 81, 31))
self.btnWasteZero = QPushButton(self.grpWaste)
self.btnWasteZero.setObjectName(u"btnWasteZero")
self.btnWasteZero.setGeometry(QRect(20, 120, 111, 51))
self.pgbWaste = QProgressBar(self.grpWaste)
self.pgbWaste.setObjectName(u"pgbWaste")
self.pgbWaste.setGeometry(QRect(110, 150, 151, 91))
self.pgbWaste.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
self.pgbWaste.setValue(24)
self.pgbWaste.setOrientation(Qt.Orientation.Vertical)
self.horizontalLayout_2.addWidget(self.grpWaste)
self.grpInfo = QGroupBox(self.widget)
self.grpInfo.setObjectName(u"grpInfo")
self.tabInfo = QTabWidget(self.grpInfo)
self.tabInfo.setObjectName(u"tabInfo")
self.tabInfo.setGeometry(QRect(20, 30, 191, 211))
self.tab_9 = QWidget()
self.tab_9.setObjectName(u"tab_9")
self.tabInfo.addTab(self.tab_9, "")
self.tab_13 = QWidget()
self.tab_13.setObjectName(u"tab_13")
self.tabInfo.addTab(self.tab_13, "")
self.horizontalLayout_2.addWidget(self.grpInfo)
self.grpType = QGroupBox(self.widget)
self.grpType.setObjectName(u"grpType")
self.fraType = QFrame(self.grpType)
self.fraType.setObjectName(u"fraType")
self.fraType.setGeometry(QRect(20, 30, 191, 201))
self.fraType.setFrameShape(QFrame.Shape.StyledPanel)
self.fraType.setFrameShadow(QFrame.Shadow.Raised)
self.horizontalLayout_2.addWidget(self.grpType)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.tabProc.addTab(self.tab_8, "")
self.tab_14 = QWidget()
self.tab_14.setObjectName(u"tab_14")
self.tabProc.addTab(self.tab_14, "")
self.retranslateUi(pageAutoProc)
self.tabProc.setCurrentIndex(0)
self.tabInfo.setCurrentIndex(0)
QMetaObject.connectSlotsByName(pageAutoProc)
# setupUi
def retranslateUi(self, pageAutoProc):
pageAutoProc.setWindowTitle("")
self.grpCamera0.setTitle(QCoreApplication.translate("pageAutoProc", u"\u76f8\u673a0", None))
self.grpCamera1.setTitle(QCoreApplication.translate("pageAutoProc", u"\u76f8\u673a1", None))
self.grpOperate.setTitle(QCoreApplication.translate("pageAutoProc", u"\u64cd\u4f5c\u4f5c\u4e1a", None))
self.btnProcStart.setText(QCoreApplication.translate("pageAutoProc", u"\u542f\u52a8\u7801\u579b\u4f5c\u4e1a", None))
self.btnProcStop.setText(QCoreApplication.translate("pageAutoProc", u"\u505c\u6b62\u7801\u579b\u4f5c\u4e1a", None))
self.btnReset.setText(QCoreApplication.translate("pageAutoProc", u"\u8bbe\u5907\u590d\u4f4d", None))
self.grpWaste.setTitle(QCoreApplication.translate("pageAutoProc", u"\u5e9f\u6599\u533a\u72b6\u6001", None))
self.lblWaste.setText(QCoreApplication.translate("pageAutoProc", u"\u5f53\u524d\u5e9f\u6599\u4e2a\u6570\uff1a", None))
self.btnWasteZero.setText(QCoreApplication.translate("pageAutoProc", u"\u5e9f\u6599\u533a\u6e05\u96f6", None))
self.grpInfo.setTitle(QCoreApplication.translate("pageAutoProc", u"\u4f5c\u4e1a\u4fe1\u606f", None))
self.tabInfo.setTabText(self.tabInfo.indexOf(self.tab_9), QCoreApplication.translate("pageAutoProc", u"\u6d41\u7a0b\u4fe1\u606f", None))
self.tabInfo.setTabText(self.tabInfo.indexOf(self.tab_13), QCoreApplication.translate("pageAutoProc", u"\u62a5\u8b66\u4fe1\u606f", None))
self.grpType.setTitle(QCoreApplication.translate("pageAutoProc", u"\u7ebf\u6761\u7c7b\u578b", None))
self.tabProc.setTabText(self.tabProc.indexOf(self.tab_8), QCoreApplication.translate("pageAutoProc", u"\u4f5c\u4e1a\u4fe1\u606f0", None))
self.tabProc.setTabText(self.tabProc.indexOf(self.tab_14), QCoreApplication.translate("pageAutoProc", u"\u4f5c\u4e1a\u4fe1\u606f1", None))
# retranslateUi

View File

@ -0,0 +1,38 @@
# 数据查询内嵌页面子类
from PySide6.QtWidgets import QWidget
from PySide6.QtCore import Qt
from wndMain.pageDataQuery.uiSub_Query import Ui_pageDataQuery
class CSubPageQuery(QWidget):
# public:
def __init__(self, widgetSize: tuple[int, int], parent=None):
super().__init__(parent)
self.ui = Ui_pageDataQuery()
self.ui.setupUi(self)
# 按需声明对应的成员变量
self.szStack = widgetSize
pass
# 界面初始化
def uiInit(self) -> None:
self._screenAdapter() # 界面自适应
self._changeWndStyle() # 设置成无框架边框
self._centerWidget() # 居中显示
pass
# ----------------------------------------
# private:
# 界面自适应
def _screenAdapter(self) -> None:
self.resize(self.szStack[0], self.szStack[1])
pass
# 修改窗体属性
def _changeWndStyle(self) -> None:
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
pass
# 窗口居中显示
def _centerWidget(self) -> None:
pass

View File

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiSub_Query.ui'
##
## Created by: Qt User Interface Compiler version 6.9.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QSizePolicy, QWidget)
class Ui_pageDataQuery(object):
def setupUi(self, pageDataQuery):
if not pageDataQuery.objectName():
pageDataQuery.setObjectName(u"pageDataQuery")
pageDataQuery.resize(758, 516)
self.retranslateUi(pageDataQuery)
QMetaObject.connectSlotsByName(pageDataQuery)
# setupUi
def retranslateUi(self, pageDataQuery):
pageDataQuery.setWindowTitle(QCoreApplication.translate("pageDataQuery", u"Form", None))
# retranslateUi

View File

@ -0,0 +1,44 @@
# 设备调试内嵌页面子类
from PySide6.QtWidgets import QWidget, QMessageBox
from PySide6.QtCore import Qt, Slot
from wndMain.pageDevDebug.uiSub_DevDebug import Ui_pageDebug
from msg_dict import g_uiGeometrySize
class CSubPageDevDebug(QWidget):
# public:
def __init__(self, widgetSize: tuple[int, int], parent=None):
super().__init__(parent)
self.ui = Ui_pageDebug()
self.ui.setupUi(self)
# 按需声明对应的成员变量
self.szStack = widgetSize
pass
# 界面初始化
def uiInit(self) -> None:
self._screenAdapter() # 界面自适应
self._changeWndStyle() # 设置成无框架边框
self._centerWidget() # 居中显示
pass
# ----------------------------------------
# private:
# 界面自适应
def _screenAdapter(self) -> None:
self.resize(self.szStack[0], self.szStack[1])
self.ui.tabServo.setGeometry(g_uiGeometrySize['WND_MARGIN_HORI'], g_uiGeometrySize['WND_MARGIN_VERT'],
self.szStack[0] - g_uiGeometrySize['WND_MARGIN_HORI'] * 2,
self.szStack[1] - g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
pass
# 修改窗体属性
def _changeWndStyle(self) -> None:
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
pass
# 窗口居中显示
def _centerWidget(self) -> None:
pass

View File

@ -0,0 +1,422 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiSub_DevDebug.ui'
##
## Created by: Qt User Interface Compiler version 6.9.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QComboBox, QLabel, QPushButton,
QRadioButton, QSizePolicy, QSlider, QTabWidget,
QTextEdit, QWidget)
class Ui_pageDebug(object):
def setupUi(self, pageDebug):
if not pageDebug.objectName():
pageDebug.setObjectName(u"pageDebug")
pageDebug.resize(653, 411)
self.tabServo = QTabWidget(pageDebug)
self.tabServo.setObjectName(u"tabServo")
self.tabServo.setGeometry(QRect(-10, 10, 651, 421))
self.tab_0 = QWidget()
self.tab_0.setObjectName(u"tab_0")
self.widget = QWidget(self.tab_0)
self.widget.setObjectName(u"widget")
self.widget.setGeometry(QRect(30, 20, 411, 291))
self.lblConveySpeed = QLabel(self.widget)
self.lblConveySpeed.setObjectName(u"lblConveySpeed")
self.lblConveySpeed.setGeometry(QRect(50, 120, 53, 20))
self.rdbLeftConveyMotor = QRadioButton(self.widget)
self.rdbLeftConveyMotor.setObjectName(u"rdbLeftConveyMotor")
self.rdbLeftConveyMotor.setGeometry(QRect(50, 30, 98, 19))
self.rdbRightConveyMotor = QRadioButton(self.widget)
self.rdbRightConveyMotor.setObjectName(u"rdbRightConveyMotor")
self.rdbRightConveyMotor.setGeometry(QRect(270, 30, 98, 19))
self.sldConveySpeed = QSlider(self.widget)
self.sldConveySpeed.setObjectName(u"sldConveySpeed")
self.sldConveySpeed.setGeometry(QRect(110, 120, 160, 22))
self.sldConveySpeed.setMinimum(-50)
self.sldConveySpeed.setMaximum(50)
self.sldConveySpeed.setOrientation(Qt.Orientation.Horizontal)
self.edtConveySpeed = QTextEdit(self.widget)
self.edtConveySpeed.setObjectName(u"edtConveySpeed")
self.edtConveySpeed.setGeometry(QRect(290, 110, 41, 31))
self.edtConveySpeed.setReadOnly(True)
self.edtConveyAcSpeed = QTextEdit(self.widget)
self.edtConveyAcSpeed.setObjectName(u"edtConveyAcSpeed")
self.edtConveyAcSpeed.setGeometry(QRect(290, 150, 41, 31))
self.edtConveyAcSpeed.setReadOnly(True)
self.sldConveyAcSpeed = QSlider(self.widget)
self.sldConveyAcSpeed.setObjectName(u"sldConveyAcSpeed")
self.sldConveyAcSpeed.setGeometry(QRect(110, 160, 160, 22))
self.sldConveyAcSpeed.setMinimum(0)
self.sldConveyAcSpeed.setMaximum(100)
self.sldConveyAcSpeed.setSingleStep(10)
self.sldConveyAcSpeed.setOrientation(Qt.Orientation.Horizontal)
self.lblConveyAcSpeed = QLabel(self.widget)
self.lblConveyAcSpeed.setObjectName(u"lblConveyAcSpeed")
self.lblConveyAcSpeed.setGeometry(QRect(50, 160, 53, 20))
self.edtConveyDeSpeed = QTextEdit(self.widget)
self.edtConveyDeSpeed.setObjectName(u"edtConveyDeSpeed")
self.edtConveyDeSpeed.setGeometry(QRect(290, 190, 41, 31))
self.edtConveyDeSpeed.setReadOnly(True)
self.sldConveyDeSpeed = QSlider(self.widget)
self.sldConveyDeSpeed.setObjectName(u"sldConveyDeSpeed")
self.sldConveyDeSpeed.setGeometry(QRect(110, 200, 160, 22))
self.sldConveyDeSpeed.setMinimum(0)
self.sldConveyDeSpeed.setMaximum(100)
self.sldConveyDeSpeed.setSingleStep(10)
self.sldConveyDeSpeed.setOrientation(Qt.Orientation.Horizontal)
self.lblConveyDeSpeed = QLabel(self.widget)
self.lblConveyDeSpeed.setObjectName(u"lblConveyDeSpeed")
self.lblConveyDeSpeed.setGeometry(QRect(50, 200, 53, 20))
self.lblConveyAddr = QLabel(self.widget)
self.lblConveyAddr.setObjectName(u"lblConveyAddr")
self.lblConveyAddr.setGeometry(QRect(50, 80, 53, 20))
self.sldConveyAddr = QSlider(self.widget)
self.sldConveyAddr.setObjectName(u"sldConveyAddr")
self.sldConveyAddr.setGeometry(QRect(110, 80, 160, 22))
self.sldConveyAddr.setMinimum(1)
self.sldConveyAddr.setMaximum(10)
self.sldConveyAddr.setOrientation(Qt.Orientation.Horizontal)
self.edtConveyAddr = QTextEdit(self.widget)
self.edtConveyAddr.setObjectName(u"edtConveyAddr")
self.edtConveyAddr.setGeometry(QRect(290, 70, 41, 31))
self.edtConveyAddr.setReadOnly(True)
self.btnConveyStart = QPushButton(self.widget)
self.btnConveyStart.setObjectName(u"btnConveyStart")
self.btnConveyStart.setGeometry(QRect(80, 250, 75, 23))
self.btnConveyStop = QPushButton(self.widget)
self.btnConveyStop.setObjectName(u"btnConveyStop")
self.btnConveyStop.setGeometry(QRect(240, 250, 75, 23))
self.tabServo.addTab(self.tab_0, "")
self.tab_1 = QWidget()
self.tab_1.setObjectName(u"tab_1")
self.widget_2 = QWidget(self.tab_1)
self.widget_2.setObjectName(u"widget_2")
self.widget_2.setGeometry(QRect(60, 30, 411, 291))
self.lblServoSpeed = QLabel(self.widget_2)
self.lblServoSpeed.setObjectName(u"lblServoSpeed")
self.lblServoSpeed.setGeometry(QRect(50, 40, 53, 20))
self.sldServoSpeed = QSlider(self.widget_2)
self.sldServoSpeed.setObjectName(u"sldServoSpeed")
self.sldServoSpeed.setGeometry(QRect(110, 40, 160, 22))
self.sldServoSpeed.setMinimum(-50)
self.sldServoSpeed.setMaximum(50)
self.sldServoSpeed.setOrientation(Qt.Orientation.Horizontal)
self.edtServoSpeed = QTextEdit(self.widget_2)
self.edtServoSpeed.setObjectName(u"edtServoSpeed")
self.edtServoSpeed.setGeometry(QRect(290, 30, 41, 31))
self.edtServoSpeed.setReadOnly(True)
self.edtServoAcSpeed = QTextEdit(self.widget_2)
self.edtServoAcSpeed.setObjectName(u"edtServoAcSpeed")
self.edtServoAcSpeed.setGeometry(QRect(290, 70, 41, 31))
self.edtServoAcSpeed.setReadOnly(True)
self.sldServoAcSpeed = QSlider(self.widget_2)
self.sldServoAcSpeed.setObjectName(u"sldServoAcSpeed")
self.sldServoAcSpeed.setGeometry(QRect(110, 80, 160, 22))
self.sldServoAcSpeed.setMinimum(0)
self.sldServoAcSpeed.setMaximum(100)
self.sldServoAcSpeed.setOrientation(Qt.Orientation.Horizontal)
self.lblServoAcSpeed = QLabel(self.widget_2)
self.lblServoAcSpeed.setObjectName(u"lblServoAcSpeed")
self.lblServoAcSpeed.setGeometry(QRect(50, 80, 53, 20))
self.edtServoOriP = QTextEdit(self.widget_2)
self.edtServoOriP.setObjectName(u"edtServoOriP")
self.edtServoOriP.setGeometry(QRect(290, 110, 41, 31))
self.edtServoOriP.setReadOnly(True)
self.sldServoOriP = QSlider(self.widget_2)
self.sldServoOriP.setObjectName(u"sldServoOriP")
self.sldServoOriP.setGeometry(QRect(110, 120, 160, 22))
self.sldServoOriP.setMinimum(0)
self.sldServoOriP.setMaximum(180)
self.sldServoOriP.setOrientation(Qt.Orientation.Horizontal)
self.lblServoOriP = QLabel(self.widget_2)
self.lblServoOriP.setObjectName(u"lblServoOriP")
self.lblServoOriP.setGeometry(QRect(50, 120, 53, 20))
self.btnStartRot = QPushButton(self.widget_2)
self.btnStartRot.setObjectName(u"btnStartRot")
self.btnStartRot.setGeometry(QRect(70, 210, 101, 23))
self.btnStartRoi = QPushButton(self.widget_2)
self.btnStartRoi.setObjectName(u"btnStartRoi")
self.btnStartRoi.setGeometry(QRect(230, 210, 75, 23))
self.lblServoRotP = QLabel(self.widget_2)
self.lblServoRotP.setObjectName(u"lblServoRotP")
self.lblServoRotP.setGeometry(QRect(50, 160, 53, 20))
self.edtServoRotP = QTextEdit(self.widget_2)
self.edtServoRotP.setObjectName(u"edtServoRotP")
self.edtServoRotP.setGeometry(QRect(290, 150, 41, 31))
self.edtServoRotP.setReadOnly(True)
self.sldServoRotP = QSlider(self.widget_2)
self.sldServoRotP.setObjectName(u"sldServoRotP")
self.sldServoRotP.setGeometry(QRect(110, 160, 160, 22))
self.sldServoRotP.setMinimum(0)
self.sldServoRotP.setMaximum(180)
self.sldServoRotP.setOrientation(Qt.Orientation.Horizontal)
self.tabServo.addTab(self.tab_1, "")
self.tab = QWidget()
self.tab.setObjectName(u"tab")
self.widget_3 = QWidget(self.tab)
self.widget_3.setObjectName(u"widget_3")
self.widget_3.setGeometry(QRect(80, 30, 411, 291))
self.lblDmSpeed = QLabel(self.widget_3)
self.lblDmSpeed.setObjectName(u"lblDmSpeed")
self.lblDmSpeed.setGeometry(QRect(50, 40, 53, 20))
self.sldDmSpeed = QSlider(self.widget_3)
self.sldDmSpeed.setObjectName(u"sldDmSpeed")
self.sldDmSpeed.setGeometry(QRect(110, 40, 160, 22))
self.sldDmSpeed.setMinimum(1)
self.sldDmSpeed.setMaximum(30)
self.sldDmSpeed.setOrientation(Qt.Orientation.Horizontal)
self.edtDmSpeed = QTextEdit(self.widget_3)
self.edtDmSpeed.setObjectName(u"edtDmSpeed")
self.edtDmSpeed.setGeometry(QRect(290, 30, 41, 31))
self.edtDmSpeed.setReadOnly(True)
self.edtDmOriP = QTextEdit(self.widget_3)
self.edtDmOriP.setObjectName(u"edtDmOriP")
self.edtDmOriP.setGeometry(QRect(290, 70, 51, 31))
self.edtDmOriP.setReadOnly(True)
self.sldDmOriP = QSlider(self.widget_3)
self.sldDmOriP.setObjectName(u"sldDmOriP")
self.sldDmOriP.setGeometry(QRect(110, 80, 160, 22))
self.sldDmOriP.setMinimum(0)
self.sldDmOriP.setMaximum(180)
self.sldDmOriP.setOrientation(Qt.Orientation.Horizontal)
self.lblDmOriP = QLabel(self.widget_3)
self.lblDmOriP.setObjectName(u"lblDmOriP")
self.lblDmOriP.setGeometry(QRect(50, 80, 53, 20))
self.btnStartRoiP = QPushButton(self.widget_3)
self.btnStartRoiP.setObjectName(u"btnStartRoiP")
self.btnStartRoiP.setGeometry(QRect(60, 210, 101, 23))
self.btnStartDropP = QPushButton(self.widget_3)
self.btnStartDropP.setObjectName(u"btnStartDropP")
self.btnStartDropP.setGeometry(QRect(210, 210, 101, 23))
self.lblDmDropP = QLabel(self.widget_3)
self.lblDmDropP.setObjectName(u"lblDmDropP")
self.lblDmDropP.setGeometry(QRect(50, 120, 53, 20))
self.edtDmDropP = QTextEdit(self.widget_3)
self.edtDmDropP.setObjectName(u"edtDmDropP")
self.edtDmDropP.setGeometry(QRect(290, 110, 41, 31))
self.edtDmDropP.setReadOnly(True)
self.sldDmDropP = QSlider(self.widget_3)
self.sldDmDropP.setObjectName(u"sldDmDropP")
self.sldDmDropP.setGeometry(QRect(110, 120, 160, 22))
self.sldDmDropP.setMinimum(0)
self.sldDmDropP.setMaximum(180)
self.sldDmDropP.setOrientation(Qt.Orientation.Horizontal)
self.btnStartZero = QPushButton(self.widget_3)
self.btnStartZero.setObjectName(u"btnStartZero")
self.btnStartZero.setGeometry(QRect(60, 170, 101, 23))
self.btnReset = QPushButton(self.widget_3)
self.btnReset.setObjectName(u"btnReset")
self.btnReset.setGeometry(QRect(210, 170, 101, 23))
self.tabServo.addTab(self.tab, "")
self.tab_2 = QWidget()
self.tab_2.setObjectName(u"tab_2")
self.widget_4 = QWidget(self.tab_2)
self.widget_4.setObjectName(u"widget_4")
self.widget_4.setGeometry(QRect(70, 30, 411, 291))
self.lblStepperSpeed = QLabel(self.widget_4)
self.lblStepperSpeed.setObjectName(u"lblStepperSpeed")
self.lblStepperSpeed.setGeometry(QRect(50, 40, 53, 20))
self.sldStepperSpeed = QSlider(self.widget_4)
self.sldStepperSpeed.setObjectName(u"sldStepperSpeed")
self.sldStepperSpeed.setGeometry(QRect(110, 40, 160, 22))
self.sldStepperSpeed.setMinimum(1)
self.sldStepperSpeed.setMaximum(3000)
self.sldStepperSpeed.setOrientation(Qt.Orientation.Horizontal)
self.edtStepperSpeed = QTextEdit(self.widget_4)
self.edtStepperSpeed.setObjectName(u"edtStepperSpeed")
self.edtStepperSpeed.setGeometry(QRect(290, 30, 41, 31))
self.edtStepperSpeed.setReadOnly(True)
self.edtStepperCycle = QTextEdit(self.widget_4)
self.edtStepperCycle.setObjectName(u"edtStepperCycle")
self.edtStepperCycle.setGeometry(QRect(290, 70, 41, 31))
self.edtStepperCycle.setReadOnly(True)
self.sldStepperCycle = QSlider(self.widget_4)
self.sldStepperCycle.setObjectName(u"sldStepperCycle")
self.sldStepperCycle.setGeometry(QRect(110, 80, 160, 22))
self.sldStepperCycle.setMinimum(0)
self.sldStepperCycle.setMaximum(20)
self.sldStepperCycle.setOrientation(Qt.Orientation.Horizontal)
self.lblStepperCycle = QLabel(self.widget_4)
self.lblStepperCycle.setObjectName(u"lblStepperCycle")
self.lblStepperCycle.setGeometry(QRect(50, 80, 53, 20))
self.lblStepperDir = QLabel(self.widget_4)
self.lblStepperDir.setObjectName(u"lblStepperDir")
self.lblStepperDir.setGeometry(QRect(50, 120, 53, 20))
self.btnStepperAlign = QPushButton(self.widget_4)
self.btnStepperAlign.setObjectName(u"btnStepperAlign")
self.btnStepperAlign.setGeometry(QRect(260, 170, 71, 23))
self.cmbStepperDir = QComboBox(self.widget_4)
self.cmbStepperDir.addItem("")
self.cmbStepperDir.addItem("")
self.cmbStepperDir.setObjectName(u"cmbStepperDir")
self.cmbStepperDir.setGeometry(QRect(110, 120, 151, 23))
self.btnStepperStart = QPushButton(self.widget_4)
self.btnStepperStart.setObjectName(u"btnStepperStart")
self.btnStepperStart.setGeometry(QRect(50, 170, 71, 23))
self.btnStepperStop = QPushButton(self.widget_4)
self.btnStepperStop.setObjectName(u"btnStepperStop")
self.btnStepperStop.setGeometry(QRect(150, 170, 71, 23))
self.tabServo.addTab(self.tab_2, "")
self.retranslateUi(pageDebug)
self.tabServo.setCurrentIndex(3)
QMetaObject.connectSlotsByName(pageDebug)
# setupUi
def retranslateUi(self, pageDebug):
pageDebug.setWindowTitle(QCoreApplication.translate("pageDebug", u"Form", None))
self.lblConveySpeed.setText(QCoreApplication.translate("pageDebug", u"\u901f\u5ea6", None))
self.rdbLeftConveyMotor.setText(QCoreApplication.translate("pageDebug", u"\u4f20\u9001\u5e26\u7535\u673a1", None))
self.rdbRightConveyMotor.setText(QCoreApplication.translate("pageDebug", u"\u4f20\u9001\u5e26\u7535\u673a2", None))
self.edtConveySpeed.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">-30</p></body></html>", None))
self.edtConveyAcSpeed.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">50</p></body></html>", None))
self.lblConveyAcSpeed.setText(QCoreApplication.translate("pageDebug", u"\u52a0\u901f\u5ea6", None))
self.edtConveyDeSpeed.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">50</p></body></html>", None))
self.lblConveyDeSpeed.setText(QCoreApplication.translate("pageDebug", u"\u51cf\u901f\u5ea6", None))
self.lblConveyAddr.setText(QCoreApplication.translate("pageDebug", u"\u4ece\u673a\u5730\u5740", None))
self.edtConveyAddr.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">1</p></body></html>", None))
self.btnConveyStart.setText(QCoreApplication.translate("pageDebug", u"\u540c\u6b65\u542f\u52a8", None))
self.btnConveyStop.setText(QCoreApplication.translate("pageDebug", u"\u540c\u6b65\u505c\u6b62", None))
self.tabServo.setTabText(self.tabServo.indexOf(self.tab_0), QCoreApplication.translate("pageDebug", u"\u4f20\u9001\u5e26\u8c03\u8bd5\u9875\u9762", None))
self.lblServoSpeed.setText(QCoreApplication.translate("pageDebug", u"\u901f\u5ea6", None))
self.edtServoSpeed.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">1500</p></body></html>", None))
self.edtServoAcSpeed.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">50</p></body></html>", None))
self.lblServoAcSpeed.setText(QCoreApplication.translate("pageDebug", u"\u52a0\u901f\u5ea6", None))
self.edtServoOriP.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">0</p></body></html>", None))
self.lblServoOriP.setText(QCoreApplication.translate("pageDebug", u"\u539f\u70b9\u4f4d\u7f6e", None))
self.btnStartRot.setText(QCoreApplication.translate("pageDebug", u"\u65cb\u8f6c\u5230\u7ffb\u8f6c\u4f4d\u7f6e", None))
self.btnStartRoi.setText(QCoreApplication.translate("pageDebug", u"\u65cb\u8f6c\u5230\u539f\u70b9", None))
self.lblServoRotP.setText(QCoreApplication.translate("pageDebug", u"\u65cb\u8f6c\u4f4d\u7f6e", None))
self.edtServoRotP.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">180</p></body></html>", None))
self.tabServo.setTabText(self.tabServo.indexOf(self.tab_1), QCoreApplication.translate("pageDebug", u"\u8235\u673a\u8c03\u8bd5\u9875\u9762", None))
self.lblDmSpeed.setText(QCoreApplication.translate("pageDebug", u"\u901f\u5ea6", None))
self.edtDmSpeed.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">30</p></body></html>", None))
self.edtDmOriP.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">-282.6</p></body></html>", None))
self.lblDmOriP.setText(QCoreApplication.translate("pageDebug", u"\u5438\u9644\u4f4d\u7f6e", None))
self.btnStartRoiP.setText(QCoreApplication.translate("pageDebug", u"\u8fd0\u52a8\u5230\u5438\u9644\u4f4d\u7f6e", None))
self.btnStartDropP.setText(QCoreApplication.translate("pageDebug", u"\u8fd0\u52a8\u5230\u653e\u7f6e\u4f4d\u7f6e", None))
self.lblDmDropP.setText(QCoreApplication.translate("pageDebug", u"\u653e\u7f6e\u4f4d\u7f6e", None))
self.edtDmDropP.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">282.6</p></body></html>", None))
self.btnStartZero.setText(QCoreApplication.translate("pageDebug", u"\u8bbe\u7f6e\u96f6\u4f4d", None))
self.btnReset.setText(QCoreApplication.translate("pageDebug", u"\u590d\u4f4d\u7535\u673a", None))
self.tabServo.setTabText(self.tabServo.indexOf(self.tab), QCoreApplication.translate("pageDebug", u"\u8fbe\u5999\u7535\u673a\u8c03\u8bd5\u9875\u9762", None))
self.lblStepperSpeed.setText(QCoreApplication.translate("pageDebug", u"\u901f\u5ea6", None))
self.edtStepperSpeed.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">2500</p></body></html>", None))
self.edtStepperCycle.setHtml(QCoreApplication.translate("pageDebug", u"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">10</p></body></html>", None))
self.lblStepperCycle.setText(QCoreApplication.translate("pageDebug", u"\u8fd0\u52a8\u5708\u6570", None))
self.lblStepperDir.setText(QCoreApplication.translate("pageDebug", u"\u8fd0\u52a8\u65b9\u5411", None))
self.btnStepperAlign.setText(QCoreApplication.translate("pageDebug", u"\u7ebf\u6761\u5bf9\u9f50", None))
self.cmbStepperDir.setItemText(0, QCoreApplication.translate("pageDebug", u"\u6b63\u5411", None))
self.cmbStepperDir.setItemText(1, QCoreApplication.translate("pageDebug", u"\u53cd\u5411", None))
self.btnStepperStart.setText(QCoreApplication.translate("pageDebug", u"\u5f00\u542f", None))
self.btnStepperStop.setText(QCoreApplication.translate("pageDebug", u"\u505c\u6b62", None))
self.tabServo.setTabText(self.tabServo.indexOf(self.tab_2), QCoreApplication.translate("pageDebug", u"\u6321\u677f\u7535\u673a\u8c03\u8bd5\u9875\u9762", None))
# retranslateUi

View File

@ -0,0 +1,42 @@
# 参数设置内嵌页面子类
from PySide6.QtWidgets import QWidget
from PySide6.QtCore import Slot, Qt
from msg_dict import g_uiGeometrySize
from wndMain.pageParaSet.uiSub_ParaSet import Ui_pageParaSet
class CSubPageParaSetting(QWidget):
# public:
def __init__(self, widgetSize: tuple[int, int], parent=None):
super().__init__(parent)
self.ui = Ui_pageParaSet()
self.ui.setupUi(self)
# 按需声明对应的成员变量
self.szStack = widgetSize
pass
# 界面初始化
def uiInit(self) -> None:
self._screenAdapter() # 界面自适应
self._changeWndStyle() # 设置成无框架边框
self._centerWidget() # 居中显示
pass
# ----------------------------------------
# private:
# 界面自适应
def _screenAdapter(self) -> None:
self.resize(self.szStack[0], self.szStack[1])
self.ui.tabParaSetting.setGeometry(g_uiGeometrySize['WND_MARGIN_HORI'], g_uiGeometrySize['WND_MARGIN_VERT'],
self.szStack[0] - g_uiGeometrySize['WND_MARGIN_HORI'] * 2,
self.szStack[1] - g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
pass
# 修改窗体属性
def _changeWndStyle(self) -> None:
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
pass
# 窗口居中显示
def _centerWidget(self) -> None:
pass

View File

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiSub_ParaSet.ui'
##
## Created by: Qt User Interface Compiler version 6.9.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QSizePolicy, QTabWidget, QWidget)
class Ui_pageParaSet(object):
def setupUi(self, pageParaSet):
if not pageParaSet.objectName():
pageParaSet.setObjectName(u"pageParaSet")
pageParaSet.resize(655, 398)
self.tabParaSetting = QTabWidget(pageParaSet)
self.tabParaSetting.setObjectName(u"tabParaSetting")
self.tabParaSetting.setGeometry(QRect(10, 0, 631, 381))
self.tabParaSetting.setTabPosition(QTabWidget.TabPosition.North)
self.tab_0 = QWidget()
self.tab_0.setObjectName(u"tab_0")
self.tabParaSetting.addTab(self.tab_0, "")
self.tab_1 = QWidget()
self.tab_1.setObjectName(u"tab_1")
self.tabParaSetting.addTab(self.tab_1, "")
self.retranslateUi(pageParaSet)
self.tabParaSetting.setCurrentIndex(0)
QMetaObject.connectSlotsByName(pageParaSet)
# setupUi
def retranslateUi(self, pageParaSet):
pageParaSet.setWindowTitle(QCoreApplication.translate("pageParaSet", u"Form", None))
self.tabParaSetting.setTabText(self.tabParaSetting.indexOf(self.tab_0), QCoreApplication.translate("pageParaSet", u"\u53c2\u6570\u9875\u97620", None))
self.tabParaSetting.setTabText(self.tabParaSetting.indexOf(self.tab_1), QCoreApplication.translate("pageParaSet", u"\u53c2\u6570\u9875\u97621", None))
# retranslateUi

Binary file not shown.

View File

@ -0,0 +1,110 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# @Time : 2026/3/4 11:14
# @Author : reenrr
# @File : sub_uiPasswdChange.py
# @Desc : 密码修改界面的功能逻辑
"""
# 设备调试内嵌页面子类
from re import T
from PySide6.QtWidgets import QWidget, QMessageBox, QDialog
from PySide6.QtCore import Qt, Slot
from wndMain.pagePasswdChange.uiPasswdChange import Ui_dlgChangePasswd
from msg_dict import g_uiGeometrySize
from dbCtrl.clsUserTb import g_userCtrl
class CPasswdChange(QDialog):
# public:
def __init__(self, userID: str, widgetSize: tuple[int, int]=(375, 293), parent=None):
super().__init__(parent)
self.ui = Ui_dlgChangePasswd()
self.ui.setupUi(self)
# 按需声明对应的成员变量
self.szStack = widgetSize
self.user = userID
pass
# 界面初始化
def uiInit(self) -> None:
self._screenAdapter() # 界面自适应
# self._changeWndStyle() # 设置成无框架边框
self._centerWidget() # 居中显示
self._setCurrentUser() # 设置当前用户
self._setupSignalSlotMapping() # 创建信号映射
pass
# ----------------------------------------
# private:
# 界面自适应
def _screenAdapter(self) -> None:
self.resize(self.szStack[0], self.szStack[1])
# self.ui.widgetPasswdChange.setGeometry(g_uiGeometrySize['WND_MARGIN_HORI'], g_uiGeometrySize['WND_MARGIN_VERT'],
# self.szStack[0] - g_uiGeometrySize['WND_MARGIN_HORI'] * 2,
# self.szStack[1] - g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
pass
# 修改窗体属性
def _changeWndStyle(self) -> None:
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
pass
# 窗口居中显示
def _centerWidget(self) -> None:
pass
# 设置当前用户
def _setCurrentUser(self) -> None:
self.ui.edtCurrentUser_PasswdChg.setText(self.user)
pass
def _setNewPasswd(self) -> None:
# 获取输入的密码
origin_passwd = self.ui.edtOrigin_PasswdChg.text() # 原密码
new_passwd = self.ui.edtNew_PasswdChg.text() # 新密码
confirm_passwd = self.ui.edtConf_PasswdChg.text() # 确认密码
# 验证输入
if not origin_passwd or not new_passwd or not confirm_passwd:
QMessageBox.warning(self, "提示", "请填写完整密码信息")
return
# 验证原密码是否正确
current_user = self.user
stored_passwd = g_userCtrl.getPasswdByUserID(current_user)
if origin_passwd != stored_passwd:
QMessageBox.warning(self, "提示", "原密码错误")
return
# 验证新密码和确认密码是否一致
if new_passwd != confirm_passwd:
QMessageBox.warning(self, "提示", "新密码和确认密码不一致")
return
# 更新密码
success = g_userCtrl.changePasswd(current_user, new_passwd)
if success:
QMessageBox.information(self, "提示", "密码修改成功")
return True
else:
QMessageBox.warning(self, "提示", "密码修改失败")
return False
# 建立信号槽连接
def _setupSignalSlotMapping(self) -> None:
self.ui.btnDecide_PasswdChg.clicked.connect(self._confChangePasswd)
# ----------------信号槽接口----------------
@Slot()
def _confChangePasswd(self) -> None:
success = self._setNewPasswd()
# 仅在密码修改成功时关闭窗口
if success:
self.close()
pass

View File

@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiPasswdChange.ui'
##
## Created by: Qt User Interface Compiler version 6.9.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QLabel, QLineEdit, QPushButton,
QSizePolicy, QWidget)
class Ui_dlgChangePasswd(object):
def setupUi(self, dlgChangePasswd):
if not dlgChangePasswd.objectName():
dlgChangePasswd.setObjectName(u"dlgChangePasswd")
dlgChangePasswd.resize(375, 293)
self.btnDecide_PasswdChg = QPushButton(dlgChangePasswd)
self.btnDecide_PasswdChg.setObjectName(u"btnDecide_PasswdChg")
self.btnDecide_PasswdChg.setGeometry(QRect(170, 220, 100, 41))
self.btnDecide_PasswdChg.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.edtOrigin_PasswdChg = QLineEdit(dlgChangePasswd)
self.edtOrigin_PasswdChg.setObjectName(u"edtOrigin_PasswdChg")
self.edtOrigin_PasswdChg.setGeometry(QRect(131, 79, 200, 21))
self.edtOrigin_PasswdChg.setMaxLength(30)
self.edtOrigin_PasswdChg.setEchoMode(QLineEdit.EchoMode.Password)
self.edtConf_PasswdChg = QLineEdit(dlgChangePasswd)
self.edtConf_PasswdChg.setObjectName(u"edtConf_PasswdChg")
self.edtConf_PasswdChg.setGeometry(QRect(131, 178, 200, 21))
self.edtConf_PasswdChg.setMaxLength(30)
self.edtConf_PasswdChg.setEchoMode(QLineEdit.EchoMode.Password)
self.lblConf_PasswdChg = QLabel(dlgChangePasswd)
self.lblConf_PasswdChg.setObjectName(u"lblConf_PasswdChg")
self.lblConf_PasswdChg.setGeometry(QRect(50, 180, 60, 16))
self.lblCurrentUser_PasswdChg = QLabel(dlgChangePasswd)
self.lblCurrentUser_PasswdChg.setObjectName(u"lblCurrentUser_PasswdChg")
self.lblCurrentUser_PasswdChg.setGeometry(QRect(50, 35, 60, 16))
self.edtNew_PasswdChg = QLineEdit(dlgChangePasswd)
self.edtNew_PasswdChg.setObjectName(u"edtNew_PasswdChg")
self.edtNew_PasswdChg.setGeometry(QRect(131, 128, 200, 21))
self.edtNew_PasswdChg.setMaxLength(30)
self.edtNew_PasswdChg.setEchoMode(QLineEdit.EchoMode.Password)
self.edtCurrentUser_PasswdChg = QLineEdit(dlgChangePasswd)
self.edtCurrentUser_PasswdChg.setObjectName(u"edtCurrentUser_PasswdChg")
self.edtCurrentUser_PasswdChg.setEnabled(False)
self.edtCurrentUser_PasswdChg.setGeometry(QRect(131, 33, 200, 21))
self.edtCurrentUser_PasswdChg.setMaxLength(30)
self.edtCurrentUser_PasswdChg.setReadOnly(True)
self.lblNew_PasswdChg = QLabel(dlgChangePasswd)
self.lblNew_PasswdChg.setObjectName(u"lblNew_PasswdChg")
self.lblNew_PasswdChg.setGeometry(QRect(62, 131, 51, 16))
self.lblOrigin_PasswdChg = QLabel(dlgChangePasswd)
self.lblOrigin_PasswdChg.setObjectName(u"lblOrigin_PasswdChg")
self.lblOrigin_PasswdChg.setGeometry(QRect(62, 82, 51, 16))
self.retranslateUi(dlgChangePasswd)
QMetaObject.connectSlotsByName(dlgChangePasswd)
# setupUi
def retranslateUi(self, dlgChangePasswd):
dlgChangePasswd.setWindowTitle(QCoreApplication.translate("dlgChangePasswd", u"\u767b\u5f55\u5bc6\u7801\u4fee\u6539", None))
self.btnDecide_PasswdChg.setText(QCoreApplication.translate("dlgChangePasswd", u"\u786e \u5b9a", None))
self.lblConf_PasswdChg.setText(QCoreApplication.translate("dlgChangePasswd", u"\u5bc6\u7801\u786e\u8ba4\uff1a", None))
self.lblCurrentUser_PasswdChg.setText(QCoreApplication.translate("dlgChangePasswd", u"\u5f53\u524d\u7528\u6237\uff1a", None))
self.lblNew_PasswdChg.setText(QCoreApplication.translate("dlgChangePasswd", u"\u65b0\u5bc6\u7801\uff1a", None))
self.lblOrigin_PasswdChg.setText(QCoreApplication.translate("dlgChangePasswd", u"\u539f\u5bc6\u7801\uff1a", None))
# retranslateUi

View File

@ -0,0 +1,212 @@
# 配方管理内嵌页面子类
from PySide6.QtWidgets import QWidget, QHeaderView, QSpacerItem, QSizePolicy, QVBoxLayout, QMessageBox, QTableWidgetItem
from PySide6.QtCore import Qt, QObject, QEvent, Slot
from PySide6.QtGui import QKeyEvent
from msg_dict import g_uiGeometrySize
from wndMain.pageRecipeMgt.uiSub_Recipe import Ui_pageRecipe
from common.generalFunc import CCommon
from dbCtrl.clsRecipeTb import g_recipeCtrl
from msg_dict import g_uiCtrlScript
class CSubPageRecipe(QWidget):
# public:
def __init__(self, userId: str, widgetSize: tuple[int, int], parent=None):
super().__init__(parent)
self.creator = userId
self.ui = Ui_pageRecipe()
self.ui.setupUi(self)
# 按需声明对应的成员变量
self.szStack = widgetSize
pass
# 界面初始化
def uiInit(self) -> None:
self._screenAdapter() # 界面自适应
self._changeWndStyle() # 设置成无框架边框
self._centerWidget() # 居中显示
self._changeLine_edit() # 设置用户输入限制
self._setupSignalSlotMapping() # 创建信号映射 先创建信号映射,再加载配方数据
self._loadRecipeData() # 加载配方数据
self._changeTableStyle() # 设置表格样式
pass
# ----------------------------------------
# private:
# 配方操作按钮布局
def _adjustRecipeOpButtons(self) -> None:
nOriginWidth = self.ui.btnAddRecipe.width()
nWidthGap = (self.ui.grpRecipeOp.width() - self.ui.btnAddRecipe.width() * 3 - g_uiGeometrySize['WND_MARGIN_HORI'] * 8) / 2
rctTemp = [self.ui.btnAddRecipe.geometry(), self.ui.btnDelRecipe.geometry(), self.ui.btnUpdateRecipe.geometry()]
rctTemp[0].setLeft(g_uiGeometrySize['WND_MARGIN_HORI'] * 4)
rctTemp[0].setWidth(nOriginWidth)
self.ui.btnAddRecipe.setGeometry(rctTemp[0])
# ------------------------------
rctTemp[1].setLeft(rctTemp[0].right() + nWidthGap)
rctTemp[1].setWidth(nOriginWidth)
self.ui.btnDelRecipe.setGeometry(rctTemp[1])
# ------------------------------
rctTemp[2].setLeft(rctTemp[1].right() + nWidthGap)
rctTemp[2].setWidth(nOriginWidth)
self.ui.btnUpdateRecipe.setGeometry(rctTemp[2])
# 纵向调整子控件高度
def _adjustVerticalHeight(self) -> None:
nBottomPos = self.geometry().bottom() - g_uiGeometrySize['WND_MARGIN_VERT'] # 获取该子页面底部位置
rctTemp = self.ui.tableRecipe.geometry()
rctTemp.setBottom(nBottomPos)
self.ui.tableRecipe.setGeometry(rctTemp) # 调整配方信息列表的高度
# ----------------------------
rctTemp = self.ui.grpRecipeDetails.geometry()
rctTemp.setBottom(nBottomPos)
self.ui.grpRecipeDetails.setGeometry(rctTemp) # 调整配方详细组合框高度
# ----------------------------
rctOtherTemp = self.ui.lstRecipeDetail.geometry()
rctOtherTemp.setHeight(rctTemp.height() - rctOtherTemp.top() - g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
self.ui.lstRecipeDetail.setGeometry(rctOtherTemp)
def _adjustTableWidth(self) -> None:
# 获取表格水平表头
header = self.ui.tableRecipe.horizontalHeader()
# 第一、二、三列设置最小宽度
self.ui.tableRecipe.setColumnWidth(0, 70)
self.ui.tableRecipe.setColumnWidth(1, 150)
self.ui.tableRecipe.setColumnWidth(2, 150)
# 其他列自适应
header.setSectionResizeMode(0, QHeaderView.Interactive)
header.setSectionResizeMode(1, QHeaderView.Interactive)
header.setSectionResizeMode(2, QHeaderView.Interactive)
header.setSectionResizeMode(3, QHeaderView.ResizeToContents)
pass
# 界面自适应
def _screenAdapter(self) -> None:
self.resize(self.szStack[0], self.szStack[1])
self._adjustRecipeOpButtons()
self._adjustVerticalHeight()
self._adjustTableWidth()
pass
# 修改窗体属性
def _changeWndStyle(self) -> None:
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
pass
# 修改表格样式
def _changeTableStyle(self) -> None:
# 禁止所有列宽拖动
self.ui.tableRecipe.horizontalHeader().setSectionResizeMode(QHeaderView.Fixed)
# 单元格内容居中
for row in range(self.ui.tableRecipe.rowCount()):
for col in range(self.ui.tableRecipe.columnCount()):
item = self.ui.tableRecipe.item(row, col)
if item:
item.setTextAlignment(Qt.AlignCenter)
# 窗口居中显示
def _centerWidget(self) -> None:
pass
# 设置用户输入限制
def _changeLine_edit(self) -> None:
self.ui.edtRecipeName.installEventFilter(self) # 建立时间触发
# 添加配方到表格
def _addRecipeToTable(self, recipeID: str, createTime: str, updateTime: str, creator: str) -> None:
rowPosition = self.ui.tableRecipe.rowCount()
self.ui.tableRecipe.insertRow(rowPosition)
self.ui.tableRecipe.setItem(rowPosition, 0, QTableWidgetItem(recipeID))
self.ui.tableRecipe.setItem(rowPosition, 1, QTableWidgetItem(createTime))
self.ui.tableRecipe.setItem(rowPosition, 2, QTableWidgetItem(updateTime))
self.ui.tableRecipe.setItem(rowPosition, 3, QTableWidgetItem(creator))
# 加载配方数据到表格
def _loadRecipeData(self) -> None:
# 清空表格
self.ui.tableRecipe.setRowCount(0)
# 加载配方数据
recipe_list = g_recipeCtrl.readRecipeID_time_creator()
# 填充表格
for recipe_info in recipe_list:
self._addRecipeToTable(recipe_info[0], recipe_info[1], recipe_info[2], recipe_info[3])
# 重新加载表格样式
self._changeTableStyle()
# 建立信号槽连接
def _setupSignalSlotMapping(self) -> None:
self.ui.btnAddRecipe.clicked.connect(self._onAddRecipeClicked)
self.ui.btnDelRecipe.clicked.connect(self._onDelRecipeClicked)
pass
# ---------事件重载---------
def eventFilter(self, obj: QObject, event):
# 处理对应输入框的键盘事件
if obj == self.ui.edtRecipeName and QEvent.Type.KeyPress == event.type():
clsKeyEvent = QKeyEvent(event)
key = clsKeyEvent.key()
modifier = clsKeyEvent.modifiers()
key_char = clsKeyEvent.text()
return super().eventFilter(obj, event) if CCommon.fnCheckInputValid(key, modifier, key_char) else True
# 非输入框/非键盘按下事件,按默认逻辑处理
return super().eventFilter(obj, event)
# ----------------信号槽接口----------------
@Slot()
def _onAddRecipeClicked(self) -> None:
# 获取输入的配方名称
recipe_name = self.ui.edtRecipeName.text().strip()
if not recipe_name:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_INPUT_RECIPE'])
return
# 检查配方名称是否已存在
if recipe_name in g_recipeCtrl.readAllRecipeNames():
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_RECIPE_EXIST'])
return
# 添加配方
success = g_recipeCtrl.addNewRecipe(recipe_name, self.creator)
if success:
self._loadRecipeData()
# 清空输入框
self.ui.edtRecipeName.clear()
QMessageBox.information(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_ADD_RECIPE_SUCCESS'])
else:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_ADD_RECIPE_FAIL'])
pass
pass
@Slot()
def _onDelRecipeClicked(self) -> None:
# 获取选中的行
selected_items = self.ui.tableRecipe.selectedItems()
if not selected_items:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_RECIPE_SELECT'])
return
# 获取选中的配方名
selected_recipes = []
for i in range(0, len(selected_items), 4):
row = selected_items[i].row()
recipe_name = self.ui.tableRecipe.item(row, 0).text()
selected_recipes.append(recipe_name)
# 确认删除
reply = QMessageBox.question(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_RECIPE_CONFIRM'].format(len(selected_recipes)),
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
success = g_recipeCtrl.delRecipe(selected_recipes)
if success:
self._loadRecipeData()
QMessageBox.information(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_RECIPE_SUCCESS'])
else:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_RECIPE_FAIL'])
pass

View File

@ -0,0 +1,104 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiSub_Recipe.ui'
##
## Created by: Qt User Interface Compiler version 6.9.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractItemView, QApplication, QGroupBox, QHeaderView,
QLabel, QLineEdit, QListView, QPushButton,
QSizePolicy, QTableWidget, QTableWidgetItem, QWidget)
class Ui_pageRecipe(object):
def setupUi(self, pageRecipe):
if not pageRecipe.objectName():
pageRecipe.setObjectName(u"pageRecipe")
pageRecipe.resize(1024, 768)
self.grpRecipeOp = QGroupBox(pageRecipe)
self.grpRecipeOp.setObjectName(u"grpRecipeOp")
self.grpRecipeOp.setGeometry(QRect(10, 10, 501, 121))
self.lblRecipeName = QLabel(self.grpRecipeOp)
self.lblRecipeName.setObjectName(u"lblRecipeName")
self.lblRecipeName.setGeometry(QRect(20, 20, 91, 16))
self.edtRecipeName = QLineEdit(self.grpRecipeOp)
self.edtRecipeName.setObjectName(u"edtRecipeName")
self.edtRecipeName.setGeometry(QRect(121, 18, 361, 21))
self.edtRecipeName.setMaxLength(30)
self.btnAddRecipe = QPushButton(self.grpRecipeOp)
self.btnAddRecipe.setObjectName(u"btnAddRecipe")
self.btnAddRecipe.setGeometry(QRect(30, 60, 100, 41))
self.btnAddRecipe.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.btnDelRecipe = QPushButton(self.grpRecipeOp)
self.btnDelRecipe.setObjectName(u"btnDelRecipe")
self.btnDelRecipe.setGeometry(QRect(160, 60, 100, 41))
self.btnDelRecipe.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.btnUpdateRecipe = QPushButton(self.grpRecipeOp)
self.btnUpdateRecipe.setObjectName(u"btnUpdateRecipe")
self.btnUpdateRecipe.setGeometry(QRect(300, 60, 100, 41))
self.btnUpdateRecipe.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.grpRecipeDetails = QGroupBox(pageRecipe)
self.grpRecipeDetails.setObjectName(u"grpRecipeDetails")
self.grpRecipeDetails.setGeometry(QRect(520, 10, 491, 751))
self.lblRecipeDetails = QLabel(self.grpRecipeDetails)
self.lblRecipeDetails.setObjectName(u"lblRecipeDetails")
self.lblRecipeDetails.setGeometry(QRect(20, 20, 91, 16))
self.lstRecipeDetail = QListView(self.grpRecipeDetails)
self.lstRecipeDetail.setObjectName(u"lstRecipeDetail")
self.lstRecipeDetail.setGeometry(QRect(20, 50, 451, 691))
self.tableRecipe = QTableWidget(pageRecipe)
if (self.tableRecipe.columnCount() < 4):
self.tableRecipe.setColumnCount(4)
__qtablewidgetitem = QTableWidgetItem()
self.tableRecipe.setHorizontalHeaderItem(0, __qtablewidgetitem)
__qtablewidgetitem1 = QTableWidgetItem()
self.tableRecipe.setHorizontalHeaderItem(1, __qtablewidgetitem1)
__qtablewidgetitem2 = QTableWidgetItem()
self.tableRecipe.setHorizontalHeaderItem(2, __qtablewidgetitem2)
__qtablewidgetitem3 = QTableWidgetItem()
self.tableRecipe.setHorizontalHeaderItem(3, __qtablewidgetitem3)
self.tableRecipe.setObjectName(u"tableRecipe")
self.tableRecipe.setEnabled(True)
self.tableRecipe.setGeometry(QRect(10, 140, 501, 621))
self.tableRecipe.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.tableRecipe.setSelectionMode(QAbstractItemView.SelectionMode.MultiSelection)
self.tableRecipe.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.tableRecipe.setColumnCount(4)
self.tableRecipe.horizontalHeader().setMinimumSectionSize(22)
self.tableRecipe.horizontalHeader().setStretchLastSection(True)
self.tableRecipe.verticalHeader().setStretchLastSection(False)
self.retranslateUi(pageRecipe)
QMetaObject.connectSlotsByName(pageRecipe)
# setupUi
def retranslateUi(self, pageRecipe):
pageRecipe.setWindowTitle(QCoreApplication.translate("pageRecipe", u"Form", None))
self.grpRecipeOp.setTitle("")
self.lblRecipeName.setText(QCoreApplication.translate("pageRecipe", u"\u65b0\u5efa\u914d\u65b9\u540d\u79f0\uff1a", None))
self.edtRecipeName.setPlaceholderText(QCoreApplication.translate("pageRecipe", u"\u957f\u5ea630\uff0c\u4ec5\u9650\u82f1\u6587\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf", None))
self.btnAddRecipe.setText(QCoreApplication.translate("pageRecipe", u"\u65b0\u5efa\u914d\u65b9", None))
self.btnDelRecipe.setText(QCoreApplication.translate("pageRecipe", u"\u5220\u9664\u914d\u65b9", None))
self.btnUpdateRecipe.setText(QCoreApplication.translate("pageRecipe", u"\u66f4\u65b0\u914d\u65b9", None))
self.grpRecipeDetails.setTitle("")
self.lblRecipeDetails.setText(QCoreApplication.translate("pageRecipe", u"\u914d\u65b9\u8be6\u7ec6\u53c2\u6570\uff1a", None))
___qtablewidgetitem = self.tableRecipe.horizontalHeaderItem(0)
___qtablewidgetitem.setText(QCoreApplication.translate("pageRecipe", u"\u914d\u65b9\u540d\u79f0", None));
___qtablewidgetitem1 = self.tableRecipe.horizontalHeaderItem(1)
___qtablewidgetitem1.setText(QCoreApplication.translate("pageRecipe", u"\u521b\u5efa\u65f6\u95f4", None));
___qtablewidgetitem2 = self.tableRecipe.horizontalHeaderItem(2)
___qtablewidgetitem2.setText(QCoreApplication.translate("pageRecipe", u"\u66f4\u65b0\u65f6\u95f4", None));
___qtablewidgetitem3 = self.tableRecipe.horizontalHeaderItem(3)
___qtablewidgetitem3.setText(QCoreApplication.translate("pageRecipe", u"\u521b\u5efa\u8005", None));
# retranslateUi

View File

@ -0,0 +1,182 @@
# 用户管理内嵌页面子类
from PySide6.QtWidgets import QWidget, QTableWidgetItem, QMessageBox, QHeaderView
from PySide6.QtCore import Qt, QObject, QEvent, Slot
from PySide6.QtGui import QKeyEvent, QHideEvent
from msg_dict import g_uiGeometrySize
from wndMain.pageUserMgt.uiSub_User import Ui_pageUser
from common.generalFunc import CCommon
from dbCtrl.clsUserTb import g_userCtrl
from msg_dict import g_uiCtrlScript
class CSubPageUser(QWidget):
# public:
def __init__(self, widgetSize: tuple[int, int], parent=None):
super().__init__(parent)
self.ui = Ui_pageUser()
self.ui.setupUi(self)
# 按需声明对应的成员变量
self.szStack = widgetSize
pass
# 界面初始化
def uiInit(self) -> None:
self._screenAdapter() # 界面自适应
self._changeWndStyle() # 设置成无框架边框
self._centerWidget() # 居中显示
self._changeLine_edit() # 设置用户输入限制
self._setupSignalSlotMapping() # 创建信号映射
self._loadUserData() # 加载用户数据
self._changeTableStyle() # 设置表格样式
pass
# ----------------------------------------
# private:
# 纵向调整子控件高度
def _adjustVerticalHeight(self):
nBottomPos = self.geometry().bottom() - g_uiGeometrySize['WND_MARGIN_VERT']
rctTemp = self.ui.grpUserlist.geometry()
rctTemp.setBottom(nBottomPos)
self.ui.grpUserlist.setGeometry(rctTemp)
# --------------------------------------
rctOtherTemp = self.ui.tabUserInfo.geometry()
rctOtherTemp.setHeight(rctTemp.height() - rctOtherTemp.top() - g_uiGeometrySize['WND_MARGIN_VERT'] * 3)
self.ui.tabUserInfo.setGeometry(rctOtherTemp)
# 界面自适应
def _screenAdapter(self) -> None:
self.resize(self.szStack[0], self.szStack[1])
self._adjustVerticalHeight()
pass
# 修改窗体属性
def _changeWndStyle(self) -> None:
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
pass
# 修改表格样式
def _changeTableStyle(self) -> None:
# 禁止所有列宽拖动
self.ui.tabUserInfo.horizontalHeader().setSectionResizeMode(QHeaderView.Fixed)
# 单元格内容居中
for row in range(self.ui.tabUserInfo.rowCount()):
for col in range(self.ui.tabUserInfo.columnCount()):
item = self.ui.tabUserInfo.item(row, col)
if item:
item.setTextAlignment(Qt.AlignCenter)
# 窗口居中显示
def _centerWidget(self) -> None:
pass
# 设置用户输入限制
def _changeLine_edit(self) -> None:
self.ui.edtUserName.installEventFilter(self) # 建立时间触发
# 添加用户到表格
def _addUserToTable(self, user_id: str, user_type: int, create_date: str) -> None:
# 插入新行
rowPosition = self.ui.tabUserInfo.rowCount()
self.ui.tabUserInfo.insertRow(rowPosition)
# 设置用户id
self.ui.tabUserInfo.setItem(rowPosition, 0, QTableWidgetItem(user_id))
# 设置用户类别
self.ui.tabUserInfo.setItem(rowPosition, 1, QTableWidgetItem(user_type))
# 设置创建日期
self.ui.tabUserInfo.setItem(rowPosition, 2, QTableWidgetItem(create_date))
pass
# 加载用户数据到表格
def _loadUserData(self) -> None:
# 清空表格
self.ui.tabUserInfo.setRowCount(0)
# 获取所有用户信息
user_list = g_userCtrl.readUserId_type_date()
# 填充表格
for user_info in user_list:
self._addUserToTable(user_info[0], user_info[1], user_info[2])
# 重新加载表格样式
self._changeTableStyle()
pass
# 建立信号槽连接
def _setupSignalSlotMapping(self) -> None:
self.ui.btnAdd.clicked.connect(self._onAddUserClicked)
self.ui.btnDel.clicked.connect(self._onDeleteUserClicked)
pass
# ---------事件重载---------
def eventFilter(self, obj: QObject, event):
# 处理对应输入框的键盘事件
if obj == self.ui.edtUserName and QEvent.Type.KeyPress == event.type():
clsKeyEvent = QKeyEvent(event)
key = clsKeyEvent.key()
modifier = clsKeyEvent.modifiers()
key_char = clsKeyEvent.text()
return super().eventFilter(obj, event) if CCommon.fnCheckInputValid(key, modifier, key_char) else True
# 非输入框/非键盘按下事件,按默认逻辑处理
return super().eventFilter(obj, event)
# ----------------信号槽接口----------------
@Slot()
def _onAddUserClicked(self) -> None:
# 获取输入的用户名
user_name = self.ui.edtUserName.text().strip()
if not user_name:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_INPUT_USER'])
return
# 检查用户名是否已存在
if user_name in g_userCtrl.readAllUserIDs():
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_USER_EXIST'])
return
# 获取用户类型
user_type = 1 if self.ui.rdoTech.isChecked() else 2
# 添加用户
success = g_userCtrl.addNewUser(user_name, user_type)
if success:
self._loadUserData()
# 清空输入框
self.ui.edtUserName.clear()
QMessageBox.information(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_ADD_USER_SUCCESS'])
else:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_USER_FAIL'])
pass
@Slot()
def _onDeleteUserClicked(self) -> None:
# 获取选中的行
selected_items = self.ui.tabUserInfo.selectedItems()
if not selected_items:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_USER_SELECT'])
return
# 获取选中的用户名
selected_users = []
for i in range(0, len(selected_items), 3):
row = selected_items[i].row()
user_name = self.ui.tabUserInfo.item(row, 0).text()
selected_users.append(user_name)
# 确认删除
reply = QMessageBox.question(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_USER_CONFIRM'].format(len(selected_users)),
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes:
success = g_userCtrl.delUser(selected_users)
if success:
self._loadUserData()
QMessageBox.information(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_USER_SUCCESS'])
else:
QMessageBox.warning(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_DEL_USER_FAIL'])
pass

View File

@ -0,0 +1,111 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiSub_User.ui'
##
## Created by: Qt User Interface Compiler version 6.9.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractItemView, QApplication, QGroupBox, QHeaderView,
QLabel, QLineEdit, QPushButton, QRadioButton,
QSizePolicy, QTableWidget, QTableWidgetItem, QWidget)
class Ui_pageUser(object):
def setupUi(self, pageUser):
if not pageUser.objectName():
pageUser.setObjectName(u"pageUser")
pageUser.setEnabled(True)
pageUser.resize(856, 493)
self.grpUserInfo = QGroupBox(pageUser)
self.grpUserInfo.setObjectName(u"grpUserInfo")
self.grpUserInfo.setGeometry(QRect(10, 10, 341, 101))
self.lblUserName = QLabel(self.grpUserInfo)
self.lblUserName.setObjectName(u"lblUserName")
self.lblUserName.setGeometry(QRect(20, 19, 81, 16))
self.edtUserName = QLineEdit(self.grpUserInfo)
self.edtUserName.setObjectName(u"edtUserName")
self.edtUserName.setGeometry(QRect(118, 16, 201, 21))
self.edtUserName.setMaxLength(30)
self.lblUserType = QLabel(self.grpUserInfo)
self.lblUserType.setObjectName(u"lblUserType")
self.lblUserType.setGeometry(QRect(20, 60, 91, 16))
self.rdoTech = QRadioButton(self.grpUserInfo)
self.rdoTech.setObjectName(u"rdoTech")
self.rdoTech.setGeometry(QRect(134, 59, 61, 20))
self.rdoTech.setChecked(True)
self.rdoOperator = QRadioButton(self.grpUserInfo)
self.rdoOperator.setObjectName(u"rdoOperator")
self.rdoOperator.setGeometry(QRect(214, 59, 61, 20))
self.grpUserOp = QGroupBox(pageUser)
self.grpUserOp.setObjectName(u"grpUserOp")
self.grpUserOp.setGeometry(QRect(10, 120, 341, 71))
self.btnAdd = QPushButton(self.grpUserOp)
self.btnAdd.setObjectName(u"btnAdd")
self.btnAdd.setGeometry(QRect(40, 20, 100, 41))
self.btnAdd.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.btnDel = QPushButton(self.grpUserOp)
self.btnDel.setObjectName(u"btnDel")
self.btnDel.setGeometry(QRect(190, 20, 100, 41))
self.btnDel.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.grpUserlist = QGroupBox(pageUser)
self.grpUserlist.setObjectName(u"grpUserlist")
self.grpUserlist.setGeometry(QRect(360, 10, 411, 461))
self.lblUserlist = QLabel(self.grpUserlist)
self.lblUserlist.setObjectName(u"lblUserlist")
self.lblUserlist.setGeometry(QRect(20, 20, 61, 16))
self.tabUserInfo = QTableWidget(self.grpUserlist)
if (self.tabUserInfo.columnCount() < 3):
self.tabUserInfo.setColumnCount(3)
__qtablewidgetitem = QTableWidgetItem()
self.tabUserInfo.setHorizontalHeaderItem(0, __qtablewidgetitem)
__qtablewidgetitem1 = QTableWidgetItem()
self.tabUserInfo.setHorizontalHeaderItem(1, __qtablewidgetitem1)
__qtablewidgetitem2 = QTableWidgetItem()
self.tabUserInfo.setHorizontalHeaderItem(2, __qtablewidgetitem2)
self.tabUserInfo.setObjectName(u"tabUserInfo")
self.tabUserInfo.setEnabled(True)
self.tabUserInfo.setGeometry(QRect(20, 40, 371, 411))
self.tabUserInfo.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.tabUserInfo.setSelectionMode(QAbstractItemView.SelectionMode.MultiSelection)
self.tabUserInfo.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.tabUserInfo.setColumnCount(3)
self.tabUserInfo.horizontalHeader().setVisible(True)
self.tabUserInfo.horizontalHeader().setProperty(u"showSortIndicator", False)
self.tabUserInfo.horizontalHeader().setStretchLastSection(True)
self.tabUserInfo.verticalHeader().setStretchLastSection(False)
self.retranslateUi(pageUser)
QMetaObject.connectSlotsByName(pageUser)
# setupUi
def retranslateUi(self, pageUser):
pageUser.setWindowTitle(QCoreApplication.translate("pageUser", u"Form", None))
self.grpUserInfo.setTitle("")
self.lblUserName.setText(QCoreApplication.translate("pageUser", u"\u65b0\u589e\u7528\u6237\u540d\uff1a", None))
self.edtUserName.setPlaceholderText(QCoreApplication.translate("pageUser", u"\u957f\u5ea630\uff0c\u4ec5\u9650\u82f1\u6587\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf", None))
self.lblUserType.setText(QCoreApplication.translate("pageUser", u"\u65b0\u589e\u7528\u6237\u7c7b\u522b\uff1a", None))
self.rdoTech.setText(QCoreApplication.translate("pageUser", u"\u6280\u672f\u5458", None))
self.rdoOperator.setText(QCoreApplication.translate("pageUser", u"\u64cd\u4f5c\u5458", None))
self.grpUserOp.setTitle("")
self.btnAdd.setText(QCoreApplication.translate("pageUser", u"\u65b0\u589e\u7528\u6237", None))
self.btnDel.setText(QCoreApplication.translate("pageUser", u"\u5220\u9664\u7528\u6237", None))
self.grpUserlist.setTitle("")
self.lblUserlist.setText(QCoreApplication.translate("pageUser", u"\u7528\u6237\u5217\u8868\uff1a", None))
___qtablewidgetitem = self.tabUserInfo.horizontalHeaderItem(0)
___qtablewidgetitem.setText(QCoreApplication.translate("pageUser", u"\u7528\u6237\u540d", None));
___qtablewidgetitem1 = self.tabUserInfo.horizontalHeaderItem(1)
___qtablewidgetitem1.setText(QCoreApplication.translate("pageUser", u"\u7528\u6237\u7c7b\u578b", None));
___qtablewidgetitem2 = self.tabUserInfo.horizontalHeaderItem(2)
___qtablewidgetitem2.setText(QCoreApplication.translate("pageUser", u"\u521b\u5efa\u65f6\u95f4", None));
# retranslateUi

View File

@ -0,0 +1,20 @@
# 该视图类用于更新主界面的状态栏
class CStatusbarView:
# private:
_lblObject = None # 状态栏单元格
_strScript = '' # 状态栏单元格显示文本
# public:
# 更新状态栏指定单元格
@classmethod
def fnRefreshGridScript(cls, obj, txt) -> None:
cls._lblObject = obj
cls._strScript = txt
cls._lblObject.setText(cls._strScript)
# 获取状态栏指定单元格文本
@classmethod
def fnGetGridScript(cls, obj) -> str:
cls._lblObject = obj
cls._strScript = cls._lblObject.text()
return cls._strScript

363
wndMain/sub_uiMain.py Normal file
View File

@ -0,0 +1,363 @@
# 主控界面子类
import time
from PySide6.QtCore import Qt, QRect, QTimer, QPoint, Slot
from PySide6.QtGui import QCloseEvent
from PySide6.QtWidgets import QMainWindow, QStatusBar, QLabel, QVBoxLayout, QMessageBox, QApplication, QDialog
from .pageDataQuery.sub_uiQuery import CSubPageQuery
from .pageDevDebug.sub_uiDevDebug import CSubPageDevDebug
from .pageParaSet.sub_uiParaSet import CSubPageParaSetting
from .pageRecipeMgt.sub_uiRecipe import CSubPageRecipe
from .pageUserMgt.sub_uiUser import CSubPageUser
from .uiMain import Ui_dlgMain
from .pageAutoPage.sub_uiAutoPage import CSubPageAutoProc
from common.generalFunc import CCommon
from common.allTypesEnum import EOSType, ESubPageType
from .statusBarView.vwStatusBar import CStatusbarView
from .funcBarView.vwFunctionBar import CFunctionBarView
from .pagePasswdChange.sub_uiPasswdChange import CPasswdChange
from .pagePasswdChange.uiPasswdChange import Ui_dlgChangePasswd
from wndCtrl.stateCtrl.clsSysState_autoproc import CStateAutoProc
from msg_dict import g_uiCtrlScript, g_uiGeometrySize, g_otherScripts, g_errMsgText
# 根据系统平台类型,调整屏幕尺寸高宽比例
def getSizeRatio(osType: EOSType) -> list:
if EOSType.MACOS == osType:
lstRatio = [1.0, 0.88]
elif EOSType.LINUX == osType:
lstRatio = [0.9, 1.0]
else:
lstRatio = [1.0, 1.0]
return lstRatio
class CSubUiMain(QMainWindow):
_m_nTimeCount = 0 #用作定时器,每秒计数
# public:
def __init__(self, userId: str, userType: str, parent=None):
super().__init__(parent)
# 挂载UI界面将当前业务类实例传入setupUiUI组件成为实例属性
self.ui = Ui_dlgMain()
self.ui.setupUi(self)
# 获取屏幕分辨率
self._m_arrScreen = CCommon.fnGetScreenRate()
# 按需声明对应的成员变量
self._m_status = None # 状态栏对象
self._m_bQuitType = True # 退出方式True完全退出系统 False返回到登录窗口
self._m_currentUser = [userId, userType]
pass
# 界面初始化
def uiInit(self) -> None:
self._createStatusLabels() # 创建状态栏显示标签
self._initStatusBar() # 创建并初始化状态栏
self._screenAdapter() # 界面自适应
# ---------------------------
self._createSubPages((int(self.ui.stkMainContainer.width()), int(self.ui.stkMainContainer.height()))) # 创建功能子页面
self._add2StackWidget() # 添加到容器
self._adjustRdoButtons() # 调整功能框单选按钮布局
# 添加其他和界面或控件初始化相关的操作
self.setWindowTitle(g_uiCtrlScript['WND_TITLE_MAIN']) #设置窗口标题
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True) # 设置当窗口close时确保关闭即销毁窗口
self._changeWndStyle() # 修改窗体属性
# ----------------------------
self._createFuncBarView() # 初始化功能区更新视图
self._updateFuncBar(CStatusbarView.fnGetGridScript(self.lblMainVariableItems[2])) # 根据当前登录用户类别,刷新功能区状态
# ----------------------------
self._createTimer() # 创建定时器
# ---------------------------------------------------------------
self._setupSignalSlotMapping() # 创建信号映射
self.m_timer.start()
pass
# private:
#------------------------------------------------------------------------------------------------------------
# 界面自适应
def _screenAdapter(self) -> None:
fRatio = getSizeRatio(EOSType.MACOS) # 屏幕尺寸高宽调整比例
realSize = (self._m_arrScreen[0] * fRatio[0], self._m_arrScreen[1] * fRatio[1])
self.setFixedSize(int(realSize[0]), int(realSize[1]))
rctGroups = self._adjustGroupBox(realSize) # 调整主界面上面和左侧的组合框
self._adjustButtonAboutUser(rctGroups[2]) # 调整上面最右侧组合框中的按钮布局
self._adjustStackPage(rctGroups[3], rctGroups[2]) #调整右侧窗口容器空间
self._adjustCapacityStatisticsCtrl() # 调整产能统计相关控件的布局
pass
# 组合框自适应
def _adjustGroupBox(self, screenSize: tuple[float, float]) -> list:
nTopGroupBoxHeight = int(screenSize[1] / 8)
# 设置上面第一个组合框大小
rctTemp: list[QRect] = [QRect(), QRect(), QRect(), QRect()]
rctTemp[0].setTop(g_uiGeometrySize['WND_MARGIN_VERT'])
rctTemp[0].setLeft(g_uiGeometrySize['WND_MARGIN_HORI'])
rctTemp[0].setHeight(nTopGroupBoxHeight)
rctTemp[0].setWidth(int(screenSize[0] / 3))
self.ui.grpMainSysInfo_0.setGeometry(rctTemp[0])
# ---------------------------------
# 设置上面第二个组合框大小
rctTemp[1].setTop(g_uiGeometrySize['WND_MARGIN_VERT'])
rctTemp[1].setLeft(rctTemp[0].right() + g_uiGeometrySize['WND_MARGIN_HORI'])
rctTemp[1].setHeight(nTopGroupBoxHeight)
rctTemp[1].setWidth(int(rctTemp[0].width() * 5 / 3))
self.ui.grpMainSysInfo_1.setGeometry(rctTemp[1])
# 设置上面第三个组合框大小
rctTemp[2].setTop(g_uiGeometrySize['WND_MARGIN_VERT'])
rctTemp[2].setLeft(rctTemp[1].right() + g_uiGeometrySize['WND_MARGIN_HORI'])
rctTemp[2].setHeight(nTopGroupBoxHeight)
rctTemp[2].setWidth(screenSize[0] - rctTemp[0].width() - rctTemp[1].width() - g_uiGeometrySize['WND_MARGIN_HORI'] * 3)
self.ui.grpMainForUser.setGeometry(rctTemp[2])
# 设置功能组合框位置大小
rctTemp[3] = self.ui.grpMainModule.geometry()
rctTemp[3].setTop(rctTemp[0].bottom() + g_uiGeometrySize['WND_MARGIN_VERT'])
rctTemp[3].setLeft(rctTemp[0].left())
rctTemp[3].setHeight(screenSize[1] - g_uiGeometrySize['WND_MARGIN_VERT'] * 2 - rctTemp[0].height() - self._m_status.height())
self.ui.grpMainModule.setGeometry(rctTemp[3])
return rctTemp
# 用户切换和修改密码按钮自适应
def _adjustButtonAboutUser(self, rctSize: QRect) -> None:
nBtnHeight: int = (rctSize.height() - g_uiGeometrySize['WND_MARGIN_VERT'] * 6) / 2
nBtnWidth: int = rctSize.width() - g_uiGeometrySize['WND_MARGIN_HORI'] * 4
rctBtn = QRect()
rctBtn.setLeft(g_uiGeometrySize['WND_MARGIN_HORI'] * 2)
rctBtn.setTop(g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
rctBtn.setWidth(nBtnWidth)
rctBtn.setHeight(nBtnHeight)
self.ui.btnMainSwitchUser.setGeometry(rctBtn)
#---------------------------
nTempHeight = rctBtn.height()
rctBtn.setTop(g_uiGeometrySize['WND_MARGIN_VERT'] * 4 + rctBtn.height())
rctBtn.setHeight(nTempHeight)
self.ui.btnMainChangePasswd.setGeometry(rctBtn)
pass
# 子页面堆栈控件自适应
def _adjustStackPage(self, rctFuncGrp: QRect, rctUserGrp: QRect) -> None:
rctStack = self.ui.stkMainContainer.geometry()
rctStack.setLeft(rctFuncGrp.right() + g_uiGeometrySize['WND_MARGIN_HORI'])
rctStack.setTop(rctFuncGrp.top())
rctStack.setHeight(rctFuncGrp.height())
rctStack.setRight(rctUserGrp.right())
self.ui.stkMainContainer.setGeometry(rctStack)
# 功能组合框,单选按钮自适应排列
def _adjustRdoButtons(self) -> None:
layVert = QVBoxLayout()
layVert.addWidget(self.ui.rdbMainAutoProc, alignment=Qt.AlignmentFlag.AlignHCenter)
layVert.addWidget(self.ui.rdbMainDebug, alignment=Qt.AlignmentFlag.AlignHCenter)
layVert.addWidget(self.ui.rdbMainSetting, alignment=Qt.AlignmentFlag.AlignHCenter)
layVert.addWidget(self.ui.rdbMainQuery, alignment=Qt.AlignmentFlag.AlignHCenter)
layVert.addWidget(self.ui.rdbMainRecipe, alignment=Qt.AlignmentFlag.AlignHCenter)
layVert.addWidget(self.ui.rdbMainUser, alignment=Qt.AlignmentFlag.AlignHCenter)
# 计算组合框内radiobutton之间的垂直间距
grpHeight = self.ui.grpMainModule.geometry().height()
nHeightGap = (grpHeight - g_uiGeometrySize['WND_MARGIN_VERT'] * 4 -
self.ui.rdbMainDebug.height() * 6) / 5
layVert.setSpacing(nHeightGap)
layVert.setContentsMargins(g_uiGeometrySize['WND_MARGIN_HORI'] * 2,
g_uiGeometrySize['WND_MARGIN_VERT'] * 2,
g_uiGeometrySize['WND_MARGIN_HORI'] * 2,
g_uiGeometrySize['WND_MARGIN_VERT'] * 2)
self.ui.grpMainModule.setLayout(layVert)
# 产能统计控件布局排列
def _adjustCapacityStatisticsCtrl(self) -> None:
nSizeArr = (self.ui.grpMainSysInfo_0.geometry().width(), self.ui.grpMainSysInfo_0.geometry().height())
# 计算控件之间的排列间隔宽度
nGapWidth = (nSizeArr[0] - g_uiGeometrySize['WND_MARGIN_VERT'] * 7 - self.ui.lblMainWoodTotal.width()
- self.ui.lblMainWoodNG.width() - self.ui.lblMainPassRate.width() - self.ui.edtMainWoodNG.width() * 3) / 2
# 根据组合框的宽高,布局内部控件
ptPosition = [QPoint(), QPoint(),] # 0: 给label 1给editbox
ptPosition[0].setY(nSizeArr[1] / 2 - g_uiGeometrySize['WND_MARGIN_VERT']) # 设置第一个label的高度位置
ptPosition[0].setX(g_uiGeometrySize['WND_MARGIN_HORI'] * 2) # 设置第一个label的水平位置
nTempCtrlSize = [self.ui.lblMainWoodTotal.width(), self.ui.lblMainWoodTotal.height(),] # 临时存储控件的宽高
self.ui.lblMainWoodTotal.setGeometry(ptPosition[0].x(), ptPosition[0].y(), nTempCtrlSize[0], nTempCtrlSize[1])
# -----------------------------------------------------------
rctTemp = self.ui.lblMainWoodTotal.geometry()
nLabelTop = rctTemp.top()
ptPosition[1].setX(rctTemp.right() + g_uiGeometrySize['WND_MARGIN_HORI'])
ptPosition[1].setY(rctTemp.top() - g_uiGeometrySize['WND_MARGIN_VERT'] / 2)
nTempWidth = self.ui.edtMainWoodTotal.width()
nTempHeight = self.ui.edtMainWoodTotal.height()
self.ui.edtMainWoodTotal.setGeometry(ptPosition[1].x(), ptPosition[1].y(), nTempWidth, nTempHeight)
# -----------------------------------------------------------
rctTemp = self.ui.edtMainWoodTotal.geometry()
nEditTop = rctTemp.top()
ptPosition[0].setX(rctTemp.right() + nGapWidth)
ptPosition[0].setY(nLabelTop)
nTempCtrlSize[0] = self.ui.lblMainWoodNG.width()
nTempCtrlSize[1] = self.ui.lblMainWoodNG.height()
self.ui.lblMainWoodNG.setGeometry(ptPosition[0].x(), ptPosition[0].y(), nTempCtrlSize[0], nTempCtrlSize[1])
# -----------------------------------------------------------
rctTemp = self.ui.lblMainWoodNG.geometry()
ptPosition[1].setX(rctTemp.right() + g_uiGeometrySize['WND_MARGIN_HORI'])
ptPosition[1].setY(nEditTop)
self.ui.edtMainWoodNG.setGeometry(ptPosition[1].x(), ptPosition[1].y(), nTempWidth, nTempHeight)
# -----------------------------------------------------------
rctTemp = self.ui.edtMainWoodNG.geometry()
ptPosition[0].setX(rctTemp.right() + nGapWidth)
nTempCtrlSize[0] = self.ui.lblMainPassRate.width()
nTempCtrlSize[1] = self.ui.lblMainPassRate.height()
self.ui.lblMainPassRate.setGeometry(ptPosition[0].x(), ptPosition[0].y(), nTempCtrlSize[0], nTempCtrlSize[1])
# -----------------------------------------------------------
rctTemp = self.ui.lblMainPassRate.geometry()
ptPosition[1].setX(rctTemp.right() + g_uiGeometrySize['WND_MARGIN_HORI'])
self.ui.edtMainPassRate.setGeometry(ptPosition[1].x(), ptPosition[1].y(), nTempWidth, nTempHeight)
pass
#------------------------------------------------------------------------------------------------------------
# 创建子页面实体
def _createSubPages(self, szStack: tuple[int, int]) -> None:
# 在此处添加每个子页面
self.m_subPages = (CSubPageAutoProc(szStack, self), CSubPageDevDebug(szStack, self),
CSubPageParaSetting(szStack, self), CSubPageQuery(szStack, self),
CSubPageRecipe(self._m_currentUser[0], szStack, self), CSubPageUser(szStack, self))
for item in self.m_subPages:
item.uiInit()
# 将子页面添加到堆栈控件中
def _add2StackWidget(self):
for item in self.m_subPages:
self.ui.stkMainContainer.addWidget(item)
self.ui.stkMainContainer.setCurrentWidget(self.m_subPages[0])
#------------------------------------------------------------------------------------------------------------
# 修改窗体属性
def _changeWndStyle(self):
self.setWindowFlags(Qt.WindowType.Dialog | Qt.WindowType.CustomizeWindowHint |
Qt.WindowType.WindowTitleHint | Qt.WindowType.WindowCloseButtonHint |
Qt.WindowType.WindowMinimizeButtonHint)
pass
# 创建状态栏
def _initStatusBar(self):
self._m_status = QStatusBar(self)
self._m_status.setSizeGripEnabled(True)
self.setStatusBar(self._m_status)
# 添加标签到状态栏,用分隔符区分
nScan: int = 0
while 4 > nScan:
self._m_status.addWidget(self.lblMainConstStatusItems[nScan])
self._m_status.addWidget(self.lblMainVariableItems[nScan])
self._m_status.addWidget(QLabel(g_otherScripts['OTHER_SEPARATOR']))
nScan += 1
else:
self._m_status.addWidget(self.lblMainConstStatusItems[4])
self._m_status.addWidget(self.lblMainVariableItems[4])
# 更新状态栏中的当前登录用户和用户类别
CStatusbarView.fnRefreshGridScript(self.lblMainVariableItems[1], self._m_currentUser[0])
CStatusbarView.fnRefreshGridScript(self.lblMainVariableItems[2], self._m_currentUser[1])
# 更新当前作业状态
CStatusbarView.fnRefreshGridScript(self.lblMainVariableItems[3], g_otherScripts['OTHER_PROC_STATE_0'])
pass
# 创建状态显示标签
def _createStatusLabels(self) -> None:
self.lblMainConstStatusItems = (QLabel(g_uiCtrlScript['WND_STATUSBAR_0']), QLabel(g_uiCtrlScript['WND_STATUSBAR_1']), QLabel(g_uiCtrlScript['WND_STATUSBAR_2']), QLabel(g_uiCtrlScript['WND_STATUSBAR_3']), QLabel(g_uiCtrlScript['WND_STATUSBAR_4']))
self.lblMainVariableItems = [QLabel(''), QLabel(''), QLabel(''), QLabel(''), QLabel('')]
# --------------------------------------------
# 创建主界面功能区视图类
def _createFuncBarView(self) -> None:
lstRdoButtons: list = [self.ui.rdbMainAutoProc, self.ui.rdbMainDebug, self.ui.rdbMainSetting, self.ui.rdbMainQuery,
self.ui.rdbMainRecipe, self.ui.rdbMainUser]
self._m_vwUpdatingFuncBar = CFunctionBarView(lstRdoButtons) # 声明功能区视图
# 更新功能区控件状态
def _updateFuncBar(self, userType: str) -> None:
self._m_vwUpdatingFuncBar.setCtrlsEnabled(userType)
if userType == g_uiCtrlScript['CTRL_USER_TYPE_ADMIN']:
self.ui.rdbMainQuery.setChecked(True)
self._setPageVisibleProperty(ESubPageType.DATAQUERY.value[0])
# --------------------------------------------
# 创建定时器
def _createTimer(self) -> None:
self.m_timer = QTimer(self)
self.m_timer.setTimerType(Qt.TimerType.PreciseTimer)
self.m_timer.setInterval(100)
#--------------------------------------------
# 内嵌页面跳转处理
def _setPageVisibleProperty(self, pageType: int) -> None:
self.ui.stkMainContainer.setCurrentWidget(self.m_subPages[pageType])
# 建立信号槽连接
def _setupSignalSlotMapping(self) -> None:
self.m_timer.timeout.connect(self._onTimer) # 定时器信号
self.ui.rdbMainAutoProc.toggled.connect(self._onClickRdoButton)
self.ui.rdbMainDebug.toggled.connect(self._onClickRdoButton)
self.ui.rdbMainSetting.toggled.connect(self._onClickRdoButton)
self.ui.rdbMainQuery.toggled.connect(self._onClickRdoButton)
self.ui.rdbMainRecipe.toggled.connect(self._onClickRdoButton)
self.ui.rdbMainUser.toggled.connect(self._onClickRdoButton)
self.ui.btnMainSwitchUser.clicked.connect(self._onClickBtnSwitchUser)
self.ui.btnMainChangePasswd.clicked.connect(self._onClickBtnChangePasswd)
pass
# 主界面退出流程
def _quitMainWndProc(self, bQuitType: bool) -> None:
# 先获取登录窗口引用
dlgParent = self.parentWidget()
# 销毁主窗口,显示登录窗口
self.m_timer.stop() # 停止计时器
time.sleep(0.03) # 等待其他操作执行结束
self.close()
# 显示之前的登录窗口
if bQuitType:
QApplication.instance().quit()
else:
dlgParent.show()
# ----------------事件重载----------------
def closeEvent(self, event: QCloseEvent) -> None:
if CStateAutoProc.getProcState():
QMessageBox.information(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_errMsgText['ERR_AUTOPROC_BUSY'])
event.ignore()
else:
reply = QMessageBox.question(self, g_uiCtrlScript['MSG_TITLE_TIPS'], g_uiCtrlScript['MSG_SCRIPT_CONFIRM'],
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No, QMessageBox.StandardButton.No)
if reply == QMessageBox.StandardButton.Yes:
self._quitMainWndProc(self._m_bQuitType)
event.accept()
else: event.ignore()
# ----------------信号槽接口----------------
@Slot()
def _onTimer(self):
# 定时器响应消息
if 10 == CSubUiMain._m_nTimeCount:
self.lblMainVariableItems[0].setText(CCommon.fnGetCurrentTime())
CSubUiMain._m_nTimeCount = 0
CSubUiMain._m_nTimeCount += 1
# 读取io状态
# g_warnState.setIOReadingException(g_emv.readIO(), g_emv.getIOErrMessage()) # 将反馈结果同步到报警器
@Slot()
def _onClickRdoButton(self):
# 单选按钮关联信号接口
selRdo = self.sender()
strName: str = selRdo.objectName()
if 'rdbMainAutoProc' == strName and self.ui.rdbMainAutoProc.isChecked():
self._setPageVisibleProperty(ESubPageType.AUTOPROC.value[0])
elif 'rdbMainDebug' == strName and self.ui.rdbMainDebug.isChecked():
self._setPageVisibleProperty(ESubPageType.DEVDEBUG.value[0])
elif 'rdbMainSetting' == strName and self.ui.rdbMainSetting.isChecked():
self._setPageVisibleProperty(ESubPageType.PARASETTING.value[0])
elif 'rdbMainQuery' == strName and self.ui.rdbMainQuery.isChecked():
self._setPageVisibleProperty(ESubPageType.DATAQUERY.value[0])
elif 'rdbMainRecipe' == strName and self.ui.rdbMainRecipe.isChecked():
self._setPageVisibleProperty(ESubPageType.RECIPEMANAGE.value[0])
elif 'rdbMainUser' == strName and self.ui.rdbMainUser.isChecked():
self._setPageVisibleProperty(ESubPageType.USERMANAGE.value[0])
@Slot()
def _onClickBtnSwitchUser(self):
self._m_bQuitType = False
self.close()
pass
@Slot()
def _onClickBtnChangePasswd(self):
passwd_dlg = CPasswdChange(self._m_currentUser[0], parent=self)
passwd_dlg.uiInit()
passwd_dlg.exec()
pass

130
wndMain/uiMain.py Normal file
View File

@ -0,0 +1,130 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'uiMain.ui'
##
## Created by: Qt User Interface Compiler version 6.9.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QGroupBox, QLabel, QLineEdit,
QPushButton, QRadioButton, QSizePolicy, QStackedWidget,
QWidget)
class Ui_dlgMain(object):
def setupUi(self, dlgMain):
if not dlgMain.objectName():
dlgMain.setObjectName(u"dlgMain")
dlgMain.resize(1024, 768)
self.grpMainSysInfo_0 = QGroupBox(dlgMain)
self.grpMainSysInfo_0.setObjectName(u"grpMainSysInfo_0")
self.grpMainSysInfo_0.setGeometry(QRect(10, 10, 400, 140))
self.lblMainWoodTotal = QLabel(self.grpMainSysInfo_0)
self.lblMainWoodTotal.setObjectName(u"lblMainWoodTotal")
self.lblMainWoodTotal.setGeometry(QRect(20, 40, 31, 16))
self.edtMainWoodTotal = QLineEdit(self.grpMainSysInfo_0)
self.edtMainWoodTotal.setObjectName(u"edtMainWoodTotal")
self.edtMainWoodTotal.setGeometry(QRect(69, 37, 60, 21))
self.edtMainWoodTotal.setMaxLength(5)
self.edtMainWoodTotal.setEchoMode(QLineEdit.EchoMode.Normal)
self.edtMainWoodTotal.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.edtMainWoodTotal.setReadOnly(True)
self.lblMainWoodNG = QLabel(self.grpMainSysInfo_0)
self.lblMainWoodNG.setObjectName(u"lblMainWoodNG")
self.lblMainWoodNG.setGeometry(QRect(190, 40, 41, 16))
self.edtMainWoodNG = QLineEdit(self.grpMainSysInfo_0)
self.edtMainWoodNG.setObjectName(u"edtMainWoodNG")
self.edtMainWoodNG.setGeometry(QRect(250, 40, 60, 21))
self.edtMainWoodNG.setMaxLength(3)
self.edtMainWoodNG.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.edtMainWoodNG.setReadOnly(True)
self.lblMainPassRate = QLabel(self.grpMainSysInfo_0)
self.lblMainPassRate.setObjectName(u"lblMainPassRate")
self.lblMainPassRate.setGeometry(QRect(30, 90, 51, 16))
self.edtMainPassRate = QLineEdit(self.grpMainSysInfo_0)
self.edtMainPassRate.setObjectName(u"edtMainPassRate")
self.edtMainPassRate.setGeometry(QRect(100, 90, 60, 21))
self.edtMainPassRate.setMaxLength(5)
self.edtMainPassRate.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.edtMainPassRate.setReadOnly(True)
self.grpMainSysInfo_1 = QGroupBox(dlgMain)
self.grpMainSysInfo_1.setObjectName(u"grpMainSysInfo_1")
self.grpMainSysInfo_1.setGeometry(QRect(419, 10, 440, 140))
self.grpMainForUser = QGroupBox(dlgMain)
self.grpMainForUser.setObjectName(u"grpMainForUser")
self.grpMainForUser.setGeometry(QRect(870, 10, 140, 140))
self.btnMainSwitchUser = QPushButton(self.grpMainForUser)
self.btnMainSwitchUser.setObjectName(u"btnMainSwitchUser")
self.btnMainSwitchUser.setGeometry(QRect(30, 20, 95, 25))
self.btnMainSwitchUser.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.btnMainChangePasswd = QPushButton(self.grpMainForUser)
self.btnMainChangePasswd.setObjectName(u"btnMainChangePasswd")
self.btnMainChangePasswd.setGeometry(QRect(30, 70, 95, 25))
self.btnMainChangePasswd.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.grpMainModule = QGroupBox(dlgMain)
self.grpMainModule.setObjectName(u"grpMainModule")
self.grpMainModule.setGeometry(QRect(10, 159, 131, 580))
self.rdbMainAutoProc = QRadioButton(self.grpMainModule)
self.rdbMainAutoProc.setObjectName(u"rdbMainAutoProc")
self.rdbMainAutoProc.setGeometry(QRect(20, 20, 90, 24))
self.rdbMainAutoProc.setChecked(True)
self.rdbMainDebug = QRadioButton(self.grpMainModule)
self.rdbMainDebug.setObjectName(u"rdbMainDebug")
self.rdbMainDebug.setGeometry(QRect(20, 100, 90, 24))
self.rdbMainSetting = QRadioButton(self.grpMainModule)
self.rdbMainSetting.setObjectName(u"rdbMainSetting")
self.rdbMainSetting.setGeometry(QRect(20, 180, 90, 24))
self.rdbMainQuery = QRadioButton(self.grpMainModule)
self.rdbMainQuery.setObjectName(u"rdbMainQuery")
self.rdbMainQuery.setGeometry(QRect(20, 250, 90, 24))
self.rdbMainRecipe = QRadioButton(self.grpMainModule)
self.rdbMainRecipe.setObjectName(u"rdbMainRecipe")
self.rdbMainRecipe.setGeometry(QRect(20, 330, 90, 24))
self.rdbMainUser = QRadioButton(self.grpMainModule)
self.rdbMainUser.setObjectName(u"rdbMainUser")
self.rdbMainUser.setGeometry(QRect(20, 400, 90, 24))
self.stkMainContainer = QStackedWidget(dlgMain)
self.stkMainContainer.setObjectName(u"stkMainContainer")
self.stkMainContainer.setGeometry(QRect(389, 339, 121, 81))
self.page = QWidget()
self.page.setObjectName(u"page")
self.stkMainContainer.addWidget(self.page)
self.page_2 = QWidget()
self.page_2.setObjectName(u"page_2")
self.stkMainContainer.addWidget(self.page_2)
self.retranslateUi(dlgMain)
self.stkMainContainer.setCurrentIndex(1)
QMetaObject.connectSlotsByName(dlgMain)
# setupUi
def retranslateUi(self, dlgMain):
dlgMain.setWindowTitle(QCoreApplication.translate("dlgMain", u"XXXX\u63a7\u5236\u7cfb\u7edf", None))
self.grpMainSysInfo_0.setTitle("")
self.lblMainWoodTotal.setText(QCoreApplication.translate("dlgMain", u"\u603b\u91cf\uff1a", None))
self.lblMainWoodNG.setText(QCoreApplication.translate("dlgMain", u"NG\u91cf\uff1a", None))
self.lblMainPassRate.setText(QCoreApplication.translate("dlgMain", u"\u901a\u8fc7\u7387\uff1a", None))
self.grpMainSysInfo_1.setTitle("")
self.grpMainForUser.setTitle("")
self.btnMainSwitchUser.setText(QCoreApplication.translate("dlgMain", u"\u5207\u6362\u7528\u6237", None))
self.btnMainChangePasswd.setText(QCoreApplication.translate("dlgMain", u"\u5bc6\u7801\u4fee\u6539", None))
self.grpMainModule.setTitle("")
self.rdbMainAutoProc.setText(QCoreApplication.translate("dlgMain", u"\u81ea\u52a8\u4f5c\u4e1a", None))
self.rdbMainDebug.setText(QCoreApplication.translate("dlgMain", u"\u8bbe\u5907\u8c03\u8bd5", None))
self.rdbMainSetting.setText(QCoreApplication.translate("dlgMain", u"\u53c2\u6570\u8bbe\u7f6e", None))
self.rdbMainQuery.setText(QCoreApplication.translate("dlgMain", u"\u6570\u636e\u67e5\u8be2", None))
self.rdbMainRecipe.setText(QCoreApplication.translate("dlgMain", u"\u914d\u65b9\u7ba1\u7406", None))
self.rdbMainUser.setText(QCoreApplication.translate("dlgMain", u"\u7528\u6237\u7ba1\u7406", None))
# retranslateUi