프로젝트

일반

사용자정보

개정판 4c3acf29

ID4c3acf29cc1a1b39f2a1668f9d54dcc3b043ec08
상위 03b91df8
하위 7c7a3d26

함의성이(가) 약 일년 전에 추가함

grid test

Change-Id: I3e4ef6ac4a540343f29162dd7a5ee0e7b8dcf6f8

차이점 보기:

DTI_PID/DTI_PID/Commands/PlaceLineCommand.py
73 73
                    [conn for conn in self.imageViewer.scene().items(param[2]) if type(conn) is not QGraphicsTextItem][0]
74 74
                    if selected is not None and type(selected) is QEngineeringConnectorItem:
75 75
                        self._polyline = QEngineeringPolylineItem()
76
                        self._polyline._vertices.append(selected.center())
76
                        self._polyline._vertices.append([selected.center()[0], selected.center()[1]])
77 77

  
78 78
                        # get line type
79 79
                        if type(selected.parentItem()) is QEngineeringLineItem:
......
119 119
                            [conn for conn in self.imageViewer.scene().items(param[2]) if
120 120
                             type(conn) is not QGraphicsTextItem][0]
121 121
                        if selected is not None and type(selected) is QEngineeringConnectorItem:
122
                            self._polyline._vertices.append(selected.center())
122
                            self._polyline._vertices.append([selected.center()[0], selected.center()[1]])
123 123
                        else:
124
                            self._polyline._vertices.append(self._polyline._pt)
124
                            self._polyline._vertices.append([self._polyline._pt[0], self._polyline._pt[1]])
125 125
                        self._polyline.update()
126 126
                    finally:
127 127
                        pass
DTI_PID/DTI_PID/MainWindow.py
3095 3095
            if configs:
3096 3096
                lineTypeMode = int(configs[0].value)
3097 3097

  
3098
            configs = AppDocData.instance().getConfigs('Data', 'Grid')
3099
            grid = int(configs[0].value) if 1 == len(configs) else -1
3100
            if grid == 1:
3101
                vts = []
3102
                for vt in home_pane.ui.toolButtonLine.tag._polyline._vertices:
3103
                    vt = vts.append([round(vt[0]), round(vt[1])])
3104
                home_pane.ui.toolButtonLine.tag._polyline._vertices = vts
3105

  
3098 3106
            count = len(home_pane.ui.toolButtonLine.tag._polyline._vertices)
3099 3107
            if count > 1:
3100 3108
                items = []
DTI_PID/DTI_PID/QtImageViewer.py
736 736
            elif not strict:
737 737
                svg.angle = angle if angle else 0.0
738 738
                svg.flip = flip if flip else 0
739
                svg.loc = [round(scenePos.x() - svg.symbolOrigin[0], 1), round(scenePos.y() - svg.symbolOrigin[1], 1)]
740 739
                configs = AppDocData.instance().getConfigs('Data', 'Grid')
741 740
                grid = int(configs[0].value) if 1 == len(configs) else -1
741
                svg.loc = [round(scenePos.x() - svg.symbolOrigin[0], 1), round(scenePos.y() - svg.symbolOrigin[1], 1)]
742 742
                if grid == 1:
743 743
                    svg.origin = [round(scenePos.x()), round(scenePos.y())]
744
                    svg.loc = [round(scenePos.x() - svg.symbolOrigin[0]), round(scenePos.y() - svg.symbolOrigin[1])]
744 745
                else:
745 746
                    svg.origin = [round(scenePos.x(), 1), round(scenePos.y(), 1)]
747
                    svg.loc = [round(scenePos.x() - svg.symbolOrigin[0], 1), round(scenePos.y() - svg.symbolOrigin[1], 1)]
746 748
                if len(svg.connectors) == 1:
747 749
                    # single connection item assistant
748 750
                    connectors = [connector for connector in connectors if connector.parentItem() is not svg and not connector.connectedItem]
DTI_PID/DTI_PID/QtImageViewerScene.py
182 182
                        origin = self.views()[0].mapFromGlobal(QCursor.pos())
183 183
                        origin = self.views()[0].mapToScene(origin)
184 184

  
185
                        configs = AppDocData.instance().getConfigs('Data', 'Grid')
186
                        grid = int(configs[0].value) if 1 == len(configs) else -1
187
                        if grid == 1:
188
                            origin = QPointF(round(origin.x()), round(origin.y()))
189

  
185 190
                        delta = QPointF(0, 0)
186 191
                        for symbol in root.find('SYMBOLS').iter('SYMBOL'):
187 192
                            item = SymbolSvgItem.fromXml(symbol)
DTI_PID/DTI_PID/Shapes/EngineeringConnectorItem.py
322 322
        from SymbolSvgItem import SymbolSvgItem
323 323
        from EngineeringPolylineItem import QEngineeringPolylineItem
324 324
        from EngineeringTextItem import QEngineeringTextItem
325
        from AppDocData import AppDocData
325 326

  
326 327
        try:
327 328
            drawing_mode = QEngineeringPolylineItem.DRAWING_MODE
328 329

  
330
            configs = AppDocData.instance().getConfigs('Data', 'Grid')
331
            grid = int(configs[0].value) if 1 == len(configs) else -1
332

  
329 333
            if not self.symbol:
330 334
                pass
331 335
            elif self.parentItem() is not None and hasattr(self, '_pressed_position') and self._pressed_position is not None:
......
369 373
                        self.connect(items[0].parent)
370 374
                        items[0].connect(self.parent)
371 375
                else:
372
                    pt = [event.scenePos().x(), event.scenePos().y()]
376
                    pt = [event.scenePos().x(), event.scenePos().y()] if grid != 1 else [round(event.scenePos().x()), round(event.scenePos().y())]
373 377
                    if drawing_mode == QEngineeringPolylineItem.AXIS_MODE:
374 378
                        if len(self.parentItem().connectors) == 2:
375 379
                            other = [connector for connector in self.parent.connectors if connector is not self]
376 380
                            if other:
377
                                pt = [event.scenePos().x(), event.scenePos().y()]
381
                                pt = [event.scenePos().x(), event.scenePos().y()] if grid != 1 else [round(event.scenePos().x()), round(event.scenePos().y())]
378 382
                                dx = abs(pt[0] - other[0].center()[0])
379 383
                                dy = abs(pt[1] - other[0].center()[1])
380 384
                                if dx < dy:
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
547 547
                                         round(self.sceneBoundingRect().height())
548 548

  
549 549
            scene_origin = self.mapToScene(self.transformOriginPoint())
550

  
551
            configs = AppDocData.instance().getConfigs('Data', 'Grid')
552
            grid = int(configs[0].value) if 1 == len(configs) else -1
553
            if grid == 1:
554
                dx = scene_origin.x() - round(scene_origin.x())
555
                dy = scene_origin.y() - round(scene_origin.y())
556
                if dx or dy:
557
                    self.moveBy(dx, dy)
558

  
550 559
            self.origin = [round(scene_origin.x(), 1), round(scene_origin.y(), 1)]
551 560

  
552 561
            if hasattr(self.scene(), 'contents_changed'):
......
1881 1890
        try:
1882 1891
            app_doc_data = AppDocData.instance()
1883 1892

  
1893
            configs = AppDocData.instance().getConfigs('Data', 'Grid')
1894
            grid = int(configs[0].value) if 1 == len(configs) else -1
1895

  
1884 1896
            uid = component['UID']
1897

  
1885 1898
            pt = [float(component['X']), float(component['Y'])]
1899
            if grid == 1:
1900
                pt = [round(pt[0]), round(pt[1])]
1901
                
1886 1902
            size = [float(component['Width']), float(component['Height'])]
1887 1903

  
1888 1904
            dbUid = int(component['Symbol_UID'])
......
1891 1907
            _type = dbData.sType
1892 1908
            angle = float(component['Rotation'])
1893 1909
            scale = float(component['Value']) if component['Value'] else 1.0
1910

  
1894 1911
            origin = [float(x) for x in component['SceneOriginPoint'].split(',')] if component['SceneOriginPoint'] is not None else pt
1912
            if grid == 1:
1913
                origin = [round(origin[0]), round(origin[1])]
1914

  
1895 1915
            connPts = []
1896 1916
            if component['ConnectionPoint']:
1897 1917
                if dbData:

내보내기 Unified diff

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