프로젝트

일반

사용자정보

개정판 acf92f86

IDacf92f86d51c3e4ab2d5e055c47c674a5788eb3f
상위 f488d56f
하위 413e693e

humkyung 이(가) 6년 이상 전에 추가함

issue #581: modified isLimitWord method for checking Line No

차이점 보기:

DTI_PID/DTI_PID/ConfigurationDialog.py
487 487
            selectedIndex =  self.ui.comboBoxColorOption.currentIndex()
488 488
            uid = self.tempLineColorUID[selectedIndex]
489 489

  
490
            docData = AppDocData.instance()
491
            lineProp = docData.getLinePropertiesByUID(uid)
492

  
493
            configs.append(Config('Line Color', 'Visible Option', 'Random' if rbRandomValue else 'Property'))
494
            configs.append(Config('Color Property', 'State', lineProp[0].UID))
495

  
496 490
            for row in range(self.ui.tableWidgetLineTypes.rowCount()):
497 491
                lineType = self.ui.tableWidgetLineTypes.item(row, 0).text()
498 492
                width = self.ui.tableWidgetLineTypes.cellWidget(row, 1).text()
499 493
                style = self.ui.tableWidgetLineTypes.cellWidget(row, 2).currentText()
500 494
                configs.append(Config('LineTypes', lineType, '{},{}'.format(width, style)))
501 495

  
502
            if not rbRandomValue:
503
                table = self.ui.tableWidgetColorProperty
504
                rowCount = self.ui.tableWidgetColorProperty.rowCount()
505
                for i in range(rowCount):
506
                    refStr = table.item(i, 2).text()
507
                    colorStr = table.item(i, 3).text()
508
                    if colorStr:
509
                        configs.append(Config(lineProp[0].UID, refStr, colorStr))
496
            docData = AppDocData.instance()
497
            lineProp = docData.getLinePropertiesByUID(uid)
498

  
499
            configs.append(Config('Line Color', 'Visible Option', 'Random' if rbRandomValue else 'Property'))
500
            if lineProp:
501
                configs.append(Config('Color Property', 'State', lineProp[0].UID))
502

  
503
                if not rbRandomValue:
504
                    table = self.ui.tableWidgetColorProperty
505
                    rowCount = self.ui.tableWidgetColorProperty.rowCount()
506
                    for i in range(rowCount):
507
                        refStr = table.item(i, 2).text()
508
                        colorStr = table.item(i, 3).text()
509
                        if colorStr:
510
                            configs.append(Config(lineProp[0].UID, refStr, colorStr))
510 511

  
511 512
            #Configuration
512 513
            configuration = None
......
522 523
            configs.append(Config('Text Style', 'Font Name', font.family()))
523 524
            configs.append(Config('Text Style', 'Font Size', str(self.ui.spinBoxFontSize.value()) if self.ui.radioButtonFixedSize.isChecked() else '-1'))
524 525
            
525
            
526 526
            docData.saveConfigs(configs)
527 527
            docData.lineTypeConfigs = None  # clear line type configurations
528 528
        except Exception as ex:
529
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
529
            from App import App
530
            from AppDocData import MessageType
531

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

  
531 535
        QDialog.accept(self)
532 536

  
DTI_PID/DTI_PID/Shapes/EngineeringTextItem.py
4 4
import sys
5 5
try:
6 6
    from PyQt5.QtCore import Qt, QPointF, QRectF, pyqtSignal, QObject, QT_VERSION_STR, QRect
7
    from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen, QTransform, QFont, QColor
7
    from PyQt5.QtGui import QImage, QPixmap, QPainterPath, QBrush, QPen, QTransform, QFont, QColor, QFontMetrics
8 8
    from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QFileDialog, QGraphicsItem, QAbstractGraphicsShapeItem, QGraphicsTextItem
9 9
except ImportError:
10 10
    try:
11 11
        from PyQt4.QtCore import Qt, QRectF, pyqtSignal, QRect, QObject, QT_VERSION_STR
12
        from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QFont, QColor
12
        from PyQt4.QtGui import QGraphicsView, QGraphicsScene, QImage, QPixmap, QPainterPath, QFileDialog, QFont, QColor, QFontMetrics
13 13
    except ImportError:
14 14
        raise ImportError("ImageViewerQt: Requires PyQt5 or PyQt4.")
15 15

  
......
285 285
            transform = QTransform()
286 286
            if (1.57 == self.angle) or (4.71 == self.angle):
287 287
                font = QFont(fontName, width*1.2 if fontSize == -1 else fontSize)
288
                
289
                x_factor = width / QFontMetrics(font).height()
290
                y_factor = height / QFontMetrics(font).width(self.text())
291
                factor = min(x_factor, y_factor)
292
                font.setPointSizeF(font.pointSizeF()*factor)
293

  
288 294
                self.setFont(font)
289 295
                rect = self.boundingRect()
290 296
                sx = width/rect.height()
......
297 303
                transform.translate(-rect.width()*0.5, -rect.height()*0.5)
298 304
            elif 3.14 == self.angle:
299 305
                font = QFont(fontName, height*1.2 if fontSize == -1 else fontSize)
306

  
307
                x_factor = width / QFontMetrics(font).width(self.text())
308
                y_factor = height / QFontMetrics(font).height()
309
                factor = min(x_factor, y_factor)
310
                font.setPointSizeF(font.pointSizeF()*factor)
311

  
300 312
                self.setFont(font)
301 313
                rect = self.boundingRect()
302 314
                sx = width/rect.width()
......
308 320
                transform.translate(-width*0.5, -height*0.5)
309 321
            else:
310 322
                font = QFont(fontName, height*1.2 if fontSize == -1 else fontSize)
323

  
324
                x_factor = width / QFontMetrics(font).width(self.text())
325
                y_factor = height / QFontMetrics(font).height()
326
                factor = min(x_factor, y_factor)
327
                font.setPointSizeF(font.pointSizeF()*factor)
328

  
311 329
                self.setFont(font)
312 330
                rect = self.boundingRect()
313 331
                sx = width/rect.width()
DTI_PID/DTI_PID/TextItemFactory.py
278 278
                attr = text
279 279
                length = pattern[0]
280 280
                isNumber = pattern[1]
281
                result = eval('attr[:' + str(length) + ']')
282 281

  
283
                if int(length) != len(result):
284
                    return(False,)
282
                if length:  # Length가 있으면 Length만큼 문자열을 가져와 길이를 검사한다.
283
                    result = eval('attr[:' + str(length) + ']')
284
                    if int(length) != len(result):
285
                        return(False,)
286
                elif isNumber:
287
                    match = re.search(re.compile('^[0-9]+'), attr)
288
                    if match:
289
                        result = match.group(match.start()) 
290
                    else:
291
                        return (False,)
292
                else:
293
                    result = attr
285 294

  
286 295
                if isNumber:
287 296
                    if self.isNumber(result):

내보내기 Unified diff

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