프로젝트

일반

사용자정보

개정판 01fc42a0

ID01fc42a0387b8ac477a8fafaa2ea38a1ca95be10
상위 69c455b7
하위 6a9e5ae7

함의성이(가) 5년 이상 전에 추가함

issue #000: add symbol thickness change

Change-Id: I1258a490598d601de4e4b736affd7661d4488498

차이점 보기:

DTI_PID/DTI_PID/ConfigurationLineNoDialog.py
61 61
    def accept(self):
62 62
        text = self.ui.lineEdit.text()
63 63
        if text == self.delimiter and text == '':
64
            QMessageBox.warning(self, self.tr('INFO'), self.tr('Please check delimiter'))
64
            QMessageBox.warning(self, self.tr('Information'), self.tr('Please check delimiter'))
65 65
            return
66 66
        if self.ui.listWidget.count() is 0:
67
            QMessageBox.warning(self, self.tr('INFO'), self.tr('Please check line number'))
67
            QMessageBox.warning(self, self.tr('Information'), self.tr('Please check line number'))
68 68
            return
69 69

  
70 70
        configuration = None
DTI_PID/DTI_PID/ImportTextFromCADDialog.py
111 111
                    message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
112 112
                    App.mainWnd().addMessage.emit(MessageType.Error, message)
113 113

  
114
        QMessageBox.information(self, self.tr('INFO'), self.tr('Importing Success!'), QMessageBox.Close)
114
        QMessageBox.information(self, self.tr('Information'), self.tr('Importing Success!'), QMessageBox.Close)
115 115
    
116 116
    def toXml(self, textNode):
117 117
        import uuid
DTI_PID/DTI_PID/MainWindow.py
59 59
from TrainingImageListDialog import QTrainingImageListDialog
60 60
from TextDataListDialog import QTextDataListDialog
61 61
from ImportTextFromCADDialog import QImportTextFromCADDialog
62
from SymbolThicknessDialog import QSymbolThicknessDialog
62 63
from DisplayColors import DisplayColors
63 64
from DisplayColors import DisplayOptions
64 65
import uuid
......
226 227
        self.actionFitWindow.triggered.connect(self.fitWindow)
227 228
        self.actionpdf_to_image.triggered.connect(self.onConvertPDFToImage)
228 229
        self.actionImport_Text_From_CAD.triggered.connect(self.onImportTextFromCAD)
230
        self.actionSymbol_Thickness_Reinforcement.triggered.connect(self.onSymbolThickness)
229 231
        self.actionHelp.triggered.connect(self.on_help)
230 232
        self.graphicsView.scene.contents_changed.connect(self.onSceneChanged)
231 233
        self.graphicsView.scene.selectionChanged.connect(self.onSelectionChanged)
......
778 780
            self.addMessage.emit(MessageType.Error, message)
779 781

  
780 782
    def onImportTextFromCAD(self):
781
        ''' import text from cad '''
783
        """ import text from cad """
782 784
        try:
783 785
            self.onCommandRejected()
784 786
            dialog = QImportTextFromCADDialog(self)
......
787 789
        except Exception as ex:
788 790
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
789 791
            self.addMessage.emit(MessageType.Error, message)
792

  
793
    def onSymbolThickness(self):
794
        """ symbol thickness reinforcement by using configuration filter drawing dilate size """
795
        try:
796
            self.onCommandRejected()
797
            dialog = QSymbolThicknessDialog(self)
798
            dialog.exec_()
799
        except Exception as ex:
800
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
801
            self.addMessage.emit(MessageType.Error, message)
790 802
        
791 803
    def on_help(self):
792 804
        """ open help file """
DTI_PID/DTI_PID/MainWindow_UI.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
# Form implementation generated from reading ui file '.\UI\MainWindow.ui'
3
# Form implementation generated from reading ui file './UI/MainWindow.ui'
4 4
#
5
# Created by: PyQt5 UI code generator 5.13.0
5
# Created by: PyQt5 UI code generator 5.11.3
6 6
#
7 7
# WARNING! All changes made in this file will be lost!
8 8

  
9

  
10 9
from PyQt5 import QtCore, QtGui, QtWidgets
11 10

  
12

  
13 11
class Ui_MainWindow(object):
14 12
    def setupUi(self, MainWindow):
15 13
        MainWindow.setObjectName("MainWindow")
......
493 491
        self.actionHelp.setObjectName("actionHelp")
494 492
        self.actionDataExport = QtWidgets.QAction(MainWindow)
495 493
        self.actionDataExport.setObjectName("actionDataExport")
494
        self.actionSymbol_Thickness_Reinforcement = QtWidgets.QAction(MainWindow)
495
        self.actionSymbol_Thickness_Reinforcement.setObjectName("actionSymbol_Thickness_Reinforcement")
496 496
        self.menu.addAction(self.actionOpen)
497 497
        self.menu.addAction(self.actionArea)
498 498
        self.menu.addAction(self.actionConfiguration)
......
521 521
        self.menu_3.addAction(self.actionDrawing_Only)
522 522
        self.menu_4.addAction(self.actionpdf_to_image)
523 523
        self.menu_4.addAction(self.actionImport_Text_From_CAD)
524
        self.menu_4.addAction(self.actionSymbol_Thickness_Reinforcement)
524 525
        self.menu_4.addSeparator()
525 526
        self.menu_4.addAction(self.actionDataTransfer)
526 527
        self.menu_4.addAction(self.actionDataExport)
......
654 655
        self.actionDataExport.setText(_translate("MainWindow", "DataExport"))
655 656
        self.actionDataExport.setToolTip(_translate("MainWindow", "Data Export"))
656 657
        self.actionDataExport.setShortcut(_translate("MainWindow", "Ctrl+T, Ctrl+E"))
658
        self.actionSymbol_Thickness_Reinforcement.setText(_translate("MainWindow", "Symbol Thickness Reinforcement"))
659

  
657 660
import MainWindow_rc
661

  
662
if __name__ == "__main__":
663
    import sys
664
    app = QtWidgets.QApplication(sys.argv)
665
    MainWindow = QtWidgets.QMainWindow()
666
    ui = Ui_MainWindow()
667
    ui.setupUi(MainWindow)
668
    MainWindow.show()
669
    sys.exit(app.exec_())
670

  
DTI_PID/DTI_PID/SymbolThicknessDialog.py
1
# -*- coding: utf-8 -*-
2

  
3
from PyQt5 import QtCore, QtGui, QtWidgets
4
from PyQt5.QtWidgets import *
5
import os, sys
6
from AppDocData import AppDocData
7
import SymbolThickness_UI
8
import cv2
9
import numpy as np
10

  
11
class QSymbolThicknessDialog(QDialog):
12
    def __init__(self, parent):
13
        QDialog.__init__(self, parent)
14

  
15
        self.ui = SymbolThickness_UI.Ui_SymbolThicknessDialog()
16
        self.ui.setupUi(self)
17
        self.isAccepted = False
18
        
19
        configs = AppDocData.instance().getConfigs('Filter', 'DilateSize')
20
        self.ui.spinBox.setValue(int(configs[0].value)) if 1 == len(configs) else self.ui.spinBoxDilateSize.setValue(0)
21

  
22
    def showDialog(self):
23
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
24
        self.exec_()
25
        return self.isAccepted, self.angle, self.sx, self.sy, self.sz
26

  
27
    def accept(self):
28
        size = self.ui.spinBox.value()
29
        if size:
30
            try:
31
                project = AppDocData.instance().getCurrentProject()
32
                rootPath = project.getImageFilePath()
33
                rootList = os.listdir(rootPath)
34

  
35
                for folder in rootList:
36
                    path = os.path.join(rootPath, folder)
37
                    imgList = os.listdir(path)
38

  
39
                    for imgPath in imgList:
40
                        fullPath = os.path.join(path, imgPath)
41
                        img = cv2.imread(fullPath, cv2.IMREAD_GRAYSCALE)
42
                        kernel = np.ones((size, size), np.uint8)
43

  
44
                        height, width = img.shape[0], img.shape[1]
45
                        new = np.ones((height + 2 * size, width + 2 * size), np.uint8) * 255
46
                        new[size:size+height, size:size+width] = img
47

  
48
                        e = cv2.erode(new, kernel, iterations=1)
49
                        cv2.imwrite(fullPath, e)
50

  
51
                QMessageBox.information(self, self.tr('Information'), self.tr('Success'))
52
            except Exception as ex:
53
                from App import App
54
                from AppDocData import MessageType
55

  
56
                message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
57
                App.mainWnd().addMessage.emit(MessageType.Error, message)
58

  
59
        QDialog.accept(self)
60

  
61
    def reject(self):
62
        QDialog.reject(self)
DTI_PID/DTI_PID/SymbolThickness_UI.py
1
# -*- coding: utf-8 -*-
2

  
3
# Form implementation generated from reading ui file './UI/SymbolThickness.ui'
4
#
5
# Created by: PyQt5 UI code generator 5.11.3
6
#
7
# WARNING! All changes made in this file will be lost!
8

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10

  
11
class Ui_SymbolThicknessDialog(object):
12
    def setupUi(self, SymbolThicknessDialog):
13
        SymbolThicknessDialog.setObjectName("SymbolThicknessDialog")
14
        SymbolThicknessDialog.resize(500, 186)
15
        SymbolThicknessDialog.setMinimumSize(QtCore.QSize(500, 0))
16
        SymbolThicknessDialog.setMaximumSize(QtCore.QSize(500, 350))
17
        font = QtGui.QFont()
18
        font.setFamily("맑은 고딕")
19
        font.setBold(True)
20
        font.setWeight(75)
21
        SymbolThicknessDialog.setFont(font)
22
        self.verticalLayout = QtWidgets.QVBoxLayout(SymbolThicknessDialog)
23
        self.verticalLayout.setObjectName("verticalLayout")
24
        self.formLayout = QtWidgets.QFormLayout()
25
        self.formLayout.setObjectName("formLayout")
26
        self.label = QtWidgets.QLabel(SymbolThicknessDialog)
27
        font = QtGui.QFont()
28
        font.setFamily("맑은 고딕")
29
        font.setPointSize(10)
30
        font.setBold(True)
31
        font.setWeight(75)
32
        self.label.setFont(font)
33
        self.label.setObjectName("label")
34
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label)
35
        self.horizontalLayout = QtWidgets.QHBoxLayout()
36
        self.horizontalLayout.setObjectName("horizontalLayout")
37
        self.spinBox = QtWidgets.QSpinBox(SymbolThicknessDialog)
38
        self.spinBox.setEnabled(False)
39
        self.spinBox.setObjectName("spinBox")
40
        self.horizontalLayout.addWidget(self.spinBox)
41
        self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout)
42
        self.textEdit = QtWidgets.QTextEdit(SymbolThicknessDialog)
43
        self.textEdit.setEnabled(False)
44
        self.textEdit.setObjectName("textEdit")
45
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.textEdit)
46
        self.verticalLayout.addLayout(self.formLayout)
47
        self.errorLabel = QtWidgets.QLabel(SymbolThicknessDialog)
48
        self.errorLabel.setMaximumSize(QtCore.QSize(16777215, 0))
49
        self.errorLabel.setStyleSheet("")
50
        self.errorLabel.setText("")
51
        self.errorLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
52
        self.errorLabel.setObjectName("errorLabel")
53
        self.verticalLayout.addWidget(self.errorLabel)
54
        self.buttonBox = QtWidgets.QDialogButtonBox(SymbolThicknessDialog)
55
        font = QtGui.QFont()
56
        font.setFamily("맑은 고딕")
57
        font.setBold(True)
58
        font.setWeight(75)
59
        self.buttonBox.setFont(font)
60
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
61
        self.buttonBox.setObjectName("buttonBox")
62
        self.verticalLayout.addWidget(self.buttonBox)
63

  
64
        self.retranslateUi(SymbolThicknessDialog)
65
        self.buttonBox.rejected.connect(SymbolThicknessDialog.reject)
66
        self.buttonBox.accepted.connect(SymbolThicknessDialog.accept)
67
        QtCore.QMetaObject.connectSlotsByName(SymbolThicknessDialog)
68

  
69
    def retranslateUi(self, SymbolThicknessDialog):
70
        _translate = QtCore.QCoreApplication.translate
71
        SymbolThicknessDialog.setWindowTitle(_translate("SymbolThicknessDialog", "Symbol Thickness Reinforcement"))
72
        self.label.setText(_translate("SymbolThicknessDialog", "Dilate Size"))
73
        self.textEdit.setHtml(_translate("SymbolThicknessDialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
74
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
75
"p, li { white-space: pre-wrap; }\n"
76
"</style></head><body style=\" font-family:\'맑은 고딕\'; font-size:9pt; font-weight:600; font-style:normal;\">\n"
77
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">This work cannot be undo.</p>\n"
78
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">All symbols are affected.</p>\n"
79
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Please make sure Dilate Size in Configuration - Filter.</p>\n"
80
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">It is highly recommended to make backup file for [Project Folder] - [image].</p>\n"
81
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
82
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Modify all symbols manually after the processing.</p></body></html>"))
83

  
84

  
85
if __name__ == "__main__":
86
    import sys
87
    app = QtWidgets.QApplication(sys.argv)
88
    SymbolThicknessDialog = QtWidgets.QDialog()
89
    ui = Ui_SymbolThicknessDialog()
90
    ui.setupUi(SymbolThicknessDialog)
91
    SymbolThicknessDialog.show()
92
    sys.exit(app.exec_())
93

  
DTI_PID/DTI_PID/TrainingEditorDialog.py
242 242
        self.boxItem.setText(boxchars)
243 243

  
244 244
        self.isChanged = False
245
        reply = QMessageBox.information(self, self.tr('INFO'), self.tr('Save Success!'), QMessageBox.Ok, QMessageBox.Cancel)
245
        reply = QMessageBox.information(self, self.tr('Information'), self.tr('Save Success!'), QMessageBox.Ok, QMessageBox.Cancel)
246 246
        if reply == QMessageBox.Ok:
247 247
            QDialog.reject(self)
248 248

  
DTI_PID/DTI_PID/UI/MainWindow.ui
117 117
    </property>
118 118
    <addaction name="actionpdf_to_image"/>
119 119
    <addaction name="actionImport_Text_From_CAD"/>
120
    <addaction name="actionSymbol_Thickness_Reinforcement"/>
120 121
    <addaction name="separator"/>
121 122
    <addaction name="actionDataTransfer"/>
122 123
    <addaction name="actionDataExport"/>
......
1113 1114
    <string>Ctrl+T, Ctrl+E</string>
1114 1115
   </property>
1115 1116
  </action>
1117
  <action name="actionSymbol_Thickness_Reinforcement">
1118
   <property name="text">
1119
    <string>Symbol Thickness Reinforcement</string>
1120
   </property>
1121
  </action>
1116 1122
 </widget>
1117 1123
 <resources>
1118 1124
  <include location="../res/MainWindow.qrc"/>
DTI_PID/DTI_PID/UI/SymbolThickness.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>SymbolThicknessDialog</class>
4
 <widget class="QDialog" name="SymbolThicknessDialog">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>500</width>
10
    <height>186</height>
11
   </rect>
12
  </property>
13
  <property name="minimumSize">
14
   <size>
15
    <width>500</width>
16
    <height>0</height>
17
   </size>
18
  </property>
19
  <property name="maximumSize">
20
   <size>
21
    <width>500</width>
22
    <height>350</height>
23
   </size>
24
  </property>
25
  <property name="font">
26
   <font>
27
    <family>맑은 고딕</family>
28
    <weight>75</weight>
29
    <bold>true</bold>
30
   </font>
31
  </property>
32
  <property name="windowTitle">
33
   <string>Symbol Thickness Reinforcement</string>
34
  </property>
35
  <layout class="QVBoxLayout" name="verticalLayout">
36
   <item>
37
    <layout class="QFormLayout" name="formLayout">
38
     <item row="1" column="0">
39
      <widget class="QLabel" name="label">
40
       <property name="font">
41
        <font>
42
         <family>맑은 고딕</family>
43
         <pointsize>10</pointsize>
44
         <weight>75</weight>
45
         <bold>true</bold>
46
        </font>
47
       </property>
48
       <property name="text">
49
        <string>Dilate Size</string>
50
       </property>
51
      </widget>
52
     </item>
53
     <item row="1" column="1">
54
      <layout class="QHBoxLayout" name="horizontalLayout">
55
       <item>
56
        <widget class="QSpinBox" name="spinBox">
57
         <property name="enabled">
58
          <bool>false</bool>
59
         </property>
60
        </widget>
61
       </item>
62
      </layout>
63
     </item>
64
     <item row="0" column="0" colspan="2">
65
      <widget class="QTextEdit" name="textEdit">
66
       <property name="enabled">
67
        <bool>false</bool>
68
       </property>
69
       <property name="html">
70
        <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
71
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
72
p, li { white-space: pre-wrap; }
73
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'맑은 고딕'; font-size:9pt; font-weight:600; font-style:normal;&quot;&gt;
74
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This work cannot be undo.&lt;/p&gt;
75
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;All symbols are affected.&lt;/p&gt;
76
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Please make sure Dilate Size in Configuration - Filter.&lt;/p&gt;
77
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;It is highly recommended to make backup file for [Project Folder] - [image].&lt;/p&gt;
78
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
79
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Modify all symbols manually after the processing.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
80
       </property>
81
      </widget>
82
     </item>
83
    </layout>
84
   </item>
85
   <item>
86
    <widget class="QLabel" name="errorLabel">
87
     <property name="maximumSize">
88
      <size>
89
       <width>16777215</width>
90
       <height>0</height>
91
      </size>
92
     </property>
93
     <property name="styleSheet">
94
      <string notr="true"/>
95
     </property>
96
     <property name="text">
97
      <string/>
98
     </property>
99
     <property name="alignment">
100
      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
101
     </property>
102
    </widget>
103
   </item>
104
   <item>
105
    <widget class="QDialogButtonBox" name="buttonBox">
106
     <property name="font">
107
      <font>
108
       <family>맑은 고딕</family>
109
       <weight>75</weight>
110
       <bold>true</bold>
111
      </font>
112
     </property>
113
     <property name="standardButtons">
114
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
115
     </property>
116
    </widget>
117
   </item>
118
  </layout>
119
 </widget>
120
 <resources/>
121
 <connections>
122
  <connection>
123
   <sender>buttonBox</sender>
124
   <signal>rejected()</signal>
125
   <receiver>SymbolThicknessDialog</receiver>
126
   <slot>reject()</slot>
127
   <hints>
128
    <hint type="sourcelabel">
129
     <x>299</x>
130
     <y>79</y>
131
    </hint>
132
    <hint type="destinationlabel">
133
     <x>299</x>
134
     <y>49</y>
135
    </hint>
136
   </hints>
137
  </connection>
138
  <connection>
139
   <sender>buttonBox</sender>
140
   <signal>accepted()</signal>
141
   <receiver>SymbolThicknessDialog</receiver>
142
   <slot>accept()</slot>
143
   <hints>
144
    <hint type="sourcelabel">
145
     <x>299</x>
146
     <y>79</y>
147
    </hint>
148
    <hint type="destinationlabel">
149
     <x>299</x>
150
     <y>49</y>
151
    </hint>
152
   </hints>
153
  </connection>
154
 </connections>
155
</ui>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)