Skip to content

Commit

Permalink
v1.3-4 GUI v1 & upgrade python
Browse files Browse the repository at this point in the history
  • Loading branch information
Hikari16665 committed Jul 2, 2024
1 parent 53820b6 commit 324efa9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
spec: main.py
requirements: requirements.txt
options: -F -i HSL.ico --name=HikariServerLauncher-${{ vars.VERSION }}.exe
python_ver: 3.10.7
python_ver: 3.10.10
python_arch: x64
exe_path: ./dist
upload_exe_with_name: HikariServerLauncher-${{ vars.VERSION }}.exe
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ dist/
.venv/
test*.py
.gitignore
.git/
.git/
.ssh/
.cache/
22 changes: 22 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import asyncio
import tkintertools as tkt
import tkintertools.animation as animation
import tkintertools.color as color
import tkintertools.core.constants as constants
import tkintertools.standard.dialogs as dialogs # Customied
import tkintertools.standard.features as features # Customied
import tkintertools.standard.shapes as shapes # Customied
import tkintertools.standard.texts as texts # Customied
import tkintertools.style as style
import tkintertools.toolbox as toolbox

WIDTH = 1280
HEIGHT = 720
HSL_NAME = 'Hikari Server Launcher'

async def init():
root = tkt.Tk((WIDTH,HEIGHT),title=f"{HSL_NAME} - GUI DEMO")
root.alpha(1)
root.center()
canvas = tkt.Canvas(root, zoom_item=True, keep_ratio="min", free_anchor=True)
canvas.place(width=1280, height=720, anchor="center")
22 changes: 17 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@
from server import Server
from workspace import Workspace
from java import Java
import gui


OPTIONS_YN = ['是', '否']
OPTIONS_GAMETYPE = ['原版','Paper','Forge','Fabric','取消']
OPTIONS_MENU = ['创建服务器', '管理服务器', '删除服务器', '设置', '退出']
OPTIONS_MANAGE = ['启动服务器','打开服务器目录','特定配置',"启动前执行命令",'自定义JVM设置','设定为自动启动','取消']
OPTIONS_MENU = ['创建服务器', '管理服务器', '删除服务器', '设置', '高级选项', '退出']
OPTIONS_MANAGE = ['启动服务器','打开服务器目录','特定配置',"启动前执行命令",'自定义JVM设置','设定为自动启动', '导出启动脚本' ,'取消']
OPTIONS_SETTINGS = ['调试模式','根目录模式','取消']
OPTIONS_ADVANCED = ['GUI测试', '取消']
OPTIONS_SCRIPT_TYPE = ['相对路径', '绝对路径', '取消']
MAXRAM_PATTERN = re.compile(r'^\d+(\.\d+)?(M|G)$')
HSL_NAME = 'Hikari Server Launcher'
OS_MAXRAM = osfunc.getOSMaxRam()
#WIDTH = 1280
#HEIGHT = 720

console = Console()

Expand Down Expand Up @@ -175,7 +177,8 @@ async def manage(self):
self.config.autorun = server.name
self.config.save_config()
console.print('[bold green]自动启动设置成功,将在下次运行此软件时自动打开该服务器。')

elif index == 6:
type = await promptSelect(OPTIONS_SCRIPT_TYPE, '请选择导出脚本类型:')

async def editConfig(self, server: Server):
console.print('[blue bold]读取特定配置索引:')
Expand Down Expand Up @@ -268,6 +271,13 @@ async def setting(self):
elif index == len(OPTIONS_SETTINGS) - 1:
return
self.config.save_config()

async def advanced_options(self):
index = await promptSelect(OPTIONS_ADVANCED, '高级选项:')
if index == 0:
await gui.init()
if index == len(OPTIONS_ADVANCED) - 1:
return
async def mainMenu(self):
console.clear()
console.rule(f'{HSL_NAME} v{str(self.version/10)}')
Expand All @@ -282,6 +292,8 @@ async def mainMenu(self):
await self.delete()
elif index == 3:
await self.setting()
elif index == 4:
await self.advanced_options()
elif index == len(OPTIONS_MENU) - 1:
return
async def autorun(self):
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ pyyaml
requests
noneprompt
aioconsole
javaproperties
pyinstaller
javaproperties
tkintertools[suggest]==3.0.0b3

0 comments on commit 324efa9

Please sign in to comment.