개정판 b6406480
ProjectDialog UI, 실행 구문 분리 및 사이즈 조절 가능하도록 수정 / QDirTreeWidget 우클릭 시 ContextMenu 출력 부분이 endWiths(.png) 인 부분 삭제
DTI_PID/DTI_PID/App.py | ||
---|---|---|
44 | 44 |
app = App(sys.argv) |
45 | 45 |
try: |
46 | 46 |
dlg = Ui_Dialog() |
47 |
dlg.show() |
|
48 |
dlg.exec_() |
|
49 |
if dlg.selectedProject is not None: |
|
50 |
AppDocData.instance().setCurrentProject(dlg.selectedProject) |
|
47 |
selectedProject = dlg.showDialog() |
|
48 |
if selectedProject is not None: |
|
49 |
AppDocData.instance().setCurrentProject(selectedProject) |
|
51 | 50 |
app.mainWnd = MainWindow.instance() |
52 | 51 |
app.mainWnd.show() |
53 | 52 |
except Exception as ex: |
DTI_PID/DTI_PID/DTI_PID.py | ||
---|---|---|
941 | 941 |
|
942 | 942 |
try: |
943 | 943 |
dlg = Ui_Dialog() |
944 |
dlg.show() |
|
945 |
dlg.exec_() |
|
946 |
if dlg.selectedProject is not None: |
|
944 |
selectedProject = dlg.showDialog() |
|
945 |
if selectedProject is not None: |
|
947 | 946 |
form = ExampleApp() |
948 | 947 |
form.show() |
949 | 948 |
except Exception as ex: |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
565 | 565 |
app = App(sys.argv) |
566 | 566 |
try: |
567 | 567 |
dlg = Ui_Dialog() |
568 |
dlg.show() |
|
569 |
dlg.exec_() |
|
570 |
if dlg.selectedProject is not None: |
|
571 |
AppDocData.instance().setCurrentProject(dlg.selectedProject) |
|
568 |
selectedProject = dlg.showDialog() |
|
569 |
if selectedProject is not None: |
|
570 |
AppDocData.instance().setCurrentProject(selectedProject) |
|
572 | 571 |
app.mainWnd = MainWindow.instance() |
573 | 572 |
app.mainWnd.show() |
574 | 573 |
except Exception as ex: |
DTI_PID/DTI_PID/ProjectDialog.py | ||
---|---|---|
11 | 11 |
import os |
12 | 12 |
from Project import Project |
13 | 13 |
from AppDocData import AppDocData |
14 |
import UI_ProjectDialog |
|
14 | 15 |
|
15 |
class Ui_Dialog(QtWidgets.QDialog):
|
|
16 |
class Ui_Dialog(QDialog): |
|
16 | 17 |
def __init__(self, parent=None): |
17 |
super().__init__(parent)
|
|
18 |
QDialog.__init__(self, parent)
|
|
18 | 19 |
self.selectedProject = None |
19 |
self.setupUi(self) |
|
20 |
|
|
21 |
def setupUi(self, Dialog): |
|
22 |
Dialog.setObjectName("Dialog") |
|
23 |
Dialog.resize(417, 88) |
|
24 |
self.label = QtWidgets.QLabel(Dialog) |
|
25 |
self.label.setGeometry(QtCore.QRect(10, 18, 70, 22)) |
|
26 |
font = QtGui.QFont() |
|
27 |
font.setFamily("맑은 고딕") |
|
28 |
font.setPointSize(11) |
|
29 |
font.setBold(True) |
|
30 |
font.setWeight(75) |
|
31 |
self.label.setFont(font) |
|
32 |
self.label.setObjectName("label") |
|
33 |
self.comboBox = QtWidgets.QComboBox(Dialog) |
|
34 |
self.comboBox.setGeometry(QtCore.QRect(90, 18, 281, 21)) |
|
35 |
font = QtGui.QFont() |
|
36 |
font.setPointSize(11) |
|
37 |
self.comboBox.setFont(font) |
|
38 |
self.comboBox.setObjectName("comboBox") |
|
39 |
self.toolButton = QtWidgets.QToolButton(Dialog) |
|
40 |
self.toolButton.setGeometry(QtCore.QRect(380, 18, 23, 22)) |
|
41 |
font = QtGui.QFont() |
|
42 |
font.setFamily("맑은 고딕") |
|
43 |
font.setPointSize(11) |
|
44 |
font.setBold(True) |
|
45 |
font.setWeight(75) |
|
46 |
self.toolButton.setFont(font) |
|
47 |
icon = QtGui.QIcon.fromTheme("add") |
|
48 |
self.toolButton.setIcon(icon) |
|
49 |
self.toolButton.setObjectName("toolButton") |
|
50 |
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) |
|
51 |
self.buttonBox.setGeometry(QtCore.QRect(250, 48, 156, 23)) |
|
52 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
|
53 |
self.buttonBox.setObjectName("buttonBox") |
|
54 |
|
|
55 |
self.buttonBox.accepted.connect(self.acceptedClick) |
|
56 |
self.buttonBox.rejected.connect(self.rejectedClick) |
|
57 |
|
|
58 |
self.toolButton.clicked.connect(self.addProjectClick) |
|
59 |
|
|
20 |
self.ui = UI_ProjectDialog.Ui_Dialog() |
|
21 |
self.ui.setupUi(self) |
|
60 | 22 |
self.initComboBox() |
61 |
self.retranslateUi(Dialog) |
|
62 |
QtCore.QMetaObject.connectSlotsByName(Dialog) |
|
23 |
self.ui.toolButton.clicked.connect(self.addProjectClick) |
|
63 | 24 |
|
64 | 25 |
def initComboBox(self): |
65 | 26 |
from AppDocData import AppDocData |
66 | 27 |
|
67 |
self.comboBox.clear() |
|
28 |
self.ui.comboBox.clear()
|
|
68 | 29 |
projectList = AppDocData.instance().getProjectList() |
69 | 30 |
## ComboBox setting |
70 | 31 |
for project in projectList: |
71 |
self.comboBox.addItem(project.getName(), project) |
|
72 |
|
|
73 |
def retranslateUi(self, Dialog): |
|
74 |
_translate = QtCore.QCoreApplication.translate |
|
75 |
Dialog.setWindowTitle(_translate("Dialog", "프로젝트 선택")) |
|
76 |
self.label.setText(_translate("Dialog", "프로젝트명")) |
|
77 |
self.toolButton.setText(_translate("Dialog", "+")) |
|
32 |
self.ui.comboBox.addItem(project.getName(), project) |
|
78 | 33 |
|
79 | 34 |
def showDialog(self): |
80 |
self.setupUi(self) |
|
81 | 35 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowCloseButtonHint & ~QtCore.Qt.WindowContextHelpButtonHint) |
82 | 36 |
self.exec_() |
83 | 37 |
return self.selectedProject |
84 | 38 |
|
85 |
def acceptedClick(self):
|
|
39 |
def accept(self): |
|
86 | 40 |
print("accepted") |
87 |
self.selectedProject = self.comboBox.currentData() |
|
41 |
self.selectedProject = self.ui.comboBox.currentData()
|
|
88 | 42 |
AppDocData.instance().updateProjectUpdatedDate(self.selectedProject.getId()) |
89 |
self.close()
|
|
43 |
QDialog.accept(self)
|
|
90 | 44 |
|
91 |
def rejectedClick(self):
|
|
45 |
def reject(self): |
|
92 | 46 |
print("rejected") |
93 | 47 |
self.selectedProject = None |
94 |
self.close()
|
|
48 |
QDialog.reject(self)
|
|
95 | 49 |
|
96 | 50 |
def addProjectClick(self): |
97 | 51 |
print("Add project path") |
... | ... | |
113 | 67 |
# ui.setupUi(Dialog) |
114 | 68 |
# Dialog.show() |
115 | 69 |
|
116 |
if __name__ == "__main__": |
|
117 |
import sys |
|
118 |
app = QtWidgets.QApplication(sys.argv) |
|
119 |
Dialog = QtWidgets.QDialog() |
|
120 |
Dialog.show() |
|
121 |
sys.exit(app.exec_()) |
|
70 |
#if __name__ == "__main__":
|
|
71 |
# import sys
|
|
72 |
# app = QtWidgets.QApplication(sys.argv)
|
|
73 |
# Dialog = QtWidgets.QDialog()
|
|
74 |
# Dialog.show()
|
|
75 |
# sys.exit(app.exec_())
|
|
122 | 76 |
|
DTI_PID/DTI_PID/QDirTreeWidget.py | ||
---|---|---|
43 | 43 |
while index.parent().isValid(): |
44 | 44 |
index = index.parent() |
45 | 45 |
level += 1 |
46 |
if text.lower().endswith(".png"): |
|
47 |
menu = QMenu()
|
|
48 |
editSymbolAction = QAction(self.tr("Edit Symbol"))
|
|
49 |
editSymbolAction.triggered.connect(lambda: self.editSymbolActionClickEvent(item, 0))
|
|
50 |
menu.addAction(editSymbolAction)
|
|
51 |
displaySymbolAction = QAction(self.tr("Display Symbol"))
|
|
52 |
displaySymbolAction.triggered.connect(lambda: self.displaySymbolActionClickEvent(sym.getType(), text))
|
|
53 |
menu.addAction(displaySymbolAction)
|
|
54 |
deleteSymbolAction = QAction(self.tr("Delete Symbol"))
|
|
55 |
deleteSymbolAction.triggered.connect(lambda: self.deleteSymbolActionClickEvent(sym.getType(), text))
|
|
56 |
menu.addAction(deleteSymbolAction)
|
|
57 |
menu.exec_(self.viewport().mapToGlobal(position))
|
|
46 |
#if text.lower().endswith(".png"):
|
|
47 |
menu = QMenu() |
|
48 |
editSymbolAction = QAction(self.tr("Edit Symbol")) |
|
49 |
editSymbolAction.triggered.connect(lambda: self.editSymbolActionClickEvent(item, 0)) |
|
50 |
menu.addAction(editSymbolAction) |
|
51 |
displaySymbolAction = QAction(self.tr("Display Symbol")) |
|
52 |
displaySymbolAction.triggered.connect(lambda: self.displaySymbolActionClickEvent(sym.getType(), text)) |
|
53 |
menu.addAction(displaySymbolAction) |
|
54 |
deleteSymbolAction = QAction(self.tr("Delete Symbol")) |
|
55 |
deleteSymbolAction.triggered.connect(lambda: self.deleteSymbolActionClickEvent(sym.getType(), text)) |
|
56 |
menu.addAction(deleteSymbolAction) |
|
57 |
menu.exec_(self.viewport().mapToGlobal(position)) |
|
58 | 58 |
|
59 | 59 |
def editSymbolActionClickEvent(self, item, columNo): |
60 | 60 |
self.showSymbolEditorDialog(item, columNo) |
DTI_PID/DTI_PID/QSymbolDisplayDialog.py | ||
---|---|---|
17 | 17 |
@brief Set up QtImageViewer and QImage |
18 | 18 |
''' |
19 | 19 |
def setupImageViewer(self): |
20 |
width = self.ui.verticalLayoutWidget.frameGeometry().width()
|
|
21 |
height = self.ui.verticalLayoutWidget.frameGeometry().height()
|
|
20 |
width = self.frameGeometry().width() |
|
21 |
height = self.frameGeometry().height() |
|
22 | 22 |
self.ui.imageView = QtImageViewer() |
23 | 23 |
self.ui.imageView.setGeometry(QtCore.QRect(0, 0, height, height)) |
24 | 24 |
self.ui.imageView.aspectRatioMode = QtCore.Qt.KeepAspectRatio |
... | ... | |
31 | 31 |
self.imgH = image.height() |
32 | 32 |
image = image.scaled(self.imgW, self.imgH) |
33 | 33 |
self.ui.imageView.setImage(image) |
34 |
self.ui.verticalLayout.addWidget(self.ui.imageView) |
|
34 |
self.ui.verticalLayout_2.addWidget(self.ui.imageView)
|
|
35 | 35 |
|
36 | 36 |
''' |
37 | 37 |
@brief Display this QDialog |
DTI_PID/DTI_PID/UI/ProjectDialog.ui | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<ui version="4.0"> |
|
3 |
<class>Dialog</class> |
|
4 |
<widget class="QDialog" name="Dialog"> |
|
5 |
<property name="geometry"> |
|
6 |
<rect> |
|
7 |
<x>0</x> |
|
8 |
<y>0</y> |
|
9 |
<width>650</width> |
|
10 |
<height>75</height> |
|
11 |
</rect> |
|
12 |
</property> |
|
13 |
<property name="minimumSize"> |
|
14 |
<size> |
|
15 |
<width>650</width> |
|
16 |
<height>75</height> |
|
17 |
</size> |
|
18 |
</property> |
|
19 |
<property name="maximumSize"> |
|
20 |
<size> |
|
21 |
<width>650</width> |
|
22 |
<height>75</height> |
|
23 |
</size> |
|
24 |
</property> |
|
25 |
<property name="windowTitle"> |
|
26 |
<string>Dialog</string> |
|
27 |
</property> |
|
28 |
<layout class="QVBoxLayout" name="verticalLayout"> |
|
29 |
<item> |
|
30 |
<layout class="QFormLayout" name="formLayout"> |
|
31 |
<item row="0" column="0"> |
|
32 |
<widget class="QLabel" name="label"> |
|
33 |
<property name="font"> |
|
34 |
<font> |
|
35 |
<family>Noto Sans CJK KR Regular</family> |
|
36 |
<pointsize>11</pointsize> |
|
37 |
<weight>75</weight> |
|
38 |
<bold>true</bold> |
|
39 |
</font> |
|
40 |
</property> |
|
41 |
<property name="text"> |
|
42 |
<string>프로젝트명</string> |
|
43 |
</property> |
|
44 |
</widget> |
|
45 |
</item> |
|
46 |
<item row="0" column="1"> |
|
47 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
|
48 |
<item> |
|
49 |
<widget class="QComboBox" name="comboBox"> |
|
50 |
<property name="font"> |
|
51 |
<font> |
|
52 |
<pointsize>11</pointsize> |
|
53 |
</font> |
|
54 |
</property> |
|
55 |
</widget> |
|
56 |
</item> |
|
57 |
<item> |
|
58 |
<widget class="QToolButton" name="toolButton"> |
|
59 |
<property name="font"> |
|
60 |
<font> |
|
61 |
<family>Noto Sans CJK KR Bold</family> |
|
62 |
<pointsize>11</pointsize> |
|
63 |
<weight>75</weight> |
|
64 |
<bold>true</bold> |
|
65 |
</font> |
|
66 |
</property> |
|
67 |
<property name="text"> |
|
68 |
<string>+</string> |
|
69 |
</property> |
|
70 |
<property name="icon"> |
|
71 |
<iconset theme="add"> |
|
72 |
<normaloff>../../../../../PyQt UI</normaloff>../../../../../PyQt UI</iconset> |
|
73 |
</property> |
|
74 |
</widget> |
|
75 |
</item> |
|
76 |
</layout> |
|
77 |
</item> |
|
78 |
</layout> |
|
79 |
</item> |
|
80 |
<item> |
|
81 |
<widget class="QDialogButtonBox" name="buttonBox"> |
|
82 |
<property name="standardButtons"> |
|
83 |
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|
84 |
</property> |
|
85 |
</widget> |
|
86 |
</item> |
|
87 |
</layout> |
|
88 |
</widget> |
|
89 |
<resources/> |
|
90 |
<connections> |
|
91 |
<connection> |
|
92 |
<sender>buttonBox</sender> |
|
93 |
<signal>rejected()</signal> |
|
94 |
<receiver>Dialog</receiver> |
|
95 |
<slot>reject()</slot> |
|
96 |
<hints> |
|
97 |
<hint type="sourcelabel"> |
|
98 |
<x>299</x> |
|
99 |
<y>79</y> |
|
100 |
</hint> |
|
101 |
<hint type="destinationlabel"> |
|
102 |
<x>299</x> |
|
103 |
<y>49</y> |
|
104 |
</hint> |
|
105 |
</hints> |
|
106 |
</connection> |
|
107 |
<connection> |
|
108 |
<sender>buttonBox</sender> |
|
109 |
<signal>accepted()</signal> |
|
110 |
<receiver>Dialog</receiver> |
|
111 |
<slot>accept()</slot> |
|
112 |
<hints> |
|
113 |
<hint type="sourcelabel"> |
|
114 |
<x>299</x> |
|
115 |
<y>79</y> |
|
116 |
</hint> |
|
117 |
<hint type="destinationlabel"> |
|
118 |
<x>299</x> |
|
119 |
<y>49</y> |
|
120 |
</hint> |
|
121 |
</hints> |
|
122 |
</connection> |
|
123 |
</connections> |
|
124 |
</ui> |
DTI_PID/DTI_PID/UI/SymbolDisplay.ui | ||
---|---|---|
10 | 10 |
<height>720</height> |
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 |
<property name="minimumSize"> |
|
14 |
<size> |
|
15 |
<width>720</width> |
|
16 |
<height>720</height> |
|
17 |
</size> |
|
18 |
</property> |
|
13 | 19 |
<property name="windowTitle"> |
14 | 20 |
<string>Dialog</string> |
15 | 21 |
</property> |
16 |
<widget class="QWidget" name="verticalLayoutWidget"> |
|
17 |
<property name="geometry"> |
|
18 |
<rect> |
|
19 |
<x>0</x> |
|
20 |
<y>0</y> |
|
21 |
<width>721</width> |
|
22 |
<height>721</height> |
|
23 |
</rect> |
|
24 |
</property> |
|
25 |
<layout class="QVBoxLayout" name="verticalLayout"/> |
|
26 |
</widget> |
|
22 |
<layout class="QVBoxLayout" name="verticalLayout_2"/> |
|
27 | 23 |
</widget> |
28 | 24 |
<resources/> |
29 | 25 |
<connections/> |
DTI_PID/DTI_PID/UI_ProjectDialog.py | ||
---|---|---|
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 |
|
|
11 |
class Ui_Dialog(object): |
|
12 |
def setupUi(self, Dialog): |
|
13 |
Dialog.setObjectName("Dialog") |
|
14 |
Dialog.resize(650, 75) |
|
15 |
Dialog.setMinimumSize(QtCore.QSize(650, 75)) |
|
16 |
Dialog.setMaximumSize(QtCore.QSize(650, 75)) |
|
17 |
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog) |
|
18 |
self.verticalLayout.setObjectName("verticalLayout") |
|
19 |
self.formLayout = QtWidgets.QFormLayout() |
|
20 |
self.formLayout.setObjectName("formLayout") |
|
21 |
self.label = QtWidgets.QLabel(Dialog) |
|
22 |
font = QtGui.QFont() |
|
23 |
font.setFamily("Noto Sans CJK KR Regular") |
|
24 |
font.setPointSize(11) |
|
25 |
font.setBold(True) |
|
26 |
font.setWeight(75) |
|
27 |
self.label.setFont(font) |
|
28 |
self.label.setObjectName("label") |
|
29 |
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label) |
|
30 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
31 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
32 |
self.comboBox = QtWidgets.QComboBox(Dialog) |
|
33 |
font = QtGui.QFont() |
|
34 |
font.setPointSize(11) |
|
35 |
self.comboBox.setFont(font) |
|
36 |
self.comboBox.setObjectName("comboBox") |
|
37 |
self.horizontalLayout.addWidget(self.comboBox) |
|
38 |
self.toolButton = QtWidgets.QToolButton(Dialog) |
|
39 |
font = QtGui.QFont() |
|
40 |
font.setFamily("Noto Sans CJK KR Bold") |
|
41 |
font.setPointSize(11) |
|
42 |
font.setBold(True) |
|
43 |
font.setWeight(75) |
|
44 |
self.toolButton.setFont(font) |
|
45 |
icon = QtGui.QIcon.fromTheme("add") |
|
46 |
self.toolButton.setIcon(icon) |
|
47 |
self.toolButton.setObjectName("toolButton") |
|
48 |
self.horizontalLayout.addWidget(self.toolButton) |
|
49 |
self.formLayout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout) |
|
50 |
self.verticalLayout.addLayout(self.formLayout) |
|
51 |
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) |
|
52 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
|
53 |
self.buttonBox.setObjectName("buttonBox") |
|
54 |
self.verticalLayout.addWidget(self.buttonBox) |
|
55 |
|
|
56 |
self.retranslateUi(Dialog) |
|
57 |
self.buttonBox.rejected.connect(Dialog.reject) |
|
58 |
self.buttonBox.accepted.connect(Dialog.accept) |
|
59 |
QtCore.QMetaObject.connectSlotsByName(Dialog) |
|
60 |
|
|
61 |
def retranslateUi(self, Dialog): |
|
62 |
_translate = QtCore.QCoreApplication.translate |
|
63 |
Dialog.setWindowTitle(_translate("Dialog", "Dialog")) |
|
64 |
self.label.setText(_translate("Dialog", "프로젝트명")) |
|
65 |
self.toolButton.setText(_translate("Dialog", "+")) |
|
66 |
|
|
67 |
|
|
68 |
if __name__ == "__main__": |
|
69 |
import sys |
|
70 |
app = QtWidgets.QApplication(sys.argv) |
|
71 |
Dialog = QtWidgets.QDialog() |
|
72 |
ui = Ui_Dialog() |
|
73 |
ui.setupUi(Dialog) |
|
74 |
Dialog.show() |
|
75 |
sys.exit(app.exec_()) |
|
76 |
|
DTI_PID/DTI_PID/UI_SymbolDisplay.py | ||
---|---|---|
12 | 12 |
def setupUi(self, Dialog): |
13 | 13 |
Dialog.setObjectName("Dialog") |
14 | 14 |
Dialog.resize(720, 720) |
15 |
self.verticalLayoutWidget = QtWidgets.QWidget(Dialog) |
|
16 |
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 721, 721)) |
|
17 |
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") |
|
18 |
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) |
|
19 |
self.verticalLayout.setContentsMargins(0, 0, 0, 0) |
|
20 |
self.verticalLayout.setObjectName("verticalLayout") |
|
21 |
|
|
15 |
Dialog.setMinimumSize(QtCore.QSize(720, 720)) |
|
16 |
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog) |
|
17 |
self.verticalLayout_2.setObjectName("verticalLayout_2") |
|
18 |
|
|
22 | 19 |
self.retranslateUi(Dialog) |
23 | 20 |
QtCore.QMetaObject.connectSlotsByName(Dialog) |
24 | 21 |
|
내보내기 Unified diff