# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'main.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5.QtWidgets import QMainWindow, QWidget, QVBoxLayout, QLabel, QHBoxLayout, QDateEdit, QPushButton, QTableWidget, QAbstractItemView, QProgressBar

from PyQt5.QtCore import QSize, QRect, QMetaObject
from PyQt5.QtGui import QFont

import datetime
import static.staticValues as staticValues

class Ui_MainWindow(QMainWindow):
    def setupUi(self, MainWindow):
        MainWindow.resize(960, 550)
        MainWindow.setMinimumSize(QSize(960, 550))
        MainWindow.setMaximumSize(QSize(960, 550))

        #메인 화면 색상py
        self.setStyleSheet("color: black;"
                        "background-color: white")

        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setMinimumSize(QSize(960, 550))
        self.centralwidget.setMaximumSize(QSize(960, 550))
        self.layoutWidget = QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QRect(10, 11, 942, 510))
        self.verticalLayout = QVBoxLayout(self.layoutWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.inquiryLabel = QLabel(self.layoutWidget)
        font = QFont()
        font.setPointSize(11)
        font.setBold(True)
        font.setWeight(75)
        self.inquiryLabel.setFont(font)
        self.verticalLayout.addWidget(self.inquiryLabel)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setContentsMargins(20, -1, 500, -1)
        self.fromDateEdit = QDateEdit(self.layoutWidget)
        self.horizontalLayout.addWidget(self.fromDateEdit)
        self.dashLabel = QLabel(self.layoutWidget)
        self.dashLabel.setFont(font)
        self.horizontalLayout.addWidget(self.dashLabel)
        self.toDateEdit = QDateEdit(self.layoutWidget)
        self.horizontalLayout.addWidget(self.toDateEdit)
        self.inquiryButton = QPushButton(self.layoutWidget)
        self.inquiryButton.setMinimumSize(QSize(100, 30))
        self.inquiryButton.setMaximumSize(QSize(100, 30))
        self.horizontalLayout.addWidget(self.inquiryButton)
        self.horizontalLayout.setStretch(0, 4)
        self.horizontalLayout.setStretch(2, 4)
        self.horizontalLayout.setStretch(3, 1)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.tableView = QTableWidget(self.layoutWidget)
        self.tableView.setMaximumSize(QSize(940, 400))
        
        self.tableView.setColumnCount(8)
        self.tableView.setHorizontalHeaderLabels(["","운송장번호", "날짜", "상호", "전화번호", "상품", "수량", "주소"])
        self.tableView.setColumnWidth(0, 10)
        self.tableView.setColumnWidth(1, 80)
        self.tableView.setColumnWidth(2, 80)

        self.tableView.setColumnWidth(3, 150)
        self.tableView.setColumnWidth(4, 120)

        self.tableView.setColumnWidth(6, 40)
        self.tableView.setColumnWidth(7, 250)
        self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        # self.tableView = QTableView(self.layoutWidget)
        # self.tableView.setMinimumSize(QSize(940, 400))
        # self.tableView.setMaximumSize(QSize(940, 400))

        # self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)	# row 전체를 선택하도록

        # self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)	# 

        # self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)		# 셀 내용을 수정 불가하도록
        
        self.verticalLayout.addWidget(self.tableView)
        self.registButton = QPushButton(self.layoutWidget)
        self.registButton.setEnabled(True)
        self.registButton.setMinimumSize(QSize(100, 30))
        self.registButton.setMaximumSize(QSize(100, 30))
        self.verticalLayout.addWidget(self.registButton)

        self.progressBar = QProgressBar()
        
        
        #UI스타일
        self.inquiryButton.setStyleSheet(staticValues.buttonStyleSheet)
        self.inquiryButton.setFont(staticValues.buttonFont)
        self.registButton.setStyleSheet(staticValues.buttonStyleSheet)
        self.registButton.setFont(staticValues.buttonFont)

        #오늘 날짜 세팅
        nowDate = datetime.datetime.now()
        self.fromDateEdit.setDate(nowDate)
        self.toDateEdit.setDate(nowDate)

        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle("이카운트 ERP 자동등록 프로그램")
        self.inquiryLabel.setText("조회 기간")
        self.dashLabel.setText("-")
        self.inquiryButton.setText("조회")
        self.registButton.setText("등록")


if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    MainWindow = QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
