修复因为获取文件大小错误导致程序无法打开问题

This commit is contained in:
gfdgd xi 2022-11-25 13:12:42 +08:00
parent c0ea459dae
commit 4217f58c2c
3 changed files with 20 additions and 17 deletions

View File

@ -11,7 +11,6 @@ env WINEPREFIX=容器路径 winewine的路径 可执行文件路径
``` ```
让你可以简易方便的使用 wine 让你可以简易方便的使用 wine
是使用 Python3 的 PyQt5 构建的 是使用 Python3 的 PyQt5 构建的
(自己美术功底太差,图标只能在网络上找了)
测试平台deepin 20.7.1UOS 家庭版 21.3.1Ubuntu 22.04Ubuntu 20.04UOS 专业版 1050openkylin 测试平台deepin 20.7.1UOS 家庭版 21.3.1Ubuntu 22.04Ubuntu 20.04UOS 专业版 1050openkylin
![截图_选择区域_20221002221112.png](https://storage.deepin.org/thread/202210022215217037_截图_选择区域_20221002221112.png) ![截图_选择区域_20221002221112.png](https://storage.deepin.org/thread/202210022215217037_截图_选择区域_20221002221112.png)
而打包器可以方便的把您的 wine 容器打包成 deb 包供他人使用,程序创建的 deb 构建临时文件夹目录树如下: 而打包器可以方便的把您的 wine 容器打包成 deb 包供他人使用,程序创建的 deb 构建临时文件夹目录树如下:

View File

@ -1,5 +1,5 @@
Package: spark-deepin-wine-runner Package: spark-deepin-wine-runner
Version: 2.5.0 Version: 2.5.0-uos
Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢 Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢
Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner, https://github.com/gfdgd-xi/deep-wine-runner, https://gitlink.org.cn/gfdgd_xi/deep-wine-runner Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner, https://github.com/gfdgd-xi/deep-wine-runner, https://gitlink.org.cn/gfdgd_xi/deep-wine-runner
Architecture: all Architecture: all

View File

@ -1808,6 +1808,7 @@ def UploadLog():
traceback.print_exc() traceback.print_exc()
QtWidgets.QMessageBox.critical(window, "错误", "上传失败!") QtWidgets.QMessageBox.critical(window, "错误", "上传失败!")
def SaveLog(): def SaveLog():
path = QtWidgets.QFileDialog.getSaveFileName(window, "保存日志", get_home(), "txt文件(*.txt);;html 文件(*.html);;所有文件(*.*))") path = QtWidgets.QFileDialog.getSaveFileName(window, "保存日志", get_home(), "txt文件(*.txt);;html 文件(*.html);;所有文件(*.*))")
if not path[1]: if not path[1]:
@ -1975,22 +1976,25 @@ except:
def getFileFolderSize(fileOrFolderPath): def getFileFolderSize(fileOrFolderPath):
"""get size for file or folder""" """get size for file or folder"""
totalSize = 0 totalSize = 0
if not os.path.exists(fileOrFolderPath): try:
return totalSize if not os.path.exists(fileOrFolderPath):
if os.path.isfile(fileOrFolderPath):
totalSize = os.path.getsize(fileOrFolderPath) # 5041481
return totalSize
if os.path.isdir(fileOrFolderPath):
with os.scandir(fileOrFolderPath) as dirEntryList:
for curSubEntry in dirEntryList:
curSubEntryFullPath = os.path.join(fileOrFolderPath, curSubEntry.name)
if curSubEntry.is_dir():
curSubFolderSize = getFileFolderSize(curSubEntryFullPath) # 5800007
totalSize += curSubFolderSize
elif curSubEntry.is_file():
curSubFileSize = os.path.getsize(curSubEntryFullPath) # 1891
totalSize += curSubFileSize
return totalSize return totalSize
if os.path.isfile(fileOrFolderPath):
totalSize = os.path.getsize(fileOrFolderPath) # 5041481
return totalSize
if os.path.isdir(fileOrFolderPath):
with os.scandir(fileOrFolderPath) as dirEntryList:
for curSubEntry in dirEntryList:
curSubEntryFullPath = os.path.join(fileOrFolderPath, curSubEntry.name)
if curSubEntry.is_dir():
curSubFolderSize = getFileFolderSize(curSubEntryFullPath) # 5800007
totalSize += curSubFolderSize
elif curSubEntry.is_file():
curSubFileSize = os.path.getsize(curSubEntryFullPath) # 1891
totalSize += curSubFileSize
return totalSize
except:
return totalSize
# 获取当前语言 # 获取当前语言
def get_now_lang()->"获取当前语言": def get_now_lang()->"获取当前语言":