diff --git a/InstallVisualCPlusPlus.py b/InstallVisualCPlusPlus.py index e4c6a41..6b14204 100755 --- a/InstallVisualCPlusPlus.py +++ b/InstallVisualCPlusPlus.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.5.1 -# 更新时间:2022年07月04日 +# 版本:1.5.2 +# 更新时间:2022年07月06日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 tkinter 构建 ########################################################################################### diff --git a/README.md b/README.md index ea96a84..9db06da 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# wine 运行器 1.5.1 +# wine 运行器 1.5.2 ## 介绍 一个图形化了以下命令的程序 @@ -9,7 +9,7 @@ env WINEPREFIX=容器路径 wine(wine的路径) 可执行文件路径 是使用 Python3 的 tkinter 构建的 (自己美术功底太差,图标只能在网络上找了) (测试平台:deepin 20.6;UOS 家庭版 21;Ubuntu 22.04) -![image.png](https://storage.deepin.org/thread/202207042234078682_image.png) +![image.png](https://storage.deepin.org/thread/202207061004446872_image.png) ## 软件架构 @@ -18,7 +18,8 @@ i386 和 amd64,deepin-wine、deepin-wine5、wine、wine64、deepin-wine5-stabl ## 使用说明 -(均在软件的“小提示”里有说明) +### 均在软件的“小提示”里有说明 +### 运行器 1、使用终端运行该程序,可以看到 wine 以及程序本身的提示和报错; 2、wine 32 位和 64 位的容器互不兼容; 3、所有的 wine 和 winetricks 均需要自行安装(可以从 菜单栏=>程序 里面进行安装) @@ -28,8 +29,26 @@ exe路径\' 参数 \' ``` 即可(单引号需要输入) 5、wine 容器如果没有指定,则会默认为 ~/.wine +### 打包器 +1、deb 打包软件包名要求: +软件包名只能含有小写字母(a-z)、数字(0-9)、加号(+)和减号(-)、以及点号(.),软件包名最短长度两个字符;它必须以字母开头 +2、如果要填写路径,有“浏览……”按钮的是要填本计算机对应文件的路径,否则就是填写安装到其他计算机使用的路径 +3、输入 wine 的容器路径时最后面请不要输入“/” +4、输入可执行文件的运行路径时是以“C:/XXX/XXX.exe”的格式进行输入,默认是以 C: 为开头,不用“\”做命令的分隔,而是用“/” +5、.desktop 的图标只支持 PNG 格式和 SVG 格式,其他格式无法显示图标 ## 更新日志 +### 1.5.2 +**※1、添加并翻新了 deepin-wine5 打包器,改为 wine 打包器,支持常见 wine 的打包** +**※2、新增 Visual Studio C++ 的安装程序** +**※3、新增从系统安装镜像提取 DLL 到 wine 容器的功能(当前只支持 Windows XP 和 Windows Server 2003 的官方安装镜像)** +4、修复了安装星火应用商店的 wine 运行器右键打开方式没有 wine 运行器选项的问题 +5、新增脚本,优化 deepin terminal 调用本程序脚本显示不佳的问题 +![image.png](https://storage.deepin.org/thread/202207061004446872_image.png) +![image.png](https://storage.deepin.org/thread/202207061005149959_image.png) +![image.png](https://storage.deepin.org/thread/202207061005251446_image.png) + + ### 1.5.1 **※1、支持打开 spark-wine7-devel 的专门缩放设置(如未安装则此按钮禁用)** **※2、支持提取选择的 exe 文件的图标** diff --git a/deb/DEBIAN/control b/deb/DEBIAN/control index 1f7a6a1..0bc1af4 100644 --- a/deb/DEBIAN/control +++ b/deb/DEBIAN/control @@ -1,5 +1,5 @@ Package: spark-deepin-wine-runner -Version: 1.5.1 +Version: 1.5.2 Maintainer: gfdgd xi <3025613752@qq.com>, 为什么您不喜欢熊出没和阿布呢 Homepage: https://gitee.com/gfdgd-xi/deep-wine-runner Architecture: all @@ -7,13 +7,9 @@ Priority: optional Depends: python3, python3-tk, python3-pip, python3-pil, python3-pil.imagetk, python3-pyquery, deepin-terminal, aria2, curl Description: gfdgd xi 制作的 wine 运行器 更新内容: - ※1、支持打开 spark-wine7-devel 的专门缩放设置(如未安装则此按钮禁用) - ※2、支持提取选择的 exe 文件的图标 - ※3、支持向指定的 wine 容器安装 mono、gecko、.net framework(此功能在菜单栏“Wine”中,卸载只需要使用程序的卸载按钮打开 Geek Uninstaller 即可) - ※4、支持指定特定的 wine 容器调用 winetricks - ※5、在没有指定 wine 容器的情况下,将自动设置为 ~/.wine - 6、新增 ukylin-wine - 7、将默认选择的 wine 改为 deepin-wine6 stable - 8、支持打开指定容器的 winecfg、winver、regedit、taskmgr - 9、双击使用 wine 运行器打开 exe(不知道能不能生效) + ※1、添加并翻新了 deepin-wine5 打包器,改为 wine 打包器,支持常见 wine 的打包 + ※2、新增 Visual Studio C++ 的安装程序 + ※3、新增从系统安装镜像提取 DLL 到 wine 容器的功能(当前只支持 Windows XP 和 Windows Server 2003 的官方安装镜像) + 4、修复了安装星火应用商店的 wine 运行器右键打开方式没有 wine 运行器选项的问题 + 5、新增脚本,优化 deepin terminal 调用本程序脚本显示不佳的问题 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 diff --git a/deb/DEBIAN/postinst b/deb/DEBIAN/postinst index acce6b0..bfcfc83 100755 --- a/deb/DEBIAN/postinst +++ b/deb/DEBIAN/postinst @@ -1,4 +1,4 @@ # !/bin/sh python3 -m pip install --upgrade ttkthemes -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com # 向服务器返回安装数加1(不显示内容且忽略错误) -curl http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=1.5.1 -s > /dev/null | true +curl http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=1.5.2 -s > /dev/null | true diff --git a/deb/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py b/deb/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py new file mode 100755 index 0000000..6b14204 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# 使用系统默认的 python3 运行 +########################################################################################### +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 版本:1.5.2 +# 更新时间:2022年07月06日 +# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 +# 基于 Python3 的 tkinter 构建 +########################################################################################### +################# +# 引入所需的库 +################# +import os +import sys + +if "--help" in sys.argv: + print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("版本:1.0.0") + print("本程序可以更方便的在 wine 容器中安装 Visual Studio C++") + sys.exit() +if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": + print("您未指定需要安装 Visual Studio C++ 的容器和使用的 wine,无法继续") + print("参数:") + print("XXX 参数一 参数二") + print("参数一为需要安装的容器,参数二为需要使用的wine,两个参数位置不能颠倒") + sys.exit() +netList = [ + ["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE"], + ["2008 (VC++ 9.0) SP1 (不再支持) ", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe"], + ["2010 (VC++ 10.0) SP1 (不再支持) ", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe"], + ["2012 (VC++ 11.0) Update 4", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe"], + ["2013 (VC++ 12.0) ", "https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe"], + ["2015、2017、2019 和 2022", "https://aka.ms/vs/17/release/vc_redist.x86.exe"] +] +print("请选择以下的 Visual Studio C++ 进行安装(不保证能正常安装运行)") +for i in range(0, len(netList)): + print(f"{i} Visual Studio C++ {netList[i][0]}") +while True: + try: + choose = int(input("请输入要选择的 Visual Studio C++ 版本:")) + except: + print("输入错误,请重新输入") + continue + if 0 <= choose and choose < len(netList): + break +print(f"您选择了 Visual Studio C++ {netList[choose][0]}") +print("开始下载") +os.system("rm -rf /tmp/wineinstallvisualstudiocplusplus") +os.system("mkdir -p /tmp/wineinstallvisualstudiocplusplus") +os.system(f"aria2c -x 16 -s 16 -d /tmp/wineinstallvisualstudiocplusplus -o install.exe \"{netList[choose][1]}\"") +os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} /tmp/wineinstallvisualstudiocplusplus/install.exe") +print("安装结束") \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/LICENSE b/deb/opt/apps/deepin-wine-runner/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/deb/opt/apps/deepin-wine-runner/deepin-wine-packager.py b/deb/opt/apps/deepin-wine-runner/deepin-wine-packager.py new file mode 100755 index 0000000..2cab876 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/deepin-wine-packager.py @@ -0,0 +1,550 @@ +#!/usr/bin/env python3 +######################################################################### +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布 +# 版本:1.5.2 +# 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序 +# 基于 Python3 的 tkinter 构建 +######################################################################### +################# +# 引入所需的库 +################# +import os +import sys +import json +import shutil +import random +import pathlib +import ttkthemes +import threading +import traceback +import subprocess +from PIL import Image +import tkinter as tk +import tkinter.ttk as ttk +import tkinter.messagebox as messagebox +import tkinter.filedialog as filedialog + +################# +# 程序所需事件 +################# + +def button1_cl(): + path = filedialog.askdirectory(title="选择 wine 容器", initialdir="~/.deepinwine") + if path != "": + e6_text.set(path) + +def button2_cl(): + path = filedialog.askopenfilename(filetypes=[("PNG图标", "*.png"), ("SVG图标", "*.svg"), ("全部文件", "*.*")], title="选择图标文件", initialdir="~") + if path != "": + e9_text.set(path) + +def button4_cl(): + path = filedialog.asksaveasfilename(filetypes=[("deb 文件", "*.deb"), ("所有文件", "*.*")], title="保存 deb 包", initialdir="~", initialfile="{}_{}_i386.deb".format(e1_text.get(), e2_text.get())) + if path != "": + e12_text.set(path) + +def disabled_or_NORMAL_all(choose): + chooses = {True: tk.NORMAL, False: tk.DISABLED} + a = chooses[choose] + label1.configure(state=a) + label2.configure(state=a) + label3.configure(state=a) + label4.configure(state=a) + label5.configure(state=a) + label6.configure(state=a) + label7.configure(state=a) + label8.configure(state=a) + label9.configure(state=a) + label10.configure(state=a) + label12.configure(state=a) + label14.configure(state=a) + label15.configure(state=a) + e1.configure(state=a) + e2.configure(state=a) + e3.configure(state=a) + e4.configure(state=a) + e5.configure(state=a) + e6.configure(state=a) + e7.configure(state=a) + e8.configure(state=a) + e9.configure(state=a) + e10.configure(state=a) + e12.configure(state=a) + e15.configure(state=a) + button1.config(state=a) + button2.config(state=a) + button4.config(state=a) + button5.config(state=a) + option1.config(state=a) + +def make_deb(): + clean_textbox1_things() + disabled_or_NORMAL_all(False) + if e1_text.get() == "" or e2_text.get() == "" or e3_text.get() == "" or e4_text.get() == "" or e5_text.get() == "" or e6_text.get() == "" or e7_text.get() == "" or e8_text.get() == "" or e12_text.get() == "": + messagebox.showinfo(title="提示", message="必填信息没有填写完整,无法继续构建 deb 包") + disabled_or_NORMAL_all(True) + label13_text_change("必填信息没有填写完整,无法继续构建 deb 包") + return + thread = threading.Thread(target=make_deb_threading) + thread.start() + +def label13_text_change(thing): + label13_text.set("当前 deb 打包情况:{}".format(thing)) + +def make_deb_threading(): + ##################################### + # 程序创建的 deb 构建临时文件夹目录树: + # /XXX + # ├── DEBIAN + # │ └── control + # └── opt + # └── apps + # └── XXX + # ├── entries + # │ ├── applications + # │ │ └── XXX.desktop + # │ └── icons + # │ └── hicolor + # │ └── scalable + # │ └── apps + # │ └── XXX.png(XXX.svg) + # ├── files + # │ ├── files.7z + # │ └── run.sh + # └── info + # + # 11 directories, 6 files + ##################################### + try: + ##################### + # 判断文件是否存在 + ##################### + label13_text_change("正在检查文件是否存在并为后面步骤准备……") + a = "" + if e6_text.get() == "/": + b = e6_text.get()[:-1] + else: + b = e6.get() + if e9_text.get() != "": + # 获取图片格式(不太准) + try: + im = Image.open(e9_text.get()) + imms = im.format.lower() + except: # 未知(就直接设置为 svg 后缀) + imms = ".svg" + a = "/opt/apps/{}/entries/icons/hicolor/scalable/apps/{}.{}".format(e1_text.get(), e1_text.get(), imms) + if not os.path.exists(e9_text.get()): + messagebox.showerror(title="提示", message="图标的路径填写错误,无法进行构建 deb 包") + disabled_or_NORMAL_all(True) + label13_text_change("图标的路径填写错误,无法进行构建 deb 包") + return + if not os.path.exists(e6_text.get()): + messagebox.showerror(title="提示", message="路径填写错误,无法继续构建 deb 包") + disabled_or_NORMAL_all(True) + label13_text_change("图标的路径填写错误,无法进行构建 deb 包") + return + ############# + # 删除文件 + ############# + label13_text_change("正在删除对构建 deb 包有影响的文件……") + debPackagePath = f"/tmp/{random.randint(0, 9999)}" + run_command(f"rm -rfv /tmp/{debPackagePath}") + ############### + # 创建目录 + ############### + label13_text_change("正在创建目录……") + os.makedirs("{}/DEBIAN".format(debPackagePath)) + os.makedirs("{}/opt/apps/{}/entries/applications".format(debPackagePath, e1_text.get())) + os.makedirs("{}/opt/apps/{}/entries/icons/hicolor/scalable/apps".format(debPackagePath, e1_text.get())) + os.makedirs("{}/opt/apps/{}/files".format(debPackagePath, e1_text.get())) + ############### + # 创建文件 + ############### + label13_text_change("正在创建文件……") + os.mknod("{}/DEBIAN/control".format(debPackagePath)) + os.mknod("{}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.get(), e1_text.get())) + os.mknod("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get())) + os.mknod("{}/opt/apps/{}/info".format(debPackagePath, e1_text.get())) + ############### + # 压缩容器 + ############### + label13_text_change("正在打包 wine 容器") + run_command("7z a {}/opt/apps/{}/files/files.7z {}/*".format(debPackagePath, e1_text.get(), b)) + ############### + # 复制图片 + ############### + label13_text_change("正在复制文件……") + run_command(f"cp -rv '{programPath}/dlls' {debPackagePath}/opt/apps/{e1_text.get()}/files/") + if e9_text.get() != "": + shutil.copy(e9_text.get(), "{}/opt/apps/{}/entries/icons/hicolor/scalable/apps/{}.{}".format(debPackagePath, e1_text.get(), e1_text.get(), imms)) + ################ + # 获取文件大小 + ################ + label13_text_change("正在计算文件大小……") + size = getFileFolderSize(debPackagePath) / 1024 + ################ + # 写入文本文档 + ################ + label13_text_change("正在写入文件……") + if not bool(chooseWineHelperValue.get()): + write_txt("{}/DEBIAN/control".format(debPackagePath), '''Package: {} +Version: {} +Architecture: i386 +Maintainer: {} +Depends: {}, deepin-wine-helper (>= 5.1.30-1), fonts-wqy-microhei, fonts-wqy-zenhei +Section: non-free/otherosfs +Priority: optional +Multi-Arch: foreign +Description: {} +'''.format(e1_text.get(), e2_text.get(), e4_text.get(), wineVersion.get(), e3_text.get())) + else: + write_txt("{}/DEBIAN/control".format(debPackagePath), '''Package: {} +Version: {} +Architecture: i386 +Maintainer: {} +Depends: {}, spark-dwine-helper (>= 1.6.2), fonts-wqy-microhei, fonts-wqy-zenhei +Section: non-free/otherosfs +Priority: optional +Multi-Arch: foreign +Description: {} +'''.format(e1_text.get(), e2_text.get(), e4_text.get(), wineVersion.get(), e3_text.get())) + write_txt("{}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.get(), e1_text.get()), '#!/usr/bin/env xdg-open\n[Desktop Entry]\nEncoding=UTF-8\nType=Application\nX-Created-By={}\nCategories={};\nIcon={}\nExec="/opt/apps/{}/files/run.sh" {}\nName={}\nComment={}\nMimeType={}\nGenericName={}\nTerminal=false\nStartupNotify=false\n'.format(e4_text.get(), option1_text.get(), a, e1_text.get(), e15_text.get(), e8_text.get(), e3_text.get(), e10_text.get(), e1_text.get())) + if not bool(chooseWineHelperValue.get()): + write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get()), '''#!/bin/sh + +# Copyright (C) 2016 Deepin, Inc. +# +# Author: Li LongYu +# Peng Hao + +version_gt() {{ test "$(echo "$@" | tr " " "\\n" | sort -V | head -n 1)" != "$1"; }} + +BOTTLENAME="{}" +APPVER="{}" +EXEC_PATH="{}" +START_SHELL_PATH="/opt/deepinwine/tools/run_v4.sh" +export MIME_TYPE="" +export DEB_PACKAGE_NAME="{}" +export APPRUN_CMD="{}" +DISABLE_ATTACH_FILE_DIALOG="" +EXPORT_ENVS="" + +export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH` + +ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files" + +export WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64 + +export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls" + +if [ -z "$DISABLE_ATTACH_FILE_DIALOG" ];then + export ATTACH_FILE_DIALOG=1 +fi + +if [ -n "$EXPORT_ENVS" ];then + export $EXPORT_ENVS +fi + +if [ -n "$EXEC_PATH" ];then + if [ -z "${{EXEC_PATH##*.lnk*}}" ];then + $START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@" + else + $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@" + fi +else + $START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@" +fi +'''.format(e5_text.get(), e2_text.get(), e7_text.get(), e1_text.get(), wineVersion.get())) + else: + write_txt("{}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get()), '''#!/bin/sh + +# Copyright (C) 2016 Deepin, Inc. +# +# Author: Li LongYu +# Peng Hao + +#######################函数段。下文调用的额外功能会在此处声明 + +Get_Dist_Name() +{{ + if grep -Eqii "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then + DISTRO='Deepin' + elif grep -Eqi "UnionTech" /etc/issue || grep -Eq "UnionTech" /etc/*-release; then + DISTRO='UniontechOS' + else + DISTRO='OtherOS' + fi +}} + +####获得发行版名称 + +version_gt() {{ test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }} + +BOTTLENAME="{}" +APPVER="{}" +EXEC_PATH="{}" +START_SHELL_PATH="/opt/deepinwine/tools/spark_run_v4.sh" +export MIME_TYPE="" +export DEB_PACKAGE_NAME="{}" +export APPRUN_CMD="{}" +EXPORT_ENVS="" + +export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH` + +ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files" + +export WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64 + +export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls" + +DISABLE_ATTACH_FILE_DIALOG="" + +Get_Dist_Name + +if [ "$DISTRO" != "Deepin" ] && [ "$DISTRO" != "UniontechOS" ];then +DISABLE_ATTACH_FILE_DIALOG="1" +echo "非deepin/UOS,默认关闭系统自带的文件选择工具,使用Wine的" +echo "如果你想改变这个行为,请到/opt/apps/$DEB_PACKAGE_NAME/files/$0处修改" +echo "To打包者:如果你要打开自带请注意在适配的发行版上进行测试" +echo "To用户:打包者没有打开这个功能,这证明启用这个功能可能造成运行问题。如果你要修改这个行为,请确保你有一定的动手能力" +fi + +if [ -z "$DISABLE_ATTACH_FILE_DIALOG" ];then + export ATTACH_FILE_DIALOG=1 +fi + +if [ -n "$EXPORT_ENVS" ];then + export $EXPORT_ENVS +fi + +if [ -n "$EXEC_PATH" ];then + if [ -z "${{EXEC_PATH##*.lnk*}}" ];then + $START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@" + else + $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@" + fi +else + $START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@" +fi +'''.format(e5_text.get(), e2_text.get(), e7_text.get(), e1_text.get(), wineVersion.get())) + write_txt("{}/opt/apps/{}/info".format(debPackagePath, e1_text.get()), '{\n "appid": "' + e1_text.get() + '",\n "name": "' + e8_text.get() + '",\n "version": "' + e2_text.get() + '",\n "arch": ["i386"],\n "permissions": {\n "autostart": false,\n "notification": false,\n "trayicon": true,\n "clipboard": true,\n "account": false,\n "bluetooth": false,\n "camera": false,\n "audio_record": false,\n "installed_apps": false\n }\n}') + ################ + # 修改文件权限 + ################ + label13_text_change("正在修改文件权限……") + run_command("chmod -Rv 644 {}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get())) + run_command("chmod -Rv 644 {}/opt/apps/{}/info".format(debPackagePath, e1_text.get())) + run_command("chmod -Rv 755 {}/opt/apps/{}/files/run.sh".format(debPackagePath, e1_text.get())) + ################ + # 构建 deb 包 + ################ + label13_text_change("正在构建 deb 包……") + run_command("dpkg -b {} {}".format(debPackagePath, e12_text.get())) + ################ + # 完成构建 + ################ + label13_text_change("完成构建!") + disabled_or_NORMAL_all(True) + except Exception as e: + messagebox.showerror(title="错误", message="程序出现错误,错误信息:\n{}".format(traceback.format_exc())) + traceback.print_exc() + label13_text_change("deb 包构建出现错误:{}".format(repr(e))) + chang_textbox1_things(traceback.format_exc()) + disabled_or_NORMAL_all(True) + +# 写入文本文档 +def write_txt(path, things): + file = open(path, 'a+', encoding='UTF-8') # 设置文件对象 + file.write(things) # 写入文本 + file.close() # 关闭文本对象 + +def chang_textbox1_things(things): + textbox1.configure(state=tk.NORMAL) + textbox1.insert('end', things) + textbox1.configure(state=tk.DISABLED) + +def clean_textbox1_things(): + textbox1.configure(state=tk.NORMAL) + textbox1.delete('1.0','end') + textbox1.configure(state=tk.DISABLED) + +def run_command(command): + res = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # 实时读取程序返回 + while res.poll() is None: + try: + text = res.stdout.readline().decode("utf8") + except: + text = "" + print(text) + chang_textbox1_things(text) + + +def getFileFolderSize(fileOrFolderPath): + """get size for file or folder""" + totalSize = 0 + if not os.path.exists(fileOrFolderPath): + 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 + +# 显示“提示”窗口 +def helps(): + messagebox.showinfo(title="提示", message=tips) + +# 读取文本文档 +def readtxt(path): + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +############### +# 程序信息 +############### +# 如果要添加其他 wine,请在字典添加其名称和执行路径 +wine = {"deepin-wine": "deepin-wine", "deepin-wine5": "deepin-wine5", "wine": "wine", "wine64": "wine64", "deepin-wine5 stable": "deepin-wine5-stable", "deepin-wine6 stable": "deepin-wine6-stable", "spark-wine7-devel": "spark-wine7-devel", "ukylin-wine": "ukylin-wine"} +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +iconPath = "{}/icon.png".format(programPath) +information = json.loads(readtxt(f"{programPath}/information.json")) +version = information["Version"] +tips = """提示: +1、deb 打包软件包名要求: +软件包名只能含有小写字母(a-z)、数字(0-9)、加号(+)和减号(-)、以及点号(.),软件包名最短长度两个字符;它必须以字母开头 +2、如果要填写路径,有“浏览……”按钮的是要填本计算机对应文件的路径,否则就是填写安装到其他计算机使用的路径 +3、输入 wine 的容器路径时最后面请不要输入“/” +4、输入可执行文件的运行路径时是以“C:/XXX/XXX.exe”的格式进行输入,默认是以 C: 为开头,不用“\”做命令的分隔,而是用“/” +5、.desktop 的图标只支持 PNG 格式和 SVG 格式,其他格式无法显示图标""" + +############### +# 窗口创建 +############### +window = tk.Tk() +# 设置变量以修改和获取值项 +wineVersion = tk.StringVar() +wineVersion.set("deepin-wine6 stable") +e1_text = tk.StringVar() +e2_text = tk.StringVar() +e3_text = tk.StringVar() +e4_text = tk.StringVar() +e5_text = tk.StringVar() +e6_text = tk.StringVar() +e7_text = tk.StringVar() +e8_text = tk.StringVar() +e9_text = tk.StringVar() +e10_text = tk.StringVar() +e12_text = tk.StringVar() +e15_text = tk.StringVar() +label13_text = tk.StringVar() +option1_text = tk.StringVar() +option1_text.set("Network") +label13_text.set("当前 deb 打包情况:暂未打包") +# 创建控件 +label1 = ttk.Label(window, text="要打包的 deb 包的包名(※必填)") +label2 = ttk.Label(window, text="要打包的 deb 包的版本号(※必填)") +label3 = ttk.Label(window, text="要打包的 deb 包的说明(※必填)") +label4 = ttk.Label(window, text="要打包的 deb 包的维护者(※必填)") +label5 = ttk.Label(window, text="要解压的 wine 容器的容器名(※必填)") +label6 = ttk.Label(window, text="要解压的 wine 容器(※必填)") +label7 = ttk.Label(window, text="要解压的 wine 容器里需要运行的可执行文件路径(※必填)") +label8 = ttk.Label(window, text="要显示的 .desktop 文件的名称(※必填)") +label9 = ttk.Label(window, text="要显示的 .desktop 文件的图标(选填)") +label10 = ttk.Label(window, text="要显示的 .desktop 文件的 MimeType 内容(选填)") +label12 = ttk.Label(window, text="打包 deb 的保存路径(※必填)") +label13 = ttk.Label(window, textvariable=label13_text) +label14 = ttk.Label(window, text="要显示的 .desktop 文件的分类(※必填)") +label15 = ttk.Label(window,text="要解压的 wine 容器里需要运行的可执行文件的参数(选填)") +wineFrame = ttk.Frame(window) +chooseWineVersionTips = ttk.Label(window,text="选择打包的 wine 版本(必选)") +chooseWineVersion = ttk.OptionMenu(wineFrame, wineVersion, "deepin-wine6 stable", *list(wine)) # 创建选择框控件 +chooseWineHelperValue = tk.IntVar() +chooseWineHelper = ttk.Checkbutton(wineFrame, text="使用星火wine helper(如不勾选默认为deepin-wine-helper)", variable=chooseWineHelperValue) +e1 = ttk.Entry(window, textvariable=e1_text, width=100) +e2 = ttk.Entry(window, textvariable=e2_text, width=100) +e3 = ttk.Entry(window, textvariable=e3_text, width=100) +e4 = ttk.Entry(window, textvariable=e4_text, width=100) +e5 = ttk.Entry(window, textvariable=e5_text, width=100) +e6 = ttk.Entry(window, textvariable=e6_text, width=100) +e7 = ttk.Entry(window, textvariable=e7_text, width=100) +e8 = ttk.Entry(window, textvariable=e8_text, width=100) +e9 = ttk.Entry(window, textvariable=e9_text, width=100) +e10 = ttk.Entry(window, textvariable=e10_text, width=100) +e12 = ttk.Entry(window, textvariable=e12_text, width=100) +e15 = ttk.Entry(window, textvariable=e15_text, width=100) +button1 = ttk.Button(window, text="浏览……", command=button1_cl) +button2 = ttk.Button(window, text="浏览……", command=button2_cl) +button4 = ttk.Button(window, text="浏览……", command=button4_cl) +button5 = ttk.Button(window, text="打包……", command=make_deb) +option1 = ttk.OptionMenu(window, option1_text, "Network", "Chat", "Audio", "Video", "Graphics", "Office", "Translation", "Development", "Utility") +textbox1 = tk.Text(window, width=100, height=4) +textbox1.configure(state=tk.DISABLED) +menu = tk.Menu(window) # 设置菜单栏 +programmenu = tk.Menu(menu, tearoff=0) # 设置“程序”菜单栏 +menu.add_cascade(label="程序", menu=programmenu) +programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项 +help = tk.Menu(menu, tearoff=0) # 设置“帮助”菜单栏 +menu.add_cascade(label="帮助", menu=help) +help.add_command(label="小提示", command=helps) # 设置“小提示”项 +# 设置窗口 +style = ttkthemes.ThemedStyle(window) +style.set_theme("breeze") +window.title(f"wine 应用打包器 {version}") +window.iconphoto(False, tk.PhotoImage(file=iconPath)) +# 控件配置 +try: + e6_text.set(sys.argv[1]) + e5_text.set(pathlib.PurePath(sys.argv[1]).name) + wineVersion.set(sys.argv[2]) +except: + pass +# 添加控件 +window.config(menu=menu) # 显示菜单栏 +label1.grid(row=0, column=0) +e1.grid(row=0, column=1) +label2.grid(row=1, column=0) +e2.grid(row=1, column=1) +label3.grid(row=2, column=0) +e3.grid(row=2, column=1) +label4.grid(row=3, column=0) +e4.grid(row=3, column=1) +label5.grid(row=4, column=0) +e5.grid(row=4, column=1) +label6.grid(row=5, column=0) +e6.grid(row=5, column=1) +button1.grid(row=5, column=2) +label7.grid(row=6, column=0) +e7.grid(row=6, column=1) +label14.grid(row=7, column=0) +option1.grid(row=7, column=1) +label15.grid(row=8, column=0) +e15.grid(row=8, column=1) +label8.grid(row=9, column=0) +e8.grid(row=9, column=1) +label9.grid(row=10, column=0) +e9.grid(row=10, column=1) +button2.grid(row=10, column=2) +label10.grid(row=11, column=0) +e10.grid(row=11, column=1) +chooseWineVersionTips.grid(row=12, column=0) +wineFrame.grid(row=12, column=1) +chooseWineVersion.grid(row=0, column=0) +chooseWineHelper.grid(row=0, column=1) +label12.grid(row=13, column=0) +e12.grid(row=13, column=1) +button4.grid(row=13, column=2) +button5.grid(row=14, column=1) +label13.grid(row=15, column=0, columnspan=3) +textbox1.grid(row=16, column=0, columnspan=3) +window.mainloop() diff --git a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner index ee2a0a6..079ee56 100755 --- a/deb/opt/apps/deepin-wine-runner/deepin-wine-runner +++ b/deb/opt/apps/deepin-wine-runner/deepin-wine-runner @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.5.1 -# 更新时间:2022年07月03日 +# 版本:1.5.2 +# 更新时间:2022年07月06日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 tkinter 构建 ########################################################################################### @@ -16,6 +16,7 @@ import time import json import shutil import threading +import traceback import ttkthemes import webbrowser import subprocess @@ -240,7 +241,7 @@ def KillProgram(): os.system("killall winedbg -9") def InstallWine(): - threading.Thread(target=os.system, args=[f"deepin-terminal -e \"{programPath}/AllInstall.py\""]).start() + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -e \"{programPath}/AllInstall.py\""]).start() def OpenWineBotton(): if e1.get() == "": @@ -266,7 +267,7 @@ def UninstallProgram_threading(): def ConfigWineBotton(): threading.Thread(target=RunWineProgram, args=["winecfg"]).start() -def RunWineProgram(wineProgram, history = False): +def RunWineProgram(wineProgram, history = False, Disbled = True): DisableButton(True) if e1.get() == "": wineBottonPath = get_home() + "/.wine" @@ -295,7 +296,8 @@ def RunWineProgram(wineProgram, history = False): write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", str(json.dumps(ListToDictionary(wineBottonHistory)))) # 将历史记录的数组转换为字典并写入 e1['value'] = findExeHistory e2['value'] = wineBottonHistory - DisableButton(False) + if Disbled: + DisableButton(False) def RunWinetricks(): DisableButton(True) @@ -326,7 +328,7 @@ def InstallMonoGecko(program): wineBottonPath = get_home() + "/.wine" else: wineBottonPath = e1.get() - os.system(f"deepin-terminal -C \"'{programPath}/InstallMono.py' '{wineBottonPath}' {wine[o1_text.get()]} {program}\" --keep-open") + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"'{programPath}/InstallMono.py' '{wineBottonPath}' {wine[o1_text.get()]} {program}\" --keep-open") DisableButton(False) def InstallNetFramework(): @@ -335,9 +337,190 @@ def InstallNetFramework(): wineBottonPath = get_home() + "/.wine" else: wineBottonPath = e1.get() - os.system(f"deepin-terminal -C \"'{programPath}/InstallNetFramework.py' '{wineBottonPath}' {wine[o1_text.get()]}\" --keep-open") + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"'{programPath}/InstallNetFramework.py' '{wineBottonPath}' {wine[o1_text.get()]}\" --keep-open") DisableButton(False) +def InstallVisualStudioCPlusPlus(): + DisableButton(True) + if e1.get() == "": + wineBottonPath = get_home() + "/.wine" + else: + wineBottonPath = e1.get() + os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"'{programPath}/InstallVisualCPlusPlus.py' '{wineBottonPath}' {wine[o1_text.get()]}\" --keep-open") + DisableButton(False) + +def BuildExeDeb(): + if e1.get() == "": + wineBottonPath = get_home() + "/.wine" + else: + wineBottonPath = e1.get() + threading.Thread(target=os.system, args=[f"python3 '{programPath}/deepin-wine-packager.py' '{wineBottonPath}' '{wine[o1_text.get()]}'"]).start() + +class GetDllFromWindowsISO: + wineBottonPath = get_home() + "/.wine" + isoPath = None#ttk.Entry() + dllList = None + message = None + dllFound = None + dllControl = None + foundButton = None + saveDll = None + setWineBotton = None + browser = None + mount = False + mountButton = None + def ShowWindow(): + DisableButton(True) + GetDllFromWindowsISO.message = tk.Toplevel() + if not e1.get() == "": + GetDllFromWindowsISO.wineBottonPath = e1.get() + ttk.Label(GetDllFromWindowsISO.message, text=f"""提示: + 目前本提取功能只支持 Windows XP 以及 Windows Server 2003 等老系统的官方安装镜像,只支持读取 i386 安装方法的安装镜像,不支持读取 wim、ghost 安装方式 + 以及不要拷贝/替换太多的 dll,否则可能会导致 wine 容器异常 + 最后,拷贝/替换 dll 后,建议点击下面“设置 wine 容器”按钮==》函数库 进行设置 +当前选择的 Wine 容器:{GetDllFromWindowsISO.wineBottonPath}""").grid(row=0, column=0, columnspan=3, sticky=tk.W) + ttk.Label(GetDllFromWindowsISO.message, text="ISO镜像:").grid(row=1, column=0, sticky=tk.W) + GetDllFromWindowsISO.isoPath = ttk.Combobox(GetDllFromWindowsISO.message, width=100) + GetDllFromWindowsISO.browser = ttk.Button(GetDllFromWindowsISO.message, text="浏览……", command=GetDllFromWindowsISO.Browser) + isoControl = ttk.Frame(GetDllFromWindowsISO.message) + GetDllFromWindowsISO.mountButton = ttk.Button(isoControl, text="读取/挂载ISO镜像", command=GetDllFromWindowsISO.MountDisk) + ttk.Button(isoControl, text="关闭/卸载ISO镜像", command=GetDllFromWindowsISO.UmountDisk).grid(row=0, column=1) + ttk.Label(GetDllFromWindowsISO.message, text="查找DLL\n(为空则代表不查找,\n将显示全部内容):").grid(row=3, column=0) + GetDllFromWindowsISO.dllFound = ttk.Combobox(GetDllFromWindowsISO.message, width=100) + GetDllFromWindowsISO.foundButton = ttk.Button(GetDllFromWindowsISO.message, text="查找", command=GetDllFromWindowsISO.Found) + GetDllFromWindowsISO.dllList = tk.Listbox(GetDllFromWindowsISO.message, width=100) + GetDllFromWindowsISO.dllControl = ttk.Frame(GetDllFromWindowsISO.message) + GetDllFromWindowsISO.saveDll = ttk.Button(GetDllFromWindowsISO.dllControl, text="保存到 wine 容器中", command=GetDllFromWindowsISO.CopyDll) + GetDllFromWindowsISO.setWineBotton = ttk.Button(GetDllFromWindowsISO.dllControl, text="设置 wine 容器", command=lambda: threading.Thread(target=RunWineProgram, args=["winecfg", False, False]).start()) + # 设置控件 + GetDllFromWindowsISO.DisbledDown(True) + GetDllFromWindowsISO.isoPath['value'] = isoPath + GetDllFromWindowsISO.dllFound['value'] = isoPathFound + # 显示控件 + GetDllFromWindowsISO.isoPath.grid(row=1, column=1) + GetDllFromWindowsISO.browser.grid(row=1, column=2) + GetDllFromWindowsISO.mountButton.grid(row=0, column=0) + isoControl.grid(row=2, column=0, columnspan=3) + GetDllFromWindowsISO.dllFound.grid(row=3, column=1) + GetDllFromWindowsISO.foundButton.grid(row=3, column=2) + GetDllFromWindowsISO.dllList.grid(row=4, column=0, columnspan=3) + GetDllFromWindowsISO.dllControl.grid(row=5, column=0, columnspan=3) + GetDllFromWindowsISO.saveDll.grid(row=0, column=0) + GetDllFromWindowsISO.setWineBotton.grid(row=0, column=1) + GetDllFromWindowsISO.message.protocol('WM_DELETE_WINDOW', GetDllFromWindowsISO.ExitWindow) + GetDllFromWindowsISO.message.mainloop() + + def DisbledUp(state): + nd = [tk.NORMAL, tk.DISABLED] + GetDllFromWindowsISO.isoPath.configure(state=nd[int(state)]) + GetDllFromWindowsISO.browser.configure(state=nd[int(state)]) + GetDllFromWindowsISO.mountButton.configure(state=nd[int(state)]) + + + def DisbledDown(state): + nd = [tk.NORMAL, tk.DISABLED] + GetDllFromWindowsISO.dllList.configure(state=nd[int(state)]) + GetDllFromWindowsISO.dllFound.configure(state=nd[int(state)]) + #GetDllFromWindowsISO.dllControl.configure(state=nd[int(state)]) + GetDllFromWindowsISO.saveDll.configure(state=nd[int(state)]) + GetDllFromWindowsISO.setWineBotton.configure(state=nd[int(state)]) + GetDllFromWindowsISO.foundButton.configure(state=nd[int(state)]) + + def Browser(): + path = tkinter.filedialog.askopenfilename(title="选择 ISO 镜像文件", + filetypes=[("ISO 镜像文件", "*.iso"), ("ISO 镜像文件", "*.ISO"), ("所有文件", "*.*")], + initialdir=json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindISO.json"))["path"]) + if path == None or path == "": + return + GetDllFromWindowsISO.isoPath.set(path) + write_txt(get_home() + "/.config/deepin-wine-runner/FindISO.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 + + def Found(): + found = GetDllFromWindowsISO.dllFound.get() + GetDllFromWindowsISO.dllList.configure(state=tk.NORMAL) + GetDllFromWindowsISO.dllList.delete(0, tk.END) + try: + if found == "": + for i in os.listdir("/tmp/wine-runner-getdll/i386"): + if i[-3:] == "dl_": + GetDllFromWindowsISO.dllList.insert("end", i[:-1] + "l") + return + for i in os.listdir("/tmp/wine-runner-getdll/i386"): + if found in i[:-1] + "l": + GetDllFromWindowsISO.dllList.insert("end", i[:-1] + "l") + isoPathFound.append(found) # 将记录写进数组 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json", str(json.dumps(ListToDictionary(isoPathFound)))) # 将历史记录的数组转换为字典并写入 + GetDllFromWindowsISO.dllFound['value'] = isoPathFound + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=traceback.format_exc()) + + + def ExitWindow(): + if GetDllFromWindowsISO.mount: + tkinter.messagebox.showinfo(title="提示", message="请关闭/卸载镜像后再关闭本窗口") + return + DisableButton(False) + GetDllFromWindowsISO.message.destroy() + + def MountDisk(): + if not os.path.exists(GetDllFromWindowsISO.isoPath.get()): + tkinter.messagebox.showerror(title="错误", message="您选择的 ISO 镜像文件不存在") + return + if os.path.exists("/tmp/wine-runner-getdll"): + try: + os.rmdir("/tmp/wine-runner-getdll") + except: + # 如果无法删除可能是挂载了文件 + os.system("pkexec umount /tmp/wine-runner-getdll") + try: + os.rmdir("/tmp/wine-runner-getdll") + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=traceback.format_exc()) + return + os.makedirs("/tmp/wine-runner-getdll") + GetDllFromWindowsISO.dllList.configure(state=tk.NORMAL) + os.system(f"pkexec mount '{GetDllFromWindowsISO.isoPath.get()}' /tmp/wine-runner-getdll") + GetDllFromWindowsISO.dllList.delete(0, tk.END) + try: + for i in os.listdir("/tmp/wine-runner-getdll/i386"): + if i[-3:] == "dl_": + GetDllFromWindowsISO.dllList.insert("end", i[:-1] + "l") + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=f"镜像内容读取/挂载失败,报错如下:\n{traceback.format_exc()}") + return + GetDllFromWindowsISO.DisbledDown(False) + GetDllFromWindowsISO.DisbledUp(True) + GetDllFromWindowsISO.mount = True + isoPath.append(GetDllFromWindowsISO.isoPath.get()) # 将记录写进数组 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPath.json", str(json.dumps(ListToDictionary(isoPath)))) # 将历史记录的数组转换为字典并写入 + GetDllFromWindowsISO.isoPath['value'] = isoPath + + def UmountDisk(): + os.system("pkexec umount /tmp/wine-runner-getdll") + GetDllFromWindowsISO.dllList.configure(state=tk.NORMAL) + try: + shutil.rmtree("/tmp/wine-runner-getdll") + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=f"关闭/卸载镜像失败,报错如下:\n{traceback.format_exc()}") + return + GetDllFromWindowsISO.DisbledDown(True) + GetDllFromWindowsISO.DisbledUp(False) + GetDllFromWindowsISO.mount = False + + def CopyDll(): + for i in GetDllFromWindowsISO.dllList.curselection(): + choose = GetDllFromWindowsISO.dllList.get(i) + if os.path.exists(f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}"): + if not tkinter.messagebox.askyesno(title="提示", message=f"DLL {choose} 已经存在,是否覆盖?"): + continue + print(i) + shutil.copy(f"/tmp/wine-runner-getdll/i386/{choose[:-1]}_", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}") + + ########################### # 加载配置 ########################### @@ -349,8 +532,14 @@ if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExeHistory.j write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", json.dumps({})) # 创建配置文件 if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", json.dumps({})) # 创建配置文件 +if not os.path.exists(get_home() + "/.config/deepin-wine-runner/ISOPath.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPath.json", json.dumps({})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json", json.dumps({})) # 写入(创建)一个配置文件 if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExe.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindISO.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/deepin-wine-runner/FindISO.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBotton.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/deepin-wine-runner/WineBotton.json", json.dumps({"path": "~/.deepinwine"})) # 写入(创建)一个配置文件 @@ -362,16 +551,18 @@ wine = {"deepin-wine": "deepin-wine", "deepin-wine5": "deepin-wine5", "wine": "w shellHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json")).values()) findExeHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json")).values()) wineBottonHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json")).values()) - +isoPath = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ISOPath.json")).values()) +isoPathFound = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json")).values()) ########################### # 程序信息 ########################### -iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0]) -programUrl = "https://gitee.com/gfdgd-xi/deep-wine-runner\nhttps://github.com/gfdgd-xi/deep-wine-runner\nhttps://www.gitlink.org.cn/gfdgd_xi/deep-wine-runner" -version = "1.5.1" -goodRunSystem = "Linux" programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +iconPath = "{}/icon.png".format(programPath) +programUrl = "https://gitee.com/gfdgd-xi/deep-wine-runner\nhttps://github.com/gfdgd-xi/deep-wine-runner\nhttps://www.gitlink.org.cn/gfdgd_xi/deep-wine-runner" +information = json.loads(readtxt(f"{programPath}/information.json")) +version = information["Version"] +goodRunSystem = "Linux" about = '''一个基于 Python3 的 tkinter 制作的 wine 运行器 版本:{} 适用平台:{} @@ -386,18 +577,14 @@ tips = '''提示: exe路径\' 参数 \' 即可(单引号需要输入) 5、wine 容器如果没有指定,则会默认为 ~/.wine''' -updateThingsString = '''※1、支持打开 spark-wine7-devel 的专门缩放设置(如未安装则此按钮禁用) -※2、支持提取选择的 exe 文件的图标 -※3、支持向指定的 wine 容器安装 mono、gecko、.net framework(此功能在菜单栏“Wine”中,卸载只需要使用程序的卸载按钮打开 Geek Uninstaller 即可) -※4、支持指定特定的 wine 容器调用 winetricks -※5、在没有指定 wine 容器的情况下,将自动设置为 ~/.wine -6、新增 ukylin-wine -7、将默认选择的 wine 改为 deepin-wine6 stable -8、支持打开指定容器的 winecfg、winver、regedit、taskmgr -9、双击使用 wine 运行器打开 exe(不知道能不能生效) +updateThingsString = '''※1、添加并翻新了 deepin-wine5 打包器,改为 wine 打包器,支持常见 wine 的打包 +※2、新增 Visual Studio C++ 的安装程序 +※3、新增从系统安装镜像提取 DLL 到 wine 容器的功能(当前只支持 Windows XP 和 Windows Server 2003 的官方安装镜像) +4、修复了安装星火应用商店的 wine 运行器右键打开方式没有 wine 运行器选项的问题 +5、新增脚本,优化 deepin terminal 调用本程序脚本显示不佳的问题 ''' title = "wine 运行器 {}".format(version) -updateTime = "2022年07月04日" +updateTime = "2022年07月06日" updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) @@ -446,7 +633,12 @@ programmenu.add_separator() # 设置分界线 programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项 wineOption = tk.Menu(menu, tearoff=0, background="white") # 设置“Wine”菜单栏 menu.add_cascade(label="Wine", menu=wineOption) +wineOption.add_command(label="打包 wine 应用", command=BuildExeDeb) +wineOption.add_separator() +wineOption.add_command(label="从镜像获取DLL(只支持Windows XP、Windows Server 2003官方安装镜像)", command=GetDllFromWindowsISO.ShowWindow) +wineOption.add_separator() wineOption.add_command(label="在指定wine、指定容器安装 .net framework", command=lambda: threading.Thread(target=InstallNetFramework).start()) +wineOption.add_command(label="在指定wine、指定容器安装 Visual Studio C++", command=lambda: threading.Thread(target=InstallVisualStudioCPlusPlus).start()) wineOption.add_command(label="在指定wine、指定容器安装 gecko", command=lambda: threading.Thread(target=InstallMonoGecko, args=["gecko"]).start()) wineOption.add_command(label="在指定wine、指定容器安装 mono", command=lambda: threading.Thread(target=InstallMonoGecko, args=["mono"]).start()) wineOption.add_command(label="打开指定wine、指定容器的注册表", command=lambda: threading.Thread(target=RunWineProgram, args=["regedit"]).start()) @@ -462,16 +654,16 @@ help.add_command(label="关于这个程序", command=about_this_program) # 设 # 设置窗口 win.iconphoto(False, tk.PhotoImage(file=iconPath)) themes = ttkthemes.ThemedStyle(win) -themes.set_theme("adapta") +themes.set_theme("breeze") win.config(bg="white") # 设置控件 if len(sys.argv) > 1 and sys.argv[1]: e1.set(f"{get_home()}/.wine") e2.set(sys.argv[1]) -menu.configure(activebackground="white") -programmenu.configure(activebackground="white") -wineOption.configure(activebackground="white") -help.configure(activebackground="white") +menu.configure(activebackground="dodgerblue") +programmenu.configure(activebackground="dodgerblue") +wineOption.configure(activebackground="dodgerblue") +help.configure(activebackground="dodgerblue") e1['value'] = findExeHistory e2['value'] = wineBottonHistory combobox1['value'] = shellHistory diff --git a/deb/opt/apps/deepin-wine-runner/dlls/gdi32.dll.so b/deb/opt/apps/deepin-wine-runner/dlls/gdi32.dll.so new file mode 100644 index 0000000..a982738 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/gdi32.dll.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/gdi32.so b/deb/opt/apps/deepin-wine-runner/dlls/gdi32.so new file mode 100644 index 0000000..5585f0d Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/gdi32.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/kernel32.dll.so b/deb/opt/apps/deepin-wine-runner/dlls/kernel32.dll.so new file mode 100644 index 0000000..41e815f Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/kernel32.dll.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/kernelbase.dll.so b/deb/opt/apps/deepin-wine-runner/dlls/kernelbase.dll.so new file mode 100644 index 0000000..83187d8 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/kernelbase.dll.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/sechost.dll.so b/deb/opt/apps/deepin-wine-runner/dlls/sechost.dll.so new file mode 100644 index 0000000..d98efad Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/sechost.dll.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/shell32.dll.so b/deb/opt/apps/deepin-wine-runner/dlls/shell32.dll.so new file mode 100644 index 0000000..7761c91 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/shell32.dll.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/user32.dll.so b/deb/opt/apps/deepin-wine-runner/dlls/user32.dll.so new file mode 100644 index 0000000..3e7f393 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/user32.dll.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/user32.so b/deb/opt/apps/deepin-wine-runner/dlls/user32.so new file mode 100644 index 0000000..f548270 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/user32.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/winebrowser.exe.so b/deb/opt/apps/deepin-wine-runner/dlls/winebrowser.exe.so new file mode 100644 index 0000000..3520019 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/winebrowser.exe.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/winex11.drv.so b/deb/opt/apps/deepin-wine-runner/dlls/winex11.drv.so new file mode 100644 index 0000000..892d829 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/winex11.drv.so differ diff --git a/deb/opt/apps/deepin-wine-runner/dlls/ws2_32.dll.so b/deb/opt/apps/deepin-wine-runner/dlls/ws2_32.dll.so new file mode 100644 index 0000000..e00c709 Binary files /dev/null and b/deb/opt/apps/deepin-wine-runner/dlls/ws2_32.dll.so differ diff --git a/deb/opt/apps/deepin-wine-runner/information.json b/deb/opt/apps/deepin-wine-runner/information.json new file mode 100644 index 0000000..3a1edf3 --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/information.json @@ -0,0 +1,3 @@ +{ + "Version": "1.5.2" +} \ No newline at end of file diff --git a/deb/opt/apps/deepin-wine-runner/launch.sh b/deb/opt/apps/deepin-wine-runner/launch.sh new file mode 100755 index 0000000..674905e --- /dev/null +++ b/deb/opt/apps/deepin-wine-runner/launch.sh @@ -0,0 +1,3 @@ +#!/bin/bash +XDG_CURRENT_DESKTOP="Deepin" +$1 -platformtheme deepin "$@" diff --git a/deb/usr/bin/deepin-wine-package-builder b/deb/usr/bin/deepin-wine-package-builder new file mode 120000 index 0000000..86e9a2d --- /dev/null +++ b/deb/usr/bin/deepin-wine-package-builder @@ -0,0 +1 @@ +/opt/apps/deepin-wine-runner/deepin-wine-packager.py \ No newline at end of file diff --git a/deb/usr/bin/deepin-wine-runner-wine-installer b/deb/usr/bin/deepin-wine-runner-wine-installer new file mode 120000 index 0000000..43deece --- /dev/null +++ b/deb/usr/bin/deepin-wine-runner-wine-installer @@ -0,0 +1 @@ +/opt/apps/deepin-wine-runner/wine install \ No newline at end of file diff --git a/deb/usr/bin/deepin-wine-runner-wine-monogecko-installer b/deb/usr/bin/deepin-wine-runner-wine-monogecko-installer new file mode 120000 index 0000000..568aac9 --- /dev/null +++ b/deb/usr/bin/deepin-wine-runner-wine-monogecko-installer @@ -0,0 +1 @@ +/opt/apps/deepin-wine-runner/InstallMono.py \ No newline at end of file diff --git a/deb/usr/bin/deepin-wine-runner-wine-netframework-installer b/deb/usr/bin/deepin-wine-runner-wine-netframework-installer new file mode 120000 index 0000000..dd9b7e9 --- /dev/null +++ b/deb/usr/bin/deepin-wine-runner-wine-netframework-installer @@ -0,0 +1 @@ +/opt/apps/deepin-wine-runner/InstallNetFramework.py \ No newline at end of file diff --git a/deb/usr/bin/deepin-wine-runner-wine-vscppruntime-installer b/deb/usr/bin/deepin-wine-runner-wine-vscppruntime-installer new file mode 120000 index 0000000..ec2afc4 --- /dev/null +++ b/deb/usr/bin/deepin-wine-runner-wine-vscppruntime-installer @@ -0,0 +1 @@ +/opt/apps/deepin-wine-runner/InstallVisualCPlusPlus.py \ No newline at end of file diff --git a/deb/usr/share/polkit-1/actions/com.deepin.pkexec.mount.policy b/deb/usr/share/polkit-1/actions/com.deepin.pkexec.mount.policy new file mode 100644 index 0000000..781bb5b --- /dev/null +++ b/deb/usr/share/polkit-1/actions/com.deepin.pkexec.mount.policy @@ -0,0 +1,21 @@ + + + + gfdgd xi + https://gitee.com/gfdgd-xi/deep-wine-runner/ + + Authentication is required to mount file + 挂载文件需要输入密码 + preferences-system + + no + no + auth_admin_keep + + /usr/bin/mount + true + + + \ No newline at end of file diff --git a/deb/usr/share/polkit-1/actions/com.deepin.pkexec.umount.policy b/deb/usr/share/polkit-1/actions/com.deepin.pkexec.umount.policy new file mode 100644 index 0000000..3112069 --- /dev/null +++ b/deb/usr/share/polkit-1/actions/com.deepin.pkexec.umount.policy @@ -0,0 +1,21 @@ + + + + gfdgd xi + https://gitee.com/gfdgd-xi/deep-wine-runner/ + + Authentication is required to unmount file + 卸载文件需要输入密码 + preferences-system + + no + no + auth_admin_keep + + /usr/bin/umount + true + + + \ No newline at end of file diff --git a/deepin-wine-packager.py b/deepin-wine-packager.py index a267e92..2cab876 100755 --- a/deepin-wine-packager.py +++ b/deepin-wine-packager.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 ######################################################################### -# 作者:gfdgd xi +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布 # 版本:1.5.2 # 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 tkinter 构建 diff --git a/main.py b/main.py index 2c261ca..079ee56 100755 --- a/main.py +++ b/main.py @@ -3,7 +3,7 @@ ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 # 版本:1.5.2 -# 更新时间:2022年07月05日 +# 更新时间:2022年07月06日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 tkinter 构建 ########################################################################################### @@ -16,6 +16,7 @@ import time import json import shutil import threading +import traceback import ttkthemes import webbrowser import subprocess @@ -266,7 +267,7 @@ def UninstallProgram_threading(): def ConfigWineBotton(): threading.Thread(target=RunWineProgram, args=["winecfg"]).start() -def RunWineProgram(wineProgram, history = False): +def RunWineProgram(wineProgram, history = False, Disbled = True): DisableButton(True) if e1.get() == "": wineBottonPath = get_home() + "/.wine" @@ -295,7 +296,8 @@ def RunWineProgram(wineProgram, history = False): write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", str(json.dumps(ListToDictionary(wineBottonHistory)))) # 将历史记录的数组转换为字典并写入 e1['value'] = findExeHistory e2['value'] = wineBottonHistory - DisableButton(False) + if Disbled: + DisableButton(False) def RunWinetricks(): DisableButton(True) @@ -354,6 +356,171 @@ def BuildExeDeb(): wineBottonPath = e1.get() threading.Thread(target=os.system, args=[f"python3 '{programPath}/deepin-wine-packager.py' '{wineBottonPath}' '{wine[o1_text.get()]}'"]).start() +class GetDllFromWindowsISO: + wineBottonPath = get_home() + "/.wine" + isoPath = None#ttk.Entry() + dllList = None + message = None + dllFound = None + dllControl = None + foundButton = None + saveDll = None + setWineBotton = None + browser = None + mount = False + mountButton = None + def ShowWindow(): + DisableButton(True) + GetDllFromWindowsISO.message = tk.Toplevel() + if not e1.get() == "": + GetDllFromWindowsISO.wineBottonPath = e1.get() + ttk.Label(GetDllFromWindowsISO.message, text=f"""提示: + 目前本提取功能只支持 Windows XP 以及 Windows Server 2003 等老系统的官方安装镜像,只支持读取 i386 安装方法的安装镜像,不支持读取 wim、ghost 安装方式 + 以及不要拷贝/替换太多的 dll,否则可能会导致 wine 容器异常 + 最后,拷贝/替换 dll 后,建议点击下面“设置 wine 容器”按钮==》函数库 进行设置 +当前选择的 Wine 容器:{GetDllFromWindowsISO.wineBottonPath}""").grid(row=0, column=0, columnspan=3, sticky=tk.W) + ttk.Label(GetDllFromWindowsISO.message, text="ISO镜像:").grid(row=1, column=0, sticky=tk.W) + GetDllFromWindowsISO.isoPath = ttk.Combobox(GetDllFromWindowsISO.message, width=100) + GetDllFromWindowsISO.browser = ttk.Button(GetDllFromWindowsISO.message, text="浏览……", command=GetDllFromWindowsISO.Browser) + isoControl = ttk.Frame(GetDllFromWindowsISO.message) + GetDllFromWindowsISO.mountButton = ttk.Button(isoControl, text="读取/挂载ISO镜像", command=GetDllFromWindowsISO.MountDisk) + ttk.Button(isoControl, text="关闭/卸载ISO镜像", command=GetDllFromWindowsISO.UmountDisk).grid(row=0, column=1) + ttk.Label(GetDllFromWindowsISO.message, text="查找DLL\n(为空则代表不查找,\n将显示全部内容):").grid(row=3, column=0) + GetDllFromWindowsISO.dllFound = ttk.Combobox(GetDllFromWindowsISO.message, width=100) + GetDllFromWindowsISO.foundButton = ttk.Button(GetDllFromWindowsISO.message, text="查找", command=GetDllFromWindowsISO.Found) + GetDllFromWindowsISO.dllList = tk.Listbox(GetDllFromWindowsISO.message, width=100) + GetDllFromWindowsISO.dllControl = ttk.Frame(GetDllFromWindowsISO.message) + GetDllFromWindowsISO.saveDll = ttk.Button(GetDllFromWindowsISO.dllControl, text="保存到 wine 容器中", command=GetDllFromWindowsISO.CopyDll) + GetDllFromWindowsISO.setWineBotton = ttk.Button(GetDllFromWindowsISO.dllControl, text="设置 wine 容器", command=lambda: threading.Thread(target=RunWineProgram, args=["winecfg", False, False]).start()) + # 设置控件 + GetDllFromWindowsISO.DisbledDown(True) + GetDllFromWindowsISO.isoPath['value'] = isoPath + GetDllFromWindowsISO.dllFound['value'] = isoPathFound + # 显示控件 + GetDllFromWindowsISO.isoPath.grid(row=1, column=1) + GetDllFromWindowsISO.browser.grid(row=1, column=2) + GetDllFromWindowsISO.mountButton.grid(row=0, column=0) + isoControl.grid(row=2, column=0, columnspan=3) + GetDllFromWindowsISO.dllFound.grid(row=3, column=1) + GetDllFromWindowsISO.foundButton.grid(row=3, column=2) + GetDllFromWindowsISO.dllList.grid(row=4, column=0, columnspan=3) + GetDllFromWindowsISO.dllControl.grid(row=5, column=0, columnspan=3) + GetDllFromWindowsISO.saveDll.grid(row=0, column=0) + GetDllFromWindowsISO.setWineBotton.grid(row=0, column=1) + GetDllFromWindowsISO.message.protocol('WM_DELETE_WINDOW', GetDllFromWindowsISO.ExitWindow) + GetDllFromWindowsISO.message.mainloop() + + def DisbledUp(state): + nd = [tk.NORMAL, tk.DISABLED] + GetDllFromWindowsISO.isoPath.configure(state=nd[int(state)]) + GetDllFromWindowsISO.browser.configure(state=nd[int(state)]) + GetDllFromWindowsISO.mountButton.configure(state=nd[int(state)]) + + + def DisbledDown(state): + nd = [tk.NORMAL, tk.DISABLED] + GetDllFromWindowsISO.dllList.configure(state=nd[int(state)]) + GetDllFromWindowsISO.dllFound.configure(state=nd[int(state)]) + #GetDllFromWindowsISO.dllControl.configure(state=nd[int(state)]) + GetDllFromWindowsISO.saveDll.configure(state=nd[int(state)]) + GetDllFromWindowsISO.setWineBotton.configure(state=nd[int(state)]) + GetDllFromWindowsISO.foundButton.configure(state=nd[int(state)]) + + def Browser(): + path = tkinter.filedialog.askopenfilename(title="选择 ISO 镜像文件", + filetypes=[("ISO 镜像文件", "*.iso"), ("ISO 镜像文件", "*.ISO"), ("所有文件", "*.*")], + initialdir=json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindISO.json"))["path"]) + if path == None or path == "": + return + GetDllFromWindowsISO.isoPath.set(path) + write_txt(get_home() + "/.config/deepin-wine-runner/FindISO.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件 + + def Found(): + found = GetDllFromWindowsISO.dllFound.get() + GetDllFromWindowsISO.dllList.configure(state=tk.NORMAL) + GetDllFromWindowsISO.dllList.delete(0, tk.END) + try: + if found == "": + for i in os.listdir("/tmp/wine-runner-getdll/i386"): + if i[-3:] == "dl_": + GetDllFromWindowsISO.dllList.insert("end", i[:-1] + "l") + return + for i in os.listdir("/tmp/wine-runner-getdll/i386"): + if found in i[:-1] + "l": + GetDllFromWindowsISO.dllList.insert("end", i[:-1] + "l") + isoPathFound.append(found) # 将记录写进数组 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json", str(json.dumps(ListToDictionary(isoPathFound)))) # 将历史记录的数组转换为字典并写入 + GetDllFromWindowsISO.dllFound['value'] = isoPathFound + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=traceback.format_exc()) + + + def ExitWindow(): + if GetDllFromWindowsISO.mount: + tkinter.messagebox.showinfo(title="提示", message="请关闭/卸载镜像后再关闭本窗口") + return + DisableButton(False) + GetDllFromWindowsISO.message.destroy() + + def MountDisk(): + if not os.path.exists(GetDllFromWindowsISO.isoPath.get()): + tkinter.messagebox.showerror(title="错误", message="您选择的 ISO 镜像文件不存在") + return + if os.path.exists("/tmp/wine-runner-getdll"): + try: + os.rmdir("/tmp/wine-runner-getdll") + except: + # 如果无法删除可能是挂载了文件 + os.system("pkexec umount /tmp/wine-runner-getdll") + try: + os.rmdir("/tmp/wine-runner-getdll") + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=traceback.format_exc()) + return + os.makedirs("/tmp/wine-runner-getdll") + GetDllFromWindowsISO.dllList.configure(state=tk.NORMAL) + os.system(f"pkexec mount '{GetDllFromWindowsISO.isoPath.get()}' /tmp/wine-runner-getdll") + GetDllFromWindowsISO.dllList.delete(0, tk.END) + try: + for i in os.listdir("/tmp/wine-runner-getdll/i386"): + if i[-3:] == "dl_": + GetDllFromWindowsISO.dllList.insert("end", i[:-1] + "l") + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=f"镜像内容读取/挂载失败,报错如下:\n{traceback.format_exc()}") + return + GetDllFromWindowsISO.DisbledDown(False) + GetDllFromWindowsISO.DisbledUp(True) + GetDllFromWindowsISO.mount = True + isoPath.append(GetDllFromWindowsISO.isoPath.get()) # 将记录写进数组 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPath.json", str(json.dumps(ListToDictionary(isoPath)))) # 将历史记录的数组转换为字典并写入 + GetDllFromWindowsISO.isoPath['value'] = isoPath + + def UmountDisk(): + os.system("pkexec umount /tmp/wine-runner-getdll") + GetDllFromWindowsISO.dllList.configure(state=tk.NORMAL) + try: + shutil.rmtree("/tmp/wine-runner-getdll") + except: + traceback.print_exc() + tkinter.messagebox.showerror(title="错误", message=f"关闭/卸载镜像失败,报错如下:\n{traceback.format_exc()}") + return + GetDllFromWindowsISO.DisbledDown(True) + GetDllFromWindowsISO.DisbledUp(False) + GetDllFromWindowsISO.mount = False + + def CopyDll(): + for i in GetDllFromWindowsISO.dllList.curselection(): + choose = GetDllFromWindowsISO.dllList.get(i) + if os.path.exists(f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}"): + if not tkinter.messagebox.askyesno(title="提示", message=f"DLL {choose} 已经存在,是否覆盖?"): + continue + print(i) + shutil.copy(f"/tmp/wine-runner-getdll/i386/{choose[:-1]}_", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}") + + ########################### # 加载配置 ########################### @@ -365,8 +532,14 @@ if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExeHistory.j write_txt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json", json.dumps({})) # 创建配置文件 if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json", json.dumps({})) # 创建配置文件 +if not os.path.exists(get_home() + "/.config/deepin-wine-runner/ISOPath.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPath.json", json.dumps({})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json", json.dumps({})) # 写入(创建)一个配置文件 if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindExe.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/deepin-wine-runner/FindExe.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 +if not os.path.exists(get_home() + "/.config/deepin-wine-runner/FindISO.json"): # 如果没有配置文件 + write_txt(get_home() + "/.config/deepin-wine-runner/FindISO.json", json.dumps({"path": "~"})) # 写入(创建)一个配置文件 if not os.path.exists(get_home() + "/.config/deepin-wine-runner/WineBotton.json"): # 如果没有配置文件 write_txt(get_home() + "/.config/deepin-wine-runner/WineBotton.json", json.dumps({"path": "~/.deepinwine"})) # 写入(创建)一个配置文件 @@ -378,7 +551,8 @@ wine = {"deepin-wine": "deepin-wine", "deepin-wine5": "deepin-wine5", "wine": "w shellHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ShellHistory.json")).values()) findExeHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/FindExeHistory.json")).values()) wineBottonHistory = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/WineBottonHistory.json")).values()) - +isoPath = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ISOPath.json")).values()) +isoPathFound = list(json.loads(readtxt(get_home() + "/.config/deepin-wine-runner/ISOPathFound.json")).values()) ########################### # 程序信息 @@ -403,18 +577,14 @@ tips = '''提示: exe路径\' 参数 \' 即可(单引号需要输入) 5、wine 容器如果没有指定,则会默认为 ~/.wine''' -updateThingsString = '''※1、支持打开 spark-wine7-devel 的专门缩放设置(如未安装则此按钮禁用) -※2、支持提取选择的 exe 文件的图标 -※3、支持向指定的 wine 容器安装 mono、gecko、.net framework(此功能在菜单栏“Wine”中,卸载只需要使用程序的卸载按钮打开 Geek Uninstaller 即可) -※4、支持指定特定的 wine 容器调用 winetricks -※5、在没有指定 wine 容器的情况下,将自动设置为 ~/.wine -6、新增 ukylin-wine -7、将默认选择的 wine 改为 deepin-wine6 stable -8、支持打开指定容器的 winecfg、winver、regedit、taskmgr -9、双击使用 wine 运行器打开 exe(不知道能不能生效) +updateThingsString = '''※1、添加并翻新了 deepin-wine5 打包器,改为 wine 打包器,支持常见 wine 的打包 +※2、新增 Visual Studio C++ 的安装程序 +※3、新增从系统安装镜像提取 DLL 到 wine 容器的功能(当前只支持 Windows XP 和 Windows Server 2003 的官方安装镜像) +4、修复了安装星火应用商店的 wine 运行器右键打开方式没有 wine 运行器选项的问题 +5、新增脚本,优化 deepin terminal 调用本程序脚本显示不佳的问题 ''' title = "wine 运行器 {}".format(version) -updateTime = "2022年07月05日" +updateTime = "2022年07月06日" updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) @@ -465,6 +635,8 @@ wineOption = tk.Menu(menu, tearoff=0, background="white") # 设置“Wine”菜 menu.add_cascade(label="Wine", menu=wineOption) wineOption.add_command(label="打包 wine 应用", command=BuildExeDeb) wineOption.add_separator() +wineOption.add_command(label="从镜像获取DLL(只支持Windows XP、Windows Server 2003官方安装镜像)", command=GetDllFromWindowsISO.ShowWindow) +wineOption.add_separator() wineOption.add_command(label="在指定wine、指定容器安装 .net framework", command=lambda: threading.Thread(target=InstallNetFramework).start()) wineOption.add_command(label="在指定wine、指定容器安装 Visual Studio C++", command=lambda: threading.Thread(target=InstallVisualStudioCPlusPlus).start()) wineOption.add_command(label="在指定wine、指定容器安装 gecko", command=lambda: threading.Thread(target=InstallMonoGecko, args=["gecko"]).start())