1 Star 0 Fork 28

ZYH / uengine 运行器

forked from gfdgd xi / uengine 运行器 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mount-disk-uengine.py 1.89 KB
一键复制 编辑 原始数据 按行查看 历史
gfdgd xi 提交于 2022-08-03 22:59 . 新建文件夹AXVM
import os
import psutil
import string
import ttkthemes
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
class Program:
def GetRoot():
return os.geteuid() == 0
def MountDisk():
Disk.MountDisk(diskChoose.get(), "/data/uengine/安卓应用文件/media/" + name.get())
class Disk:
def MountDisk(disk, path):
if not os.path.exists(path):
os.makedirs(path)
os.system("mount \"{}\" \"{}\"".format(disk, path))
class File:
def DiskList():
diskList = []
partitions = psutil.disk_partitions()
for p in partitions:
if not "loop" in p.device and not "boot" in p.device and not p.device in diskList:
#print(p.device)
diskList.append(p.device)
#print(p.mountpoint)
return diskList
if __name__ == "__main__":
window = tk.Tk()
print(File.DiskList())
if not Program.GetRoot():
window.withdraw()
messagebox.showerror(title="错误", message="此程序必须在 root 下运行!")
quit()
if not os.path.exists("/data/uengine/安卓应用文件/media"):
os.makedirs("/data/uengine/安卓应用文件/media")
#window.withdraw()
#messagebox.showerror(title="错误", message="目录不存在,无法继续操作!")
#quit()
window.title("挂载磁盘")
diskList = File.DiskList()
diskChoose = tk.StringVar()
diskChoose.set(diskList[0])
weight = ttk.Frame(window)
ttk.Label(weight, text="挂载磁盘:").grid(row=0, column=0)
ttk.OptionMenu(weight, diskChoose, diskList[0], *diskList).grid(row=0, column=1)
ttk.Label(weight, text="挂载名称:").grid(row=1, column=0)
name = ttk.Entry(weight)
ttk.Button(weight, text="挂载", command=Program.MountDisk).grid(row=2, column=1)
name.grid(row=1, column=1)
weight.pack()
window.mainloop()
Python
1
https://gitee.com/ZYH-A/uengine-runner.git
git@gitee.com:ZYH-A/uengine-runner.git
ZYH-A
uengine-runner
uengine 运行器
main

搜索帮助