Add new UI section or tab by extending BaseSection. Use when adding new screen, tab, section, or UI feature. Covers BaseSection inheritance, SectionType registration, MainWindow integration, and theme application.
core/types.py의 SectionType Enum에 새 값 추가:
class SectionType(Enum):
# ... 기존 값들 ...
MY_NEW_SECTION = "my_new_section"
ui/sections/{카테고리}/{섹션명}_section.py 생성. BaseSection 상속:
"""
{기능명} 섹션 - {설명}
"""
from ui.sections.base_section import BaseSection
from ui.components.log_widget import LOG_INFO, LOG_SUCCESS
class MyNewSection(BaseSection):
"""{기능명} 섹션"""
def __init__(self, parent=None):
super().__init__("섹션 제목", parent)
self.setup_content()
def setup_content(self):
"""콘텐츠 구성 - content_layout에 위젯 추가"""
# self.content_layout.addWidget(...)
pass
def on_section_activated(self):
"""섹션 활성화 시 (선택 구현)"""
pass
def on_section_deactivated(self):
"""섹션 비활성화 시 (선택 구현)"""
pass
ui/main_window.py의 _initialize_sections()에 추가:
from ui.sections.xxx.my_new_section import MyNewSection
self._add_section(SectionType.MY_NEW_SECTION.value, MyNewSection())
ui/components/sidebar.py의 _create_sidebar_items()에 추가:
my_btn = SidebarButton("표시명", icon_name="ph.xxx")
my_btn.clicked.connect(lambda: self._on_button_clicked(SectionType.MY_NEW_SECTION.value))
self.scroll_layout.addWidget(my_btn)
self._buttons[SectionType.MY_NEW_SECTION.value] = my_btn
ph.house, ph.gear, ph.truck, ph.clipboard-text 등get_theme().get_color("primary") 등으로 색상 사용theme_changed 시그널 자동 연결