[feature] 项目管理ui设计
This commit is contained in:
parent
ae09c4f5be
commit
dc8d0e8bfd
BIN
data/database.db
BIN
data/database.db
Binary file not shown.
Binary file not shown.
@ -1,8 +1,9 @@
|
||||
import sys
|
||||
from PySide6.QtWidgets import (QApplication, QWidget, QPushButton, QGridLayout,
|
||||
QVBoxLayout, QHBoxLayout, QCheckBox, QComboBox,
|
||||
QLabel, QSlider, QFrame, QGroupBox)
|
||||
from PySide6.QtCore import Qt
|
||||
QLabel, QSlider, QFrame, QGroupBox, QListView)
|
||||
from PySide6.QtCore import Qt, QSize
|
||||
from PySide6.QtGui import QIcon
|
||||
from widgets.audio_filter_widget import AudioFilterWidget
|
||||
|
||||
class ChannelButton(QWidget):
|
||||
@ -120,12 +121,43 @@ class AVAS_WIDGET(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.setWindowTitle("AVAS")
|
||||
self.is_panel_visible = True # 添加状态标记
|
||||
self.setup_ui()
|
||||
|
||||
def setup_ui(self):
|
||||
main_layout = QVBoxLayout()
|
||||
# 创建主水平布局
|
||||
main_layout = QHBoxLayout()
|
||||
|
||||
# Top section - Channel buttons
|
||||
# 左侧项目信息面板
|
||||
self.left_panel = self.create_project_panel()
|
||||
|
||||
# 创建切换按钮容器
|
||||
toggle_container = QVBoxLayout()
|
||||
self.toggle_button = QPushButton("◀") # 使用箭头符号
|
||||
self.toggle_button.setFixedSize(20, 60)
|
||||
self.toggle_button.clicked.connect(self.toggle_panel)
|
||||
self.toggle_button.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #404040;
|
||||
color: white;
|
||||
border: 1px solid #505050;
|
||||
border-radius: 3px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #505050;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #303030;
|
||||
}
|
||||
""")
|
||||
toggle_container.addStretch()
|
||||
toggle_container.addWidget(self.toggle_button)
|
||||
toggle_container.addStretch()
|
||||
|
||||
# 右侧原有内容面板
|
||||
right_panel = QVBoxLayout()
|
||||
|
||||
# 添加原有的通道按钮网格
|
||||
channels_layout = QGridLayout()
|
||||
for i in range(24):
|
||||
row = i // 8
|
||||
@ -133,35 +165,134 @@ class AVAS_WIDGET(QWidget):
|
||||
channel = ChannelButton(i + 1)
|
||||
channels_layout.addWidget(channel, row, col)
|
||||
|
||||
# Middle section
|
||||
# 中间部分
|
||||
middle_layout = QHBoxLayout()
|
||||
|
||||
# Left side - Parameter matrix
|
||||
param_matrix = self.create_parameter_matrix()
|
||||
|
||||
# Right side - Filter controls
|
||||
filter_controls = self.create_filter_controls()
|
||||
|
||||
middle_layout.addWidget(param_matrix, stretch=2)
|
||||
middle_layout.addWidget(filter_controls, stretch=1)
|
||||
|
||||
# Bottom section
|
||||
# 底部按钮
|
||||
bottom_layout = QHBoxLayout()
|
||||
clean_btn = QPushButton("Clean")
|
||||
send_btn = QPushButton("Send")
|
||||
enable_cb = QCheckBox("Enable")
|
||||
|
||||
bottom_layout.addStretch()
|
||||
bottom_layout.addWidget(clean_btn)
|
||||
bottom_layout.addWidget(send_btn)
|
||||
bottom_layout.addWidget(enable_cb)
|
||||
|
||||
# Add all sections to main layout
|
||||
main_layout.addLayout(channels_layout)
|
||||
main_layout.addLayout(middle_layout)
|
||||
main_layout.addLayout(bottom_layout)
|
||||
# 将所有部分添加到右侧面板
|
||||
right_panel.addLayout(channels_layout)
|
||||
right_panel.addLayout(middle_layout)
|
||||
right_panel.addLayout(bottom_layout)
|
||||
|
||||
# 添加左右面板和切换按钮到主布局
|
||||
main_layout.addWidget(self.left_panel, stretch=1)
|
||||
main_layout.addLayout(toggle_container)
|
||||
main_layout.addLayout(right_panel, stretch=4)
|
||||
|
||||
self.setLayout(main_layout)
|
||||
|
||||
def toggle_panel(self):
|
||||
"""切换左侧面板的显示状态"""
|
||||
self.is_panel_visible = not self.is_panel_visible
|
||||
self.left_panel.setVisible(self.is_panel_visible)
|
||||
|
||||
# 更新切换按钮的箭头方向
|
||||
if self.is_panel_visible:
|
||||
self.toggle_button.setText("◀")
|
||||
else:
|
||||
self.toggle_button.setText("▶")
|
||||
|
||||
def create_project_panel(self):
|
||||
"""创建左侧项目信息面板"""
|
||||
panel = QGroupBox("项目信息")
|
||||
layout = QVBoxLayout()
|
||||
|
||||
# 创建列表视图
|
||||
self.project_list = QListView()
|
||||
self.project_list.setViewMode(QListView.ViewMode.IconMode)
|
||||
self.project_list.setIconSize(QSize(80, 80))
|
||||
self.project_list.setSpacing(10)
|
||||
self.project_list.setResizeMode(QListView.ResizeMode.Adjust)
|
||||
self.project_list.setMovement(QListView.Movement.Static)
|
||||
|
||||
# 设置样式
|
||||
self.project_list.setStyleSheet("""
|
||||
QListView {
|
||||
background-color: #2D2D2D;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
}
|
||||
QListView::item {
|
||||
background-color: #3D3D3D;
|
||||
border-radius: 6px;
|
||||
margin: 5px;
|
||||
}
|
||||
QListView::item:selected {
|
||||
background-color: #4A4A4A;
|
||||
}
|
||||
QListView::item:hover {
|
||||
background-color: #454545;
|
||||
}
|
||||
""")
|
||||
|
||||
# 添加工具栏按钮
|
||||
toolbar = QHBoxLayout()
|
||||
add_btn = QPushButton("添加")
|
||||
delete_btn = QPushButton("删除")
|
||||
refresh_btn = QPushButton("刷新")
|
||||
|
||||
# 设置按钮样式
|
||||
button_style = """
|
||||
QPushButton {
|
||||
background-color: #404040;
|
||||
color: white;
|
||||
border: 1px solid #505050;
|
||||
border-radius: 3px;
|
||||
padding: 5px 10px;
|
||||
min-width: 60px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #505050;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #303030;
|
||||
}
|
||||
"""
|
||||
add_btn.setStyleSheet(button_style)
|
||||
delete_btn.setStyleSheet(button_style)
|
||||
refresh_btn.setStyleSheet(button_style)
|
||||
|
||||
toolbar.addWidget(add_btn)
|
||||
toolbar.addWidget(delete_btn)
|
||||
toolbar.addWidget(refresh_btn)
|
||||
|
||||
# 组装面板
|
||||
layout.addLayout(toolbar)
|
||||
layout.addWidget(self.project_list)
|
||||
panel.setLayout(layout)
|
||||
|
||||
# 设置面板样式
|
||||
panel.setStyleSheet("""
|
||||
QGroupBox {
|
||||
background-color: #2D2D2D;
|
||||
border: 1px solid #505050;
|
||||
border-radius: 6px;
|
||||
margin-top: 1ex;
|
||||
padding: 10px;
|
||||
color: white;
|
||||
}
|
||||
QGroupBox::title {
|
||||
subcontrol-origin: margin;
|
||||
subcontrol-position: top center;
|
||||
padding: 0 3px;
|
||||
}
|
||||
""")
|
||||
|
||||
return panel
|
||||
|
||||
def create_parameter_matrix(self):
|
||||
frame = QFrame()
|
||||
|
Loading…
Reference in New Issue
Block a user