83 lines
1.9 KiB
Python
83 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
입력 다이얼로그 모듈
|
|
섹션 데이터 입력을 위한 기본 다이얼로그입니다.
|
|
"""
|
|
|
|
from PySide6.QtWidgets import QWidget
|
|
|
|
from ui.base.base_dialog import BaseDialog
|
|
from database.models import BaseModel
|
|
from core.config import ConfigManager
|
|
from core.logger import get_logger
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
class InputDialog(BaseDialog):
|
|
"""
|
|
기본 입력 다이얼로그
|
|
|
|
데이터 입력을 위한 기본 다이얼로그입니다.
|
|
"""
|
|
|
|
def __init__(
|
|
self,
|
|
parent=None,
|
|
title: str = "입력",
|
|
width: int = 400,
|
|
height: int = 600
|
|
):
|
|
super().__init__(parent, title=title, width=width, height=height)
|
|
|
|
# 확인/취소 버튼
|
|
self.add_confirm_cancel_buttons()
|
|
|
|
|
|
class SectionInputDialog(InputDialog):
|
|
"""
|
|
섹션 입력 다이얼로그
|
|
|
|
섹션 데이터 입력을 위한 다이얼로그입니다.
|
|
"""
|
|
|
|
def __init__(
|
|
self,
|
|
parent=None,
|
|
title: str = "입력",
|
|
record: BaseModel = None,
|
|
width: int = 400,
|
|
height: int = 600
|
|
):
|
|
super().__init__(parent, title=title, width=width, height=height)
|
|
|
|
self.record = record
|
|
self.config = ConfigManager()
|
|
|
|
def get_data(self) -> dict:
|
|
"""
|
|
입력 데이터 반환 (자식 클래스에서 오버라이드)
|
|
|
|
Returns:
|
|
입력 데이터 딕셔너리
|
|
"""
|
|
return {}
|
|
|
|
def validate(self) -> bool:
|
|
"""
|
|
입력 유효성 검사 (자식 클래스에서 오버라이드)
|
|
|
|
Returns:
|
|
유효 여부
|
|
"""
|
|
return True
|
|
|
|
def _on_confirm(self):
|
|
"""확인 버튼 클릭"""
|
|
if self.validate():
|
|
super()._on_confirm()
|
|
else:
|
|
self.signals.status_message.emit("필수 항목을 입력해주세요.", 3000)
|
|
|
|
|