hytos / DTI_PID / DTI_PID / ProjectDialog.py @ 6547b5f1
이력 | 보기 | 이력해설 | 다운로드 (2.41 KB)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 | |
3 |
# Form implementation generated from reading ui file 'ProjectDialog.ui'
|
4 |
#
|
5 |
# Created by: PyQt5 UI code generator 5.6
|
6 |
#
|
7 |
# WARNING! All changes made in this file will be lost!
|
8 | |
9 |
from PyQt5 import QtCore, QtGui, QtWidgets |
10 |
from PyQt5.QtWidgets import * |
11 |
import os |
12 |
from Project import Project |
13 |
from AppDocData import AppDocData |
14 |
import Project_UI |
15 | |
16 |
class Ui_Dialog(QDialog): |
17 |
def __init__(self, parent=None): |
18 |
QDialog.__init__(self, parent)
|
19 |
self.selectedProject = None |
20 |
self.ui = Project_UI.Ui_ProjectDialog()
|
21 |
self.ui.setupUi(self) |
22 |
self.initComboBox()
|
23 |
self.ui.toolButton.clicked.connect(self.addProjectClick) |
24 |
self.setWindowTitle('프로젝트') |
25 |
self.EventFunc()
|
26 | |
27 |
def EventFunc(self): |
28 |
self.ui.comboBox.editTextChanged.connect(self.test) |
29 | |
30 |
def initComboBox(self): |
31 |
from AppDocData import AppDocData |
32 | |
33 |
self.ui.comboBox.clear()
|
34 |
projectList = AppDocData.instance().getProjectList() |
35 |
## ComboBox setting
|
36 |
for project in projectList: |
37 |
self.ui.comboBox.addItem(project.getName(), project)
|
38 | |
39 |
def showDialog(self): |
40 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowCloseButtonHint & ~QtCore.Qt.WindowContextHelpButtonHint) |
41 |
self.exec_()
|
42 |
return self.selectedProject |
43 | |
44 |
def test(self): |
45 |
QMessageBox.show("test")
|
46 | |
47 |
def accept(self): |
48 |
self.selectedProject = self.ui.comboBox.currentData() |
49 |
AppDocData.instance().updateProjectUpdatedDate(self.selectedProject.getId())
|
50 |
QDialog.accept(self)
|
51 | |
52 |
def reject(self): |
53 |
self.selectedProject = None |
54 |
QDialog.reject(self)
|
55 | |
56 |
def addProjectClick(self): |
57 |
options = QFileDialog.Options() |
58 |
options |= QFileDialog.DontUseNativeDialog |
59 |
options |= QFileDialog.ShowDirsOnly |
60 |
selectedDir = QFileDialog.getExistingDirectory(None, "프로젝트 경로 선택", os.getcwd() , options=options) |
61 |
if selectedDir:
|
62 |
self.insertProjectInfo(selectedDir)
|
63 |
|
64 |
def insertProjectInfo(self, dir): |
65 |
AppDocData.instance().insertProjectInfo(dir)
|
66 |
self.initComboBox()
|
67 |
|
68 |
#if __name__ == "__init__":
|
69 |
# dialog = QtWidgets.QDialog()
|
70 |
# ui = Ui_Dialog()
|
71 |
# ui.setupUi(Dialog)
|
72 |
# Dialog.show()
|
73 | |
74 |
#if __name__ == "__main__":
|
75 |
# import sys
|
76 |
# app = QtWidgets.QApplication(sys.argv)
|
77 |
# Dialog = QtWidgets.QDialog()
|
78 |
# Dialog.show()
|
79 |
# sys.exit(app.exec_())
|
80 |