프로젝트

일반

사용자정보

개정판 619e4b8e

ID619e4b8ea925f41f863e2b634bb5c97079b66f68
상위 fceaf69c
하위 1a130d01

함의성이(가) 8달 전에 추가함

add tag split funct

Change-Id: I1623e4128fd584ad863c0ab09ce7c6d1ad871aa3

차이점 보기:

DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py
272 272
                menu.addAction(alignAction)
273 273

  
274 274
            if len(items) == 1:
275
                tagSplitAction = QAction('Split Suffix', None)
276
                tagSplitAction.triggered.connect(self.contextSplitSuffix)
277
                menu.addAction(tagSplitAction)
278

  
275 279
                allAction = QAction('Select All in View(A)', None)
276 280
                allAction.triggered.connect(self.contextSelectAll)
277 281
                menu.addAction(allAction)
......
295 299

  
296 300
            menu.exec_(event.screenPos())
297 301

  
302
    def contextSplitSuffix(self):
303
        text = self.text()
304

  
305
        if len(text) < 4:
306
            return
307
        
308
        delimiter = ''
309
        if '-' in text and text.rfind('-') == len(text) - 2:
310
            delimiter = '-'
311
        elif '~' in text and text.rfind('~') == len(text) - 2:
312
            delimiter = '~'
313
        elif '^' in text and text.rfind('^') == len(text) - 2:
314
            delimiter = '^'
315
        else:
316
            return
317
        
318
        commonText = text[:-3]
319
        suffix = text[-3:]
320
        startIndex = ord(suffix[0])
321
        endIndex = ord(suffix[2]) + 1
322

  
323
        newTexts = []
324
        for index in range(startIndex, endIndex):
325
            newTexts.append(commonText + chr(index))
326

  
327
        index = 0
328
        for _text in newTexts:
329
            textInfo = TextInfo(_text, self.loc[0] + self.size[0] * index, self.loc[1], self.size[0], self.size[1], self.angle)
330
            item = QEngineeringTextItem.create_text_with(self.scene(), textInfo)
331
            if item is not None:
332
                item.area = self.area
333
                item.transfer.onRemoved.connect(self.transfer.onRemoved)
334
                index = index + 1
335

  
336
        self.transfer.onRemoved.emit(self)
337

  
298 338
    def contextSelectAll(self):
299 339
        from QEngineeringSizeTextItem import QEngineeringSizeTextItem
300 340
        from App import App

내보내기 Unified diff

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