Compare commits

..

No commits in common. "d12975bf9b86f74ed8a8124cda03cfd3f41fb907" and "89b7b813141b8162775ea4c033dcb1eccb3fc193" have entirely different histories.

3 changed files with 35 additions and 69 deletions

View File

@ -6,7 +6,7 @@
import os
import sys
import tomli_w
import tomlkit
import io
@ -35,7 +35,7 @@ if sys.argv == [__file__]: # 没有输入参数,直接输出默认信息并
config_file = tools.load_file("./config/main.toml")
config_file["window"]["width"] = 1024
config_file["window"]["height"] = 768
tomli_w.dump(config_file, open("./config/main.toml", "wb"))
tomlkit.dump(config_file, open("./config/main.toml", "w"))
elif os.path.abspath(os.curdir) in sys.path and "-github" in sys.argv:
print(f"DR_version={DR_status.DR_version}")

View File

@ -70,13 +70,6 @@ class BaseButtonTheme:
:return:
"""
def on_update(self, button) -> None:
"""
当按钮的位置发生变化的时候
:param button: 按钮
:return:
"""
class MinecraftWikiButtonTheme(BaseButtonTheme):
"""
@ -102,33 +95,18 @@ class MinecraftWikiButtonTheme(BaseButtonTheme):
touch_d = (106, 107, 108, 255) # 同上
pad = 2 # 边框宽度 2 px
list_pad = 4 # 下巴 4px
pop_out = False
if pop_out:
# 主背景
self.back_ground = Rectangle(x=x + (pad * 2), y=y + (pad * 2) + list_pad,
width=width - (pad * 4), height=height - (pad * 4) - list_pad,
color=a, batch=batch, group=Group(order=3, parent=group))
# 左上方向的覆盖
self.cover_back = Rectangle(x=x + pad, y=y + pad + list_pad,
width=width - (pad * 2), height=height - (pad * 2) - list_pad,
color=b, batch=batch, group=Group(order=1, parent=group))
# 右下方向的覆盖
self.cover_back2 = Rectangle(x=x + (pad * 2), y=y + pad + list_pad,
width=width - (pad * 3), height=height - (pad * 3) - list_pad,
color=c, batch=batch, group=Group(order=2, parent=group))
else:
# 主背景
self.back_ground = Rectangle(x=x + (pad * 2), y=y + (pad * 2) + list_pad,
width=width - (pad * 4), height=height - (pad * 4) - list_pad,
color=c, batch=batch, group=Group(order=3, parent=group))
# 左上方向的覆盖
self.cover_back = Rectangle(x=x + pad, y=y + (pad * 2) + list_pad,
width=width - (pad * 3), height=height - (pad * 3) - list_pad,
color=b, batch=batch, group=Group(order=2, parent=group))
# 右下方向的覆盖
self.cover_back2 = Rectangle(x=x + pad, y=y + pad + list_pad,
width=width - (pad * 2), height=height - (pad * 2) - list_pad,
color=a, batch=batch, group=Group(order=1, parent=group))
# 主背景
self.back_ground = Rectangle(x=x + (pad * 2), y=y + (pad * 2) + list_pad,
width=width - (pad * 4), height=height - (pad * 4) - list_pad,
color=a, batch=batch, group=Group(order=3, parent=group))
# 左上方向的覆盖
self.cover_back = Rectangle(x=x + pad, y=y + pad + list_pad,
width=width - (pad * 2), height=height - (pad * 2) - list_pad,
color=b, batch=batch, group=Group(order=1, parent=group))
# 右下方向的覆盖
self.cover_back2 = Rectangle(x=x + (pad * 2), y=y + pad + list_pad,
width=width - (pad * 3), height=height - (pad * 3) - list_pad,
color=c, batch=batch, group=Group(order=2, parent=group))
# 下巴的框
self.list_back = BorderedRectangle(x=x, y=y,
width=width, height=height,
@ -145,8 +123,8 @@ class MinecraftWikiButtonTheme(BaseButtonTheme):
self.touch_d = touch_d
self.pad = pad
self.list_pad = list_pad
self.pop_out = pop_out
self.drag_list = False
self.base_x = x
self.base_y = y
def on_touch(self, x, y) -> None:
"""
@ -169,42 +147,30 @@ class MinecraftWikiButtonTheme(BaseButtonTheme):
:param y: 鼠标绝对位置
:return:
"""
if self.pop_out:
self.back_ground.color = self.touch_a
self.cover_back.color = self.touch_b
self.cover_back2.color = self.touch_c
else:
self.back_ground.color = self.touch_c
self.cover_back.color = self.touch_b
self.cover_back2.color = self.touch_a
if self.drag_list:
self.back_ground.y = self.y + (self.pad * 2)
self.back_ground.height = self.height - (self.pad * 4)
self.cover_back.y = self.y + self.pad
self.cover_back.height = self.height - (self.pad * 2)
self.cover_back2.y = self.y + self.pad
self.cover_back2.height = self.height - (self.pad * 3)
self.back_ground.color = self.touch_a
self.cover_back.color = self.touch_b
self.cover_back2.color = self.touch_c
self.back_ground.y = self.base_y + (self.pad * 2)
self.back_ground.height = self.height - (self.pad * 4)
self.cover_back.y = self.base_y + self.pad
self.cover_back.height = self.height - (self.pad * 2)
self.cover_back2.y = self.base_y + self.pad
self.cover_back2.height = self.height - (self.pad * 3)
def on_release(self) -> None:
"""
当鼠标松开按钮的时候
:return:
"""
if self.pop_out:
self.back_ground.color = self.a
self.cover_back.color = self.b
self.cover_back2.color = self.c
else:
self.back_ground.color = self.c
self.cover_back.color = self.b
self.cover_back2.color = self.a
if self.drag_list:
self.back_ground.y = self.y + (self.pad * 2) + self.list_pad
self.back_ground.height = self.height - (self.pad * 4) - self.list_pad
self.cover_back.y = self.y + self.pad + self.list_pad
self.cover_back.height = self.height - (self.pad * 2) - self.list_pad
self.cover_back2.y = self.y + self.pad + self.list_pad
self.cover_back2.height = self.height - (self.pad * 3) - self.list_pad
self.back_ground.color = self.a
self.cover_back.color = self.b
self.cover_back2.color = self.c
self.back_ground.y = self.base_y + (self.pad * 2) + self.list_pad
self.back_ground.height = self.height - (self.pad * 4) - self.list_pad
self.cover_back.y = self.base_y + self.pad + self.list_pad
self.cover_back.height = self.height - (self.pad * 2) - self.list_pad
self.cover_back2.y = self.base_y + self.pad + self.list_pad
self.cover_back2.height = self.height - (self.pad * 3) - self.list_pad
class ButtonThemeOptions(Options):

View File

@ -8,7 +8,7 @@ fonts_folder = "assets/fonts"
[window]
style = "None"
width = 1003
height = 715
height = 632
visible = true
gui_scale = 1
caption = "Difficult Rocket v{DR_version}"