From b1deb06b491d8c7268e392e2e42ddeda1ada2bb9 Mon Sep 17 00:00:00 2001
From: gfdgd_xi <3025613752@qq.com>
Date: Tue, 27 Sep 2022 21:34:13 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E4=BA=8E=E7=94=9F=E6=80=81=E9=80=82?=
 =?UTF-8?q?=E9=85=8D=E8=84=9A=E6=9C=AC=E6=94=AF=E6=8C=81=E6=8C=87=E5=AE=9A?=
 =?UTF-8?q?=E5=AE=B9=E5=99=A81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 hope.cpp                          | 28 ++++++++++++++++++++++++++++
 package-script/package-hshw.sh    |  2 ++
 package-script/package.py         | 31 ++++++++++++++++++++++++++-----
 package-script/script-packager.sh |  4 +++-
 4 files changed, 59 insertions(+), 6 deletions(-)
 create mode 100644 hope.cpp

diff --git a/hope.cpp b/hope.cpp
new file mode 100644
index 0000000..483754c
--- /dev/null
+++ b/hope.cpp
@@ -0,0 +1,28 @@
+
+////////////////////////////////////////////////////////////////////
+//                          _ooOoo_                               //
+//                         o8888888o                              //
+//                         88" . "88                              //
+//                         (| ^_^ |)                              //
+//                         O\  =  /O                              //
+//                      ____/`---'\____                           //
+//                    .'  \\|     |//  `.                         //
+//                   /  \\|||  :  |||//  \                        //
+//                  /  _||||| -:- |||||-  \                       //
+//                  |   | \\\  -  /// |   |                       //
+//                  | \_|  ''\---/''  |   |                       //
+//                  \  .-\__  `-`  ___/-. /                       //
+//                ___`. .'  /--.--\  `. . ___                     //
+//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
+//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
+//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
+//      ========`-.____`-.___\_____/___.-`____.-'========         //
+//                           `=---='                              //
+//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
+//         佛祖保佑       永无BUG     永不修改                  //
+////////////////////////////////////////////////////////////////////
+#include <iostream>
+using namespace std;
+int main(){
+    cout << "佛祖保佑       永无BUG     永不修改" << endl;
+}
\ No newline at end of file
diff --git a/package-script/package-hshw.sh b/package-script/package-hshw.sh
index e929c3a..1731970 100755
--- a/package-script/package-hshw.sh
+++ b/package-script/package-hshw.sh
@@ -15,6 +15,8 @@ export exec_path="c:/Program Files/plantsvszombies/PlantsVsZombies.exe"
 export deb_package_name="Deepin-plantsvszombies"
 #最终生成的包的版本号,版本号命名规则:应用版本号+deepin+数字
 export deb_version_string="1"
+#读取和最终解压的包名
+export bottle_name="Deepin-plantsvszombies"
 
 export package_depends="deepin-wine6-stable:amd64 (>= 6.0.0.12-1), deepin-wine-helper (>= 5.1.25-1)"
 export apprun_cmd="deepin-wine6-stable"
diff --git a/package-script/package.py b/package-script/package.py
index 953242f..2f77697 100755
--- a/package-script/package.py
+++ b/package-script/package.py
@@ -47,6 +47,7 @@ def DisbledOrEnabled(choose: bool):
     packageName.setDisabled(choose)
     versionName.setDisabled(choose)
     buildDeb.setDisabled(choose)
+    bottonName.setDisabled(choose)
 
 
 class PackageDebThread(QtCore.QThread):
@@ -75,6 +76,8 @@ export exec_path="{exePath.text()}"
 export deb_package_name="{packageName.text()}"
 #最终生成的包的版本号,版本号命名规则:应用版本号+deepin+数字
 export deb_version_string="{versionName.text()}"
+#读取和最终解压的包名
+export bottle_name="{bottonName.text()}"
 
 export package_depends="deepin-wine6-stable:amd64 (>= 6.0.0.12-1), spark-dwine-helper | store.spark-app.spark-dwine-helper"
 export apprun_cmd="deepin-wine6-stable"
@@ -114,9 +117,11 @@ def PackageDeb():
             DisbledOrEnabled(False)
             return
     commandReturn.setText("")
+    global lockB
+    lockB = False
     QT.run = PackageDebThread()
     QT.run.signal.connect(RunCommand)
-    QT.info.signal.connect(MessageBoxInformation)
+    QT.run.info.connect(MessageBoxInformation)
     QT.run.start()
 
 def RunCommand(command):
@@ -129,6 +134,17 @@ def ShowHelp():
 def OpenPackageFolder():
     os.system(f"xdg-open '{programPath}/package_save/uos'")
 
+# 自动设置包名/容器名
+lockB = False
+def NameChange(packageOrBotton: int):
+    global lockB
+    # 0 代表包名
+    # 1 代表容器名
+    if packageOrBotton == 0 and not lockB:
+        bottonName.setText(packageName.text())
+    elif packageOrBotton == 1 and bottonName.text() != packageName.text():
+        lockB = True
+
 ###########################
 # 程序信息
 ###########################
@@ -165,6 +181,7 @@ debDescription = QtWidgets.QLineEdit()
 typeName = QtWidgets.QComboBox()
 exePath = QtWidgets.QLineEdit()
 packageName = QtWidgets.QLineEdit()
+bottonName = QtWidgets.QLineEdit()
 versionName = QtWidgets.QLineEdit()
 controlFrame = QtWidgets.QHBoxLayout()
 buildDeb = QtWidgets.QPushButton("打包")
@@ -181,16 +198,20 @@ widgetLayout.addWidget(QtWidgets.QLabel("包描述:"), 2, 0, 1, 1)
 widgetLayout.addWidget(QtWidgets.QLabel("程序分类:"), 3, 0, 1, 1)
 widgetLayout.addWidget(QtWidgets.QLabel("程序在 Wine 容器的位置:"), 4, 0, 1, 1)
 widgetLayout.addWidget(QtWidgets.QLabel("包名:"), 5, 0, 1, 1)
-widgetLayout.addWidget(QtWidgets.QLabel("版本号:"), 6, 0, 1, 1)
+widgetLayout.addWidget(QtWidgets.QLabel("容器名:"), 6, 0, 1, 1)
+widgetLayout.addWidget(QtWidgets.QLabel("版本号:"), 7, 0, 1, 1)
 widgetLayout.addWidget(chineseName, 0, 1, 1, 1)
 widgetLayout.addWidget(englishName, 1, 1, 1, 1)
 widgetLayout.addWidget(debDescription, 2, 1, 1, 1)
 widgetLayout.addWidget(typeName, 3, 1, 1, 1)
 widgetLayout.addWidget(exePath, 4, 1, 1, 1)
 widgetLayout.addWidget(packageName, 5, 1, 1, 1)
-widgetLayout.addWidget(versionName, 6, 1, 1, 1)
-widgetLayout.addLayout(controlFrame, 7, 0, 1, 2)
-widgetLayout.addWidget(commandReturn, 8, 0, 1, 2)
+widgetLayout.addWidget(bottonName, 6, 1, 1, 1)
+widgetLayout.addWidget(versionName, 7, 1, 1, 1)
+widgetLayout.addLayout(controlFrame, 8, 0, 1, 2)
+widgetLayout.addWidget(commandReturn, 9, 0, 1, 2)
+packageName.textChanged.connect(lambda: NameChange(0))
+bottonName.textChanged.connect(lambda: NameChange(1))
 buildDeb.clicked.connect(PackageDeb)
 debPath.clicked.connect(OpenPackageFolder)
 widget.setLayout(widgetLayout)
diff --git a/package-script/script-packager.sh b/package-script/script-packager.sh
index 117966c..3f0302b 100755
--- a/package-script/script-packager.sh
+++ b/package-script/script-packager.sh
@@ -13,7 +13,9 @@ if [ -n "$apprun_cmd" ];then
     wine_name=${wine_name##*/}
 fi
 
-export public_bottle_name="$deb_package_name"
+# export public_bottle_name="$deb_package_name"
+# 为了满足用户自定义容器名的需求,更改
+export public_bottle_name="$bottle_name"
 
 CheckTool()
 {