프로젝트

일반

사용자정보

개정판 db2dcb47

IDdb2dcb47fd595380340f00078f3da2484de877bf
상위 a1723c66
하위 846b3598, 85ba4667

백흠경이(가) 약 5년 전에 추가함

issue #628: 자주 사용하는 심볼을 즐겨 찾기에 추가하여 도면에 입력할 수 있다

Change-Id: I4d8067f1d6d7ea4b0615d32161b3b7210c641085

차이점 보기:

DTI_PID/DTI_PID/LibraryItem.py
71 71
        title.setFont(font)
72 72
        layout.addWidget(title, 1, 0, Qt.AlignTop | Qt.AlignHCenter)
73 73
        self.setLayout(layout)
74
        self.setMaximumSize(64, 64)
74
        self.setMaximumSize(96, 96)
75 75

  
76 76
    @property
77 77
    def symbol(self):
DTI_PID/DTI_PID/MainWindow.py
170 170
        # Add Custom TreeWidget
171 171
        self.symbolTreeWidget = SymbolTreeWidget.QSymbolTreeWidget()
172 172
        self.symbolTreeWidget.header().hide()
173
        self.symbolTabVerticalLayout.addWidget(self.symbolTreeWidget)
173
        self.verticalLayoutSymbolTree.addWidget(self.symbolTreeWidget)
174 174

  
175 175
        from LibraryItem import LibraryItemWidget
176
        self.propertyTableWidget = LibraryItemWidget()
177
        self.symbolTabVerticalLayout.addWidget(self.propertyTableWidget)
178
        """
176
        self.libraryWidget = LibraryItemWidget()
177
        self.verticalLayoutLibrary.addWidget(self.libraryWidget)
179 178
        # Add Custom Property TableWidget
180 179
        self.propertyTableWidget = SymbolPropertyTableWidget.QSymbolPropertyTableWidget()
181
        self.symbolTabVerticalLayout.addWidget(self.propertyTableWidget)
180
        self.verticalLayoutSymbolProperty.addWidget(self.propertyTableWidget)
182 181
        self.symbolTreeWidget.singleClicked.connect(self.propertyTableWidget.getClickedSymbol)
183
        """
184
        # add splitter widget
185
        splitter = QSplitter(Qt.Vertical)
186
        splitter.addWidget(self.symbolTreeWidget)
187
        splitter.addWidget(self.propertyTableWidget)
188
        self.symbolTabVerticalLayout.addWidget(splitter)
189
        # up to here
182

  
183
        self.splitterSymbol.setSizes([500, 300])
190 184

  
191 185
        # Add Custom Result Tree Widget (Symbol Explorer)
192 186
        self.itemTreeWidget = ItemTreeWidget.QItemTreeWidget(self.graphicsView)
DTI_PID/DTI_PID/MainWindow_UI.py
72 72
        self.toolBar.setObjectName("toolBar")
73 73
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
74 74
        self.dockWidget = QtWidgets.QDockWidget(MainWindow)
75
        self.dockWidget.setMinimumSize(QtCore.QSize(200, 115))
75
        self.dockWidget.setMinimumSize(QtCore.QSize(284, 309))
76 76
        self.dockWidget.setObjectName("dockWidget")
77 77
        self.dockWidgetContents = QtWidgets.QWidget()
78 78
        self.dockWidgetContents.setObjectName("dockWidgetContents")
79 79
        self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents)
80 80
        self.gridLayout_2.setObjectName("gridLayout_2")
81
        self.tabWidget = QtWidgets.QTabWidget(self.dockWidgetContents)
81
        self.splitterSymbol = QtWidgets.QSplitter(self.dockWidgetContents)
82
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
83
        sizePolicy.setHorizontalStretch(0)
84
        sizePolicy.setVerticalStretch(1)
85
        sizePolicy.setHeightForWidth(self.splitterSymbol.sizePolicy().hasHeightForWidth())
86
        self.splitterSymbol.setSizePolicy(sizePolicy)
87
        self.splitterSymbol.setBaseSize(QtCore.QSize(0, 1000))
88
        self.splitterSymbol.setOrientation(QtCore.Qt.Vertical)
89
        self.splitterSymbol.setObjectName("splitterSymbol")
90
        self.widget = QtWidgets.QWidget(self.splitterSymbol)
91
        self.widget.setObjectName("widget")
92
        self.gridLayout_3 = QtWidgets.QGridLayout(self.widget)
93
        self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
94
        self.gridLayout_3.setObjectName("gridLayout_3")
95
        self.tabWidget = QtWidgets.QTabWidget(self.widget)
82 96
        self.tabWidget.setObjectName("tabWidget")
83 97
        self.Symbol = QtWidgets.QWidget()
84 98
        self.Symbol.setObjectName("Symbol")
85
        self.gridLayout_3 = QtWidgets.QGridLayout(self.Symbol)
86
        self.gridLayout_3.setObjectName("gridLayout_3")
87
        self.symbolTabVerticalLayout = QtWidgets.QVBoxLayout()
88
        self.symbolTabVerticalLayout.setObjectName("symbolTabVerticalLayout")
89
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
90
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
99
        self.gridLayout_9 = QtWidgets.QGridLayout(self.Symbol)
100
        self.gridLayout_9.setObjectName("gridLayout_9")
101
        self.horizontalLayout = QtWidgets.QHBoxLayout()
102
        self.horizontalLayout.setObjectName("horizontalLayout")
91 103
        self.pushButtonCreateSymbol = QtWidgets.QPushButton(self.Symbol)
92 104
        self.pushButtonCreateSymbol.setMaximumSize(QtCore.QSize(32, 16777215))
93 105
        self.pushButtonCreateSymbol.setLayoutDirection(QtCore.Qt.LeftToRight)
94 106
        self.pushButtonCreateSymbol.setObjectName("pushButtonCreateSymbol")
95
        self.horizontalLayout_3.addWidget(self.pushButtonCreateSymbol)
107
        self.horizontalLayout.addWidget(self.pushButtonCreateSymbol)
96 108
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
97
        self.horizontalLayout_3.addItem(spacerItem)
109
        self.horizontalLayout.addItem(spacerItem)
98 110
        self.pushButtonDetectSymbol = QtWidgets.QPushButton(self.Symbol)
99 111
        self.pushButtonDetectSymbol.setMaximumSize(QtCore.QSize(130, 16777215))
100 112
        self.pushButtonDetectSymbol.setObjectName("pushButtonDetectSymbol")
101
        self.horizontalLayout_3.addWidget(self.pushButtonDetectSymbol)
102
        self.symbolTabVerticalLayout.addLayout(self.horizontalLayout_3)
103
        self.gridLayout_3.addLayout(self.symbolTabVerticalLayout, 0, 0, 1, 1)
113
        self.horizontalLayout.addWidget(self.pushButtonDetectSymbol)
114
        self.gridLayout_9.addLayout(self.horizontalLayout, 0, 0, 1, 1)
115
        self.verticalLayoutSymbolTree = QtWidgets.QVBoxLayout()
116
        self.verticalLayoutSymbolTree.setObjectName("verticalLayoutSymbolTree")
117
        self.gridLayout_9.addLayout(self.verticalLayoutSymbolTree, 1, 0, 1, 1)
104 118
        self.tabWidget.addTab(self.Symbol, "")
105
        self.gridLayout_2.addWidget(self.tabWidget, 0, 0, 1, 1)
119
        self.gridLayout_3.addWidget(self.tabWidget, 0, 0, 1, 1)
120
        self.widgetSymbolProperty = QtWidgets.QWidget(self.splitterSymbol)
121
        self.widgetSymbolProperty.setMaximumSize(QtCore.QSize(16777215, 500))
122
        self.widgetSymbolProperty.setObjectName("widgetSymbolProperty")
123
        self.gridLayout_10 = QtWidgets.QGridLayout(self.widgetSymbolProperty)
124
        self.gridLayout_10.setContentsMargins(0, 0, 0, 0)
125
        self.gridLayout_10.setObjectName("gridLayout_10")
126
        self.tabWidgetSymbolProperty = QtWidgets.QTabWidget(self.widgetSymbolProperty)
127
        self.tabWidgetSymbolProperty.setMaximumSize(QtCore.QSize(16777215, 500))
128
        self.tabWidgetSymbolProperty.setBaseSize(QtCore.QSize(0, 300))
129
        self.tabWidgetSymbolProperty.setObjectName("tabWidgetSymbolProperty")
130
        self.tabLibrary = QtWidgets.QWidget()
131
        self.tabLibrary.setObjectName("tabLibrary")
132
        self.gridLayout_13 = QtWidgets.QGridLayout(self.tabLibrary)
133
        self.gridLayout_13.setObjectName("gridLayout_13")
134
        self.scrollArea = QtWidgets.QScrollArea(self.tabLibrary)
135
        self.scrollArea.setMaximumSize(QtCore.QSize(16777215, 500))
136
        self.scrollArea.setWidgetResizable(True)
137
        self.scrollArea.setObjectName("scrollArea")
138
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
139
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 222, 106))
140
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
141
        self.gridLayout_14 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
142
        self.gridLayout_14.setObjectName("gridLayout_14")
143
        self.verticalLayoutLibrary = QtWidgets.QVBoxLayout()
144
        self.verticalLayoutLibrary.setObjectName("verticalLayoutLibrary")
145
        self.gridLayout_14.addLayout(self.verticalLayoutLibrary, 0, 0, 1, 1)
146
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
147
        self.gridLayout_13.addWidget(self.scrollArea, 0, 0, 1, 1)
148
        self.tabWidgetSymbolProperty.addTab(self.tabLibrary, "")
149
        self.tabSymbolProperty = QtWidgets.QWidget()
150
        self.tabSymbolProperty.setObjectName("tabSymbolProperty")
151
        self.gridLayout_15 = QtWidgets.QGridLayout(self.tabSymbolProperty)
152
        self.gridLayout_15.setObjectName("gridLayout_15")
153
        self.verticalLayoutSymbolProperty = QtWidgets.QVBoxLayout()
154
        self.verticalLayoutSymbolProperty.setObjectName("verticalLayoutSymbolProperty")
155
        self.gridLayout_15.addLayout(self.verticalLayoutSymbolProperty, 0, 0, 1, 1)
156
        self.tabWidgetSymbolProperty.addTab(self.tabSymbolProperty, "")
157
        self.gridLayout_10.addWidget(self.tabWidgetSymbolProperty, 0, 0, 1, 1)
158
        self.gridLayout_2.addWidget(self.splitterSymbol, 0, 0, 1, 1)
106 159
        self.dockWidget.setWidget(self.dockWidgetContents)
107 160
        MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget)
108 161
        self.dockWidgetObjectExplorer = QtWidgets.QDockWidget(MainWindow)
......
603 656

  
604 657
        self.retranslateUi(MainWindow)
605 658
        self.tabWidget.setCurrentIndex(0)
659
        self.tabWidgetSymbolProperty.setCurrentIndex(0)
606 660
        self.tabWidgetItemExplorer.setCurrentIndex(0)
607 661
        self.tabWidget_2.setCurrentIndex(0)
608 662
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
......
624 678
        self.pushButtonCreateSymbol.setText(_translate("MainWindow", "Create"))
625 679
        self.pushButtonDetectSymbol.setText(_translate("MainWindow", "Symbol Manager"))
626 680
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Symbol), _translate("MainWindow", "Symbol"))
681
        self.tabWidgetSymbolProperty.setTabText(self.tabWidgetSymbolProperty.indexOf(self.tabLibrary), _translate("MainWindow", "Library"))
682
        self.tabWidgetSymbolProperty.setTabText(self.tabWidgetSymbolProperty.indexOf(self.tabSymbolProperty), _translate("MainWindow", "Property"))
627 683
        self.dockWidgetObjectExplorer.setWindowTitle(_translate("MainWindow", "Object Explorer"))
628 684
        self.tabWidgetItemExplorer.setTabText(self.tabWidgetItemExplorer.indexOf(self.tabItemProperty), _translate("MainWindow", "Object Explorer"))
629 685
        self.pushButtonBatchRecognition.setText(_translate("MainWindow", "Batch Job"))
DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
969 969
                self._angle = math.acos(dx / length)
970 970
                cross = int(np.cross([1, 0], [dx, dy]))
971 971
                self._angle = -self._angle if cross < 0 else self._angle
972
                self._angle = 360 + self._angle if self._angle < 0 else self._angle
972 973

  
973 974
                self.rotate(self._angle)
974 975

  
DTI_PID/DTI_PID/SymbolTreeWidget.py
212 212

  
213 213
                    _, svg = app_doc_data.read_symbol_shape(symbol.sName)
214 214
                    if svg:
215
                        symbol.pixmap = QPixmap(QSize(32, 32))
215
                        symbol.pixmap = QPixmap()
216 216
                        symbol.pixmap.loadFromData(svg if isinstance(svg, bytes) else svg.encode())
217 217
                        icon = QIcon(symbol.pixmap)
218 218
                        symbolItem.setIcon(0, icon)
219 219
                        symbolItem.svgFilePath = None   # save svg file path
220 220
                    else:
221 221
                        svgPath = symbol.getSvgFileFullPath()
222
                        icon = QIcon(svgPath)
223
                        symbol.pixmap = icon.pixmap(QSize(32, 32))
222
                        symbol.pixmap = QPixmap(svgPath)
223
                        icon = QIcon(symbol.pixmap)
224 224
                        symbolItem.setIcon(0, icon)
225 225
                        symbolItem.svgFilePath = svgPath  # save svg file path
226 226

  
......
336 336
            if data is not None and type(data) is symbol.SymbolBase:
337 337
                self.singleClicked.emit(data)
338 338

  
339
    '''
340
        @brief  start drag
341
        @author humkyung
342
        @date   2018.04.17
343
        @history    18.04.20    Jeongwoo    Change Path in QPixmap
344
                    18.06.21    Jeongwoo    Casting string to float and int
345
    '''
346

  
347 339
    def startDrag(self, dropAction):
340
        """start drag"""
348 341
        try:
349 342
            items = self.selectedItems()
350 343
            if items and hasattr(items[0], 'svgFilePath'):
351 344
                symData = items[0].data(0, self.TREE_DATA_ROLE)
352
                if items[0].svgFilePath:
353
                    pixmap = QPixmap(items[0].svgFilePath)
354
                else:
355
                    app_doc_data = AppDocData.instance()
356
                    _, svg = app_doc_data.read_symbol_shape(symData.getName())
357
                    if svg:
358
                        pixmap = QPixmap()
359
                        pixmap.loadFromData(svg if isinstance(svg, bytes) else svg.encode())
360 345

  
361 346
                mime = QMimeData()
362 347
                mime.setText(symData.getName())
......
367 352
                originalPoint = symData.getOriginalPoint()
368 353
                drag.setHotSpot(
369 354
                    QPoint(int(float(originalPoint.split(",")[0])), int(float(originalPoint.split(",")[1]))))
370
                drag.setPixmap(pixmap)
355
                drag.setPixmap(symData.pixmap)
371 356
                drag.exec(Qt.CopyAction)
372 357
        except Exception as ex:
373 358
            from App import App
DTI_PID/DTI_PID/UI/MainWindow.ui
200 200
  <widget class="QDockWidget" name="dockWidget">
201 201
   <property name="minimumSize">
202 202
    <size>
203
     <width>200</width>
204
     <height>115</height>
203
     <width>284</width>
204
     <height>309</height>
205 205
    </size>
206 206
   </property>
207 207
   <property name="windowTitle">
......
213 213
   <widget class="QWidget" name="dockWidgetContents">
214 214
    <layout class="QGridLayout" name="gridLayout_2">
215 215
     <item row="0" column="0">
216
      <widget class="QTabWidget" name="tabWidget">
217
       <property name="currentIndex">
218
        <number>0</number>
216
      <widget class="QSplitter" name="splitterSymbol">
217
       <property name="sizePolicy">
218
        <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
219
         <horstretch>0</horstretch>
220
         <verstretch>1</verstretch>
221
        </sizepolicy>
219 222
       </property>
220
       <widget class="QWidget" name="Symbol">
221
        <attribute name="title">
222
         <string>Symbol</string>
223
        </attribute>
223
       <property name="baseSize">
224
        <size>
225
         <width>0</width>
226
         <height>1000</height>
227
        </size>
228
       </property>
229
       <property name="orientation">
230
        <enum>Qt::Vertical</enum>
231
       </property>
232
       <widget class="QWidget" name="widget" native="true">
224 233
        <layout class="QGridLayout" name="gridLayout_3">
225 234
         <item row="0" column="0">
226
          <layout class="QVBoxLayout" name="symbolTabVerticalLayout">
227
           <item>
228
            <layout class="QHBoxLayout" name="horizontalLayout_3">
229
             <item>
230
              <widget class="QPushButton" name="pushButtonCreateSymbol">
231
               <property name="maximumSize">
232
                <size>
233
                 <width>32</width>
234
                 <height>16777215</height>
235
                </size>
236
               </property>
237
               <property name="layoutDirection">
238
                <enum>Qt::LeftToRight</enum>
239
               </property>
240
               <property name="text">
241
                <string>Create</string>
242
               </property>
243
              </widget>
235
          <widget class="QTabWidget" name="tabWidget">
236
           <property name="currentIndex">
237
            <number>0</number>
238
           </property>
239
           <widget class="QWidget" name="Symbol">
240
            <attribute name="title">
241
             <string>Symbol</string>
242
            </attribute>
243
            <layout class="QGridLayout" name="gridLayout_9">
244
             <item row="0" column="0">
245
              <layout class="QHBoxLayout" name="horizontalLayout">
246
               <item>
247
                <widget class="QPushButton" name="pushButtonCreateSymbol">
248
                 <property name="maximumSize">
249
                  <size>
250
                   <width>32</width>
251
                   <height>16777215</height>
252
                  </size>
253
                 </property>
254
                 <property name="layoutDirection">
255
                  <enum>Qt::LeftToRight</enum>
256
                 </property>
257
                 <property name="text">
258
                  <string>Create</string>
259
                 </property>
260
                </widget>
261
               </item>
262
               <item>
263
                <spacer name="horizontalSpacer">
264
                 <property name="orientation">
265
                  <enum>Qt::Horizontal</enum>
266
                 </property>
267
                 <property name="sizeHint" stdset="0">
268
                  <size>
269
                   <width>40</width>
270
                   <height>20</height>
271
                  </size>
272
                 </property>
273
                </spacer>
274
               </item>
275
               <item>
276
                <widget class="QPushButton" name="pushButtonDetectSymbol">
277
                 <property name="maximumSize">
278
                  <size>
279
                   <width>130</width>
280
                   <height>16777215</height>
281
                  </size>
282
                 </property>
283
                 <property name="text">
284
                  <string>Symbol Manager</string>
285
                 </property>
286
                </widget>
287
               </item>
288
              </layout>
244 289
             </item>
245
             <item>
246
              <spacer name="horizontalSpacer">
247
               <property name="orientation">
248
                <enum>Qt::Horizontal</enum>
249
               </property>
250
               <property name="sizeHint" stdset="0">
251
                <size>
252
                 <width>40</width>
253
                 <height>20</height>
254
                </size>
255
               </property>
256
              </spacer>
290
             <item row="1" column="0">
291
              <layout class="QVBoxLayout" name="verticalLayoutSymbolTree"/>
257 292
             </item>
258
             <item>
259
              <widget class="QPushButton" name="pushButtonDetectSymbol">
293
            </layout>
294
           </widget>
295
          </widget>
296
         </item>
297
        </layout>
298
       </widget>
299
       <widget class="QWidget" name="widgetSymbolProperty" native="true">
300
        <property name="maximumSize">
301
         <size>
302
          <width>16777215</width>
303
          <height>500</height>
304
         </size>
305
        </property>
306
        <layout class="QGridLayout" name="gridLayout_10">
307
         <item row="0" column="0">
308
          <widget class="QTabWidget" name="tabWidgetSymbolProperty">
309
           <property name="maximumSize">
310
            <size>
311
             <width>16777215</width>
312
             <height>500</height>
313
            </size>
314
           </property>
315
           <property name="baseSize">
316
            <size>
317
             <width>0</width>
318
             <height>300</height>
319
            </size>
320
           </property>
321
           <property name="currentIndex">
322
            <number>0</number>
323
           </property>
324
           <widget class="QWidget" name="tabLibrary">
325
            <attribute name="title">
326
             <string>Library</string>
327
            </attribute>
328
            <layout class="QGridLayout" name="gridLayout_13">
329
             <item row="0" column="0">
330
              <widget class="QScrollArea" name="scrollArea">
260 331
               <property name="maximumSize">
261 332
                <size>
262
                 <width>130</width>
263
                 <height>16777215</height>
333
                 <width>16777215</width>
334
                 <height>500</height>
264 335
                </size>
265 336
               </property>
266
               <property name="text">
267
                <string>Symbol Manager</string>
337
               <property name="widgetResizable">
338
                <bool>true</bool>
268 339
               </property>
340
               <widget class="QWidget" name="scrollAreaWidgetContents">
341
                <property name="geometry">
342
                 <rect>
343
                  <x>0</x>
344
                  <y>0</y>
345
                  <width>222</width>
346
                  <height>106</height>
347
                 </rect>
348
                </property>
349
                <layout class="QGridLayout" name="gridLayout_14">
350
                 <item row="0" column="0">
351
                  <layout class="QVBoxLayout" name="verticalLayoutLibrary"/>
352
                 </item>
353
                </layout>
354
               </widget>
269 355
              </widget>
270 356
             </item>
271 357
            </layout>
272
           </item>
273
          </layout>
358
           </widget>
359
           <widget class="QWidget" name="tabSymbolProperty">
360
            <attribute name="title">
361
             <string>Property</string>
362
            </attribute>
363
            <layout class="QGridLayout" name="gridLayout_15">
364
             <item row="0" column="0">
365
              <layout class="QVBoxLayout" name="verticalLayoutSymbolProperty"/>
366
             </item>
367
            </layout>
368
           </widget>
369
          </widget>
274 370
         </item>
275 371
        </layout>
276 372
       </widget>
......
1161 1257
  </action>
1162 1258
  <action name="actionExportAsSVG">
1163 1259
   <property name="icon">
1164
    <iconset resource="../res/MainWindow.qrc">
1260
    <iconset>
1165 1261
     <normaloff>:/newPrefix/svg.png</normaloff>:/newPrefix/svg.png</iconset>
1166 1262
   </property>
1167 1263
   <property name="text">
......
1188 1284
  </action>
1189 1285
  <action name="actionRecognizeTable">
1190 1286
   <property name="icon">
1191
    <iconset resource="../res/MainWindow.qrc">
1287
    <iconset>
1192 1288
     <normaloff>:/newPrefix/table_ocr.png</normaloff>:/newPrefix/table_ocr.png</iconset>
1193 1289
   </property>
1194 1290
   <property name="text">

내보내기 Unified diff

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