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

网站的结构是什么样的一个企业可以做多个网站吗

网站的结构是什么样的,一个企业可以做多个网站吗,wordpress完成版,嘉兴app开发公司前言 由于需要使用不同的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/919981/

相关文章:

  • 网站关于我们怎么做企业数字化平台
  • 商城网站设计配色思想邢台生活网
  • 新手建网站视频教程阿里云 网站
  • 做网站有关机械的图片钓鱼网站源码
  • html5单页网站模板购买网站空间ftp设计
  • 做信息流推广需要建立网站么如何进行简单的网页设计
  • 网站开发 强制兼容模式濮阳网红
  • 如何让自己做的博客网站上线千岛湖建设集团办公网站
  • 闲鱼网站建设郑州网站推广优化公司
  • 河南中安建设集团有限公司网站温州网站优化页面
  • 黑帽seo怎么做网站排名做网站原型图
  • 国内免费推广产品的网站网站建设中的背景图片模板
  • 推进门户网站建设方案wordpress 分隔符 sp
  • 广西平台网站建设报价网页设计作品收获与思考
  • 赢了网站怎么做的三网合一网站系统
  • 一站式网站建设用途重庆网站怎么设置
  • 杭州建站系统开发费用
  • 58同城企业网站怎么做的免费 wordpress主题
  • 厦门企业自助建站课程网站开发合同
  • 微网站开发平台系统软件双峰做网站
  • 网站建设在微信里打广告内容有全部公司的网站
  • 音乐外链网站东四做网站
  • 咨询行业网站制作网络营销定价的特点有
  • 做刷网站电商网站开发的现状
  • 国外免费个人网站空间做网站可以在哪儿接活
  • 品牌网站建设哪家公司好专做项目报告的网站
  • 做竞猜网站合法吗网站推荐界面
  • 淄博网站推广哪家好呼和浩特市手机网站
  • 找公司做网站多少钱成都wordpress建站教程linux
  • 东莞学习网站建设计算机类17个专业