This commit is contained in:
Jeffreytsai1004 2025-02-10 01:11:14 +08:00
parent b755d26810
commit 64b615556b
3 changed files with 19 additions and 14 deletions

View File

@ -19,8 +19,8 @@ class MetaFusion(QtWidgets.QMainWindow):
# === 设置窗口属性 ===
self.setWindowTitle(f"{config.TOOL_NAME} {config.TOOL_VERSION}")
# 设置初始大小和最小大小
self.resize(550, 900) # 初始大小
self.setMinimumSize(550, 900) # 最小大小限制
self.resize(550, 850) # 初始大小
self.setMinimumSize(550, 850) # 最小大小限制
# === 创建中心部件 ===
self.central_widget = QtWidgets.QWidget()

View File

@ -159,7 +159,6 @@ class MenuBar(QtWidgets.QMenuBar):
# === Actions ===
self.help_actions = {}
actions = [
("check_update", "检查更新", "update.png", ""),
("help", "帮助文档", "help.png", "F1"),
("about", "关于", "about.png", "")
]

View File

@ -193,16 +193,16 @@ class MeshesTab(QtWidgets.QWidget):
buttons = QtWidgets.QWidget()
button_layout = QtWidgets.QHBoxLayout(buttons)
button_layout.setContentsMargins(0, 8, 0, 8)
button_layout.setSpacing(12)
button_layout.setSpacing(8) # 统一按钮间距为8
# 创建功能按钮
load_btn = self._create_tool_button("自动加载模型", "load_meshes.png", "fileOpen.png")
standardize_btn = self._create_tool_button("标准化命名", "standardize_name.png", "setEdNormalize.png")
standardize_btn = self._create_tool_button("标准化命名", "standardize.png", "setEdNormalize.png")
group_btn = self._create_tool_button("自动分组", "auto_group.png", "menuIconEdit.png")
delete_btn = self._create_tool_button("清理", "delete.png", "delete.png")
# 设置按钮固定宽度
button_width = (widget.width() - 36) // 4 # 调整宽度以适应四个按钮
button_width = (widget.width() - 32) // 4 # 32是左右边距和3个按钮间距(8*3)的总和
for btn in [load_btn, standardize_btn, group_btn, delete_btn]:
btn.setFixedWidth(button_width)
button_layout.addWidget(btn)
@ -217,7 +217,7 @@ class MeshesTab(QtWidgets.QWidget):
"""创建网格项"""
item = QtWidgets.QWidget()
layout = QtWidgets.QHBoxLayout(item)
layout.setContentsMargins(4, 4, 4, 4)
layout.setContentsMargins(4, 2, 4, 2) # 减小上下边距
layout.setSpacing(8)
# 网格名称标签
@ -230,9 +230,9 @@ class MeshesTab(QtWidgets.QWidget):
# 添加按钮
add_btn = QtWidgets.QPushButton()
add_btn.setIcon(QtGui.QIcon(":fileOpen.png")) # 使用Maya内置图标
add_btn.setIcon(QtGui.QIcon(":fileOpen.png"))
add_btn.setToolTip("浏览...")
add_btn.setFixedSize(28, 28)
add_btn.setFixedSize(24, 24) # 减小按钮大小
layout.addWidget(name_label)
layout.addWidget(path_edit)
@ -282,10 +282,16 @@ class MeshesTab(QtWidgets.QWidget):
# 尝试使用自定义图标如果失败则使用Maya内置图标
icon_path = f"{config.ICONS_PATH}/{icon_name}"
print(f"尝试加载图标: {icon_path}") # 添加调试输出
if os.path.exists(icon_path):
btn.setIcon(QtGui.QIcon(icon_path))
print(f"成功加载自定义图标: {icon_path}")
elif fallback_icon:
btn.setIcon(QtGui.QIcon(f":{fallback_icon}"))
print(f"使用Maya内置图标: {fallback_icon}")
else:
print(f"未能找到图标: {icon_path}")
btn.setStyleSheet("""
QPushButton {
@ -373,12 +379,12 @@ class MeshesTab(QtWidgets.QWidget):
# 创建按钮
self.separate_btn = self._create_tool_button("模型分离", "separate.png", "polyUnite.png")
self.face_accessory_btn = self._create_tool_button("生成面部配件", "face_accessory.png", "polyCreateFacet.png")
self.fix_normal_btn = self._create_tool_button("修复法线", "fix_normal.png", "polyNormal.png")
self.fix_vertex_order_btn = self._create_tool_button("修复点序", "fix_vertex_order.png", "polyNormalPerVertex.png")
self.fix_seam_btn = self._create_tool_button("修复接缝", "fix_seam.png", "polyMergeVertex.png")
self.fix_normal_btn = self._create_tool_button("修复法线", "repair_normals.png", "polyNormal.png")
self.fix_vertex_order_btn = self._create_tool_button("修复点序", "repair_vertex_order.png", "polyNormalPerVertex.png")
self.fix_seam_btn = self._create_tool_button("修复接缝", "fix_seam.png", "polyChipOff.png")
# 设置按钮固定宽度
button_width = (widget.width() - 24) // 2 # 24是左右边距和按钮间距的总和
button_width = (widget.width() - 24) // 2 # 24是左右边距和按钮间距(8)的总和
for btn in [self.separate_btn, self.face_accessory_btn,
self.fix_normal_btn, self.fix_vertex_order_btn,
self.fix_seam_btn]:
@ -420,7 +426,7 @@ class MeshesTab(QtWidgets.QWidget):
def _adjust_button_widths(self, event, buttons):
"""调整按钮宽度以适应窗口大小"""
width = event.size().width()
button_width = (width - 24) // 2 # 24是左右边距和按钮间距的总和
button_width = (width - 24) // 2 # 24是左右边距和按钮间距(8)的总和
for btn in buttons:
btn.setFixedWidth(button_width)