Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d105f85510 | |||
| 8057f2a596 | |||
| 74831ea4c2 | |||
| bcaae02aec | |||
| 4b889b6056 | |||
| 76d3710963 | |||
| 89aa00ebf5 | |||
| a2038ac40e | |||
| 530c3ad384 | |||
| c9a1316022 | |||
| f5b04826c2 | |||
| 9d1f3e8176 | |||
| a80397ee9e | |||
| deec28ce83 | |||
| 4dd48b5273 | |||
| a28f4e6ba9 | |||
| 3ba28b053d | |||
| becf3200ec | |||
| db206335b1 | |||
| a1eee38deb | |||
| 67f8d2beca | |||
| d01423853a | |||
| d486fa55d8 | |||
|
|
73d1e3b484 | ||
| ce52b8579a | |||
| fcc37f707e | |||
| 908177b69d | |||
| 89702f681e | |||
| 7786c7b855 | |||
|
|
2c75309d75 |
373
LICENSE
Executable file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
201
README.md
Normal file → Executable file
@@ -1,86 +1,203 @@
|
||||
# 我图标的获取有问题,继续深造去了(为什么图标是xml),可以使用其他替代品,链接:https://bbs.deepin.org/zh/post/222874
|
||||
# uengine 运行器 1.4.3
|
||||
|
||||
# uengine 运行器 1.2.1
|
||||
### 介绍
|
||||
新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。
|
||||

|
||||
(测试平台:UOS 家庭版,deepin 20.2.2,UOS 专业版 1040)
|
||||
(自己美术功底太差,图标直接用 anbox 的了)
|
||||
|
||||
#### 介绍
|
||||
### 更新内容
|
||||
#### V1.4.3(2021-09-11,开学第一版):
|
||||
此版本在受伤宅家期间写的
|
||||
**※1、支持打包器打包的包名带前缀“uengine-dc”**
|
||||
**※2、修复了两种情况可能导致程序卡住/出错无法继续运行的情况(配置文件夹不齐全和获取版本信息卡住两种情况)**
|
||||
**※3、修改了 UEngine 打包器打包的应用包名可能有大写的情况**
|
||||
4、支持一键使用 Scrcpy 连接 UEngine(①先安装 adb 破解补丁;②请确保是使用snap安装的 Scrcpy【目前只支持 snap 安装的 Scrcpy 进行连接】)
|
||||
5、支持右键打包 apk
|
||||

|
||||
|
||||
使用 Python3 的 tkinter 构建
|
||||
#### V1.4.2(2021-08-30,快开学了):
|
||||
**※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;**
|
||||
2、菜单栏的项目添加以及外观优化;
|
||||
3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;
|
||||
4、把 uengine 改为 UEngine;
|
||||
5、修改 pkexec 获取密码时显示的图标和文本;
|
||||
6、添加了 UEngine 系统设置的快捷方式;
|
||||

|
||||
|
||||
(测试平台:UOS 家庭版,deepin 20.2.2 待测试)
|
||||
#### V1.4.1(2021-08-26):
|
||||
**※1、初步支持键盘映射**
|
||||
2、修复新版包在发送uengine列表快捷方式时会提示找不到文件
|
||||

|
||||
|
||||
(自己美术功底太差,图标直接用 anbox 的了)
|
||||
#### V1.4.0(2021-08-19):
|
||||
**※1、添加新版打包方式(deepin打包方式);**
|
||||
**※2、支持测试运行/创建/删除uengine图标;**
|
||||
**※3、支持提取安装的apk;**
|
||||
**※4、支持打包deb包;**
|
||||
5、修改菜单栏布局;
|
||||
6、支持打开uengine数据目录和用户数据目录;
|
||||
7、程序信息保存到json,非直接写入程序本体;
|
||||
8、更多命令操作;
|
||||

|
||||
|
||||
#### 软件架构
|
||||
i386 和 amd64
|
||||
#### V1.3.2(2021-08-16):
|
||||
**※1、支持uengine数据重置;**
|
||||
**※2、支持修改uengine网络桥接的启动状态;**
|
||||
**※3、支持右键安装/卸载;**
|
||||
**※4、支持启用或禁用uengine;**
|
||||
**※5、修复打包问题,不会出现“dpkg:警告:卸载spark-uengine-runner时,目录/opt/apps/uengine-runner非空,因而不会删除该目录”的错误;**
|
||||

|
||||
|
||||
#### 更新内容
|
||||
#### V1.3.1(2021-08-12):
|
||||
**※1、修复打包问题,防止部分用户安装出错的问题;**
|
||||
**※2、修复了程序无法提取图标时可以提取默认图标使用;**
|
||||

|
||||
|
||||
1.2.1更新内容:
|
||||
#### V1.3.0(2021-08-08):
|
||||
**※1、修改了界面布局;**
|
||||
**※2、修复大多数新安装普通用户的路图标及启动菜单文件路径不存在导致安装APK报错的bugs;**
|
||||
3、删除少量冗余代码,调整代码顺序;
|
||||
4、支持提取 apk 图标。
|
||||

|
||||
|
||||
※1、进行了安装方式的修改(不使用 adb),修复原无法安装和卸载的问题;
|
||||
#### V1.2.3(2021-08-02):
|
||||
1、调整部分控件名称;
|
||||
2、调整界面布局及界面风格;
|
||||

|
||||
|
||||
2、进行了部分优化;
|
||||
#### V1.2.2(2021-07-11):
|
||||
1、对程序错误的显示更加人性化;
|
||||
2、对 icon 的获取方式进行了升级;
|
||||
3、增加了注释、删除部分冗余代码。
|
||||

|
||||
|
||||
3、进行了功能缩水;
|
||||
#### V1.2.1(2021-07-02):
|
||||
**※1、进行了安装方式的修改(不使用 adb),修复原无法安装和卸载的问题;**
|
||||
2、进行了部分优化;
|
||||
3、进行了功能缩水;
|
||||
4、修复 deb 打包错误。
|
||||

|
||||
|
||||
4、修复 deb 打包错误。
|
||||
#### V1.2.0(2021-06-06):
|
||||
1、支持安装自动添加快捷方式、卸载删除快捷方式;
|
||||
2、支持使用包名或 APK 文件卸载程序;
|
||||
3、支持查看安装的所有包名;
|
||||
4、进行了部分优化
|
||||

|
||||
|
||||
1.2.0更新内容:
|
||||
#### V1.1.0(2021-05-30):
|
||||
1、修改了因编写时出现的中、英文混用的情况
|
||||
2、支持一键连接默认 IP
|
||||
3、修复在不连接设备直接选择 apk 安装时会卡住的问题
|
||||
4、修复在把“uengine 程序菜单”发送到桌面或启动器如果询问覆盖时点击取消会卡住的问题
|
||||
5、修改了程序界面为白色调,不和标题栏冲突矛盾
|
||||

|
||||
|
||||
1、支持安装自动添加快捷方式、卸载删除快捷方式;
|
||||
|
||||
2、支持使用包名或 APK 文件卸载程序;
|
||||
|
||||
3、支持查看安装的所有包名;
|
||||
|
||||
4、进行了部分优化
|
||||
|
||||
|
||||
#### 源码安装教程
|
||||
#### V1.0.0(2021-05-29):
|
||||

|
||||
|
||||
### 源码安装教程
|
||||
按下 <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>T</kbd> 打开终端,按以下内容操作:
|
||||
1. 安装所需依赖
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo apt install python3 python3-tk git python3-pip aapt uengine
|
||||
pip3 install pillow
|
||||
pip3 install ttkthemes
|
||||
pip3 install pillow -U
|
||||
pip3 install ttkthemes -U
|
||||
python3 -m pip install ttkthemes
|
||||
```
|
||||
|
||||
2. 下载本程序
|
||||
|
||||
```
|
||||
```bash
|
||||
git clone https://gitee.com/gfdgd-xi/uengine-runner.git
|
||||
```
|
||||
|
||||
3. 运行本程序
|
||||
|
||||
```
|
||||
sudo cp uengine-runner /opt/apps -rv
|
||||
```bash
|
||||
sudo mkdir /opt/apps/uengine-runner
|
||||
sudo cp uengine-runner /opt/apps/uengine-runner -rv
|
||||
sudo cp getxmlimg.py /opt/apps/uengine-runner -rv
|
||||
sudo cp icon.png /opt/apps/uengine-runner -rv
|
||||
chmod 777 /opt/apps/uengine-runner/main.py
|
||||
sudo cp /opt/apps/uengine-runner/main.py /usr/bin/uengine-runner
|
||||
./main.py
|
||||
```
|
||||
|
||||
4. 卸载本程序
|
||||
```
|
||||
```bash
|
||||
sudo rm /usr/bin/uengine-runner -v
|
||||
sudo rm /opt/apps/uengine-runner/ -rfv
|
||||
pip3 uninstall pillow
|
||||
pip3 uninstall ttkthemes
|
||||
```
|
||||
|
||||
#### 使用说明
|
||||
### 使用说明
|
||||
1、需要你有使用 root 权限的能力;
|
||||
2、需要安装 UEngine 才能使用,UOS建议在商店安装一个安卓应用,让系统自动安装 UEngine 及相关的依赖包;
|
||||
3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;
|
||||
4、如果报错是有关产生 .deksotp 文件有关,一般可以打开程序列表运行。如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。
|
||||
|
||||
提示:
|
||||
1、需要你有使用 root 权限的能力;
|
||||
### 故障排除
|
||||
提 issue 最好,当然有些问题自己无法解决,请大佬 push 一下
|
||||
如果出现故障,尝试终端运行,如果是可以自行解决的问题,就**自行解决**,如果可以就**提 issues 并提供解决方案**,不行就**提 isscue 并提供程序和终端报错以及程序版本**
|
||||
|
||||
2、需要安装 uengine 才能使用。
|
||||
### 下载量
|
||||
这里只统计蓝奏云的下载量,链接(每周更新一次):
|
||||
[https://kdocs.cn/l/smrvazWGuKcY](https://kdocs.cn/l/smrvazWGuKcY)
|
||||
|
||||
如果想要连接其他手机,请使用 1.2.0 以前的版本,可以使用 adb 连接。
|
||||
### 已知问题
|
||||
<p align="center"><img src='https://bbs.deepin.org/assets/image/raccoon/[sad].gif'></p>
|
||||
|
||||

|
||||
部分 app 无法读取出图片,已知:
|
||||
| 程序 | 下载链接 |
|
||||
| :-: | :-: |
|
||||
| Firefox For Android | https://www.firefox.com.cn/download/ |
|
||||
| 网易云音乐 For Android | https://music.163.com/#/download |
|
||||
| 抖音 | https://www.wandoujia.com/apps/7461948 |
|
||||
| 360 手机浏览器 | https://mse.360.cn/ |
|
||||
| E-Go | 忘了 |
|
||||
| 其他待测试…… | 其他待测试…… |
|
||||
**注意:提取不出图标不代表未安装成功!**
|
||||
|
||||
|
||||
#### 特技
|
||||
### 贡献
|
||||
<p align="center"><img src='https://bbs.deepin.org/assets/image/raccoon/blush.gif'></p>
|
||||
|
||||
……
|
||||
非常欢迎大家的贡献
|
||||
贡献的开发者列表:
|
||||
| 开发者 | 邮箱 |
|
||||
| :-: | :-: |
|
||||
| gfdgd xi | 3025613752@qq.com |
|
||||
| actionchen | 917981399@qq.com |
|
||||
|
||||
### 相关项目
|
||||
| 项目名称 | 项目地址 |
|
||||
| :-: | :-:|
|
||||
| uengine-installer | https://gitee.com/Maicss/uengine-installer |
|
||||
| uengine APK 打包器 | https://gitee.com/gfdgd-xi/uengine-apk-builder |
|
||||
|
||||
### 附测试生成图标无问题列表:
|
||||
**至于能不能用就不测试了,这暂时不是重点**
|
||||
| 程序 | 下载链接 |
|
||||
|:-:|:-:|
|
||||
| QQ 全家桶(完整版、极速版、Android Pad 版) | https://im.qq.com |
|
||||
| TIM | 忘了 |
|
||||
| 微信 | https://weixin.qq.com |
|
||||
| 百度翻译 | 忘了 |
|
||||
| 百度网盘 | https://pan.baidu.com |
|
||||
| 腾讯课堂 | 忘了 |
|
||||
| 抖音极速版 | 忘了 |
|
||||
| 豌豆荚 | 忘了 |
|
||||
| 小猿口算 | 忘了 |
|
||||
| Hyperbowl | 忘了 |
|
||||
| bilibili | https://d.bilibili.com/download_app.html?bsource=app_bili |
|
||||
| 蓝奏云 | https://up.woozooo.com/lanzouh5.apk |
|
||||
| QQ 音乐(完整版、Android Pad 版、TV 版、车载版) | https://y.qq.com/download/index.html |
|
||||
| 360 手机卫士(完整版、极速版) | https://shouji.360.cn/v6/index.html |
|
||||
| 360 清理大师(稳定版、尝鲜版) | http://shouji.360.cn/360cleandroid/ |
|
||||
| 360 手机助手 | http://sj.360.cn/index.html |
|
||||
| WPS Office For Android | https://www.wps.cn/ |
|
||||
| 钉钉 for android | https://page.dingtalk.com/wow/dingtalk/act/download?spm=a3140.8196062.0.0.6f4c5c3dWBhYUM |
|
||||
|
||||
### ©2021-2021
|
||||
6
UengineAndroidProgramList.desktop
Normal file → Executable file
@@ -1,11 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Categories=System;
|
||||
Comment=uengine(anbox) 程序菜单
|
||||
Comment=UEngine 程序菜单
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
MimeType=
|
||||
Name=uengine 程序菜单
|
||||
StartupWMClass=uengine 程序菜单
|
||||
Name=UEngine 程序菜单
|
||||
StartupWMClass=UEngine 程序菜单
|
||||
Terminal=false
|
||||
Type=Application
|
||||
|
||||
BIN
__pycache__/getxmlimg.cpython-37.pyc
Normal file
@@ -1,9 +1,10 @@
|
||||
Package: spark-uengine-runner
|
||||
Version: 1.2.2
|
||||
Maintainer: gfdgd xi <3025613752@qq.com>
|
||||
Homepage: https://gitee.com/gfdgd-xi/uengine-runner
|
||||
Version: 1.4.3
|
||||
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>
|
||||
Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner]
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Depends: python3, python3-tk, python3-pip, aapt, uengine
|
||||
Description: gfdgd xi make's uengine runner
|
||||
Conflicts: com.gitee.uengine.runner.spark, spark-uengine-apk-builder
|
||||
Depends: python3, python3-tk, python3-pip, aapt, uengine, python3-pil, python3-setuptools, deepin-terminal
|
||||
Description: UEngine Runner for deepin and UOS
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# !/bin/sh
|
||||
python3 -m pip install --upgrade pillow >> /tmp/uengine-runner.temp.install.log
|
||||
python3 -m pip install --upgrade ttkthemes >> /tmp/uengine-runner.temp.install.log
|
||||
#!/bin/sh
|
||||
python3 -m pip install --upgrade ttkthemes
|
||||
python3 -m pip install --upgrade pyautogui
|
||||
python3 -m pip install --upgrade keyboard
|
||||
python3 -m pip install --upgrade requests
|
||||
|
||||
373
build/opt/apps/uengine-runner/LICENSE
Executable file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
@@ -1,46 +0,0 @@
|
||||
# uengine 运行器
|
||||
|
||||
#### 介绍
|
||||
|
||||
使用 Python3 的 tkinter 构建
|
||||
|
||||
(测试平台:UOS 家庭版)
|
||||
|
||||
(自己美术功底太差,图标直接用 anbox 的了)
|
||||
|
||||
#### 软件架构
|
||||
i386 和 amd64
|
||||
|
||||
|
||||
#### 源码安装教程
|
||||
|
||||
1. 安装所需依赖
|
||||
|
||||
```
|
||||
sudo apt install python3 python3-tk git adb
|
||||
```
|
||||
|
||||
2. 下载本程序
|
||||
|
||||
```
|
||||
git clone https://gitee.com/gfdgd-xi/uengine-runner.git
|
||||
```
|
||||
|
||||
3. 运行本程序
|
||||
|
||||
```
|
||||
cd uengine-runner
|
||||
chmod 777 main.py
|
||||
./main.py
|
||||
```
|
||||
|
||||
|
||||
#### 使用说明
|
||||
|
||||
提示:
|
||||
|
||||
None
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
0
build/opt/apps/uengine-runner/UengineAndroidProgramList.desktop
Normal file → Executable file
BIN
build/opt/apps/uengine-runner/defult.png
Executable file
|
After Width: | Height: | Size: 312 KiB |
118
build/opt/apps/uengine-runner/getxmlimg.py
Executable file
@@ -0,0 +1,118 @@
|
||||
import PIL.Image as Image
|
||||
import PIL.ImageDraw as ImageDraw
|
||||
import zipfile
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
class getsavexml():
|
||||
|
||||
def savexml(self,apkFilePath,xmlpath,iconSavePath):
|
||||
cmddumpid = "aapt dump xmltree "+ apkFilePath + " " + xmlpath
|
||||
print(cmddumpid)
|
||||
xmltree = subprocess.getoutput(cmddumpid)
|
||||
xmls = xmltree.splitlines()
|
||||
# find strs ,print next line
|
||||
def FindStrs(lines,strs):
|
||||
i=0
|
||||
while i < len(lines):
|
||||
if re.search(strs,lines[i]):
|
||||
tmpstr = lines[i+1]
|
||||
i += 1
|
||||
Resultstr = tmpstr.split(":")[-1].split("=")[-1].split("0x")[-1]
|
||||
return Resultstr
|
||||
else:
|
||||
i += 1
|
||||
#从apk的信息中获取前后景图片的ID号
|
||||
backimgid = FindStrs(xmls,"background")
|
||||
foreimgid = FindStrs(xmls,"foreground")
|
||||
print(backimgid)
|
||||
print(foreimgid)
|
||||
|
||||
# 直接从apk resource文件获取前后两层图片路径及ID字符串
|
||||
resource = subprocess.getoutput("aapt dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"")
|
||||
resourcelines = resource.splitlines()
|
||||
print(resourcelines)
|
||||
|
||||
# 从过滤出的字符串中获取所有相同ID的图片路径
|
||||
def Findpicpath(lines,imgid):
|
||||
i=0
|
||||
Resultstr = []
|
||||
while i < len(lines):
|
||||
if re.search(imgid,lines[i]) and re.search("string8",lines[i+1]) :
|
||||
print(lines[i+1])
|
||||
tmpstr = lines[i+1].replace("\"","")
|
||||
i += 1
|
||||
Resultstr.append(tmpstr.split()[-1])
|
||||
else:
|
||||
i += 1
|
||||
return Resultstr
|
||||
|
||||
#获取所有带前后图片ID的图片路径(相同背景或者前景的图片ID但分辨率不一样)
|
||||
backimgs = Findpicpath(resourcelines,backimgid)
|
||||
foreimgs = Findpicpath(resourcelines,foreimgid)
|
||||
print(backimgs)
|
||||
print(foreimgs)
|
||||
#获取分辨率最高的图片路径
|
||||
def getmaxsize(imgs):
|
||||
j = 0
|
||||
size=(0,0)
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
imgpath = ""
|
||||
while j < len(imgs):
|
||||
print(imgs[j])
|
||||
img = Image.open(zipapk.open(imgs[j]))
|
||||
print(imgs[j])
|
||||
print(img.size)
|
||||
if size < img.size:
|
||||
size = img.size
|
||||
imgpath = imgs[j]
|
||||
j += 1
|
||||
return imgpath
|
||||
|
||||
# 获取到文件列表后,进行比较分辨率,选取分辨率最高的张图片
|
||||
iconbackpath = getmaxsize(backimgs)
|
||||
iconforepath = getmaxsize(foreimgs)
|
||||
print(iconbackpath + " " + iconforepath)
|
||||
|
||||
#从APK文件获取最终图片
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
iconback = zipapk.open(iconbackpath)
|
||||
iconfore = zipapk.open(iconforepath)
|
||||
|
||||
|
||||
# 叠加图片,mask 设置前景为蒙版
|
||||
iconbackimg = Image.open(iconback).convert("RGBA")
|
||||
iconforeimg = Image.open(iconfore).convert("RGBA")
|
||||
iconbackimg.paste(iconforeimg,mask=iconforeimg)
|
||||
|
||||
|
||||
# 圆角图片函数,网上拷贝的
|
||||
def circle_corner(img, radii): #把原图片变成圆角,这个函数是从网上找的,原址 https://www.pyget.cn/p/185266
|
||||
"""
|
||||
圆角处理
|
||||
:param img: 源图象。
|
||||
:param radii: 半径,如:30。
|
||||
:return: 返回一个圆角处理后的图象。
|
||||
"""
|
||||
# 画圆(用于分离4个角)
|
||||
circle = Image.new('L', (radii * 2, radii * 2), 0) # 创建一个黑色背景的画布
|
||||
draw = ImageDraw.Draw(circle)
|
||||
draw.ellipse((0, 0, radii * 2, radii * 2), fill=255) # 画白色圆形
|
||||
# 原图
|
||||
img = img.convert("RGBA")
|
||||
w, h = img.size
|
||||
# 画4个角(将整圆分离为4个部分)
|
||||
alpha = Image.new('L', img.size, 255)
|
||||
alpha.paste(circle.crop((0, 0, radii, radii)), (0, 0)) # 左上角
|
||||
alpha.paste(circle.crop((radii, 0, radii * 2, radii)), (w - radii, 0)) # 右上角
|
||||
alpha.paste(circle.crop((radii, radii, radii * 2, radii * 2)), (w - radii, h - radii)) # 右下角
|
||||
alpha.paste(circle.crop((0, radii, radii, radii * 2)), (0, h - radii)) # 左下角
|
||||
# alpha.show()
|
||||
img.putalpha(alpha) # 白色区域透明可见,黑色区域不可见
|
||||
return img
|
||||
|
||||
# 圆角半径1/8边长,保存icon图片
|
||||
w,h = iconbackimg.size
|
||||
iconimg = circle_corner(iconbackimg,int(w/8))
|
||||
iconimg.save(iconSavePath)
|
||||
|
||||
0
build/opt/apps/uengine-runner/icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
119
build/opt/apps/uengine-runner/information.json
Executable file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"Url": [
|
||||
"https://gitee.com/gfdgd-xi/uengine-runner",
|
||||
"https://github.com/gfdgd-xi/uengine-runner"
|
||||
],
|
||||
"Version": "1.4.3",
|
||||
"System": "Linux(deepin/UOS)",
|
||||
"Tips": [
|
||||
"更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
|
||||
"",
|
||||
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
|
||||
"",
|
||||
"卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。",
|
||||
"",
|
||||
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
|
||||
"",
|
||||
"重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
|
||||
" 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
|
||||
"",
|
||||
"打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
|
||||
"",
|
||||
"提示:",
|
||||
"1、需要你有使用 root 权限的能力;",
|
||||
"2、需要安装 UEngine 才能使用;",
|
||||
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
|
||||
"4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
],
|
||||
"Update": [
|
||||
"V1.4.3:",
|
||||
"※1、支持打包器打包的包名带前缀“uengine-dc”",
|
||||
"※2、修复了两种情况可能导致程序卡住/出错无法继续运行的情况(配置文件夹不齐全和获取版本信息卡住两种情况)",
|
||||
"※3、修改了 UEngine 打包器打包的应用包名可能有大写的情况",
|
||||
"4、支持一键使用 Scrcpy 连接 UEngine(①先安装 adb 破解补丁;②请确保是使用snap安装的 Scrcpy【目前只支持 snap 安装的 Scrcpy 进行连接】)",
|
||||
"5、支持右键打包 apk",
|
||||
"",
|
||||
"V1.4.2:",
|
||||
"※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;",
|
||||
"2、菜单栏的项目添加以及外观优化;",
|
||||
"3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
|
||||
"4、把 uengine 改为 UEngine;",
|
||||
"5、修改 pkexec 获取密码时显示的图标和文本;",
|
||||
"6、添加了 UEngine 系统设置的快捷方式;",
|
||||
"",
|
||||
"V1.4.1:",
|
||||
"※1、初步支持键盘映射",
|
||||
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
|
||||
"",
|
||||
"V1.4.0:",
|
||||
"※1、添加新版打包方式(deepin打包方式);",
|
||||
"※2、支持测试运行/创建/删除uengine图标;",
|
||||
"※3、支持提取安装的apk;",
|
||||
"※4、支持打包deb包;",
|
||||
"5、修改菜单栏布局;",
|
||||
"6、支持打开uengine数据目录和用户数据目录;",
|
||||
"7、程序信息保存到json,非直接写入程序本体;",
|
||||
"8、更多命令操作;",
|
||||
"",
|
||||
"V.1.3.2:",
|
||||
"※1、支持uengine数据重置;",
|
||||
"※2、支持修改uengine网络桥接的启动状态;",
|
||||
"※3、支持右键安装/卸载;",
|
||||
"※4、支持启用或禁用uengine;",
|
||||
"※5、修复打包问题,不会出现“dpkg:警告:卸载spark-uengine-runner时,目录/opt/apps/uengine-runner非空,因而不会删除该目录”的错误;",
|
||||
"",
|
||||
"V1.3.1:",
|
||||
"※1、修复打包问题,防止部分用户安装出错的问题;",
|
||||
"※2、修复了程序无法提取图标时可以提取默认图标使用;",
|
||||
"",
|
||||
"V1.3.0:",
|
||||
"※1、修改了界面布局;",
|
||||
"※2、修复大多数新安装普通用户的路图标及启动菜单文件路径不存在导致安装APK报错的bugs;",
|
||||
"3、删除少量冗余代码,调整代码顺序;",
|
||||
"4、支持提取apk图标。",
|
||||
"",
|
||||
"V1.2.3",
|
||||
"1、调整部分控件名称;",
|
||||
"2、调整界面布局及界面风格;",
|
||||
"",
|
||||
"V1.2.2",
|
||||
"1、对程序错误的显示更加人性化;",
|
||||
"2、对 icon 的获取方式进行了升级;",
|
||||
"3、增加了注释、删除部分冗余代码。",
|
||||
"",
|
||||
"V1.2.1",
|
||||
"※1、进行了安装方式的修改(不使用 adb),修复原无法安装和卸载的问题;",
|
||||
"2、进行了部分优化;",
|
||||
"3、进行了功能缩水;",
|
||||
"4、修复 deb 打包错误。",
|
||||
"",
|
||||
"V1.2.0",
|
||||
"1、支持安装自动添加快捷方式、卸载删除快捷方式;",
|
||||
"2、支持使用包名或 APK 文件卸载程序;",
|
||||
"3、支持查看安装的所有包名;",
|
||||
"4、进行了部分优化",
|
||||
"",
|
||||
"V1.1.0",
|
||||
"暂无数据",
|
||||
"",
|
||||
"V1.0.0",
|
||||
"暂无数据"
|
||||
],
|
||||
"Use": [
|
||||
"1、UEngine相关软件包(基于anbox开发)",
|
||||
"2、Python3",
|
||||
"3、tkinter(tkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk)",
|
||||
"4、aapt",
|
||||
"5、dpkg",
|
||||
"6、tree",
|
||||
"7、mkdir",
|
||||
"8、echo",
|
||||
"9、chmod",
|
||||
"10、adb",
|
||||
"11、deepin 终端",
|
||||
"……"
|
||||
],
|
||||
"Time": "2021年08月30日",
|
||||
"Contribute": ["gfdgd xi<3025613752@qq.com>",
|
||||
"actionchen<917981399@qq.com>"]
|
||||
}
|
||||
7
build/opt/apps/uengine-runner/setting.json
Executable file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"Package": "spark-uengine-runner",
|
||||
"Update": true,
|
||||
"Version": "1.4.3",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
|
||||
}
|
||||
444
build/opt/apps/uengine-runner/uengine-apk-builder
Executable file
@@ -0,0 +1,444 @@
|
||||
#!/usr/bin/env python3
|
||||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.4.2
|
||||
# 更新时间:2021年8月30日
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import random
|
||||
import zipfile
|
||||
import traceback
|
||||
import threading
|
||||
import subprocess
|
||||
import ttkthemes
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
import tkinter.filedialog as filedialog
|
||||
from getxmlimg import getsavexml
|
||||
|
||||
def FindApk():
|
||||
path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"])
|
||||
if path != "" and path != "()":
|
||||
try:
|
||||
combobox1.set(path)
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
|
||||
except:
|
||||
pass
|
||||
|
||||
def BuildDeb():
|
||||
if combobox1.get() == "":
|
||||
messagebox.showerror(title="提示", message="信息没有填写完整,无法继续打包 APK")
|
||||
return
|
||||
if not os.path.exists(combobox1.get()):
|
||||
messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK")
|
||||
return
|
||||
DisabledAndEnbled(True)
|
||||
threading.Thread(target=BuildApkDeb, args=(combobox1.get(),)).start()
|
||||
|
||||
def RunCommandShow(command):
|
||||
TextboxAddText1("$> {}".format(command))
|
||||
TextboxAddText1(GetCommandReturn(command))
|
||||
|
||||
def BuildApkDeb(apkPath):
|
||||
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
|
||||
RunCommandShow("echo '======================================New===================================='")
|
||||
RunCommandShow("echo '创建目录'")
|
||||
RunCommandShow("mkdir -pv '{}/DEBIAN'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/applications'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
|
||||
RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
|
||||
apkPackageName = GetApkPackageName(apkPath)
|
||||
apkPackageVersion = GetApkVersion(apkPath)
|
||||
apkChineseLabel = GetApkChineseLabel(apkPath)
|
||||
apkActivityName = GetApkActivityName(apkPath)
|
||||
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageName)
|
||||
debControl = '''Package: {}
|
||||
Version: {}
|
||||
Architecture: all
|
||||
Maintainer: {}
|
||||
Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1)
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Description: {}\n'''.format(apkPackageName, apkPackageVersion, apkChineseLabel, apkChineseLabel)
|
||||
debPostinst = '''#!/bin/sh
|
||||
|
||||
APK_DIR="/usr/share/uengine/apk"
|
||||
APK_NAME="{}.apk"
|
||||
APK_PATH="$APK_DIR/$APK_NAME"
|
||||
DESKTOP_FILE="/usr/share/applications/{}.desktop"
|
||||
ICON_FILE="/usr/share/uengine/icons/{}.png"
|
||||
|
||||
if [ -f $APK_PATH ]; then
|
||||
echo "Installing $APK_NAME"
|
||||
else
|
||||
echo "ERROR: $APK_NAME file not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: apk install error..."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo rm -f "$APK_PATH"
|
||||
|
||||
exit 0'''.format(apkPackageName, apkPackageName, apkPackageName)
|
||||
debPrerm = '''#!/bin/sh
|
||||
|
||||
APP_NAME="{}"
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Uninstalling $APP_NAME"
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: app uninstall error..."
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /etc/passwd | awk -F: '$3>=1000' | cut -f 1 -d : | while read line
|
||||
do
|
||||
inifile="/home/$line/.config/uengineAppGeometry.ini"
|
||||
if [ -f $inifile ]; then
|
||||
sed -i "/$APP_NAME/d" $inifile
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0'''.format(apkPackageName)
|
||||
desktopFile = '''[Desktop Entry]
|
||||
Categories=Other;
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
Icon=/usr/share/uengine/icons/{}.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
GenericName={}
|
||||
Name={}
|
||||
'''
|
||||
#RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath))
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/control".format(tempPath), debControl)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
|
||||
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageName))
|
||||
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName), desktopFile)
|
||||
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, iconSavePath,
|
||||
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName))
|
||||
RunCommandShow("echo '复制文件'")
|
||||
RunCommandShow("echo '写入 APK 软件图标'")
|
||||
SaveApkIcon(apkPath, iconSavePath)
|
||||
RunCommandShow("echo '复制 APK 文件'")
|
||||
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageName))
|
||||
RunCommandShow("echo '正在设置文件权限……'")
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
|
||||
RunCommandShow("echo '打包 deb 到桌面……'")
|
||||
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageName, apkPackageVersion))
|
||||
RunCommandShow("echo '完成!'")
|
||||
findApkHistory.append(apkPath)
|
||||
combobox1['value'] = findApkHistory
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
|
||||
messagebox.showinfo(title="提示", message="打包完成")
|
||||
DisabledAndEnbled(False)
|
||||
|
||||
def DisabledAndEnbled(choose):
|
||||
userChoose = {True: tk.DISABLED, False: tk.NORMAL}
|
||||
a = userChoose[choose]
|
||||
combobox1.configure(state=a)
|
||||
check.configure(state=a)
|
||||
button2.configure(state=a)
|
||||
button3.configure(state=a)
|
||||
|
||||
# 需引入 subprocess
|
||||
def GetCommandReturn(cmd):
|
||||
# cmd 是要获取输出的命令
|
||||
return subprocess.getoutput(cmd)
|
||||
|
||||
# 重启本应用程序
|
||||
def ReStartProgram():
|
||||
python = sys.executable
|
||||
os.execl(python, python, * sys.argv)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
# 获取用户桌面目录
|
||||
def get_desktop_path():
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
|
||||
# 数组转字典
|
||||
def ListToDictionary(list):
|
||||
dictionary = {}
|
||||
for i in range(len(list)):
|
||||
dictionary[i] = list[i]
|
||||
return dictionary
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path):
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
# 写入文本文档
|
||||
def write_txt(path, things):
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
def GetApkInformation(apkFilePath):
|
||||
return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath))
|
||||
|
||||
def GetApkActivityName(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "launchable-activity" in line:
|
||||
line = line[0: line.index("label='")]
|
||||
line = line.replace("launchable-activity: ", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
line = line.replace("name=", "")
|
||||
line = line.replace("label=", "")
|
||||
line = line.replace("icon=", "")
|
||||
return line
|
||||
|
||||
def GetApkPackageName(apkFilePath):
|
||||
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "package:" in line:
|
||||
line = line[0: line.index("versionCode='")]
|
||||
line = line.replace("package:", "")
|
||||
line = line.replace("name=", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
# 此较为特殊,因为需要判断用户是否要添加前缀
|
||||
if qianZhui.get() == True:
|
||||
return "uengine-dc-{}".format(line).lower()
|
||||
return line.lower()
|
||||
|
||||
def GetApkVersion(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "package:" in line:
|
||||
if "compileSdkVersion='" in line:
|
||||
line = line.replace(line[line.index("compileSdkVersion='"): -1], "")
|
||||
if "platform" in line:
|
||||
line = line.replace(line[line.index("platform"): -1], "")
|
||||
line = line.replace(line[0: line.index("versionName='")], "")
|
||||
line = line.replace("versionName='", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
return line
|
||||
|
||||
def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath):
|
||||
things = '''
|
||||
[Desktop Entry]
|
||||
Categories=app;
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
GenericName={}
|
||||
Icon={}
|
||||
MimeType=
|
||||
Name={}
|
||||
StartupWMClass={}
|
||||
Terminal=false
|
||||
Type=Application
|
||||
'''.format(packageName, activityName, showName, iconPath, showName, showName)
|
||||
write_txt(savePath, things)
|
||||
|
||||
def GetApkChineseLabel(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application-label:" in line:
|
||||
line = line.replace("application-label:", "")
|
||||
line = line.replace("'", "")
|
||||
return line
|
||||
|
||||
def GetApkIconInApk(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application:" in line:
|
||||
line = line[line.index("icon='"): -1]
|
||||
line = line.replace("icon='", "")
|
||||
if "'" in line:
|
||||
line = line[0: line.index("'")]
|
||||
return line
|
||||
return line
|
||||
|
||||
#合并两个函数到一起
|
||||
def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标":
|
||||
try:
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application:" in line:
|
||||
xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","")
|
||||
if xmlpath.endswith('.xml'):
|
||||
xmlsave = getsavexml()
|
||||
print(xmlpath)
|
||||
xmlsave.savexml(apkFilePath,xmlpath,iconSavePath)
|
||||
else:
|
||||
zip = zipfile.ZipFile(apkFilePath)
|
||||
iconData = zip.read(xmlpath)
|
||||
with open(iconSavePath, 'w+b') as saveIconFile:
|
||||
saveIconFile.write(iconData)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("Error, show defult icon")
|
||||
shutil.copy(programPath + "/defult.png", iconSavePath)
|
||||
|
||||
|
||||
#def SaveApkIcon(apkFilePath, iconSavePath):
|
||||
# zip = zipfile.ZipFile(apkFilePath)
|
||||
# iconData = zip.read(GetApkIconInApk(apkFilePath))
|
||||
# with open(iconSavePath, 'w+b') as saveIconFile:
|
||||
# saveIconFile.write(iconData)
|
||||
|
||||
def TextboxAddText1(message):
|
||||
global textbox1
|
||||
textbox1.configure(state=tk.NORMAL)
|
||||
textbox1.insert(tk.END,message + "\n")
|
||||
textbox1.configure(state=tk.DISABLED)
|
||||
|
||||
# 获取用户桌面目录
|
||||
def get_desktop_path():
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
###########################
|
||||
# 程序信息
|
||||
###########################
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
information = json.loads(readtxt(programPath + "/information.json"))
|
||||
version = information["Version"]
|
||||
title = "UEngine APK 应用打包器 {}".format(version)
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
|
||||
###########################
|
||||
# 加载配置
|
||||
###########################
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
|
||||
os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json"): # 如果没有配置文件
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", json.dumps({})) # 创建配置文件
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuild.json"): # 如果没有配置文件
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": "~"})) # 创建配置文件
|
||||
|
||||
###########################
|
||||
# 设置变量
|
||||
###########################
|
||||
findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json")).values())
|
||||
|
||||
###########################
|
||||
# 窗口创建
|
||||
###########################
|
||||
win = tk.Tk()
|
||||
|
||||
qianZhui = tk.BooleanVar()
|
||||
|
||||
window = ttk.Frame(win)
|
||||
frame2 = ttk.Frame(window)
|
||||
label1 = ttk.Label(window, text="要打包的 apk 路径:")
|
||||
combobox1 = ttk.Combobox(window, width=100)
|
||||
button2 = ttk.Button(window, text="浏览", command=FindApk)
|
||||
button3 = ttk.Button(frame2, text="打包", command=BuildDeb)
|
||||
check = ttk.Checkbutton(frame2, variable=qianZhui,text="使用前缀“uengine-dc”")
|
||||
textbox1 = tk.Text(window, width=100)
|
||||
menu = tk.Menu(window, background="white") # 设置菜单栏
|
||||
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
|
||||
|
||||
menu.add_cascade(label="程序", menu=programmenu)
|
||||
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
|
||||
# 设置控件
|
||||
combobox1['value'] = findApkHistory
|
||||
textbox1.configure(state=tk.DISABLED)
|
||||
textbox1.config(foreground='white', background='black')
|
||||
# 如果有参数
|
||||
if len(sys.argv) > 1:
|
||||
combobox1.set(sys.argv[1])
|
||||
# 设置窗口
|
||||
style = ttkthemes.ThemedStyle(win)
|
||||
style.set_theme("breeze")
|
||||
win.attributes('-alpha', 0.5)
|
||||
win.title(title)
|
||||
win.resizable(0, 0)
|
||||
win.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
#
|
||||
win.config(menu=menu) # 显示菜单栏
|
||||
label1.grid(row=2, column=0)
|
||||
combobox1.grid(row=2, column=1)
|
||||
button2.grid(row=2, column=2)
|
||||
button3.grid(row=0, column=1)
|
||||
check.grid(row=0, column=0)
|
||||
frame2.grid(row=3, columnspa=3)
|
||||
textbox1.grid(row=4, columnspa=3)
|
||||
window.pack()
|
||||
win.mainloop()
|
||||
11
build/opt/apps/uengine-runner/uengine-app-install
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("uengine-app-install apk路径")
|
||||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
11
build/opt/apps/uengine-runner/uengine-app-uninstall
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("uengine-app-uninstall apk包名")
|
||||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
11
build/opt/apps/uengine-runner/uengine-clean
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("输入命令即可清空/重置UEngine")
|
||||
sys.exit(0)
|
||||
print("参数错误")
|
||||
sys.exit(1)
|
||||
sys.exit(os.system("sudo rm -rf /data/uengine"))
|
||||
227
build/opt/apps/uengine-runner/uengine-keyboard
Executable file
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env python3
|
||||
#########################################
|
||||
# 版本:1.4.0
|
||||
# 更新时间:2021年08月26日
|
||||
# Need: unix, python3-tk, python3-pip, pymouse, keyboard
|
||||
#########################################
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
import shutil
|
||||
import keyboard
|
||||
import traceback
|
||||
import ttkthemes
|
||||
import pyautogui
|
||||
import threading
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
import tkinter.filedialog as filedialog
|
||||
import Xlib.threaded as threaded
|
||||
#import pymouse.unix as pymouse
|
||||
########################
|
||||
#
|
||||
########################
|
||||
def Inputt(key):
|
||||
if key.event_type == "up":
|
||||
global setting
|
||||
if setting:
|
||||
Setting(key)
|
||||
else:
|
||||
Mouse(key)
|
||||
#Mouse(key)
|
||||
|
||||
def Open():
|
||||
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
|
||||
if not path == "" or path == ():
|
||||
shutil.copy(path, get_home() + "/.config/uengine-keyboard/key.json")
|
||||
if messagebox.askyesno(title="提示", message="导入成功!是否现在重启程序以便生效?"):
|
||||
ReStartProgram()
|
||||
|
||||
def Save():
|
||||
path = filedialog.asksaveasfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
|
||||
if not path == "" or path == ():
|
||||
shutil.copy(get_home() + "/.config/uengine-keyboard/key.json", path)
|
||||
messagebox.showinfo(title="提示", message="导出成功!")
|
||||
|
||||
# 重启本应用程序
|
||||
def ReStartProgram()->"重启本应用程序":
|
||||
python = sys.executable
|
||||
os.execl(python, python, * sys.argv)
|
||||
|
||||
|
||||
def Mouse(key):
|
||||
print(keybo)
|
||||
if keybo.__contains__(key.name):
|
||||
print(keybo[key.name]["MousePlace"])
|
||||
pyautogui.FAILSAFE = False
|
||||
#os.system(programPath + "/mouse.py {} {}".format(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]))
|
||||
#pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])
|
||||
pyautogui.click(1500, 800)
|
||||
#m.click(keybo[key.name]["MousePlace"][0],keybo[key.name]["MousePlace"][1])
|
||||
|
||||
def Setting(key):
|
||||
if key.event_type == 'up':
|
||||
keybo[key.name] = {"Mouse": "Left", "MousePlace": pyautogui.position()}
|
||||
write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), json.dumps(keybo))
|
||||
global inputs
|
||||
inputs = True
|
||||
global setting
|
||||
setting = False
|
||||
return False
|
||||
|
||||
def ShowTips():
|
||||
try:
|
||||
if setting:
|
||||
settingLabelText.set('''设置方法:把鼠标移动带所需位置然后按下需要设置的按键即可({}x{})
|
||||
提示:
|
||||
1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键;
|
||||
2、使用映射不能关闭本窗口,但可以最小化;
|
||||
3、本程序需要 root 权限才能使用;
|
||||
4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1]))
|
||||
settingButton.configure(state=tk.DISABLED)
|
||||
else:
|
||||
settingLabelText.set('''点击“设置”按钮设置映射({}x{})
|
||||
提示:
|
||||
1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键;
|
||||
2、使用映射不能关闭本窗口,但可以最小化;
|
||||
3、本程序需要 root 权限才能使用;
|
||||
4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1]))
|
||||
settingButton.configure(state=tk.NORMAL)
|
||||
time.sleep(0.1)
|
||||
ShowTips()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
if not close:
|
||||
ShowTips()
|
||||
|
||||
def Closing():
|
||||
close = True
|
||||
window.destroy()
|
||||
|
||||
def Key():
|
||||
keyboard.hook(Inputt)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home()->"获取用户主目录":
|
||||
return os.path.expanduser('~')
|
||||
|
||||
# 写入文本文档
|
||||
def write_txt(path: "路径", things: "内容")->"写入文本文档":
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
def Settings():
|
||||
global setting
|
||||
setting = True
|
||||
|
||||
def Clean():
|
||||
if messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
|
||||
shutil.rmtree("{}/.config/uengine-keyboard".format(get_home()))
|
||||
if messagebox.askyesno(title="提示", message="删除成功!是否现在重启程序以便生效?"):
|
||||
ReStartProgram()
|
||||
|
||||
def About():
|
||||
threading.Thread(target=os.system, args=["{}/uengine-runner-about".format(programPath)]).start()
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
if not os.path.exists("{}/.config/uengine-keyboard".format(get_home())):
|
||||
os.mkdir("{}/.config/uengine-keyboard".format(get_home()))
|
||||
if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home())):
|
||||
write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), "{}")
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
setting = False
|
||||
close = False
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home())))
|
||||
version = json.loads(readtxt("{}/information.json".format(programPath)))["Version"]
|
||||
|
||||
###################
|
||||
# 判断是不是 root
|
||||
###################
|
||||
if os.geteuid() != 0:
|
||||
print("不是以 root 权限运行本程序!")
|
||||
root = tk.Tk()
|
||||
root.overrideredirect(1)
|
||||
root.withdraw()
|
||||
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
|
||||
sys.exit(1)
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
window = tk.Tk()
|
||||
win = ttk.Frame(window)
|
||||
show = ttk.Frame(win)
|
||||
|
||||
settingLabelText = tk.StringVar()
|
||||
|
||||
# 设置菜单栏
|
||||
menu = tk.Menu(window, tearoff=0, background="white")
|
||||
programMenu = tk.Menu(menu, tearoff=0, background="white")
|
||||
aboutMenu = tk.Menu(menu, tearoff=0, background="white")
|
||||
|
||||
settingLabel = ttk.Label(win, textvariable=settingLabelText)
|
||||
|
||||
settingMouseToKeyboard = ttk.Button(show, text="启动键盘映射(已启用)")
|
||||
settingButton = ttk.Button(show, text="添加或覆盖键盘映射设置", command=Settings)
|
||||
|
||||
settingMouseToKeyboard.configure(state=tk.DISABLED)
|
||||
|
||||
style = ttkthemes.ThemedStyle(window)
|
||||
style.set_theme("breeze")
|
||||
window.protocol('WM_DELETE_WINDOW', Closing)
|
||||
window.resizable(0, 0)
|
||||
window.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
window.title("UEngine 键盘映射 {}".format(version))
|
||||
|
||||
menu.add_cascade(label="程序", menu=programMenu)
|
||||
menu.add_cascade(label="帮助", menu=aboutMenu)
|
||||
menu.configure(activebackground="dodgerblue")
|
||||
|
||||
programMenu.add_command(label="导入映射设置", command=Open)
|
||||
programMenu.add_command(label="导出映射设置", command=Save)
|
||||
programMenu.add_command(label="删除所有映射设置", command=Clean)
|
||||
programMenu.add_separator()
|
||||
programMenu.add_command(label="退出程序", command=sys.exit)
|
||||
programMenu.configure(activebackground="dodgerblue")
|
||||
|
||||
aboutMenu.add_command(label="关于", command=About)
|
||||
|
||||
window.config(menu=menu) # 显示菜单栏
|
||||
|
||||
show.grid(row=1, column=0)
|
||||
|
||||
settingLabel.grid(row=0, column=0)
|
||||
|
||||
settingMouseToKeyboard.grid(row=0, column=0)
|
||||
settingButton.grid(row=0, column=1)
|
||||
|
||||
win.pack(fill="both", expand="yes")
|
||||
#threaded.lock.allocate_lock()
|
||||
threading.Thread(target=Key).start()
|
||||
threading.Thread(target=ShowTips).start()
|
||||
pyautogui.FAILSAFE = False
|
||||
'''def B(key):
|
||||
if key.event_type == "up":
|
||||
print(pyautogui.position())
|
||||
print(key.name)
|
||||
pyautogui.click(1500, 800)
|
||||
keyboard.hook(B)
|
||||
keyboard.wait()'''
|
||||
window.mainloop()
|
||||
170
build/opt/apps/uengine-runner/uengine-runner-about
Executable file
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env python3
|
||||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.4.3
|
||||
# 更新时间:2021年9月11日
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import json
|
||||
import ttkthemes
|
||||
import subprocess
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
###########################
|
||||
# 程序信息
|
||||
###########################
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
information = json.loads(readtxt(programPath + "/information.json"))
|
||||
programUrl = information["Url"][0]
|
||||
version = information["Version"]
|
||||
goodRunSystem = information["System"]
|
||||
aaptVersion = subprocess.getoutput("aapt version")
|
||||
about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。
|
||||
|
||||
版本 :{}
|
||||
|
||||
适用平台 :{}
|
||||
|
||||
程序官网 :{}
|
||||
|
||||
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
|
||||
tips = "\n".join(information["Tips"])
|
||||
updateThingsString = "\n".join(information["Update"])
|
||||
title = "UEngine 运行器 {}".format(version)
|
||||
updateTime = information["Time"]
|
||||
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
|
||||
desktopName = "UengineAndroidProgramList.desktop"
|
||||
contribute = "\n".join(information["Contribute"])
|
||||
useProgram = ""
|
||||
threading.Thread(target=useProgram).start()
|
||||
|
||||
# add sub window
|
||||
#添加窗口开启关闭开关,防止重复开启
|
||||
windowflag = "close"
|
||||
|
||||
def UseProgram():
|
||||
global useProgram
|
||||
useProgram = '''1、UEngine:{}
|
||||
2、python3:{}
|
||||
3、tkinter:{}
|
||||
4、aapt:{}
|
||||
5、dpkg:{}
|
||||
6、mkdir:{}
|
||||
7、echo
|
||||
8、chmod:{}
|
||||
9、adb:{}
|
||||
10、deepin 终端:{}'''.format(subprocess.getoutput("uengine version"),
|
||||
subprocess.getoutput("python3 --version"),
|
||||
tk.TkVersion,
|
||||
subprocess.getoutput("aapt version"),
|
||||
subprocess.getoutput("dpkg --version"),
|
||||
subprocess.getoutput("mkdir --version"),
|
||||
subprocess.getoutput("chmod --version"),
|
||||
subprocess.getoutput("adb version"),
|
||||
subprocess.getoutput("deepin-terminal -v"))
|
||||
|
||||
def showhelp():
|
||||
|
||||
#define window and frame and button label
|
||||
#
|
||||
global windowflag
|
||||
if windowflag == "close":
|
||||
helpwindow=tk.Tk()
|
||||
helpwindow.resizable(0, 0)
|
||||
helpwindow.title("帮助")
|
||||
|
||||
|
||||
# get screen width and height
|
||||
screen_width = helpwindow.winfo_screenwidth()
|
||||
screen_height = helpwindow.winfo_screenheight()
|
||||
# calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
|
||||
winwith=550
|
||||
winhigh=700
|
||||
x = (screen_width/2) - (winwith/2)
|
||||
y = (screen_height/2) - (winhigh/2)
|
||||
|
||||
helpwindow.geometry("550x700"+"+{:.0f}+{:.0f}".format(x, y))
|
||||
helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
|
||||
style = ttkthemes.ThemedStyle(helpwindow)
|
||||
style.set_theme("breeze")
|
||||
|
||||
|
||||
|
||||
Frmroot=ttk.Frame(helpwindow)
|
||||
FrmMenu = ttk.Frame(Frmroot)
|
||||
FrmText = ttk.Frame(Frmroot)
|
||||
|
||||
LabFrmText=ttk.LabelFrame(FrmText,text="帮助",height=800,borderwidth=3)
|
||||
HelpStr = tk.StringVar()
|
||||
HelpStr.set(tips)
|
||||
LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55)
|
||||
LabText.config(wraplength=350)
|
||||
|
||||
def on_closing():
|
||||
global windowflag
|
||||
windowflag = "close"
|
||||
print(windowflag)
|
||||
helpwindow.destroy()
|
||||
|
||||
|
||||
|
||||
# define button func
|
||||
def ChgLog():
|
||||
HelpStr.set(updateThingsString)
|
||||
def ChgAbout():
|
||||
HelpStr.set(about)
|
||||
def ChgDep():
|
||||
if useProgram == "":
|
||||
BtnZujian.configure(state=tk.DISABLED)
|
||||
return
|
||||
HelpStr.set(useProgram)
|
||||
def ChgCon():
|
||||
HelpStr.set(contribute)
|
||||
def ChgTips():
|
||||
HelpStr.set(tips)
|
||||
LabText.config(wraplength=350)
|
||||
|
||||
BtnReadme = ttk.Button(FrmMenu, text="使用说明",width=14,command=ChgTips)
|
||||
BtnLog = ttk.Button(FrmMenu, text="更新内容",width=14,command=ChgLog)
|
||||
BtnZujian = ttk.Button(FrmMenu, text="程序依赖的组件",width=14,command=ChgDep)
|
||||
BtnGongxian = ttk.Button(FrmMenu, text="有贡献的开发者",width=14,command=ChgCon)
|
||||
BtnAbout = ttk.Button(FrmMenu, text="关于",width=14,command=ChgAbout)
|
||||
|
||||
|
||||
#layout
|
||||
FrmMenu.grid(row=0,column=0,sticky=tk.NW)
|
||||
BtnReadme.grid(row=0,column=0,sticky=tk.NW,padx=3)
|
||||
BtnLog.grid(row=1,column=0,sticky=tk.NW,padx=3)
|
||||
BtnZujian.grid(row=2,column=0,sticky=tk.NW,padx=3)
|
||||
BtnGongxian.grid(row=3,column=0,sticky=tk.NW,padx=3)
|
||||
BtnAbout.grid(row=4,column=0,sticky=tk.NW,padx=3)
|
||||
|
||||
FrmText.grid(row=0,column=1,sticky=tk.NW)
|
||||
LabFrmText.grid(row=0,column=0,sticky=tk.NW,padx=3,pady=3)
|
||||
LabText.grid(row=0,column=0,sticky=tk.NW)
|
||||
|
||||
Frmroot.pack()
|
||||
windowflag = "open"
|
||||
print(windowflag)
|
||||
helpwindow.mainloop()
|
||||
#helpwindow.protocol("WM_DELETE_WINDOW", on_closing)
|
||||
showhelp()
|
||||
83
build/opt/apps/uengine-runner/uengine-useadb
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
#########################################
|
||||
# 版本:1.4.2
|
||||
# 更新时间:2021年08月30日
|
||||
#########################################
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import traceback
|
||||
import ttkthemes
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
########################
|
||||
#
|
||||
########################
|
||||
# 写入文本文档
|
||||
def write_txt(path: "路径", things: "内容")->"写入文本文档":
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
###################
|
||||
# 判断是不是 root
|
||||
###################
|
||||
if os.geteuid() != 0:
|
||||
print("不是以 root 权限运行本程序!")
|
||||
root = tk.Tk()
|
||||
root.overrideredirect(1)
|
||||
root.withdraw()
|
||||
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
|
||||
sys.exit(1)
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
window = tk.Tk()
|
||||
style = ttkthemes.ThemedStyle(window)
|
||||
style.set_theme("breeze")
|
||||
window.overrideredirect(1)
|
||||
window.withdraw()
|
||||
try:
|
||||
if sys.argv[1] == "1" and messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
|
||||
os.remove("/data/uengine/data/data/misc/adb/adb_keys")
|
||||
messagebox.showinfo(title="提示", message="完成")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
sys.exit(2)
|
||||
if sys.argv[1] == "1":
|
||||
sys.exit(0)
|
||||
|
||||
if not messagebox.askyesno(title="提示", message='''请阅读以下提示然后确定是否继续:
|
||||
1、安装后即可使用 adb 连接 UEngine;
|
||||
2、重置 UEngine 或 adb 就需要重新设置该支持补丁;
|
||||
3、需要 root 权限;'''):
|
||||
sys.exit(0)
|
||||
# 写入(需要 root)
|
||||
if not os.path.exists("/data/uengine/data/data/misc/adb"):
|
||||
messagebox.showerror(title="错误", message="无法读取 UEngine 数据!")
|
||||
sys.exit(1)
|
||||
try:
|
||||
things = readtxt(sys.argv[2])
|
||||
adbKey = []
|
||||
# 提取内容
|
||||
for i in things.split('\n'):
|
||||
adbKey.append(i[0: i.find(" ")])
|
||||
old = ""
|
||||
if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
|
||||
old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n"
|
||||
write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey))
|
||||
messagebox.showinfo(title="提示", message="完成")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
sys.exit(2)
|
||||
59
build/opt/apps/uengine-runner/update-console.py
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import requests
|
||||
import traceback
|
||||
|
||||
# 读取文本文档
|
||||
def read_txt(path):
|
||||
f = open(path,"r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
def GetPackageUpdateInformation():
|
||||
global setting
|
||||
global package
|
||||
for i in allJson['Program']:
|
||||
if i['Package'] == package:
|
||||
return i
|
||||
|
||||
try:
|
||||
setting = json.loads(read_txt("{}/setting.json".format(os.path.split(os.path.realpath(__file__))[0])))
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("配置文件无法访问!")
|
||||
package = setting['Package']
|
||||
nowVersion = setting['Version']
|
||||
try:
|
||||
jsons = requests.get(setting["Url"])
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("服务器出现错误!")
|
||||
sys.exit(1)
|
||||
allJson = json.loads(jsons.text)
|
||||
updateInformation = GetPackageUpdateInformation()
|
||||
name = updateInformation['Name']
|
||||
newVersion = updateInformation['Version']
|
||||
print("更新程序:{}".format(name))
|
||||
print("最新版本:{}".format(newVersion))
|
||||
print("目前版本:{}".format(nowVersion))
|
||||
if nowVersion == newVersion:
|
||||
print("目前是最新版本,无需更新!")
|
||||
quit()
|
||||
print("更新内容:")
|
||||
print(updateInformation['New Things'])
|
||||
choose = input("更新?[Y/N]")
|
||||
if choose.upper() == "N":
|
||||
quit()
|
||||
if os.path.exists("/tmp/update-console-{}".format(package)):
|
||||
shutil.rmtree("/tmp/update-console-{}".format(package))
|
||||
os.mkdir("/tmp/update-console-{}".format(package))
|
||||
if updateInformation["Linux App Url"][0] == None:
|
||||
print("没有可用包源")
|
||||
quit()
|
||||
os.system("wget '{}' -P '/tmp/update-console-{}'".format(updateInformation["Linux App Url"][0], package))
|
||||
os.system("sudo dpkg -i /tmp/update-console-{}/*".format(package))
|
||||
os.system("sudo apt install -f -y")
|
||||
1
build/usr/bin/uengine-apk-builder
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/uengine-runner/uengine-apk-builder
|
||||
1
build/usr/bin/uengine-app-install
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/uengine-runner/uengine-app-install
|
||||
1
build/usr/bin/uengine-app-uninstall
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/uengine-runner/uengine-app-uninstall
|
||||
1
build/usr/bin/uengine-clean
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/uengine-runner/uengine-clean
|
||||
1
build/usr/bin/uengine-keyboard
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/uengine-runner/uengine-keyboard
|
||||
1
build/usr/bin/uengine-runner-about
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/uengine-runner/uengine-runner-about
|
||||
1
build/usr/bin/uengine-useadb
Symbolic link
@@ -0,0 +1 @@
|
||||
/opt/apps/uengine-runner/uengine-useadb
|
||||
@@ -1,11 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Categories=System;
|
||||
Comment=uengine(anbox) 程序菜单
|
||||
Comment=UEngine 程序菜单
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
MimeType=
|
||||
Name=uengine 程序菜单
|
||||
StartupWMClass=uengine 程序菜单
|
||||
Name=UEngine 程序菜单
|
||||
StartupWMClass=UEngine 程序菜单
|
||||
Terminal=false
|
||||
Type=Application
|
||||
|
||||
11
build/usr/share/applications/UengineAndroidSetting.desktop
Normal file
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Categories=System;
|
||||
Comment=UEngine 系统设置
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
MimeType=
|
||||
Name=UEngine 系统设置
|
||||
StartupWMClass=UEngine 系统设置
|
||||
Terminal=false
|
||||
Type=Application
|
||||
15
build/usr/share/applications/spark-uengine-apk-build.desktop
Executable file
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-apk-builder %F
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
Name=Build Apk To Deb(UEngine Runner)
|
||||
Comment=Build Apk To Deb(UEngine Runner)
|
||||
Comment[zh]=打包 deb(UEngine 运行器)
|
||||
Name[zh]=打包 deb(UEngine 运行器)
|
||||
StartupNotify=true
|
||||
Hidden=false
|
||||
NoDisplay=true
|
||||
MimeType=application/vnd.android.package-archive
|
||||
15
build/usr/share/applications/spark-uengine-install.desktop
Normal file
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-runner -i %F
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
Name=Install APK(UEngine runner)
|
||||
Comment=Install APK(UEngine runner)
|
||||
Comment[zh]=安装 APK(UEngine 运行器)
|
||||
Name[zh]=安装 APK(UEngine 运行器)
|
||||
StartupNotify=true
|
||||
Hidden=false
|
||||
NoDisplay=true
|
||||
MimeType=application/vnd.android.package-archive
|
||||
15
build/usr/share/applications/spark-uengine-uninstall.desktop
Normal file
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-runner -u %F
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
Name=Uninstall APK(UEngine runner)
|
||||
Comment=Uninstall APK(UEngine runner)
|
||||
Comment[zh]=卸载 APK(UEngine 运行器)
|
||||
Name[zh]=卸载 APK(UEngine 运行器)
|
||||
StartupNotify=true
|
||||
Hidden=false
|
||||
NoDisplay=true
|
||||
MimeType=application/vnd.android.package-archive
|
||||
12
build/usr/share/applications/uengine-apk-builder.desktop
Executable file
@@ -0,0 +1,12 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-apk-builder %F
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
Name=uengine Apk Builder
|
||||
Comment=UEngine Apk Builder
|
||||
Comment[zh]=UEngine 应用打包器
|
||||
Name[zh]=UEngine 应用打包器
|
||||
StartupNotify=true
|
||||
@@ -1,11 +1,13 @@
|
||||
[Desktop Entry]
|
||||
Categories=System;
|
||||
Comment=uengine(anbox) 运行器
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-runner
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
MimeType=
|
||||
Name=uengine 运行器
|
||||
StartupWMClass=uengine 运行器
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Name=uengine runner
|
||||
Comment=UEngine Runner
|
||||
Comment[zh]=UEngine 运行器
|
||||
Name[zh]=UEngine 运行器
|
||||
StartupNotify=true
|
||||
MimeType=
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.env">
|
||||
<message>Authentication is required to Run App</message>
|
||||
<message xml:lang="zh_CN">使用对应的程序需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/env</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.installscrcpy">
|
||||
<message>Authentication is required to Install Scrcpy</message>
|
||||
<message xml:lang="zh_CN">安装 Scrcpy 需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/tmp/uengine-runner/InstallScrcpy.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
21
build/usr/share/polkit-1/actions/com.deepin.pkexec.rm.policy
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.rm">
|
||||
<message>Authentication is required to Delete Files</message>
|
||||
<message xml:lang="zh_CN">删除文件需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/rm</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://github.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.uengine-bridge">
|
||||
<message>Authentication is required to Setting UEngine Internet Bridge</message>
|
||||
<message xml:lang="zh_CN">设置 UEngine 桥接需要输入密码</message>
|
||||
<icon_name>kbox</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/uengine-bridge.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.uengine-session-launch-helper">
|
||||
<message>Authentication is required to Change UEngine</message>
|
||||
<message xml:lang="zh_CN">设置 UEngine 需要输入密码</message>
|
||||
<icon_name>kbox</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/uengine-session-launch-helper</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
BIN
com.gitee.uengine.runner.spark.deb
Executable file
BIN
defult.png
Executable file
|
After Width: | Height: | Size: 312 KiB |
118
getxmlimg.py
Executable file
@@ -0,0 +1,118 @@
|
||||
import PIL.Image as Image
|
||||
import PIL.ImageDraw as ImageDraw
|
||||
import zipfile
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
class getsavexml():
|
||||
|
||||
def savexml(self,apkFilePath,xmlpath,iconSavePath):
|
||||
cmddumpid = "aapt dump xmltree "+ apkFilePath + " " + xmlpath
|
||||
print(cmddumpid)
|
||||
xmltree = subprocess.getoutput(cmddumpid)
|
||||
xmls = xmltree.splitlines()
|
||||
# find strs ,print next line
|
||||
def FindStrs(lines,strs):
|
||||
i=0
|
||||
while i < len(lines):
|
||||
if re.search(strs,lines[i]):
|
||||
tmpstr = lines[i+1]
|
||||
i += 1
|
||||
Resultstr = tmpstr.split(":")[-1].split("=")[-1].split("0x")[-1]
|
||||
return Resultstr
|
||||
else:
|
||||
i += 1
|
||||
#从apk的信息中获取前后景图片的ID号
|
||||
backimgid = FindStrs(xmls,"background")
|
||||
foreimgid = FindStrs(xmls,"foreground")
|
||||
print(backimgid)
|
||||
print(foreimgid)
|
||||
|
||||
# 直接从apk resource文件获取前后两层图片路径及ID字符串
|
||||
resource = subprocess.getoutput("aapt dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"")
|
||||
resourcelines = resource.splitlines()
|
||||
print(resourcelines)
|
||||
|
||||
# 从过滤出的字符串中获取所有相同ID的图片路径
|
||||
def Findpicpath(lines,imgid):
|
||||
i=0
|
||||
Resultstr = []
|
||||
while i < len(lines):
|
||||
if re.search(imgid,lines[i]) and re.search("string8",lines[i+1]) :
|
||||
print(lines[i+1])
|
||||
tmpstr = lines[i+1].replace("\"","")
|
||||
i += 1
|
||||
Resultstr.append(tmpstr.split()[-1])
|
||||
else:
|
||||
i += 1
|
||||
return Resultstr
|
||||
|
||||
#获取所有带前后图片ID的图片路径(相同背景或者前景的图片ID但分辨率不一样)
|
||||
backimgs = Findpicpath(resourcelines,backimgid)
|
||||
foreimgs = Findpicpath(resourcelines,foreimgid)
|
||||
print(backimgs)
|
||||
print(foreimgs)
|
||||
#获取分辨率最高的图片路径
|
||||
def getmaxsize(imgs):
|
||||
j = 0
|
||||
size=(0,0)
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
imgpath = ""
|
||||
while j < len(imgs):
|
||||
print(imgs[j])
|
||||
img = Image.open(zipapk.open(imgs[j]))
|
||||
print(imgs[j])
|
||||
print(img.size)
|
||||
if size < img.size:
|
||||
size = img.size
|
||||
imgpath = imgs[j]
|
||||
j += 1
|
||||
return imgpath
|
||||
|
||||
# 获取到文件列表后,进行比较分辨率,选取分辨率最高的张图片
|
||||
iconbackpath = getmaxsize(backimgs)
|
||||
iconforepath = getmaxsize(foreimgs)
|
||||
print(iconbackpath + " " + iconforepath)
|
||||
|
||||
#从APK文件获取最终图片
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
iconback = zipapk.open(iconbackpath)
|
||||
iconfore = zipapk.open(iconforepath)
|
||||
|
||||
|
||||
# 叠加图片,mask 设置前景为蒙版
|
||||
iconbackimg = Image.open(iconback).convert("RGBA")
|
||||
iconforeimg = Image.open(iconfore).convert("RGBA")
|
||||
iconbackimg.paste(iconforeimg,mask=iconforeimg)
|
||||
|
||||
|
||||
# 圆角图片函数,网上拷贝的
|
||||
def circle_corner(img, radii): #把原图片变成圆角,这个函数是从网上找的,原址 https://www.pyget.cn/p/185266
|
||||
"""
|
||||
圆角处理
|
||||
:param img: 源图象。
|
||||
:param radii: 半径,如:30。
|
||||
:return: 返回一个圆角处理后的图象。
|
||||
"""
|
||||
# 画圆(用于分离4个角)
|
||||
circle = Image.new('L', (radii * 2, radii * 2), 0) # 创建一个黑色背景的画布
|
||||
draw = ImageDraw.Draw(circle)
|
||||
draw.ellipse((0, 0, radii * 2, radii * 2), fill=255) # 画白色圆形
|
||||
# 原图
|
||||
img = img.convert("RGBA")
|
||||
w, h = img.size
|
||||
# 画4个角(将整圆分离为4个部分)
|
||||
alpha = Image.new('L', img.size, 255)
|
||||
alpha.paste(circle.crop((0, 0, radii, radii)), (0, 0)) # 左上角
|
||||
alpha.paste(circle.crop((radii, 0, radii * 2, radii)), (w - radii, 0)) # 右上角
|
||||
alpha.paste(circle.crop((radii, radii, radii * 2, radii * 2)), (w - radii, h - radii)) # 右下角
|
||||
alpha.paste(circle.crop((0, radii, radii, radii * 2)), (0, h - radii)) # 左下角
|
||||
# alpha.show()
|
||||
img.putalpha(alpha) # 白色区域透明可见,黑色区域不可见
|
||||
return img
|
||||
|
||||
# 圆角半径1/8边长,保存icon图片
|
||||
w,h = iconbackimg.size
|
||||
iconimg = circle_corner(iconbackimg,int(w/8))
|
||||
iconimg.save(iconSavePath)
|
||||
|
||||
0
icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
119
information.json
Executable file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"Url": [
|
||||
"https://gitee.com/gfdgd-xi/uengine-runner",
|
||||
"https://github.com/gfdgd-xi/uengine-runner"
|
||||
],
|
||||
"Version": "1.4.3",
|
||||
"System": "Linux(deepin/UOS)",
|
||||
"Tips": [
|
||||
"更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
|
||||
"",
|
||||
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
|
||||
"",
|
||||
"卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。",
|
||||
"",
|
||||
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
|
||||
"",
|
||||
"重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
|
||||
" 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
|
||||
"",
|
||||
"打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
|
||||
"",
|
||||
"提示:",
|
||||
"1、需要你有使用 root 权限的能力;",
|
||||
"2、需要安装 UEngine 才能使用;",
|
||||
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
|
||||
"4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
],
|
||||
"Update": [
|
||||
"V1.4.3:",
|
||||
"※1、支持打包器打包的包名带前缀“uengine-dc”",
|
||||
"※2、修复了两种情况可能导致程序卡住/出错无法继续运行的情况(配置文件夹不齐全和获取版本信息卡住两种情况)",
|
||||
"※3、修改了 UEngine 打包器打包的应用包名可能有大写的情况",
|
||||
"4、支持一键使用 Scrcpy 连接 UEngine(①先安装 adb 破解补丁;②请确保是使用snap安装的 Scrcpy【目前只支持 snap 安装的 Scrcpy 进行连接】)",
|
||||
"5、支持右键打包 apk",
|
||||
"",
|
||||
"V1.4.2:",
|
||||
"※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;",
|
||||
"2、菜单栏的项目添加以及外观优化;",
|
||||
"3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
|
||||
"4、把 uengine 改为 UEngine;",
|
||||
"5、修改 pkexec 获取密码时显示的图标和文本;",
|
||||
"6、添加了 UEngine 系统设置的快捷方式;",
|
||||
"",
|
||||
"V1.4.1:",
|
||||
"※1、初步支持键盘映射",
|
||||
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
|
||||
"",
|
||||
"V1.4.0:",
|
||||
"※1、添加新版打包方式(deepin打包方式);",
|
||||
"※2、支持测试运行/创建/删除uengine图标;",
|
||||
"※3、支持提取安装的apk;",
|
||||
"※4、支持打包deb包;",
|
||||
"5、修改菜单栏布局;",
|
||||
"6、支持打开uengine数据目录和用户数据目录;",
|
||||
"7、程序信息保存到json,非直接写入程序本体;",
|
||||
"8、更多命令操作;",
|
||||
"",
|
||||
"V.1.3.2:",
|
||||
"※1、支持uengine数据重置;",
|
||||
"※2、支持修改uengine网络桥接的启动状态;",
|
||||
"※3、支持右键安装/卸载;",
|
||||
"※4、支持启用或禁用uengine;",
|
||||
"※5、修复打包问题,不会出现“dpkg:警告:卸载spark-uengine-runner时,目录/opt/apps/uengine-runner非空,因而不会删除该目录”的错误;",
|
||||
"",
|
||||
"V1.3.1:",
|
||||
"※1、修复打包问题,防止部分用户安装出错的问题;",
|
||||
"※2、修复了程序无法提取图标时可以提取默认图标使用;",
|
||||
"",
|
||||
"V1.3.0:",
|
||||
"※1、修改了界面布局;",
|
||||
"※2、修复大多数新安装普通用户的路图标及启动菜单文件路径不存在导致安装APK报错的bugs;",
|
||||
"3、删除少量冗余代码,调整代码顺序;",
|
||||
"4、支持提取apk图标。",
|
||||
"",
|
||||
"V1.2.3",
|
||||
"1、调整部分控件名称;",
|
||||
"2、调整界面布局及界面风格;",
|
||||
"",
|
||||
"V1.2.2",
|
||||
"1、对程序错误的显示更加人性化;",
|
||||
"2、对 icon 的获取方式进行了升级;",
|
||||
"3、增加了注释、删除部分冗余代码。",
|
||||
"",
|
||||
"V1.2.1",
|
||||
"※1、进行了安装方式的修改(不使用 adb),修复原无法安装和卸载的问题;",
|
||||
"2、进行了部分优化;",
|
||||
"3、进行了功能缩水;",
|
||||
"4、修复 deb 打包错误。",
|
||||
"",
|
||||
"V1.2.0",
|
||||
"1、支持安装自动添加快捷方式、卸载删除快捷方式;",
|
||||
"2、支持使用包名或 APK 文件卸载程序;",
|
||||
"3、支持查看安装的所有包名;",
|
||||
"4、进行了部分优化",
|
||||
"",
|
||||
"V1.1.0",
|
||||
"暂无数据",
|
||||
"",
|
||||
"V1.0.0",
|
||||
"暂无数据"
|
||||
],
|
||||
"Use": [
|
||||
"1、UEngine相关软件包(基于anbox开发)",
|
||||
"2、Python3",
|
||||
"3、tkinter(tkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk)",
|
||||
"4、aapt",
|
||||
"5、dpkg",
|
||||
"6、tree",
|
||||
"7、mkdir",
|
||||
"8、echo",
|
||||
"9、chmod",
|
||||
"10、adb",
|
||||
"11、deepin 终端",
|
||||
"……"
|
||||
],
|
||||
"Time": "2021年08月30日",
|
||||
"Contribute": ["gfdgd xi<3025613752@qq.com>",
|
||||
"actionchen<917981399@qq.com>"]
|
||||
}
|
||||
11
new-deb-build/DEBIAN/control
Normal file
@@ -0,0 +1,11 @@
|
||||
Package: com.gitee.uengine.runner.spark
|
||||
Source: com.gitee.uengine.runner.spark
|
||||
Version: 1.4.3
|
||||
Architecture: all
|
||||
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>
|
||||
Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, adb, python3-pil, python3-setuptools, uengine, deepin-terminal
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Conflicts: spark-uengine-runner, spark-uengine-apk-builder
|
||||
Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner]
|
||||
Description: UEngine Runner for deepin and UOS
|
||||
15
new-deb-build/DEBIAN/postinst
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# 使用 pip 安装所需库
|
||||
python3 -m pip install --upgrade ttkthemes
|
||||
python3 -m pip install --upgrade requests
|
||||
python3 -m pip install --upgrade pyautogui
|
||||
python3 -m pip install --upgrade keyboard
|
||||
# 建立软链接
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner /usr/bin/uengine-runner
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder /usr/bin/uengine-apk-builder
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall /usr/bin/uengine-app-uninstall
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install /usr/bin/uengine-app-install
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean /usr/bin/uengine-clean
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about /usr/bin/uengine-runner-about
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard /usr/bin/uengine-keyboard
|
||||
ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb /usr/bin/uengine-useadb
|
||||
10
new-deb-build/DEBIAN/postrm
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# 删除软链接
|
||||
rm -fv /usr/bin/uengine-runner
|
||||
rm -fv /usr/bin/uengine-apk-builder
|
||||
rm -fv /usr/bin/uengine-app-uninstall
|
||||
rm -fv /usr/bin/uengine-app-install
|
||||
rm -fv /usr/bin/uengine-clean
|
||||
rm -fv /usr/bin/uengine-runner-about
|
||||
rm -fv /usr/bin/uengine-keyboard
|
||||
rm -fv /usr/bin/uengine-useadb
|
||||
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Categories=System;
|
||||
Comment=UEngine(anbox) 程序菜单
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
MimeType=
|
||||
Name=UEngine 程序菜单
|
||||
StartupWMClass=UEngine 程序菜单
|
||||
Terminal=false
|
||||
Type=Application
|
||||
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Categories=System;
|
||||
Comment=UEngine 系统设置
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package=com.android.settings --component=com.android.settings.Settings
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
MimeType=
|
||||
Name=UEngine 系统设置
|
||||
StartupWMClass=UEngine 系统设置
|
||||
Terminal=false
|
||||
Type=Application
|
||||
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-apk-builder %F
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
Name=Build Apk To Deb(UEngine Runner)
|
||||
Comment=Build Apk To Deb(UEngine Runner)
|
||||
Comment[zh]=打包 deb(UEngine 运行器)
|
||||
Name[zh]=打包 deb(UEngine 运行器)
|
||||
StartupNotify=true
|
||||
Hidden=false
|
||||
NoDisplay=true
|
||||
MimeType=application/vnd.android.package-archive
|
||||
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-runner -i %F
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
Name=Install APK(uengine runner)
|
||||
Comment=Install APK(UEngine runner)
|
||||
Comment[zh]=安装 APK(UEngine 运行器)
|
||||
Name[zh]=安装 APK(UEngine 运行器)
|
||||
StartupNotify=true
|
||||
Hidden=false
|
||||
NoDisplay=true
|
||||
MimeType=application/vnd.android.package-archive
|
||||
@@ -0,0 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-runner -u %F
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
Name=Uninstall APK(UEngine runner)
|
||||
Comment=Uninstall APK(UEngine runner)
|
||||
Comment[zh]=卸载 APK(UEngine 运行器)
|
||||
Name[zh]=卸载 APK(UEngine 运行器)
|
||||
StartupNotify=true
|
||||
Hidden=false
|
||||
NoDisplay=true
|
||||
MimeType=application/vnd.android.package-archive
|
||||
@@ -0,0 +1,12 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-apk-builder %F
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
Name=uengine Apk Builder
|
||||
Comment=UEngine Apk Builder
|
||||
Comment[zh]=UEngine 应用打包器
|
||||
Name[zh]=UEngine 应用打包器
|
||||
StartupNotify=true
|
||||
@@ -0,0 +1,13 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Categories=System;
|
||||
Terminal=false
|
||||
Exec=/usr/bin/uengine-runner
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
Name=uengine runner
|
||||
Comment=UEngine Runner
|
||||
Comment[zh]=UEngine 运行器
|
||||
Name[zh]=UEngine 运行器
|
||||
StartupNotify=true
|
||||
MimeType=
|
||||
373
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/LICENSE
Executable file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Categories=System;
|
||||
Comment=UEngine 程序菜单
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
|
||||
Icon=/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
|
||||
MimeType=
|
||||
Name=UEngine 程序菜单
|
||||
StartupWMClass=UEngine 程序菜单
|
||||
Terminal=false
|
||||
Type=Application
|
||||
BIN
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/defult.png
Executable file
|
After Width: | Height: | Size: 312 KiB |
118
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/getxmlimg.py
Executable file
@@ -0,0 +1,118 @@
|
||||
import PIL.Image as Image
|
||||
import PIL.ImageDraw as ImageDraw
|
||||
import zipfile
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
class getsavexml():
|
||||
|
||||
def savexml(self,apkFilePath,xmlpath,iconSavePath):
|
||||
cmddumpid = "aapt dump xmltree "+ apkFilePath + " " + xmlpath
|
||||
print(cmddumpid)
|
||||
xmltree = subprocess.getoutput(cmddumpid)
|
||||
xmls = xmltree.splitlines()
|
||||
# find strs ,print next line
|
||||
def FindStrs(lines,strs):
|
||||
i=0
|
||||
while i < len(lines):
|
||||
if re.search(strs,lines[i]):
|
||||
tmpstr = lines[i+1]
|
||||
i += 1
|
||||
Resultstr = tmpstr.split(":")[-1].split("=")[-1].split("0x")[-1]
|
||||
return Resultstr
|
||||
else:
|
||||
i += 1
|
||||
#从apk的信息中获取前后景图片的ID号
|
||||
backimgid = FindStrs(xmls,"background")
|
||||
foreimgid = FindStrs(xmls,"foreground")
|
||||
print(backimgid)
|
||||
print(foreimgid)
|
||||
|
||||
# 直接从apk resource文件获取前后两层图片路径及ID字符串
|
||||
resource = subprocess.getoutput("aapt dump --values resources " + apkFilePath + "| grep -iE -A1 " + "\"" + backimgid + "|" + foreimgid + "\"")
|
||||
resourcelines = resource.splitlines()
|
||||
print(resourcelines)
|
||||
|
||||
# 从过滤出的字符串中获取所有相同ID的图片路径
|
||||
def Findpicpath(lines,imgid):
|
||||
i=0
|
||||
Resultstr = []
|
||||
while i < len(lines):
|
||||
if re.search(imgid,lines[i]) and re.search("string8",lines[i+1]) :
|
||||
print(lines[i+1])
|
||||
tmpstr = lines[i+1].replace("\"","")
|
||||
i += 1
|
||||
Resultstr.append(tmpstr.split()[-1])
|
||||
else:
|
||||
i += 1
|
||||
return Resultstr
|
||||
|
||||
#获取所有带前后图片ID的图片路径(相同背景或者前景的图片ID但分辨率不一样)
|
||||
backimgs = Findpicpath(resourcelines,backimgid)
|
||||
foreimgs = Findpicpath(resourcelines,foreimgid)
|
||||
print(backimgs)
|
||||
print(foreimgs)
|
||||
#获取分辨率最高的图片路径
|
||||
def getmaxsize(imgs):
|
||||
j = 0
|
||||
size=(0,0)
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
imgpath = ""
|
||||
while j < len(imgs):
|
||||
print(imgs[j])
|
||||
img = Image.open(zipapk.open(imgs[j]))
|
||||
print(imgs[j])
|
||||
print(img.size)
|
||||
if size < img.size:
|
||||
size = img.size
|
||||
imgpath = imgs[j]
|
||||
j += 1
|
||||
return imgpath
|
||||
|
||||
# 获取到文件列表后,进行比较分辨率,选取分辨率最高的张图片
|
||||
iconbackpath = getmaxsize(backimgs)
|
||||
iconforepath = getmaxsize(foreimgs)
|
||||
print(iconbackpath + " " + iconforepath)
|
||||
|
||||
#从APK文件获取最终图片
|
||||
zipapk = zipfile.ZipFile(apkFilePath)
|
||||
iconback = zipapk.open(iconbackpath)
|
||||
iconfore = zipapk.open(iconforepath)
|
||||
|
||||
|
||||
# 叠加图片,mask 设置前景为蒙版
|
||||
iconbackimg = Image.open(iconback).convert("RGBA")
|
||||
iconforeimg = Image.open(iconfore).convert("RGBA")
|
||||
iconbackimg.paste(iconforeimg,mask=iconforeimg)
|
||||
|
||||
|
||||
# 圆角图片函数,网上拷贝的
|
||||
def circle_corner(img, radii): #把原图片变成圆角,这个函数是从网上找的,原址 https://www.pyget.cn/p/185266
|
||||
"""
|
||||
圆角处理
|
||||
:param img: 源图象。
|
||||
:param radii: 半径,如:30。
|
||||
:return: 返回一个圆角处理后的图象。
|
||||
"""
|
||||
# 画圆(用于分离4个角)
|
||||
circle = Image.new('L', (radii * 2, radii * 2), 0) # 创建一个黑色背景的画布
|
||||
draw = ImageDraw.Draw(circle)
|
||||
draw.ellipse((0, 0, radii * 2, radii * 2), fill=255) # 画白色圆形
|
||||
# 原图
|
||||
img = img.convert("RGBA")
|
||||
w, h = img.size
|
||||
# 画4个角(将整圆分离为4个部分)
|
||||
alpha = Image.new('L', img.size, 255)
|
||||
alpha.paste(circle.crop((0, 0, radii, radii)), (0, 0)) # 左上角
|
||||
alpha.paste(circle.crop((radii, 0, radii * 2, radii)), (w - radii, 0)) # 右上角
|
||||
alpha.paste(circle.crop((radii, radii, radii * 2, radii * 2)), (w - radii, h - radii)) # 右下角
|
||||
alpha.paste(circle.crop((0, radii, radii, radii * 2)), (0, h - radii)) # 左下角
|
||||
# alpha.show()
|
||||
img.putalpha(alpha) # 白色区域透明可见,黑色区域不可见
|
||||
return img
|
||||
|
||||
# 圆角半径1/8边长,保存icon图片
|
||||
w,h = iconbackimg.size
|
||||
iconimg = circle_corner(iconbackimg,int(w/8))
|
||||
iconimg.save(iconSavePath)
|
||||
|
||||
BIN
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/icon.png
Executable file
|
After Width: | Height: | Size: 10 KiB |
119
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json
Executable file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"Url": [
|
||||
"https://gitee.com/gfdgd-xi/uengine-runner",
|
||||
"https://github.com/gfdgd-xi/uengine-runner"
|
||||
],
|
||||
"Version": "1.4.3",
|
||||
"System": "Linux(deepin/UOS)",
|
||||
"Tips": [
|
||||
"更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis",
|
||||
"",
|
||||
"安装APK:点浏览按钮,选中需要安装的APK,然后点安装按钮",
|
||||
"",
|
||||
"卸载APK:在卸载APK下面的输入框内输入需要卸载的APK包名,点卸载按钮,如果无法获取包名,可以通过浏览APK文件程序自动获取包名进行卸载。",
|
||||
"",
|
||||
"保存APK图标:在安装APK下面的输入框浏览或输入APK的路径,然后点击“保存图标”按钮,选择保存位置即可",
|
||||
"",
|
||||
"重置(删除)UEngine数据:点击菜单栏的“UEngine”的“清空UEngine数据”,输入密码重启即可",
|
||||
" 注意:如果任何安卓一遍打不开,多打开几遍应该就可以重新加载UEngine配置了",
|
||||
"",
|
||||
"打开UEngine应用列表:打开系统已安装的应用列表(安卓界面)",
|
||||
"",
|
||||
"提示:",
|
||||
"1、需要你有使用 root 权限的能力;",
|
||||
"2、需要安装 UEngine 才能使用;",
|
||||
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
|
||||
"4、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)"
|
||||
],
|
||||
"Update": [
|
||||
"V1.4.3:",
|
||||
"※1、支持打包器打包的包名带前缀“uengine-dc”",
|
||||
"※2、修复了两种情况可能导致程序卡住/出错无法继续运行的情况(配置文件夹不齐全和获取版本信息卡住两种情况)",
|
||||
"※3、修改了 UEngine 打包器打包的应用包名可能有大写的情况",
|
||||
"4、支持一键使用 Scrcpy 连接 UEngine(①先安装 adb 破解补丁;②请确保是使用snap安装的 Scrcpy【目前只支持 snap 安装的 Scrcpy 进行连接】)",
|
||||
"5、支持右键打包 apk",
|
||||
"",
|
||||
"V1.4.2:",
|
||||
"※1、添加adb破解补丁(用于可以让adb连接UEngine)并支持adb的部分操作;",
|
||||
"2、菜单栏的项目添加以及外观优化;",
|
||||
"3、修复键盘映射无法添加新映射的问题并修改键盘映射启动方式;",
|
||||
"4、把 uengine 改为 UEngine;",
|
||||
"5、修改 pkexec 获取密码时显示的图标和文本;",
|
||||
"6、添加了 UEngine 系统设置的快捷方式;",
|
||||
"",
|
||||
"V1.4.1:",
|
||||
"※1、初步支持键盘映射",
|
||||
"2、修复新版包在发送uengine列表快捷方式时会提示找不到文件",
|
||||
"",
|
||||
"V1.4.0:",
|
||||
"※1、添加新版打包方式(deepin打包方式);",
|
||||
"※2、支持测试运行/创建/删除uengine图标;",
|
||||
"※3、支持提取安装的apk;",
|
||||
"※4、支持打包deb包;",
|
||||
"5、修改菜单栏布局;",
|
||||
"6、支持打开uengine数据目录和用户数据目录;",
|
||||
"7、程序信息保存到json,非直接写入程序本体;",
|
||||
"8、更多命令操作;",
|
||||
"",
|
||||
"V.1.3.2:",
|
||||
"※1、支持uengine数据重置;",
|
||||
"※2、支持修改uengine网络桥接的启动状态;",
|
||||
"※3、支持右键安装/卸载;",
|
||||
"※4、支持启用或禁用uengine;",
|
||||
"※5、修复打包问题,不会出现“dpkg:警告:卸载spark-uengine-runner时,目录/opt/apps/uengine-runner非空,因而不会删除该目录”的错误;",
|
||||
"",
|
||||
"V1.3.1:",
|
||||
"※1、修复打包问题,防止部分用户安装出错的问题;",
|
||||
"※2、修复了程序无法提取图标时可以提取默认图标使用;",
|
||||
"",
|
||||
"V1.3.0:",
|
||||
"※1、修改了界面布局;",
|
||||
"※2、修复大多数新安装普通用户的路图标及启动菜单文件路径不存在导致安装APK报错的bugs;",
|
||||
"3、删除少量冗余代码,调整代码顺序;",
|
||||
"4、支持提取apk图标。",
|
||||
"",
|
||||
"V1.2.3",
|
||||
"1、调整部分控件名称;",
|
||||
"2、调整界面布局及界面风格;",
|
||||
"",
|
||||
"V1.2.2",
|
||||
"1、对程序错误的显示更加人性化;",
|
||||
"2、对 icon 的获取方式进行了升级;",
|
||||
"3、增加了注释、删除部分冗余代码。",
|
||||
"",
|
||||
"V1.2.1",
|
||||
"※1、进行了安装方式的修改(不使用 adb),修复原无法安装和卸载的问题;",
|
||||
"2、进行了部分优化;",
|
||||
"3、进行了功能缩水;",
|
||||
"4、修复 deb 打包错误。",
|
||||
"",
|
||||
"V1.2.0",
|
||||
"1、支持安装自动添加快捷方式、卸载删除快捷方式;",
|
||||
"2、支持使用包名或 APK 文件卸载程序;",
|
||||
"3、支持查看安装的所有包名;",
|
||||
"4、进行了部分优化",
|
||||
"",
|
||||
"V1.1.0",
|
||||
"暂无数据",
|
||||
"",
|
||||
"V1.0.0",
|
||||
"暂无数据"
|
||||
],
|
||||
"Use": [
|
||||
"1、UEngine相关软件包(基于anbox开发)",
|
||||
"2、Python3",
|
||||
"3、tkinter(tkinter.tk、ttkthemes、tkinter.messagebox、tkinter.simpledialog、tkinter.filedialog 和 tkinter.ttk)",
|
||||
"4、aapt",
|
||||
"5、dpkg",
|
||||
"6、tree",
|
||||
"7、mkdir",
|
||||
"8、echo",
|
||||
"9、chmod",
|
||||
"10、adb",
|
||||
"11、deepin 终端",
|
||||
"……"
|
||||
],
|
||||
"Time": "2021年08月30日",
|
||||
"Contribute": ["gfdgd xi<3025613752@qq.com>",
|
||||
"actionchen<917981399@qq.com>"]
|
||||
}
|
||||
6
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/setting.json
Executable file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"Package": "com.gitee.uengine.runner.spark",
|
||||
"Update": true,
|
||||
"Version": "1.4.3",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
}
|
||||
444
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder
Executable file
@@ -0,0 +1,444 @@
|
||||
#!/usr/bin/env python3
|
||||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.4.2
|
||||
# 更新时间:2021年8月30日
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import random
|
||||
import zipfile
|
||||
import traceback
|
||||
import threading
|
||||
import subprocess
|
||||
import ttkthemes
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
import tkinter.filedialog as filedialog
|
||||
from getxmlimg import getsavexml
|
||||
|
||||
def FindApk():
|
||||
path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"])
|
||||
if path != "" and path != "()":
|
||||
try:
|
||||
combobox1.set(path)
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
|
||||
except:
|
||||
pass
|
||||
|
||||
def BuildDeb():
|
||||
if combobox1.get() == "":
|
||||
messagebox.showerror(title="提示", message="信息没有填写完整,无法继续打包 APK")
|
||||
return
|
||||
if not os.path.exists(combobox1.get()):
|
||||
messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK")
|
||||
return
|
||||
DisabledAndEnbled(True)
|
||||
threading.Thread(target=BuildApkDeb, args=(combobox1.get(),)).start()
|
||||
|
||||
def RunCommandShow(command):
|
||||
TextboxAddText1("$> {}".format(command))
|
||||
TextboxAddText1(GetCommandReturn(command))
|
||||
|
||||
def BuildApkDeb(apkPath):
|
||||
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
|
||||
RunCommandShow("echo '======================================New===================================='")
|
||||
RunCommandShow("echo '创建目录'")
|
||||
RunCommandShow("mkdir -pv '{}/DEBIAN'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/applications'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
|
||||
RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
|
||||
apkPackageName = GetApkPackageName(apkPath)
|
||||
apkPackageVersion = GetApkVersion(apkPath)
|
||||
apkChineseLabel = GetApkChineseLabel(apkPath)
|
||||
apkActivityName = GetApkActivityName(apkPath)
|
||||
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageName)
|
||||
debControl = '''Package: {}
|
||||
Version: {}
|
||||
Architecture: all
|
||||
Maintainer: {}
|
||||
Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1)
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Description: {}\n'''.format(apkPackageName, apkPackageVersion, apkChineseLabel, apkChineseLabel)
|
||||
debPostinst = '''#!/bin/sh
|
||||
|
||||
APK_DIR="/usr/share/uengine/apk"
|
||||
APK_NAME="{}.apk"
|
||||
APK_PATH="$APK_DIR/$APK_NAME"
|
||||
DESKTOP_FILE="/usr/share/applications/{}.desktop"
|
||||
ICON_FILE="/usr/share/uengine/icons/{}.png"
|
||||
|
||||
if [ -f $APK_PATH ]; then
|
||||
echo "Installing $APK_NAME"
|
||||
else
|
||||
echo "ERROR: $APK_NAME file not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: apk install error..."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo rm -f "$APK_PATH"
|
||||
|
||||
exit 0'''.format(apkPackageName, apkPackageName, apkPackageName)
|
||||
debPrerm = '''#!/bin/sh
|
||||
|
||||
APP_NAME="{}"
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Uninstalling $APP_NAME"
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: app uninstall error..."
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /etc/passwd | awk -F: '$3>=1000' | cut -f 1 -d : | while read line
|
||||
do
|
||||
inifile="/home/$line/.config/uengineAppGeometry.ini"
|
||||
if [ -f $inifile ]; then
|
||||
sed -i "/$APP_NAME/d" $inifile
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0'''.format(apkPackageName)
|
||||
desktopFile = '''[Desktop Entry]
|
||||
Categories=Other;
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
Icon=/usr/share/uengine/icons/{}.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
GenericName={}
|
||||
Name={}
|
||||
'''
|
||||
#RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath))
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/control".format(tempPath), debControl)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
|
||||
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageName))
|
||||
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName), desktopFile)
|
||||
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, iconSavePath,
|
||||
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName))
|
||||
RunCommandShow("echo '复制文件'")
|
||||
RunCommandShow("echo '写入 APK 软件图标'")
|
||||
SaveApkIcon(apkPath, iconSavePath)
|
||||
RunCommandShow("echo '复制 APK 文件'")
|
||||
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageName))
|
||||
RunCommandShow("echo '正在设置文件权限……'")
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
|
||||
RunCommandShow("echo '打包 deb 到桌面……'")
|
||||
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageName, apkPackageVersion))
|
||||
RunCommandShow("echo '完成!'")
|
||||
findApkHistory.append(apkPath)
|
||||
combobox1['value'] = findApkHistory
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
|
||||
messagebox.showinfo(title="提示", message="打包完成")
|
||||
DisabledAndEnbled(False)
|
||||
|
||||
def DisabledAndEnbled(choose):
|
||||
userChoose = {True: tk.DISABLED, False: tk.NORMAL}
|
||||
a = userChoose[choose]
|
||||
combobox1.configure(state=a)
|
||||
check.configure(state=a)
|
||||
button2.configure(state=a)
|
||||
button3.configure(state=a)
|
||||
|
||||
# 需引入 subprocess
|
||||
def GetCommandReturn(cmd):
|
||||
# cmd 是要获取输出的命令
|
||||
return subprocess.getoutput(cmd)
|
||||
|
||||
# 重启本应用程序
|
||||
def ReStartProgram():
|
||||
python = sys.executable
|
||||
os.execl(python, python, * sys.argv)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
# 获取用户桌面目录
|
||||
def get_desktop_path():
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
|
||||
# 数组转字典
|
||||
def ListToDictionary(list):
|
||||
dictionary = {}
|
||||
for i in range(len(list)):
|
||||
dictionary[i] = list[i]
|
||||
return dictionary
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path):
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
# 写入文本文档
|
||||
def write_txt(path, things):
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
def GetApkInformation(apkFilePath):
|
||||
return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath))
|
||||
|
||||
def GetApkActivityName(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "launchable-activity" in line:
|
||||
line = line[0: line.index("label='")]
|
||||
line = line.replace("launchable-activity: ", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
line = line.replace("name=", "")
|
||||
line = line.replace("label=", "")
|
||||
line = line.replace("icon=", "")
|
||||
return line
|
||||
|
||||
def GetApkPackageName(apkFilePath):
|
||||
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "package:" in line:
|
||||
line = line[0: line.index("versionCode='")]
|
||||
line = line.replace("package:", "")
|
||||
line = line.replace("name=", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
# 此较为特殊,因为需要判断用户是否要添加前缀
|
||||
if qianZhui.get() == True:
|
||||
return "uengine-dc-{}".format(line).lower()
|
||||
return line.lower()
|
||||
|
||||
def GetApkVersion(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "package:" in line:
|
||||
if "compileSdkVersion='" in line:
|
||||
line = line.replace(line[line.index("compileSdkVersion='"): -1], "")
|
||||
if "platform" in line:
|
||||
line = line.replace(line[line.index("platform"): -1], "")
|
||||
line = line.replace(line[0: line.index("versionName='")], "")
|
||||
line = line.replace("versionName='", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
return line
|
||||
|
||||
def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath):
|
||||
things = '''
|
||||
[Desktop Entry]
|
||||
Categories=app;
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
GenericName={}
|
||||
Icon={}
|
||||
MimeType=
|
||||
Name={}
|
||||
StartupWMClass={}
|
||||
Terminal=false
|
||||
Type=Application
|
||||
'''.format(packageName, activityName, showName, iconPath, showName, showName)
|
||||
write_txt(savePath, things)
|
||||
|
||||
def GetApkChineseLabel(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application-label:" in line:
|
||||
line = line.replace("application-label:", "")
|
||||
line = line.replace("'", "")
|
||||
return line
|
||||
|
||||
def GetApkIconInApk(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application:" in line:
|
||||
line = line[line.index("icon='"): -1]
|
||||
line = line.replace("icon='", "")
|
||||
if "'" in line:
|
||||
line = line[0: line.index("'")]
|
||||
return line
|
||||
return line
|
||||
|
||||
#合并两个函数到一起
|
||||
def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标":
|
||||
try:
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application:" in line:
|
||||
xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","")
|
||||
if xmlpath.endswith('.xml'):
|
||||
xmlsave = getsavexml()
|
||||
print(xmlpath)
|
||||
xmlsave.savexml(apkFilePath,xmlpath,iconSavePath)
|
||||
else:
|
||||
zip = zipfile.ZipFile(apkFilePath)
|
||||
iconData = zip.read(xmlpath)
|
||||
with open(iconSavePath, 'w+b') as saveIconFile:
|
||||
saveIconFile.write(iconData)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("Error, show defult icon")
|
||||
shutil.copy(programPath + "/defult.png", iconSavePath)
|
||||
|
||||
|
||||
#def SaveApkIcon(apkFilePath, iconSavePath):
|
||||
# zip = zipfile.ZipFile(apkFilePath)
|
||||
# iconData = zip.read(GetApkIconInApk(apkFilePath))
|
||||
# with open(iconSavePath, 'w+b') as saveIconFile:
|
||||
# saveIconFile.write(iconData)
|
||||
|
||||
def TextboxAddText1(message):
|
||||
global textbox1
|
||||
textbox1.configure(state=tk.NORMAL)
|
||||
textbox1.insert(tk.END,message + "\n")
|
||||
textbox1.configure(state=tk.DISABLED)
|
||||
|
||||
# 获取用户桌面目录
|
||||
def get_desktop_path():
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
###########################
|
||||
# 程序信息
|
||||
###########################
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
information = json.loads(readtxt(programPath + "/information.json"))
|
||||
version = information["Version"]
|
||||
title = "UEngine APK 应用打包器 {}".format(version)
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
|
||||
###########################
|
||||
# 加载配置
|
||||
###########################
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
|
||||
os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json"): # 如果没有配置文件
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", json.dumps({})) # 创建配置文件
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuild.json"): # 如果没有配置文件
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": "~"})) # 创建配置文件
|
||||
|
||||
###########################
|
||||
# 设置变量
|
||||
###########################
|
||||
findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json")).values())
|
||||
|
||||
###########################
|
||||
# 窗口创建
|
||||
###########################
|
||||
win = tk.Tk()
|
||||
|
||||
qianZhui = tk.BooleanVar()
|
||||
|
||||
window = ttk.Frame(win)
|
||||
frame2 = ttk.Frame(window)
|
||||
label1 = ttk.Label(window, text="要打包的 apk 路径:")
|
||||
combobox1 = ttk.Combobox(window, width=100)
|
||||
button2 = ttk.Button(window, text="浏览", command=FindApk)
|
||||
button3 = ttk.Button(frame2, text="打包", command=BuildDeb)
|
||||
check = ttk.Checkbutton(frame2, variable=qianZhui,text="使用前缀“uengine-dc”")
|
||||
textbox1 = tk.Text(window, width=100)
|
||||
menu = tk.Menu(window, background="white") # 设置菜单栏
|
||||
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
|
||||
|
||||
menu.add_cascade(label="程序", menu=programmenu)
|
||||
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
|
||||
# 设置控件
|
||||
combobox1['value'] = findApkHistory
|
||||
textbox1.configure(state=tk.DISABLED)
|
||||
textbox1.config(foreground='white', background='black')
|
||||
# 如果有参数
|
||||
if len(sys.argv) > 1:
|
||||
combobox1.set(sys.argv[1])
|
||||
# 设置窗口
|
||||
style = ttkthemes.ThemedStyle(win)
|
||||
style.set_theme("breeze")
|
||||
win.attributes('-alpha', 0.5)
|
||||
win.title(title)
|
||||
win.resizable(0, 0)
|
||||
win.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
#
|
||||
win.config(menu=menu) # 显示菜单栏
|
||||
label1.grid(row=2, column=0)
|
||||
combobox1.grid(row=2, column=1)
|
||||
button2.grid(row=2, column=2)
|
||||
button3.grid(row=0, column=1)
|
||||
check.grid(row=0, column=0)
|
||||
frame2.grid(row=3, columnspa=3)
|
||||
textbox1.grid(row=4, columnspa=3)
|
||||
window.pack()
|
||||
win.mainloop()
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("uengine-app-install apk路径")
|
||||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("uengine-app-uninstall apk包名")
|
||||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
11
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("输入命令即可清空/重置UEngine")
|
||||
sys.exit(0)
|
||||
print("参数错误")
|
||||
sys.exit(1)
|
||||
sys.exit(os.system("sudo rm -rf /data/uengine"))
|
||||
227
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard
Executable file
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env python3
|
||||
#########################################
|
||||
# 版本:1.4.0
|
||||
# 更新时间:2021年08月26日
|
||||
# Need: unix, python3-tk, python3-pip, pymouse, keyboard
|
||||
#########################################
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
import shutil
|
||||
import keyboard
|
||||
import traceback
|
||||
import ttkthemes
|
||||
import pyautogui
|
||||
import threading
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
import tkinter.filedialog as filedialog
|
||||
import Xlib.threaded as threaded
|
||||
#import pymouse.unix as pymouse
|
||||
########################
|
||||
#
|
||||
########################
|
||||
def Inputt(key):
|
||||
if key.event_type == "up":
|
||||
global setting
|
||||
if setting:
|
||||
Setting(key)
|
||||
else:
|
||||
Mouse(key)
|
||||
#Mouse(key)
|
||||
|
||||
def Open():
|
||||
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
|
||||
if not path == "" or path == ():
|
||||
shutil.copy(path, get_home() + "/.config/uengine-keyboard/key.json")
|
||||
if messagebox.askyesno(title="提示", message="导入成功!是否现在重启程序以便生效?"):
|
||||
ReStartProgram()
|
||||
|
||||
def Save():
|
||||
path = filedialog.asksaveasfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
|
||||
if not path == "" or path == ():
|
||||
shutil.copy(get_home() + "/.config/uengine-keyboard/key.json", path)
|
||||
messagebox.showinfo(title="提示", message="导出成功!")
|
||||
|
||||
# 重启本应用程序
|
||||
def ReStartProgram()->"重启本应用程序":
|
||||
python = sys.executable
|
||||
os.execl(python, python, * sys.argv)
|
||||
|
||||
|
||||
def Mouse(key):
|
||||
print(keybo)
|
||||
if keybo.__contains__(key.name):
|
||||
print(keybo[key.name]["MousePlace"])
|
||||
pyautogui.FAILSAFE = False
|
||||
#os.system(programPath + "/mouse.py {} {}".format(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]))
|
||||
#pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])
|
||||
pyautogui.click(1500, 800)
|
||||
#m.click(keybo[key.name]["MousePlace"][0],keybo[key.name]["MousePlace"][1])
|
||||
|
||||
def Setting(key):
|
||||
if key.event_type == 'up':
|
||||
keybo[key.name] = {"Mouse": "Left", "MousePlace": pyautogui.position()}
|
||||
write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), json.dumps(keybo))
|
||||
global inputs
|
||||
inputs = True
|
||||
global setting
|
||||
setting = False
|
||||
return False
|
||||
|
||||
def ShowTips():
|
||||
try:
|
||||
if setting:
|
||||
settingLabelText.set('''设置方法:把鼠标移动带所需位置然后按下需要设置的按键即可({}x{})
|
||||
提示:
|
||||
1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键;
|
||||
2、使用映射不能关闭本窗口,但可以最小化;
|
||||
3、本程序需要 root 权限才能使用;
|
||||
4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1]))
|
||||
settingButton.configure(state=tk.DISABLED)
|
||||
else:
|
||||
settingLabelText.set('''点击“设置”按钮设置映射({}x{})
|
||||
提示:
|
||||
1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键;
|
||||
2、使用映射不能关闭本窗口,但可以最小化;
|
||||
3、本程序需要 root 权限才能使用;
|
||||
4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1]))
|
||||
settingButton.configure(state=tk.NORMAL)
|
||||
time.sleep(0.1)
|
||||
ShowTips()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
if not close:
|
||||
ShowTips()
|
||||
|
||||
def Closing():
|
||||
close = True
|
||||
window.destroy()
|
||||
|
||||
def Key():
|
||||
keyboard.hook(Inputt)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home()->"获取用户主目录":
|
||||
return os.path.expanduser('~')
|
||||
|
||||
# 写入文本文档
|
||||
def write_txt(path: "路径", things: "内容")->"写入文本文档":
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
def Settings():
|
||||
global setting
|
||||
setting = True
|
||||
|
||||
def Clean():
|
||||
if messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
|
||||
shutil.rmtree("{}/.config/uengine-keyboard".format(get_home()))
|
||||
if messagebox.askyesno(title="提示", message="删除成功!是否现在重启程序以便生效?"):
|
||||
ReStartProgram()
|
||||
|
||||
def About():
|
||||
threading.Thread(target=os.system, args=["{}/uengine-runner-about".format(programPath)]).start()
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
if not os.path.exists("{}/.config/uengine-keyboard".format(get_home())):
|
||||
os.mkdir("{}/.config/uengine-keyboard".format(get_home()))
|
||||
if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home())):
|
||||
write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), "{}")
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
setting = False
|
||||
close = False
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home())))
|
||||
version = json.loads(readtxt("{}/information.json".format(programPath)))["Version"]
|
||||
|
||||
###################
|
||||
# 判断是不是 root
|
||||
###################
|
||||
if os.geteuid() != 0:
|
||||
print("不是以 root 权限运行本程序!")
|
||||
root = tk.Tk()
|
||||
root.overrideredirect(1)
|
||||
root.withdraw()
|
||||
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
|
||||
sys.exit(1)
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
window = tk.Tk()
|
||||
win = ttk.Frame(window)
|
||||
show = ttk.Frame(win)
|
||||
|
||||
settingLabelText = tk.StringVar()
|
||||
|
||||
# 设置菜单栏
|
||||
menu = tk.Menu(window, tearoff=0, background="white")
|
||||
programMenu = tk.Menu(menu, tearoff=0, background="white")
|
||||
aboutMenu = tk.Menu(menu, tearoff=0, background="white")
|
||||
|
||||
settingLabel = ttk.Label(win, textvariable=settingLabelText)
|
||||
|
||||
settingMouseToKeyboard = ttk.Button(show, text="启动键盘映射(已启用)")
|
||||
settingButton = ttk.Button(show, text="添加或覆盖键盘映射设置", command=Settings)
|
||||
|
||||
settingMouseToKeyboard.configure(state=tk.DISABLED)
|
||||
|
||||
style = ttkthemes.ThemedStyle(window)
|
||||
style.set_theme("breeze")
|
||||
window.protocol('WM_DELETE_WINDOW', Closing)
|
||||
window.resizable(0, 0)
|
||||
window.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
window.title("UEngine 键盘映射 {}".format(version))
|
||||
|
||||
menu.add_cascade(label="程序", menu=programMenu)
|
||||
menu.add_cascade(label="帮助", menu=aboutMenu)
|
||||
menu.configure(activebackground="dodgerblue")
|
||||
|
||||
programMenu.add_command(label="导入映射设置", command=Open)
|
||||
programMenu.add_command(label="导出映射设置", command=Save)
|
||||
programMenu.add_command(label="删除所有映射设置", command=Clean)
|
||||
programMenu.add_separator()
|
||||
programMenu.add_command(label="退出程序", command=sys.exit)
|
||||
programMenu.configure(activebackground="dodgerblue")
|
||||
|
||||
aboutMenu.add_command(label="关于", command=About)
|
||||
|
||||
window.config(menu=menu) # 显示菜单栏
|
||||
|
||||
show.grid(row=1, column=0)
|
||||
|
||||
settingLabel.grid(row=0, column=0)
|
||||
|
||||
settingMouseToKeyboard.grid(row=0, column=0)
|
||||
settingButton.grid(row=0, column=1)
|
||||
|
||||
win.pack(fill="both", expand="yes")
|
||||
#threaded.lock.allocate_lock()
|
||||
threading.Thread(target=Key).start()
|
||||
threading.Thread(target=ShowTips).start()
|
||||
pyautogui.FAILSAFE = False
|
||||
'''def B(key):
|
||||
if key.event_type == "up":
|
||||
print(pyautogui.position())
|
||||
print(key.name)
|
||||
pyautogui.click(1500, 800)
|
||||
keyboard.hook(B)
|
||||
keyboard.wait()'''
|
||||
window.mainloop()
|
||||
1176
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner
Executable file
170
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about
Executable file
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env python3
|
||||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.4.3
|
||||
# 更新时间:2021年9月11日
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import json
|
||||
import ttkthemes
|
||||
import subprocess
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
###########################
|
||||
# 程序信息
|
||||
###########################
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
information = json.loads(readtxt(programPath + "/information.json"))
|
||||
programUrl = information["Url"][0]
|
||||
version = information["Version"]
|
||||
goodRunSystem = information["System"]
|
||||
aaptVersion = subprocess.getoutput("aapt version")
|
||||
about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。
|
||||
|
||||
版本 :{}
|
||||
|
||||
适用平台 :{}
|
||||
|
||||
程序官网 :{}
|
||||
|
||||
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
|
||||
tips = "\n".join(information["Tips"])
|
||||
updateThingsString = "\n".join(information["Update"])
|
||||
title = "UEngine 运行器 {}".format(version)
|
||||
updateTime = information["Time"]
|
||||
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
|
||||
desktopName = "UengineAndroidProgramList.desktop"
|
||||
contribute = "\n".join(information["Contribute"])
|
||||
useProgram = ""
|
||||
threading.Thread(target=useProgram).start()
|
||||
|
||||
# add sub window
|
||||
#添加窗口开启关闭开关,防止重复开启
|
||||
windowflag = "close"
|
||||
|
||||
def UseProgram():
|
||||
global useProgram
|
||||
useProgram = '''1、UEngine:{}
|
||||
2、python3:{}
|
||||
3、tkinter:{}
|
||||
4、aapt:{}
|
||||
5、dpkg:{}
|
||||
6、mkdir:{}
|
||||
7、echo
|
||||
8、chmod:{}
|
||||
9、adb:{}
|
||||
10、deepin 终端:{}'''.format(subprocess.getoutput("uengine version"),
|
||||
subprocess.getoutput("python3 --version"),
|
||||
tk.TkVersion,
|
||||
subprocess.getoutput("aapt version"),
|
||||
subprocess.getoutput("dpkg --version"),
|
||||
subprocess.getoutput("mkdir --version"),
|
||||
subprocess.getoutput("chmod --version"),
|
||||
subprocess.getoutput("adb version"),
|
||||
subprocess.getoutput("deepin-terminal -v"))
|
||||
|
||||
def showhelp():
|
||||
|
||||
#define window and frame and button label
|
||||
#
|
||||
global windowflag
|
||||
if windowflag == "close":
|
||||
helpwindow=tk.Tk()
|
||||
helpwindow.resizable(0, 0)
|
||||
helpwindow.title("帮助")
|
||||
|
||||
|
||||
# get screen width and height
|
||||
screen_width = helpwindow.winfo_screenwidth()
|
||||
screen_height = helpwindow.winfo_screenheight()
|
||||
# calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
|
||||
winwith=550
|
||||
winhigh=700
|
||||
x = (screen_width/2) - (winwith/2)
|
||||
y = (screen_height/2) - (winhigh/2)
|
||||
|
||||
helpwindow.geometry("550x700"+"+{:.0f}+{:.0f}".format(x, y))
|
||||
helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
|
||||
style = ttkthemes.ThemedStyle(helpwindow)
|
||||
style.set_theme("breeze")
|
||||
|
||||
|
||||
|
||||
Frmroot=ttk.Frame(helpwindow)
|
||||
FrmMenu = ttk.Frame(Frmroot)
|
||||
FrmText = ttk.Frame(Frmroot)
|
||||
|
||||
LabFrmText=ttk.LabelFrame(FrmText,text="帮助",height=800,borderwidth=3)
|
||||
HelpStr = tk.StringVar()
|
||||
HelpStr.set(tips)
|
||||
LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55)
|
||||
LabText.config(wraplength=350)
|
||||
|
||||
def on_closing():
|
||||
global windowflag
|
||||
windowflag = "close"
|
||||
print(windowflag)
|
||||
helpwindow.destroy()
|
||||
|
||||
|
||||
|
||||
# define button func
|
||||
def ChgLog():
|
||||
HelpStr.set(updateThingsString)
|
||||
def ChgAbout():
|
||||
HelpStr.set(about)
|
||||
def ChgDep():
|
||||
if useProgram == "":
|
||||
BtnZujian.configure(state=tk.DISABLED)
|
||||
return
|
||||
HelpStr.set(useProgram)
|
||||
def ChgCon():
|
||||
HelpStr.set(contribute)
|
||||
def ChgTips():
|
||||
HelpStr.set(tips)
|
||||
LabText.config(wraplength=350)
|
||||
|
||||
BtnReadme = ttk.Button(FrmMenu, text="使用说明",width=14,command=ChgTips)
|
||||
BtnLog = ttk.Button(FrmMenu, text="更新内容",width=14,command=ChgLog)
|
||||
BtnZujian = ttk.Button(FrmMenu, text="程序依赖的组件",width=14,command=ChgDep)
|
||||
BtnGongxian = ttk.Button(FrmMenu, text="有贡献的开发者",width=14,command=ChgCon)
|
||||
BtnAbout = ttk.Button(FrmMenu, text="关于",width=14,command=ChgAbout)
|
||||
|
||||
|
||||
#layout
|
||||
FrmMenu.grid(row=0,column=0,sticky=tk.NW)
|
||||
BtnReadme.grid(row=0,column=0,sticky=tk.NW,padx=3)
|
||||
BtnLog.grid(row=1,column=0,sticky=tk.NW,padx=3)
|
||||
BtnZujian.grid(row=2,column=0,sticky=tk.NW,padx=3)
|
||||
BtnGongxian.grid(row=3,column=0,sticky=tk.NW,padx=3)
|
||||
BtnAbout.grid(row=4,column=0,sticky=tk.NW,padx=3)
|
||||
|
||||
FrmText.grid(row=0,column=1,sticky=tk.NW)
|
||||
LabFrmText.grid(row=0,column=0,sticky=tk.NW,padx=3,pady=3)
|
||||
LabText.grid(row=0,column=0,sticky=tk.NW)
|
||||
|
||||
Frmroot.pack()
|
||||
windowflag = "open"
|
||||
print(windowflag)
|
||||
helpwindow.mainloop()
|
||||
#helpwindow.protocol("WM_DELETE_WINDOW", on_closing)
|
||||
showhelp()
|
||||
83
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
#########################################
|
||||
# 版本:1.4.2
|
||||
# 更新时间:2021年08月30日
|
||||
#########################################
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import traceback
|
||||
import ttkthemes
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
########################
|
||||
#
|
||||
########################
|
||||
# 写入文本文档
|
||||
def write_txt(path: "路径", things: "内容")->"写入文本文档":
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
###################
|
||||
# 判断是不是 root
|
||||
###################
|
||||
if os.geteuid() != 0:
|
||||
print("不是以 root 权限运行本程序!")
|
||||
root = tk.Tk()
|
||||
root.overrideredirect(1)
|
||||
root.withdraw()
|
||||
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
|
||||
sys.exit(1)
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
window = tk.Tk()
|
||||
style = ttkthemes.ThemedStyle(window)
|
||||
style.set_theme("breeze")
|
||||
window.overrideredirect(1)
|
||||
window.withdraw()
|
||||
try:
|
||||
if sys.argv[1] == "1" and messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
|
||||
os.remove("/data/uengine/data/data/misc/adb/adb_keys")
|
||||
messagebox.showinfo(title="提示", message="完成")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
sys.exit(2)
|
||||
if sys.argv[1] == "1":
|
||||
sys.exit(0)
|
||||
|
||||
if not messagebox.askyesno(title="提示", message='''请阅读以下提示然后确定是否继续:
|
||||
1、安装后即可使用 adb 连接 UEngine;
|
||||
2、重置 UEngine 或 adb 就需要重新设置该支持补丁;
|
||||
3、需要 root 权限;'''):
|
||||
sys.exit(0)
|
||||
# 写入(需要 root)
|
||||
if not os.path.exists("/data/uengine/data/data/misc/adb"):
|
||||
messagebox.showerror(title="错误", message="无法读取 UEngine 数据!")
|
||||
sys.exit(1)
|
||||
try:
|
||||
things = readtxt(sys.argv[2])
|
||||
adbKey = []
|
||||
# 提取内容
|
||||
for i in things.split('\n'):
|
||||
adbKey.append(i[0: i.find(" ")])
|
||||
old = ""
|
||||
if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
|
||||
old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n"
|
||||
write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey))
|
||||
messagebox.showinfo(title="提示", message="完成")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
sys.exit(2)
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import requests
|
||||
import traceback
|
||||
|
||||
# 读取文本文档
|
||||
def read_txt(path):
|
||||
f = open(path,"r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
def GetPackageUpdateInformation():
|
||||
global setting
|
||||
global package
|
||||
for i in allJson['Program']:
|
||||
if i['Package'] == package:
|
||||
return i
|
||||
|
||||
try:
|
||||
setting = json.loads(read_txt("{}/setting.json".format(os.path.split(os.path.realpath(__file__))[0])))
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("配置文件无法访问!")
|
||||
package = setting['Package']
|
||||
nowVersion = setting['Version']
|
||||
try:
|
||||
jsons = requests.get(setting["Url"])
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("服务器出现错误!")
|
||||
sys.exit(1)
|
||||
allJson = json.loads(jsons.text)
|
||||
updateInformation = GetPackageUpdateInformation()
|
||||
name = updateInformation['Name']
|
||||
newVersion = updateInformation['Version']
|
||||
print("更新程序:{}".format(name))
|
||||
print("最新版本:{}".format(newVersion))
|
||||
print("目前版本:{}".format(nowVersion))
|
||||
if nowVersion == newVersion:
|
||||
print("目前是最新版本,无需更新!")
|
||||
quit()
|
||||
print("更新内容:")
|
||||
print(updateInformation['New Things'])
|
||||
choose = input("更新?[Y/N]")
|
||||
if choose.upper() == "N":
|
||||
quit()
|
||||
if os.path.exists("/tmp/update-console-{}".format(package)):
|
||||
shutil.rmtree("/tmp/update-console-{}".format(package))
|
||||
os.mkdir("/tmp/update-console-{}".format(package))
|
||||
if updateInformation["Linux App Url"][0] == None:
|
||||
print("没有可用包源")
|
||||
quit()
|
||||
os.system("wget '{}' -P '/tmp/update-console-{}'".format(updateInformation["Linux App Url"][0], package))
|
||||
os.system("sudo dpkg -i /tmp/update-console-{}/*".format(package))
|
||||
os.system("sudo apt install -f -y")
|
||||
17
new-deb-build/opt/apps/com.gitee.uengine.runner.spark/info
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"appid": "com.gitee.uengine.runner.spark",
|
||||
"name": "com.gitee.uengine.runner.spark",
|
||||
"version": "1.3.2",
|
||||
"arch": ["all"],
|
||||
"permissions": {
|
||||
"autostart": false,
|
||||
"notification": false,
|
||||
"trayicon": false,
|
||||
"clipboard": false,
|
||||
"account": false,
|
||||
"bluetooth": false,
|
||||
"camera": false,
|
||||
"audio_record": false,
|
||||
"installed_apps": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.env">
|
||||
<message>Authentication is required to Run App</message>
|
||||
<message xml:lang="zh_CN">使用对应的程序需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/env</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.installscrcpy">
|
||||
<message>Authentication is required to Install Scrcpy</message>
|
||||
<message xml:lang="zh_CN">安装 Scrcpy 需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/tmp/uengine-runner/InstallScrcpy.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.rm">
|
||||
<message>Authentication is required to Delete Files</message>
|
||||
<message xml:lang="zh_CN">删除文件需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/rm</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://github.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.uengine-bridge">
|
||||
<message>Authentication is required to Setting UEngine Internet Bridge</message>
|
||||
<message xml:lang="zh_CN">设置 UEngine 桥接需要输入密码</message>
|
||||
<icon_name>kbox</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/uengine-bridge.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.uengine-session-launch-helper">
|
||||
<message>Authentication is required to Change UEngine</message>
|
||||
<message xml:lang="zh_CN">设置 UEngine 需要输入密码</message>
|
||||
<icon_name>kbox</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/uengine-session-launch-helper</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
21
pkexec/com.deepin.pkexec.env.policy
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.env">
|
||||
<message>Authentication is required to Run App</message>
|
||||
<message xml:lang="zh_CN">使用对应的程序需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/env</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
21
pkexec/com.deepin.pkexec.installscrcpy.policy
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.installscrcpy">
|
||||
<message>Authentication is required to Install Scrcpy</message>
|
||||
<message xml:lang="zh_CN">安装 Scrcpy 需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/tmp/uengine-runner/InstallScrcpy.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
21
pkexec/com.deepin.pkexec.rm.policy
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.rm">
|
||||
<message>Authentication is required to Delete Files</message>
|
||||
<message xml:lang="zh_CN">删除文件需要输入密码</message>
|
||||
<icon_name>preferences-system</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/rm</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
21
pkexec/com.deepin.pkexec.uengine-bridge.policy
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://github.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.uengine-bridge">
|
||||
<message>Authentication is required to Setting UEngine Internet Bridge</message>
|
||||
<message xml:lang="zh_CN">设置 UEngine 桥接需要输入密码</message>
|
||||
<icon_name>kbox</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/uengine-bridge.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
|
||||
<policyconfig>
|
||||
<vendor>gfdgd xi</vendor>
|
||||
<vendor_url>https://gitee.com/gfdgd-xi/uengine-runner/</vendor_url>
|
||||
<action id="com.deepin.pkexec.uengine-session-launch-helper">
|
||||
<message>Authentication is required to Change UEngine</message>
|
||||
<message xml:lang="zh_CN">设置 UEngine 需要输入密码</message>
|
||||
<icon_name>kbox</icon_name>
|
||||
<defaults>
|
||||
<allow_any>no</allow_any>
|
||||
<allow_inactive>no</allow_inactive>
|
||||
<allow_active>auth_admin_keep</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/uengine-session-launch-helper</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
58
pkexec/icon/kbox.svg
Normal file
@@ -0,0 +1,58 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" viewBox="0 0 512 512">
|
||||
<defs>
|
||||
<filter id="安卓容器-512px-a" width="122.6%" height="123.3%" x="-11.3%" y="-11.6%" filterUnits="objectBoundingBox">
|
||||
<feOffset dy="8" in="SourceAlpha" result="shadowOffsetOuter1"/>
|
||||
<feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="10"/>
|
||||
<feColorMatrix in="shadowBlurOuter1" result="shadowMatrixOuter1" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>
|
||||
<feMerge>
|
||||
<feMergeNode in="shadowMatrixOuter1"/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
<linearGradient id="安卓容器-512px-b" x1="50%" x2="50%" y1="0%" y2="100%">
|
||||
<stop offset="0%" stop-color="#CFFB82"/>
|
||||
<stop offset="100%" stop-color="#539109"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="安卓容器-512px-c" x1="50%" x2="50%" y1="0%" y2="190.452%">
|
||||
<stop offset="0%" stop-color="#FFF"/>
|
||||
<stop offset="100%" stop-color="#FFF" stop-opacity=".255"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="安卓容器-512px-d" x1="50%" x2="50%" y1="11.664%" y2="100%">
|
||||
<stop offset="0%" stop-color="#ECCB89"/>
|
||||
<stop offset="15.474%" stop-color="#CC9A4E"/>
|
||||
<stop offset="23.345%" stop-color="#E2BB78"/>
|
||||
<stop offset="29.459%" stop-color="#E5BE7D"/>
|
||||
<stop offset="100%" stop-color="#D1965D"/>
|
||||
</linearGradient>
|
||||
<path id="安卓容器-512px-e" d="M72,148 L406,148 C426.434536,148 443,164.565464 443,185 L443,427 C443,447.434536 426.434536,464 406,464 L72,464 C51.5654643,464 35,447.434536 35,427 L35,185 C35,164.565464 51.5654643,148 72,148 Z"/>
|
||||
<linearGradient id="安卓容器-512px-f" x1="50%" x2="50%" y1="0%" y2="126.091%">
|
||||
<stop offset="0%" stop-color="#FD9"/>
|
||||
<stop offset="100%" stop-color="#D1A25E"/>
|
||||
</linearGradient>
|
||||
<path id="安卓容器-512px-g" d="M45.2703171,146 L432.729683,146 C438.398863,146 443.508433,149.418972 445.671038,154.659463 L474.009349,223.329731 C475.484098,226.903388 473.782597,230.995929 470.20894,232.470677 C469.362065,232.820159 468.454823,233 467.538672,233 L10.4613285,233 C6.59533521,233 3.46132846,229.865993 3.46132846,226 C3.46132846,225.083848 3.64116944,224.176606 3.99065113,223.329731 L32.3289625,154.659463 C34.4915674,149.418972 39.6011368,146 45.2703171,146 Z"/>
|
||||
<filter id="安卓容器-512px-h" width="99.6%" height="105.7%" x=".2%" y="-2.9%" filterUnits="objectBoundingBox">
|
||||
<feOffset dx="-2" dy="-3" in="SourceAlpha" result="shadowOffsetInner1"/>
|
||||
<feComposite in="shadowOffsetInner1" in2="SourceAlpha" k2="-1" k3="1" operator="arithmetic" result="shadowInnerInner1"/>
|
||||
<feColorMatrix in="shadowInnerInner1" result="shadowMatrixInner1" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.08 0"/>
|
||||
<feGaussianBlur in="SourceAlpha" result="shadowBlurInner2" stdDeviation="1"/>
|
||||
<feOffset dy="3" in="shadowBlurInner2" result="shadowOffsetInner2"/>
|
||||
<feComposite in="shadowOffsetInner2" in2="SourceAlpha" k2="-1" k3="1" operator="arithmetic" result="shadowInnerInner2"/>
|
||||
<feColorMatrix in="shadowInnerInner2" result="shadowMatrixInner2" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.241313374 0"/>
|
||||
<feMerge>
|
||||
<feMergeNode in="shadowMatrixInner1"/>
|
||||
<feMergeNode in="shadowMatrixInner2"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
</defs>
|
||||
<g fill="none" fill-rule="evenodd" filter="url(#安卓容器-512px-a)" transform="translate(17 23)">
|
||||
<g transform="translate(98)">
|
||||
<path fill="url(#安卓容器-512px-b)" d="M0,169 L282,169 C282,121.487244 262.463855,78.877939 223.561446,50.9789895 L254.479518,20.2056028 C259.575904,14.2876438 259.575904,8.87693847 254.479518,3.8044022 C249.383133,-1.26813407 243.777108,-1.26813407 238.001205,3.8044022 L202.836145,38.8049025 C183.639759,28.6598299 163.084337,23.5872936 141,23.5872936 C118.236145,23.5872936 97.3409639,28.6598299 78.1445783,38.973987 L42.9795181,3.8044022 C37.8831325,-1.26813407 32.2771084,-1.26813407 26.5012048,3.8044022 C20.5554217,8.87693847 20.5554217,14.4567284 26.5012048,20.2056028 L57.4192771,50.9789895 C19.026506,78.0325163 0,120.641821 0,169 Z"/>
|
||||
<path fill="url(#安卓容器-512px-c)" d="M205,88 C214.444444,88 222,95.5555556 222,105 C222,114.444444 214.444444,122 205,122 C195.555556,122 188,114.444444 188,105 C188,95.5555556 195.555556,88 205,88 Z M77,88 C86.4444444,88 94,95.5555556 94,105 C94,114.444444 86.4444444,122 77,122 C67.5555556,122 60,114.444444 60,105 C60,95.5555556 67.5555556,88 77,88 Z"/>
|
||||
</g>
|
||||
<use fill="url(#安卓容器-512px-d)" fill-rule="nonzero" xlink:href="#安卓容器-512px-e"/>
|
||||
<g fill-rule="nonzero">
|
||||
<use fill="url(#安卓容器-512px-f)" xlink:href="#安卓容器-512px-g"/>
|
||||
<use fill="#000" filter="url(#安卓容器-512px-h)" xlink:href="#安卓容器-512px-g"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
48
pkexec/icon/preferences-system.svg
Normal file
|
After Width: | Height: | Size: 16 KiB |
6
setting-new.json
Executable file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"Package": "com.gitee.uengine.runner.spark",
|
||||
"Update": true,
|
||||
"Version": "1.4.3",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
}
|
||||
7
setting.json
Executable file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"Package": "spark-uengine-runner",
|
||||
"Update": true,
|
||||
"Version": "1.4.3",
|
||||
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
|
||||
|
||||
}
|
||||
BIN
spark-uengine-runner.deb
Normal file → Executable file
444
uengine-apk-builder
Executable file
@@ -0,0 +1,444 @@
|
||||
#!/usr/bin/env python3
|
||||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.4.2
|
||||
# 更新时间:2021年8月30日
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import random
|
||||
import zipfile
|
||||
import traceback
|
||||
import threading
|
||||
import subprocess
|
||||
import ttkthemes
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
import tkinter.filedialog as filedialog
|
||||
from getxmlimg import getsavexml
|
||||
|
||||
def FindApk():
|
||||
path = filedialog.askopenfilename(title="选择 Apk", filetypes=[("APK 文件", "*.apk"), ("所有文件", "*.*")], initialdir=json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuild.json"))["path"])
|
||||
if path != "" and path != "()":
|
||||
try:
|
||||
combobox1.set(path)
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": os.path.dirname(path)})) # 写入配置文件
|
||||
except:
|
||||
pass
|
||||
|
||||
def BuildDeb():
|
||||
if combobox1.get() == "":
|
||||
messagebox.showerror(title="提示", message="信息没有填写完整,无法继续打包 APK")
|
||||
return
|
||||
if not os.path.exists(combobox1.get()):
|
||||
messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK")
|
||||
return
|
||||
DisabledAndEnbled(True)
|
||||
threading.Thread(target=BuildApkDeb, args=(combobox1.get(),)).start()
|
||||
|
||||
def RunCommandShow(command):
|
||||
TextboxAddText1("$> {}".format(command))
|
||||
TextboxAddText1(GetCommandReturn(command))
|
||||
|
||||
def BuildApkDeb(apkPath):
|
||||
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
|
||||
RunCommandShow("echo '======================================New===================================='")
|
||||
RunCommandShow("echo '创建目录'")
|
||||
RunCommandShow("mkdir -pv '{}/DEBIAN'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/applications'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
|
||||
RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
|
||||
RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
|
||||
apkPackageName = GetApkPackageName(apkPath)
|
||||
apkPackageVersion = GetApkVersion(apkPath)
|
||||
apkChineseLabel = GetApkChineseLabel(apkPath)
|
||||
apkActivityName = GetApkActivityName(apkPath)
|
||||
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageName)
|
||||
debControl = '''Package: {}
|
||||
Version: {}
|
||||
Architecture: all
|
||||
Maintainer: {}
|
||||
Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1)
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Description: {}\n'''.format(apkPackageName, apkPackageVersion, apkChineseLabel, apkChineseLabel)
|
||||
debPostinst = '''#!/bin/sh
|
||||
|
||||
APK_DIR="/usr/share/uengine/apk"
|
||||
APK_NAME="{}.apk"
|
||||
APK_PATH="$APK_DIR/$APK_NAME"
|
||||
DESKTOP_FILE="/usr/share/applications/{}.desktop"
|
||||
ICON_FILE="/usr/share/uengine/icons/{}.png"
|
||||
|
||||
if [ -f $APK_PATH ]; then
|
||||
echo "Installing $APK_NAME"
|
||||
else
|
||||
echo "ERROR: $APK_NAME file not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: apk install error..."
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
#sudo rm -f $DESKTOP_FILE
|
||||
#sudo rm -f $ICON_FILE
|
||||
#sudo rm -f "$APK_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo rm -f "$APK_PATH"
|
||||
|
||||
exit 0'''.format(apkPackageName, apkPackageName, apkPackageName)
|
||||
debPrerm = '''#!/bin/sh
|
||||
|
||||
APP_NAME="{}"
|
||||
|
||||
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
|
||||
if test -z "$session_manager"; then
|
||||
echo "ERROR: app install failed(session-manager not start)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Uninstalling $APP_NAME"
|
||||
ret=`/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: app uninstall error..."
|
||||
exit 1
|
||||
fi
|
||||
chkfail=`echo $ret |grep "Failed"`
|
||||
if test -n "$chkfail" ; then
|
||||
echo "ERROR: $ret"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /etc/passwd | awk -F: '$3>=1000' | cut -f 1 -d : | while read line
|
||||
do
|
||||
inifile="/home/$line/.config/uengineAppGeometry.ini"
|
||||
if [ -f $inifile ]; then
|
||||
sed -i "/$APP_NAME/d" $inifile
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0'''.format(apkPackageName)
|
||||
desktopFile = '''[Desktop Entry]
|
||||
Categories=Other;
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
Icon=/usr/share/uengine/icons/{}.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
GenericName={}
|
||||
Name={}
|
||||
'''
|
||||
#RunCommandShow("echo '{}' > '{}/DEBIAN/control'".format(debControl, tempPath))
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/control'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/control".format(tempPath), debControl)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/postinst'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
|
||||
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
|
||||
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
|
||||
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageName))
|
||||
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName), desktopFile)
|
||||
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, iconSavePath,
|
||||
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName))
|
||||
RunCommandShow("echo '复制文件'")
|
||||
RunCommandShow("echo '写入 APK 软件图标'")
|
||||
SaveApkIcon(apkPath, iconSavePath)
|
||||
RunCommandShow("echo '复制 APK 文件'")
|
||||
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageName))
|
||||
RunCommandShow("echo '正在设置文件权限……'")
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
|
||||
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
|
||||
RunCommandShow("echo '打包 deb 到桌面……'")
|
||||
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageName, apkPackageVersion))
|
||||
RunCommandShow("echo '完成!'")
|
||||
findApkHistory.append(apkPath)
|
||||
combobox1['value'] = findApkHistory
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", str(json.dumps(ListToDictionary(findApkHistory)))) # 将历史记录的数组转换为字典并写入
|
||||
messagebox.showinfo(title="提示", message="打包完成")
|
||||
DisabledAndEnbled(False)
|
||||
|
||||
def DisabledAndEnbled(choose):
|
||||
userChoose = {True: tk.DISABLED, False: tk.NORMAL}
|
||||
a = userChoose[choose]
|
||||
combobox1.configure(state=a)
|
||||
check.configure(state=a)
|
||||
button2.configure(state=a)
|
||||
button3.configure(state=a)
|
||||
|
||||
# 需引入 subprocess
|
||||
def GetCommandReturn(cmd):
|
||||
# cmd 是要获取输出的命令
|
||||
return subprocess.getoutput(cmd)
|
||||
|
||||
# 重启本应用程序
|
||||
def ReStartProgram():
|
||||
python = sys.executable
|
||||
os.execl(python, python, * sys.argv)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
# 获取用户桌面目录
|
||||
def get_desktop_path():
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
|
||||
# 数组转字典
|
||||
def ListToDictionary(list):
|
||||
dictionary = {}
|
||||
for i in range(len(list)):
|
||||
dictionary[i] = list[i]
|
||||
return dictionary
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path):
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
# 写入文本文档
|
||||
def write_txt(path, things):
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
def GetApkInformation(apkFilePath):
|
||||
return GetCommandReturn("aapt dump badging '{}'".format(apkFilePath))
|
||||
|
||||
def GetApkActivityName(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "launchable-activity" in line:
|
||||
line = line[0: line.index("label='")]
|
||||
line = line.replace("launchable-activity: ", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
line = line.replace("name=", "")
|
||||
line = line.replace("label=", "")
|
||||
line = line.replace("icon=", "")
|
||||
return line
|
||||
|
||||
def GetApkPackageName(apkFilePath):
|
||||
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "package:" in line:
|
||||
line = line[0: line.index("versionCode='")]
|
||||
line = line.replace("package:", "")
|
||||
line = line.replace("name=", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
# 此较为特殊,因为需要判断用户是否要添加前缀
|
||||
if qianZhui.get() == True:
|
||||
return "uengine-dc-{}".format(line).lower()
|
||||
return line.lower()
|
||||
|
||||
def GetApkVersion(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "package:" in line:
|
||||
if "compileSdkVersion='" in line:
|
||||
line = line.replace(line[line.index("compileSdkVersion='"): -1], "")
|
||||
if "platform" in line:
|
||||
line = line.replace(line[line.index("platform"): -1], "")
|
||||
line = line.replace(line[0: line.index("versionName='")], "")
|
||||
line = line.replace("versionName='", "")
|
||||
line = line.replace("'", "")
|
||||
line = line.replace(" ", "")
|
||||
return line
|
||||
|
||||
def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath):
|
||||
things = '''
|
||||
[Desktop Entry]
|
||||
Categories=app;
|
||||
Encoding=UTF-8
|
||||
Exec=/usr/bin/uengine-launch.sh --action=android.intent.action.MAIN --package={} --component={}
|
||||
GenericName={}
|
||||
Icon={}
|
||||
MimeType=
|
||||
Name={}
|
||||
StartupWMClass={}
|
||||
Terminal=false
|
||||
Type=Application
|
||||
'''.format(packageName, activityName, showName, iconPath, showName, showName)
|
||||
write_txt(savePath, things)
|
||||
|
||||
def GetApkChineseLabel(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application-label:" in line:
|
||||
line = line.replace("application-label:", "")
|
||||
line = line.replace("'", "")
|
||||
return line
|
||||
|
||||
def GetApkIconInApk(apkFilePath):
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application:" in line:
|
||||
line = line[line.index("icon='"): -1]
|
||||
line = line.replace("icon='", "")
|
||||
if "'" in line:
|
||||
line = line[0: line.index("'")]
|
||||
return line
|
||||
return line
|
||||
|
||||
#合并两个函数到一起
|
||||
def SaveApkIcon(apkFilePath, iconSavePath)->"获取 apk 文件的图标":
|
||||
try:
|
||||
info = GetApkInformation(apkFilePath)
|
||||
for line in info.split('\n'):
|
||||
if "application:" in line:
|
||||
xmlpath = line.split(":")[-1].split()[-1].split("=")[-1].replace("'","")
|
||||
if xmlpath.endswith('.xml'):
|
||||
xmlsave = getsavexml()
|
||||
print(xmlpath)
|
||||
xmlsave.savexml(apkFilePath,xmlpath,iconSavePath)
|
||||
else:
|
||||
zip = zipfile.ZipFile(apkFilePath)
|
||||
iconData = zip.read(xmlpath)
|
||||
with open(iconSavePath, 'w+b') as saveIconFile:
|
||||
saveIconFile.write(iconData)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
print("Error, show defult icon")
|
||||
shutil.copy(programPath + "/defult.png", iconSavePath)
|
||||
|
||||
|
||||
#def SaveApkIcon(apkFilePath, iconSavePath):
|
||||
# zip = zipfile.ZipFile(apkFilePath)
|
||||
# iconData = zip.read(GetApkIconInApk(apkFilePath))
|
||||
# with open(iconSavePath, 'w+b') as saveIconFile:
|
||||
# saveIconFile.write(iconData)
|
||||
|
||||
def TextboxAddText1(message):
|
||||
global textbox1
|
||||
textbox1.configure(state=tk.NORMAL)
|
||||
textbox1.insert(tk.END,message + "\n")
|
||||
textbox1.configure(state=tk.DISABLED)
|
||||
|
||||
# 获取用户桌面目录
|
||||
def get_desktop_path():
|
||||
for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件
|
||||
desktop_index = line.find("XDG_DESKTOP_DIR=\"") # 寻找是否有对应项,有返回 0,没有返回 -1
|
||||
if desktop_index != -1: # 如果有对应项
|
||||
break # 结束循环
|
||||
if desktop_index == -1: # 如果是提前结束,值一定≠-1,如果是没有提前结束,值一定=-1
|
||||
return -1
|
||||
else:
|
||||
get = line[17:-2] # 截取桌面目录路径
|
||||
get_index = get.find("$HOME") # 寻找是否有对应的项,需要替换内容
|
||||
if get != -1: # 如果有
|
||||
get = get.replace("$HOME", get_home()) # 则把其替换为用户目录(~)
|
||||
return get # 返回目录
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
|
||||
###########################
|
||||
# 程序信息
|
||||
###########################
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
information = json.loads(readtxt(programPath + "/information.json"))
|
||||
version = information["Version"]
|
||||
title = "UEngine APK 应用打包器 {}".format(version)
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
|
||||
###########################
|
||||
# 加载配置
|
||||
###########################
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner"): # 如果没有配置文件夹
|
||||
os.makedirs(get_home() + "/.config/uengine-runner") # 创建配置文件夹
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json"): # 如果没有配置文件
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json", json.dumps({})) # 创建配置文件
|
||||
if not os.path.exists(get_home() + "/.config/uengine-runner/FindApkBuild.json"): # 如果没有配置文件
|
||||
write_txt(get_home() + "/.config/uengine-runner/FindApkBuild.json", json.dumps({"path": "~"})) # 创建配置文件
|
||||
|
||||
###########################
|
||||
# 设置变量
|
||||
###########################
|
||||
findApkHistory = list(json.loads(readtxt(get_home() + "/.config/uengine-runner/FindApkBuildHistory.json")).values())
|
||||
|
||||
###########################
|
||||
# 窗口创建
|
||||
###########################
|
||||
win = tk.Tk()
|
||||
|
||||
qianZhui = tk.BooleanVar()
|
||||
|
||||
window = ttk.Frame(win)
|
||||
frame2 = ttk.Frame(window)
|
||||
label1 = ttk.Label(window, text="要打包的 apk 路径:")
|
||||
combobox1 = ttk.Combobox(window, width=100)
|
||||
button2 = ttk.Button(window, text="浏览", command=FindApk)
|
||||
button3 = ttk.Button(frame2, text="打包", command=BuildDeb)
|
||||
check = ttk.Checkbutton(frame2, variable=qianZhui,text="使用前缀“uengine-dc”")
|
||||
textbox1 = tk.Text(window, width=100)
|
||||
menu = tk.Menu(window, background="white") # 设置菜单栏
|
||||
programmenu = tk.Menu(menu, tearoff=0, background="white") # 设置“程序”菜单栏
|
||||
|
||||
menu.add_cascade(label="程序", menu=programmenu)
|
||||
programmenu.add_command(label="退出程序", command=window.quit) # 设置“退出程序”项
|
||||
# 设置控件
|
||||
combobox1['value'] = findApkHistory
|
||||
textbox1.configure(state=tk.DISABLED)
|
||||
textbox1.config(foreground='white', background='black')
|
||||
# 如果有参数
|
||||
if len(sys.argv) > 1:
|
||||
combobox1.set(sys.argv[1])
|
||||
# 设置窗口
|
||||
style = ttkthemes.ThemedStyle(win)
|
||||
style.set_theme("breeze")
|
||||
win.attributes('-alpha', 0.5)
|
||||
win.title(title)
|
||||
win.resizable(0, 0)
|
||||
win.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
#
|
||||
win.config(menu=menu) # 显示菜单栏
|
||||
label1.grid(row=2, column=0)
|
||||
combobox1.grid(row=2, column=1)
|
||||
button2.grid(row=2, column=2)
|
||||
button3.grid(row=0, column=1)
|
||||
check.grid(row=0, column=0)
|
||||
frame2.grid(row=3, columnspa=3)
|
||||
textbox1.grid(row=4, columnspa=3)
|
||||
window.pack()
|
||||
win.mainloop()
|
||||
11
uengine-app-install
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("uengine-app-install apk路径")
|
||||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
11
uengine-app-uninstall
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("uengine-app-uninstall apk包名")
|
||||
sys.exit(0)
|
||||
sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(sys.argv[1])))
|
||||
print("命令参数错误")
|
||||
sys.exit(1)
|
||||
11
uengine-clean
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == "--help":
|
||||
print("帮助:")
|
||||
print("输入命令即可清空/重置UEngine")
|
||||
sys.exit(0)
|
||||
print("参数错误")
|
||||
sys.exit(1)
|
||||
sys.exit(os.system("sudo rm -rf /data/uengine"))
|
||||
10
uengine-install (1).desktop
Normal file → Executable file
@@ -2,15 +2,15 @@
|
||||
Categories=system;Utility;
|
||||
Encoding=UTF-8
|
||||
Exec=uengine-runner -ci %F
|
||||
GenericName=APK 安装(uengine)
|
||||
GenericName[zh_CN]=APK 安装(uengine)
|
||||
GenericName=APK Install(UEngine)
|
||||
GenericName[zh_CN]=APK 安装(UEngine)
|
||||
Icon=/opt/apps/uengine-runner/icon.png
|
||||
MimeType=application/apk;
|
||||
Name=APK 安装(uengine)
|
||||
Name[zh_CN]=APK 安装(uengine)
|
||||
Name=APK Install(UEngine)
|
||||
Name[zh_CN]=APK 安装(UEngine)
|
||||
NoDisplay=true
|
||||
OnlyShowIn=Unity;
|
||||
StartupNotify=false
|
||||
StartupWMClass=APK 安装(uengine)
|
||||
StartupWMClass=APK 安装(UEngine)
|
||||
Terminal=false
|
||||
Type=Application
|
||||
|
||||
227
uengine-keyboard
Executable file
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env python3
|
||||
#########################################
|
||||
# 版本:1.4.0
|
||||
# 更新时间:2021年08月26日
|
||||
# Need: unix, python3-tk, python3-pip, pymouse, keyboard
|
||||
#########################################
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
import shutil
|
||||
import keyboard
|
||||
import traceback
|
||||
import ttkthemes
|
||||
import pyautogui
|
||||
import threading
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
import tkinter.filedialog as filedialog
|
||||
import Xlib.threaded as threaded
|
||||
#import pymouse.unix as pymouse
|
||||
########################
|
||||
#
|
||||
########################
|
||||
def Inputt(key):
|
||||
if key.event_type == "up":
|
||||
global setting
|
||||
if setting:
|
||||
Setting(key)
|
||||
else:
|
||||
Mouse(key)
|
||||
#Mouse(key)
|
||||
|
||||
def Open():
|
||||
path = filedialog.askopenfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
|
||||
if not path == "" or path == ():
|
||||
shutil.copy(path, get_home() + "/.config/uengine-keyboard/key.json")
|
||||
if messagebox.askyesno(title="提示", message="导入成功!是否现在重启程序以便生效?"):
|
||||
ReStartProgram()
|
||||
|
||||
def Save():
|
||||
path = filedialog.asksaveasfilename(title="打开", filetypes=[["json 文件", "*.json"], ["全部文件", ["*.*"]]])
|
||||
if not path == "" or path == ():
|
||||
shutil.copy(get_home() + "/.config/uengine-keyboard/key.json", path)
|
||||
messagebox.showinfo(title="提示", message="导出成功!")
|
||||
|
||||
# 重启本应用程序
|
||||
def ReStartProgram()->"重启本应用程序":
|
||||
python = sys.executable
|
||||
os.execl(python, python, * sys.argv)
|
||||
|
||||
|
||||
def Mouse(key):
|
||||
print(keybo)
|
||||
if keybo.__contains__(key.name):
|
||||
print(keybo[key.name]["MousePlace"])
|
||||
pyautogui.FAILSAFE = False
|
||||
#os.system(programPath + "/mouse.py {} {}".format(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1]))
|
||||
#pyautogui.click(keybo[key.name]["MousePlace"][0], keybo[key.name]["MousePlace"][1])
|
||||
pyautogui.click(1500, 800)
|
||||
#m.click(keybo[key.name]["MousePlace"][0],keybo[key.name]["MousePlace"][1])
|
||||
|
||||
def Setting(key):
|
||||
if key.event_type == 'up':
|
||||
keybo[key.name] = {"Mouse": "Left", "MousePlace": pyautogui.position()}
|
||||
write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), json.dumps(keybo))
|
||||
global inputs
|
||||
inputs = True
|
||||
global setting
|
||||
setting = False
|
||||
return False
|
||||
|
||||
def ShowTips():
|
||||
try:
|
||||
if setting:
|
||||
settingLabelText.set('''设置方法:把鼠标移动带所需位置然后按下需要设置的按键即可({}x{})
|
||||
提示:
|
||||
1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键;
|
||||
2、使用映射不能关闭本窗口,但可以最小化;
|
||||
3、本程序需要 root 权限才能使用;
|
||||
4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1]))
|
||||
settingButton.configure(state=tk.DISABLED)
|
||||
else:
|
||||
settingLabelText.set('''点击“设置”按钮设置映射({}x{})
|
||||
提示:
|
||||
1、目前不支持同时按两个及以上按键,只支持在单一时间内按一个按键;
|
||||
2、使用映射不能关闭本窗口,但可以最小化;
|
||||
3、本程序需要 root 权限才能使用;
|
||||
4、映射时会占用鼠标,所以在使用时最好不要使用鼠标;'''.format(pyautogui.position()[0], pyautogui.position()[1]))
|
||||
settingButton.configure(state=tk.NORMAL)
|
||||
time.sleep(0.1)
|
||||
ShowTips()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
if not close:
|
||||
ShowTips()
|
||||
|
||||
def Closing():
|
||||
close = True
|
||||
window.destroy()
|
||||
|
||||
def Key():
|
||||
keyboard.hook(Inputt)
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home()->"获取用户主目录":
|
||||
return os.path.expanduser('~')
|
||||
|
||||
# 写入文本文档
|
||||
def write_txt(path: "路径", things: "内容")->"写入文本文档":
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
def Settings():
|
||||
global setting
|
||||
setting = True
|
||||
|
||||
def Clean():
|
||||
if messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
|
||||
shutil.rmtree("{}/.config/uengine-keyboard".format(get_home()))
|
||||
if messagebox.askyesno(title="提示", message="删除成功!是否现在重启程序以便生效?"):
|
||||
ReStartProgram()
|
||||
|
||||
def About():
|
||||
threading.Thread(target=os.system, args=["{}/uengine-runner-about".format(programPath)]).start()
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
if not os.path.exists("{}/.config/uengine-keyboard".format(get_home())):
|
||||
os.mkdir("{}/.config/uengine-keyboard".format(get_home()))
|
||||
if not os.path.exists("{}/.config/uengine-keyboard/key.json".format(get_home())):
|
||||
write_txt("{}/.config/uengine-keyboard/key.json".format(get_home()), "{}")
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
setting = False
|
||||
close = False
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
keybo = json.loads(readtxt("{}/.config/uengine-keyboard/key.json".format(get_home())))
|
||||
version = json.loads(readtxt("{}/information.json".format(programPath)))["Version"]
|
||||
|
||||
###################
|
||||
# 判断是不是 root
|
||||
###################
|
||||
if os.geteuid() != 0:
|
||||
print("不是以 root 权限运行本程序!")
|
||||
root = tk.Tk()
|
||||
root.overrideredirect(1)
|
||||
root.withdraw()
|
||||
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
|
||||
sys.exit(1)
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
window = tk.Tk()
|
||||
win = ttk.Frame(window)
|
||||
show = ttk.Frame(win)
|
||||
|
||||
settingLabelText = tk.StringVar()
|
||||
|
||||
# 设置菜单栏
|
||||
menu = tk.Menu(window, tearoff=0, background="white")
|
||||
programMenu = tk.Menu(menu, tearoff=0, background="white")
|
||||
aboutMenu = tk.Menu(menu, tearoff=0, background="white")
|
||||
|
||||
settingLabel = ttk.Label(win, textvariable=settingLabelText)
|
||||
|
||||
settingMouseToKeyboard = ttk.Button(show, text="启动键盘映射(已启用)")
|
||||
settingButton = ttk.Button(show, text="添加或覆盖键盘映射设置", command=Settings)
|
||||
|
||||
settingMouseToKeyboard.configure(state=tk.DISABLED)
|
||||
|
||||
style = ttkthemes.ThemedStyle(window)
|
||||
style.set_theme("breeze")
|
||||
window.protocol('WM_DELETE_WINDOW', Closing)
|
||||
window.resizable(0, 0)
|
||||
window.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
window.title("UEngine 键盘映射 {}".format(version))
|
||||
|
||||
menu.add_cascade(label="程序", menu=programMenu)
|
||||
menu.add_cascade(label="帮助", menu=aboutMenu)
|
||||
menu.configure(activebackground="dodgerblue")
|
||||
|
||||
programMenu.add_command(label="导入映射设置", command=Open)
|
||||
programMenu.add_command(label="导出映射设置", command=Save)
|
||||
programMenu.add_command(label="删除所有映射设置", command=Clean)
|
||||
programMenu.add_separator()
|
||||
programMenu.add_command(label="退出程序", command=sys.exit)
|
||||
programMenu.configure(activebackground="dodgerblue")
|
||||
|
||||
aboutMenu.add_command(label="关于", command=About)
|
||||
|
||||
window.config(menu=menu) # 显示菜单栏
|
||||
|
||||
show.grid(row=1, column=0)
|
||||
|
||||
settingLabel.grid(row=0, column=0)
|
||||
|
||||
settingMouseToKeyboard.grid(row=0, column=0)
|
||||
settingButton.grid(row=0, column=1)
|
||||
|
||||
win.pack(fill="both", expand="yes")
|
||||
#threaded.lock.allocate_lock()
|
||||
threading.Thread(target=Key).start()
|
||||
threading.Thread(target=ShowTips).start()
|
||||
pyautogui.FAILSAFE = False
|
||||
'''def B(key):
|
||||
if key.event_type == "up":
|
||||
print(pyautogui.position())
|
||||
print(key.name)
|
||||
pyautogui.click(1500, 800)
|
||||
keyboard.hook(B)
|
||||
keyboard.wait()'''
|
||||
window.mainloop()
|
||||
170
uengine-runner-about
Executable file
@@ -0,0 +1,170 @@
|
||||
#!/usr/bin/env python3
|
||||
# 使用系统默认的 python3 运行
|
||||
###########################################################################################
|
||||
# 作者:gfdgd xi
|
||||
# 版本:1.4.3
|
||||
# 更新时间:2021年9月11日
|
||||
# 感谢:anbox、deepin 和 统信
|
||||
# 基于 Python3 的 tkinter 构建
|
||||
###########################################################################################
|
||||
#################
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import json
|
||||
import ttkthemes
|
||||
import subprocess
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
###########################
|
||||
# 程序信息
|
||||
###########################
|
||||
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||
information = json.loads(readtxt(programPath + "/information.json"))
|
||||
programUrl = information["Url"][0]
|
||||
version = information["Version"]
|
||||
goodRunSystem = information["System"]
|
||||
aaptVersion = subprocess.getoutput("aapt version")
|
||||
about = '''介绍 :一个基于 Python3 的 tkinter 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。
|
||||
|
||||
版本 :{}
|
||||
|
||||
适用平台 :{}
|
||||
|
||||
程序官网 :{}
|
||||
|
||||
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, time.strftime("%Y"))
|
||||
tips = "\n".join(information["Tips"])
|
||||
updateThingsString = "\n".join(information["Update"])
|
||||
title = "UEngine 运行器 {}".format(version)
|
||||
updateTime = information["Time"]
|
||||
updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y"))
|
||||
iconPath = "{}/icon.png".format(os.path.split(os.path.realpath(__file__))[0])
|
||||
desktop = "/opt/apps/uengine-runner/UengineAndroidProgramList.desktop"
|
||||
desktopName = "UengineAndroidProgramList.desktop"
|
||||
contribute = "\n".join(information["Contribute"])
|
||||
useProgram = ""
|
||||
threading.Thread(target=useProgram).start()
|
||||
|
||||
# add sub window
|
||||
#添加窗口开启关闭开关,防止重复开启
|
||||
windowflag = "close"
|
||||
|
||||
def UseProgram():
|
||||
global useProgram
|
||||
useProgram = '''1、UEngine:{}
|
||||
2、python3:{}
|
||||
3、tkinter:{}
|
||||
4、aapt:{}
|
||||
5、dpkg:{}
|
||||
6、mkdir:{}
|
||||
7、echo
|
||||
8、chmod:{}
|
||||
9、adb:{}
|
||||
10、deepin 终端:{}'''.format(subprocess.getoutput("uengine version"),
|
||||
subprocess.getoutput("python3 --version"),
|
||||
tk.TkVersion,
|
||||
subprocess.getoutput("aapt version"),
|
||||
subprocess.getoutput("dpkg --version"),
|
||||
subprocess.getoutput("mkdir --version"),
|
||||
subprocess.getoutput("chmod --version"),
|
||||
subprocess.getoutput("adb version"),
|
||||
subprocess.getoutput("deepin-terminal -v"))
|
||||
|
||||
def showhelp():
|
||||
|
||||
#define window and frame and button label
|
||||
#
|
||||
global windowflag
|
||||
if windowflag == "close":
|
||||
helpwindow=tk.Tk()
|
||||
helpwindow.resizable(0, 0)
|
||||
helpwindow.title("帮助")
|
||||
|
||||
|
||||
# get screen width and height
|
||||
screen_width = helpwindow.winfo_screenwidth()
|
||||
screen_height = helpwindow.winfo_screenheight()
|
||||
# calculate position x and y coordinates 假设主窗口大小固定 570x236像素 ,设置窗口位置为屏幕中心。
|
||||
winwith=550
|
||||
winhigh=700
|
||||
x = (screen_width/2) - (winwith/2)
|
||||
y = (screen_height/2) - (winhigh/2)
|
||||
|
||||
helpwindow.geometry("550x700"+"+{:.0f}+{:.0f}".format(x, y))
|
||||
helpwindow.iconphoto(False, tk.PhotoImage(file=iconPath))
|
||||
|
||||
style = ttkthemes.ThemedStyle(helpwindow)
|
||||
style.set_theme("breeze")
|
||||
|
||||
|
||||
|
||||
Frmroot=ttk.Frame(helpwindow)
|
||||
FrmMenu = ttk.Frame(Frmroot)
|
||||
FrmText = ttk.Frame(Frmroot)
|
||||
|
||||
LabFrmText=ttk.LabelFrame(FrmText,text="帮助",height=800,borderwidth=3)
|
||||
HelpStr = tk.StringVar()
|
||||
HelpStr.set(tips)
|
||||
LabText = ttk.Label(LabFrmText, textvariable=HelpStr,width=55)
|
||||
LabText.config(wraplength=350)
|
||||
|
||||
def on_closing():
|
||||
global windowflag
|
||||
windowflag = "close"
|
||||
print(windowflag)
|
||||
helpwindow.destroy()
|
||||
|
||||
|
||||
|
||||
# define button func
|
||||
def ChgLog():
|
||||
HelpStr.set(updateThingsString)
|
||||
def ChgAbout():
|
||||
HelpStr.set(about)
|
||||
def ChgDep():
|
||||
if useProgram == "":
|
||||
BtnZujian.configure(state=tk.DISABLED)
|
||||
return
|
||||
HelpStr.set(useProgram)
|
||||
def ChgCon():
|
||||
HelpStr.set(contribute)
|
||||
def ChgTips():
|
||||
HelpStr.set(tips)
|
||||
LabText.config(wraplength=350)
|
||||
|
||||
BtnReadme = ttk.Button(FrmMenu, text="使用说明",width=14,command=ChgTips)
|
||||
BtnLog = ttk.Button(FrmMenu, text="更新内容",width=14,command=ChgLog)
|
||||
BtnZujian = ttk.Button(FrmMenu, text="程序依赖的组件",width=14,command=ChgDep)
|
||||
BtnGongxian = ttk.Button(FrmMenu, text="有贡献的开发者",width=14,command=ChgCon)
|
||||
BtnAbout = ttk.Button(FrmMenu, text="关于",width=14,command=ChgAbout)
|
||||
|
||||
|
||||
#layout
|
||||
FrmMenu.grid(row=0,column=0,sticky=tk.NW)
|
||||
BtnReadme.grid(row=0,column=0,sticky=tk.NW,padx=3)
|
||||
BtnLog.grid(row=1,column=0,sticky=tk.NW,padx=3)
|
||||
BtnZujian.grid(row=2,column=0,sticky=tk.NW,padx=3)
|
||||
BtnGongxian.grid(row=3,column=0,sticky=tk.NW,padx=3)
|
||||
BtnAbout.grid(row=4,column=0,sticky=tk.NW,padx=3)
|
||||
|
||||
FrmText.grid(row=0,column=1,sticky=tk.NW)
|
||||
LabFrmText.grid(row=0,column=0,sticky=tk.NW,padx=3,pady=3)
|
||||
LabText.grid(row=0,column=0,sticky=tk.NW)
|
||||
|
||||
Frmroot.pack()
|
||||
windowflag = "open"
|
||||
print(windowflag)
|
||||
helpwindow.mainloop()
|
||||
#helpwindow.protocol("WM_DELETE_WINDOW", on_closing)
|
||||
showhelp()
|
||||
83
uengine-useadb
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
#########################################
|
||||
# 版本:1.4.2
|
||||
# 更新时间:2021年08月30日
|
||||
#########################################
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import traceback
|
||||
import ttkthemes
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
import tkinter.messagebox as messagebox
|
||||
########################
|
||||
#
|
||||
########################
|
||||
# 写入文本文档
|
||||
def write_txt(path: "路径", things: "内容")->"写入文本文档":
|
||||
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
||||
file.write(things) # 写入文本
|
||||
file.close() # 关闭文本对象
|
||||
|
||||
# 读取文本文档
|
||||
def readtxt(path: "路径")->"读取文本文档":
|
||||
f = open(path, "r") # 设置文件对象
|
||||
str = f.read() # 获取内容
|
||||
f.close() # 关闭文本对象
|
||||
return str # 返回结果
|
||||
|
||||
###################
|
||||
# 判断是不是 root
|
||||
###################
|
||||
if os.geteuid() != 0:
|
||||
print("不是以 root 权限运行本程序!")
|
||||
root = tk.Tk()
|
||||
root.overrideredirect(1)
|
||||
root.withdraw()
|
||||
messagebox.showerror(title="错误", message="不是以 root 权限运行本程序!")
|
||||
sys.exit(1)
|
||||
|
||||
###################
|
||||
#
|
||||
###################
|
||||
window = tk.Tk()
|
||||
style = ttkthemes.ThemedStyle(window)
|
||||
style.set_theme("breeze")
|
||||
window.overrideredirect(1)
|
||||
window.withdraw()
|
||||
try:
|
||||
if sys.argv[1] == "1" and messagebox.askokcancel(title="提示", message="你确定要删除吗?"):
|
||||
os.remove("/data/uengine/data/data/misc/adb/adb_keys")
|
||||
messagebox.showinfo(title="提示", message="完成")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
sys.exit(2)
|
||||
if sys.argv[1] == "1":
|
||||
sys.exit(0)
|
||||
|
||||
if not messagebox.askyesno(title="提示", message='''请阅读以下提示然后确定是否继续:
|
||||
1、安装后即可使用 adb 连接 UEngine;
|
||||
2、重置 UEngine 或 adb 就需要重新设置该支持补丁;
|
||||
3、需要 root 权限;'''):
|
||||
sys.exit(0)
|
||||
# 写入(需要 root)
|
||||
if not os.path.exists("/data/uengine/data/data/misc/adb"):
|
||||
messagebox.showerror(title="错误", message="无法读取 UEngine 数据!")
|
||||
sys.exit(1)
|
||||
try:
|
||||
things = readtxt(sys.argv[2])
|
||||
adbKey = []
|
||||
# 提取内容
|
||||
for i in things.split('\n'):
|
||||
adbKey.append(i[0: i.find(" ")])
|
||||
old = ""
|
||||
if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
|
||||
old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n"
|
||||
write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey))
|
||||
messagebox.showinfo(title="提示", message="完成")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
messagebox.showerror(title="错误", message=traceback.format_exc())
|
||||
sys.exit(2)
|
||||