当前位置: 首页 > news >正文

网站开发和合同视频生成链接

网站开发和合同,视频生成链接,d8 wordpress,企业公示信息查询系统 江苏前言 由于需要使用不同的qt环境(PySide,PyQt)所以写了这个脚本,使用找到的随便一个uic命令去转换ui文件,然后将导入模块换成qtpy这个通用库(支持pyside2-6,pyqt5-6),老版本的是Qt.py(支持pysid…

前言

由于需要使用不同的qt环境(PySide,PyQt)所以写了这个脚本,使用找到的随便一个uic命令去转换ui文件,然后将导入模块换成qtpy这个通用库(支持pyside2-6,pyqt5-6),老版本的是Qt.py(支持pyside0-2~pyqt4-5)你可以自己改

使用

将内容保存为 ui2py.ps1 放置到后缀 ui 文件的同目录下
在拥有环境的powershell中运行 .\ui2py

<#
.SYNOPSIS
Convert all ui files in the same directory to py files for Python to use.DESCRIPTION
It needs to be used on terminals that have a Python environment, making sure that pyuic* or pyside*-uic is present
This script replaces the import 'from PyQt*' or 'from PySide*' in the py file with the 'from qtpy' module after compilation.EXAMPLE
PS> .\MyScript.ps1
Run directly, no parameters required.LINK
https://blog.csdn.net/weixin_42579717/article/details/137279306#>
# Check whether the uic command exists
$_commands = @("pyuic5", "pyside2-uic", "pyuic6", "pyside6-uic", "pyside-uic", "pyuic")
$command = $null
foreach ($cmd in $_commands)
{$command = Get-Command $cmd -ErrorAction SilentlyContinueif ($command){break}
}
if (-not$command)
{Write-Host "Command not found."exit 1
}
$command = $command.Name
Write-Output "Use command: $command"# Gets the folder where the current script is located
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition# Perform conversion operations for all *.ui files in the folder
Get-ChildItem -Path $scriptDirectory -Filter *.ui | ForEach-Object {$uiFile = $_.FullName$pyFile = $_.BaseName + ".py"$pyFilePath = Join-Path $scriptDirectory $pyFileWrite-Host $uiFileWrite-Host $pyFilePath# Convert '.ui' to '.py'& $command -o $pyFilePath $uiFile# Check whether the file is successfully convertedif (Test-Path $pyFilePath){# Replace import module(Get-Content $pyFilePath -Encoding UTF8) -replace "from (PyQt[456]?|PySide[26]?)", "from qtpy" | Set-Content $pyFilePath -Encoding UTF8Write-Host "Files have been converted and modified successfully: $pyFile"}else{Write-Host "convert failed: $uiFile"}
}

如果你的项目是有结构的比如下图
目录结构
需要将ui转出的py文件放置到上层的ui目录中的话,可以修改以下内容
添加父文件夹$parentDirectory = Split-Path -Parent $scriptDirectory


# Gets the folder where the current script is located
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition
$parentDirectory = Split-Path -Parent $scriptDirectory# Perform conversion operations for all *.ui files in the folder
Get-ChildItem -Path $scriptDirectory -Filter *.ui | ForEach-Object {$uiFile = $_.FullName$pyFile = $_.BaseName + ".py"$pyFilePath = Join-Path $parentDirectory ("ui/" + $pyFile)

PS

  • qrc转py同理 可以看看另一篇文章 qrc2py
http://www.yayakq.cn/news/974678/

相关文章:

  • 山东网站建设公司电话网络基础知识培训
  • 对网站建设需求网络营销的常见工具有什么
  • 网站开发工程师的职责汕头站
  • 网站直接登陆wordpress插画网站
  • 爱站网长尾词挖掘工具建设商城网站的书籍钱
  • 建设 公司 网站 请示四川企业网站开发
  • 做网络课程的网站wordpress响应式concise主题
  • 个人网站设计及实现论文杭州市做网站的公司
  • 装修公司网站源码php电商营销渠道有哪些
  • 惠州网站推广app开发大概要多少钱
  • 网站开发的英文书有什么iis6建设网站
  • 哪些网站比较容易做珠海网站建设
  • 上传网站软件备案域名查询官网
  • 廊坊网站关键词排名下载网站模板后本地的网站会自动做跳转
  • 单页响应式网站模板零基础学习做网站
  • 长春火车站时刻表极简网站模板
  • 峨山网站建设山东外贸网站是什么意思
  • 网站收录查询爱站2020新闻大事件摘抄
  • 成都科技网站建设电话辽宁省建设工程信息网入辽打印
  • 农药放行单在哪个网站做省建设厅网站安徽
  • 全自动网站建设宠物网站项目
  • 网站开发core文件作用php一个空间放多个网站
  • 坪地网站建设如何网站页面图片尺寸
  • 安居网站建设动画制作软件免费
  • 公众号里的电影网站怎么做的免费网站加速服务
  • 大型网站建设规范佛山网站优化流程
  • 内推网站最好的网站模板下载网站
  • 建网站的意义视频制作软件哪个好 前十名
  • 公司的网站如何做成都优化网站推广
  • 苏州市城乡和建设局网站网站建设方案.doc