프로젝트

일반

사용자정보

개정판 35d6d96c

ID35d6d96cb41a59dd5f48d4aeba14d44a5b3cb969
상위 dc620556
하위 d076a78e

김정우 이(가) 약 7년 전에 추가함

작업 중

차이점 보기:

DTI_PID/DTI_PID/QSymbolEditorDialog.py
11 11
import potrace
12 12

  
13 13
import UI_SymbolEditor
14
from AppDocData import AppDocData
15

  
14 16

  
15 17
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '\\Commands')
16 18
import CropCommand, HandCommand, ZoomCommand, PenCommand, EraserCommand, AreaEraserCommand, OriginalPointCommand, ConnectionPointCommand
......
73 75
        self.ui.addAdditionalSymbolButton.clicked.connect(self.addAdditionalSymbol)
74 76
        self.ui.addOriginalPointButton.clicked.connect(self.addOriginalPoint)
75 77
        self.ui.addConnectionPointButton.clicked.connect(self.addConnectionPoint)
78
        self.initBaseSymbolComboBoxItems()
79
        self.initAdditionalSymbolComboBoxItems()
76 80
        
77 81
    def initContents(self):
78 82
        self.ui.targetDBLineEdit.setText(self.project.getPath()+'/db/ITI_PID.db')
......
81 85
        #self.ui.baseSymbolComboBox
82 86
        #self.initBaseSymbolComboBoxItems()
83 87
        #self.ui.defaultSymbolDirectionComboBox
84
        #self.ui.addtionalSymbolComboBox
88
        #self.ui.additionalSymbolComboBox
85 89

  
86 90
    def initIsOriginDetectComboBoxItems(self):
87 91
        self.ui.isOriginDetectComboBox.addItem("원본 도면", 0)
......
98 102
        self.ui.defaultSymbolDirectionComboBox.addItem("좌", 3)
99 103
        self.ui.defaultSymbolDirectionComboBox.addItem("우", 1)
100 104

  
105
    def initBaseSymbolComboBoxItems(self):
106
        symbolNameList = AppDocData.instance().getSymbolNameList()
107
        symbolNameList.insert(0, "None")
108
        for name in symbolNameList:
109
            self.ui.baseSymbolComboBox.addItem(name)
110

  
111
    def initAdditionalSymbolComboBoxItems(self):
112
        symbolNameList = AppDocData.instance().getSymbolNameList()
113
        symbolNameList.insert(0, "None")
114
        for name in symbolNameList:
115
            self.ui.additionalSymbolComboBox.addItem(name)
116

  
101 117
    def removeConnectionPointCircles(self, circlePointList):
102 118
        for circlePoint in circlePointList:
103 119
            self.removeConnectionPointCircle(circlePoint)
......
139 155
        originalPoint = self.ui.originalPointLineEdit.text()
140 156
        connectionPoint = self.makeConnectionPointListString()
141 157
        ### 기초심볼추가
142
        baseSymbol = None
158
        baseSymbol = self.ui.baseSymbolComboBox.currentText()
143 159
        ### 부가심볼추가
144
        additionalSymbol = None
160
        additionalSymbol = self.makeAdditionalSymbolListString()
145 161

  
146 162
        convertedThreshold = int(threshold) / 100.0
147 163

  
......
150 166

  
151 167
        return newSym
152 168

  
169
    def makeAdditionalSymbolListString(self):
170
        ret = ""
171
        listItems = []
172
        for index in range(self.ui.additionalSymbolListWidget.count()):
173
            listItems.append(self.ui.additionalSymbolListWidget.item(index))
174
        if listItems is not None:
175
            for index in range(len(listItems)):
176
                item = listItems[index]
177
                text = item.text()
178
                if index != 0:
179
                    ret = ret + "/"
180
                ret = ret + text
181
        return ret
182

  
153 183
    def makeConnectionPointListString(self):
154 184
        ret = ""
155 185
        listItems = []
......
248 278

  
249 279
    def addAdditionalSymbol(self, event):
250 280
        print("addAdditionalSymbol")
251
        direction = self.ui.defaultSymbolDirectionComboBox.currentData()
252
        additionalSymbol = self.ui.addtionalSymbolComboBox.currentData()
281
        additionalSymbolIndex = self.ui.additionalSymbolComboBox.currentIndex()
282
        if additionalSymbolIndex != 0:
283
            print("Symbol Selected")
284
            direction = self.ui.defaultSymbolDirectionComboBox.currentText()
285
            symbolName = self.ui.additionalSymbolComboBox.currentText()
286
            text = "{},{}".format(direction, symbolName)
287

  
288
            if self.isAlreadyAdded(text):
289
                QMessageBox.about(self.ui.buttonBox, "알림", "이미 추가된 아이템입니다.")
290
            else:
291
                self.ui.additionalSymbolListWidget.addItem(text)
292

  
293
    def isAlreadyAdded(self, text):
294
        for index in range(self.ui.additionalSymbolListWidget.count()):
295
            item = self.ui.additionalSymbolListWidget.item(index)
296
            if item.text() == text:
297
                return True
298
        return False
253 299

  
254 300
    def addOriginalPoint(self, event):
255 301
        print("addOriginalPoint")
......
279 325
            infoTitle = self.ui.nameLabel.text()
280 326
            return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
281 327

  
282
        if not self.ui.typeLineEdit.text():
283
            infoTitle = self.ui.typeLabel.text()
284
            return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
328
        #if not self.ui.typeLineEdit.text():
329
        #    infoTitle = self.ui.typeLabel.text()
330
        #    return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
285 331

  
286 332
        thresholdText = self.ui.thresholdLineEdit.text()
287 333
        threshold = float(thresholdText) if thresholdText else -1
......
295 341
            infoTitle = self.ui.minMatchPointLabel.text()
296 342
            return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
297 343

  
344
        if self.ui.baseSymbolComboBox.currentIndex() == 0: #default value(None) index
345
            infoTitle = self.ui.baseSymbolLabel.text()
346
            return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))
347

  
348
        #Additional Symbol is Nullable
349

  
298 350
        if not self.ui.originalPointLineEdit.text() or self.ui.imageView.isOriginalPointSelected == False:
299 351
            infoTitle = self.ui.originalPointLabel.text()
300 352
            return (False, EXCEPTION_MSG_FORMAT.format(infoTitle))

내보내기 Unified diff

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