프로젝트

일반

사용자정보

개정판 ba93b63d

IDba93b63df1c6de7bd7199406981ac69682953ffc
상위 273f1e40
하위 95b4e440, 12701420

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

line no sort ongoing

Change-Id: I609ad21f197ef9b16e789c3b3006f4885f0d6dff

차이점 보기:

DTI_PID/DTI_PID/AppDocData.py
255 255

  
256 256
        cmp_fnc = lambda psz1, psz2: _StrCmpLogicalW(psz1, psz2)
257 257

  
258
        return sorted(data, key=cmp_to_key(cmp_fnc))
258
        sorted(data, key=cmp_to_key(cmp_fnc))
259 259

  
260 260
    '''
261 261
        @brief      Get drawing file list
......
273 273
                               (os.path.splitext(f)[1].upper() == '.PNG' or os.path.splitext(f)[1].upper() == '.JPG' or
274 274
                                os.path.splitext(f)[1].upper() == '.JPEG')]
275 275
            
276
            drawingFileList = self.winsort(drawingFileList)
276
            self.winsort(drawingFileList)
277 277
            #drawingFileList.sort()
278 278
        except Exception as ex:
279 279
            print('error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
DTI_PID/DTI_PID/MainWindow.py
128 128
        # save timer
129 129
        self.save_timer = None
130 130

  
131
        self.drawing_reverse = False
132

  
131 133
        self._scene = QtImageViewerScene(self)
132 134

  
133 135
        self.graphicsView = QtImageViewer(self)
......
182 184
        #self.actionExportAsImage.triggered.connect(self.export_as_image)
183 185
        #self.actionLine.triggered.connect(self.onPlaceLine)
184 186
        #self.actionRecognition.triggered.connect(self.recognize)
187
        self.pushButtonLineNoSortSetting.clicked.connect(self.on_line_no_sort_setting)
185 188
        self.pushButtonRefreshDrawings.clicked.connect(self.load_drawing_list)
186 189
        self.pushButtonRefreshTree.clicked.connect(self.refresh_item_list)
187 190
        #self.actionLineRecognition.triggered.connect(self.connect_attributes)
......
590 593

  
591 594
        self.itemTreeWidget.InitLineNoItems()
592 595

  
593
        #'''
596
        line_nos = [line_no for line_no in line_nos if type(line_no) is QEngineeringLineNoTextItem]
597
        line_no_pairs = []
598
        line_no_texts = []
599
        for line_no in line_nos:
600
            text = line_no.sort_order_text()
601
            line_no_pairs.append([line_no, text])
602
            line_no_texts.append(text)
603
        
604

  
605

  
594 606
        line_nos = app_doc_data.tracerLineNos
595 607
        line_nos.sort(key=lambda x: int(x.getAttributes(True)[[_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No'][0]]) if (x.getAttributes(True) and [_key for _key in x.getAttributes(True).keys() if _key.Attribute == 'Tag Seq No']) else -1 if type(x) is QEngineeringLineNoTextItem else 9999999)
596 608
        for line_no in line_nos:
......
599 611
            for connectedItem in connectedItems:
600 612
                if issubclass(type(connectedItem), SymbolSvgItem):
601 613
                    self.itemTreeWidget.addTreeItem(item, connectedItem)
602
        #'''
603 614
        
604 615
    def sort_drawing_list(self, index):
605 616
        """ sort drawing list """
......
608 619
                self.load_drawing_list(reverse=False)
609 620
            else:
610 621
                self.load_drawing_list(reverse=True)
622
            self.drawing_reverse = not self.drawing_reverse
623

  
624
    def on_line_no_sort_setting(self):
625
        from PSNLineNoAttrTargetDialog import PSNLineNoAttrTargetDialog
626

  
627
        dialog = PSNLineNoAttrTargetDialog(self, 'Sort')
628
        (isAccept) = dialog.showDialog()        
611 629

  
612 630
    def load_drawing_list(self, reverse=False):
613 631
        """load p&id drawing list"""
DTI_PID/DTI_PID/MainWindow_UI.py
1 1
# -*- coding: utf-8 -*-
2 2

  
3
# Form implementation generated from reading ui file '.\UI\MainWindow.ui'
3
# Form implementation generated from reading ui file './UI/MainWindow.ui'
4 4
#
5 5
# Created by: PyQt5 UI code generator 5.15.4
6 6
#
......
146 146
        self.symbolExplorerVerticalLayout.setObjectName("symbolExplorerVerticalLayout")
147 147
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
148 148
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
149
        self.pushButtonLineNoSortSetting = QtWidgets.QPushButton(self.tabItemProperty)
150
        self.pushButtonLineNoSortSetting.setObjectName("pushButtonLineNoSortSetting")
151
        self.horizontalLayout_2.addWidget(self.pushButtonLineNoSortSetting)
149 152
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
150 153
        self.horizontalLayout_2.addItem(spacerItem)
151 154
        self.pushButtonRefreshTree = QtWidgets.QPushButton(self.tabItemProperty)
......
645 648
        self.tabWidgetSymbolProperty.setTabText(self.tabWidgetSymbolProperty.indexOf(self.tabLibrary), _translate("MainWindow", "Library"))
646 649
        self.tabWidgetSymbolProperty.setTabText(self.tabWidgetSymbolProperty.indexOf(self.tabSymbolProperty), _translate("MainWindow", "Property"))
647 650
        self.dockWidgetObjectExplorer.setWindowTitle(_translate("MainWindow", "Object Explorer"))
651
        self.pushButtonLineNoSortSetting.setText(_translate("MainWindow", "Sort Setting"))
648 652
        self.pushButtonRefreshTree.setText(_translate("MainWindow", "Refresh Item List"))
649 653
        self.tabWidgetItemExplorer.setTabText(self.tabWidgetItemExplorer.indexOf(self.tabItemProperty), _translate("MainWindow", "Topology Manager"))
650 654
        self.drawingFilter.setPlaceholderText(_translate("MainWindow", "Search..."))
......
749 753
        self.actionImport_Text_from_CAD_for_Instrument.setText(_translate("MainWindow", "Import Text from PDF for Instrument"))
750 754
        self.actionStreamline.setText(_translate("MainWindow", "Streamline"))
751 755
import MainWindow_rc
756

  
757

  
758
if __name__ == "__main__":
759
    import sys
760
    app = QtWidgets.QApplication(sys.argv)
761
    MainWindow = QtWidgets.QMainWindow()
762
    ui = Ui_MainWindow()
763
    ui.setupUi(MainWindow)
764
    MainWindow.show()
765
    sys.exit(app.exec_())
DTI_PID/DTI_PID/PSNLineNoAttrTargetDialog.py
12 12
import PSNLineNoAttrTarget_UI
13 13

  
14 14
class PSNLineNoAttrTargetDialog(QDialog):
15
    def __init__(self, parent):
15
    def __init__(self, parent, conKey='PSN'):
16 16
        QDialog.__init__(self, parent)
17 17

  
18 18
        self.ui = PSNLineNoAttrTarget_UI.Ui_AttributeTarget()
......
28 28
        attrs = app_doc_data.getLineProperties()
29 29
        self.ui.tableWidget.setRowCount(len(attrs))
30 30

  
31
        configs = app_doc_data.getConfigs('PSN', 'LineNoKeys')
31
        self.key = conKey
32
        configs = app_doc_data.getConfigs(self.key, 'LineNoKeys')
32 33
        self.target = configs[0].value if configs else ''
33 34

  
34 35
        index = 0
......
74 75

  
75 76
            app_doc_data = AppDocData.instance()
76 77
            configs = []
77
            configs.append(Config('PSN', 'LineNoKeys', self.target))
78
            configs.append(Config(self.key, 'LineNoKeys', self.target))
78 79
            app_doc_data.saveConfigs(configs)
79 80

  
80 81
            self.isAccepted = True
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py
1157 1157
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1158 1158
                                                           sys.exc_info()[-1].tb_lineno)
1159 1159
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1160

  
1161
    def sort_order_text(self):
1162
        """ return true if line no same"""
1163

  
1164
        app_doc_data = AppDocData.instance()
1165
        
1166
        configs = app_doc_data.getConfigs('Sort', 'LineNoKeys')
1167
        targets = configs[0].value.split(',') if configs else []
1168

  
1169
        attrs = self.getAttributes(True)
1170
        matches = []
1171

  
1172
        for key in targets:
1173
            _matches = [_key for _key in list(attrs.keys()) if str(_key.UID) == key]
1174
            if _matches:
1175
                matches.append(attrs[_matches[0]])
1176

  
1177
        return '_'.join(matches)
1160 1178
    
1161 1179
    def validate(self):
1162 1180
        """ validation check """
DTI_PID/DTI_PID/UI/MainWindow.ui
254 254
           <item>
255 255
            <layout class="QHBoxLayout" name="horizontalLayout_2">
256 256
             <item>
257
              <widget class="QPushButton" name="pushButtonLineNoSortSetting">
258
               <property name="text">
259
                <string>Sort Setting</string>
260
               </property>
261
              </widget>
262
             </item>
263
             <item>
257 264
              <spacer name="horizontalSpacer">
258 265
               <property name="orientation">
259 266
                <enum>Qt::Horizontal</enum>

내보내기 Unified diff

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