프로젝트

일반

사용자정보

개정판 31939a2b

ID31939a2be8febd6a666d307963507bb93ca06dbf
상위 291a86fa
하위 2b57a455, 0dde3765

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

issue #49: custom code table for line no ongoing

Change-Id: Ic4d2b69e663fc4ea756c84e4cdb866b27b1c4e61

차이점 보기:

DTI_PID/DTI_PID/CustomCodeTablesDialog.py
1
# coding: utf-8
2
"""
3
    This is area configuration module
4
"""
5
import os
6
import sys
7
from PyQt5.QtCore import *
8
from PyQt5.QtGui import *
9
from PyQt5.QtWidgets import *
10
from AppDocData import AppDocData
11

  
12
import CustomCodeTables_UI
13

  
14
class CustomCodeTablesDialog(QDialog):
15
    def __init__(self, parent):
16
        QDialog.__init__(self, parent)
17

  
18
        self.ui = CustomCodeTables_UI.Ui_CustomCodeTables()
19
        self.ui.setupUi(self)
20

  
21
        self.ui.tableWidgetCustomCodeTable.setSortingEnabled(True)
22

  
23
        self.isAccepted = False
24

  
25
        self.ui.buttonBox.accepted.connect(self.accept)
26
        self.ui.buttonBox.rejected.connect(self.reject)
27

  
28
    '''
29
        @brief  accept dialog
30
    '''
31
    def accept(self):
32
        import uuid
33

  
34
        try:
35
            self.isAccepted = False
36

  
37
            self.isAccepted = True
38
            QDialog.accept(self)
39

  
40
        except Exception as ex:
41
            from App import App
42
            from AppDocData import MessageType
43

  
44
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
45
            App.mainWnd().addMessage.emit(MessageType.Error, message)
46
        
47
    def reject(self):
48
        try:
49
            self.isAccepted = False
50

  
51
            pass
52
            QDialog.reject(self)
53

  
54
        except Exception as ex:
55
            from App import App
56
            from AppDocData import MessageType
57

  
58
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
59
            App.mainWnd().addMessage.emit(MessageType.Error, message)
DTI_PID/DTI_PID/CustomCodeTables_UI.py
1
# -*- coding: utf-8 -*-
2

  
3
# Form implementation generated from reading ui file './UI/CustomCodeTables.ui'
4
#
5
# Created by: PyQt5 UI code generator 5.11.3
6
#
7
# WARNING! All changes made in this file will be lost!
8

  
9
from PyQt5 import QtCore, QtGui, QtWidgets
10

  
11
class Ui_CustomCodeTables(object):
12
    def setupUi(self, CustomCodeTables):
13
        CustomCodeTables.setObjectName("CustomCodeTables")
14
        CustomCodeTables.resize(496, 341)
15
        font = QtGui.QFont()
16
        font.setFamily("맑은 고딕")
17
        CustomCodeTables.setFont(font)
18
        icon = QtGui.QIcon()
19
        icon.addPixmap(QtGui.QPixmap(":/newPrefix/codetable.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
20
        CustomCodeTables.setWindowIcon(icon)
21
        self.gridLayout = QtWidgets.QGridLayout(CustomCodeTables)
22
        self.gridLayout.setObjectName("gridLayout")
23
        self.horizontalLayout = QtWidgets.QHBoxLayout()
24
        self.horizontalLayout.setObjectName("horizontalLayout")
25
        self.buttonBox = QtWidgets.QDialogButtonBox(CustomCodeTables)
26
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
27
        self.buttonBox.setObjectName("buttonBox")
28
        self.horizontalLayout.addWidget(self.buttonBox)
29
        self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 1)
30
        self.groupBoxTitleBlock = QtWidgets.QGroupBox(CustomCodeTables)
31
        self.groupBoxTitleBlock.setObjectName("groupBoxTitleBlock")
32
        self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBoxTitleBlock)
33
        self.gridLayout_4.setObjectName("gridLayout_4")
34
        self.verticalLayout_3 = QtWidgets.QVBoxLayout()
35
        self.verticalLayout_3.setObjectName("verticalLayout_3")
36
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
37
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
38
        self.tableWidgetCustomCodeTable = QtWidgets.QTableWidget(self.groupBoxTitleBlock)
39
        self.tableWidgetCustomCodeTable.setColumnCount(2)
40
        self.tableWidgetCustomCodeTable.setObjectName("tableWidgetCustomCodeTable")
41
        self.tableWidgetCustomCodeTable.setRowCount(0)
42
        self.horizontalLayout_4.addWidget(self.tableWidgetCustomCodeTable)
43
        self.verticalLayout_3.addLayout(self.horizontalLayout_4)
44
        self.gridLayout_4.addLayout(self.verticalLayout_3, 1, 0, 1, 1)
45
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
46
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
47
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
48
        self.horizontalLayout_2.addItem(spacerItem)
49
        self.pushButtonAdd = QtWidgets.QPushButton(self.groupBoxTitleBlock)
50
        self.pushButtonAdd.setObjectName("pushButtonAdd")
51
        self.horizontalLayout_2.addWidget(self.pushButtonAdd)
52
        self.pushButtonDelete = QtWidgets.QPushButton(self.groupBoxTitleBlock)
53
        self.pushButtonDelete.setObjectName("pushButtonDelete")
54
        self.horizontalLayout_2.addWidget(self.pushButtonDelete)
55
        self.gridLayout_4.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
56
        self.gridLayout.addWidget(self.groupBoxTitleBlock, 1, 0, 1, 1)
57

  
58
        self.retranslateUi(CustomCodeTables)
59
        QtCore.QMetaObject.connectSlotsByName(CustomCodeTables)
60

  
61
    def retranslateUi(self, CustomCodeTables):
62
        _translate = QtCore.QCoreApplication.translate
63
        CustomCodeTables.setWindowTitle(_translate("CustomCodeTables", "Custom Code Tables"))
64
        self.groupBoxTitleBlock.setTitle(_translate("CustomCodeTables", "Custom Tables"))
65
        self.pushButtonAdd.setText(_translate("CustomCodeTables", "+"))
66
        self.pushButtonDelete.setText(_translate("CustomCodeTables", "-"))
67

  
68
import MainWindow_rc
69

  
70
if __name__ == "__main__":
71
    import sys
72
    app = QtWidgets.QApplication(sys.argv)
73
    CustomCodeTables = QtWidgets.QDialog()
74
    ui = Ui_CustomCodeTables()
75
    ui.setupUi(CustomCodeTables)
76
    CustomCodeTables.show()
77
    sys.exit(app.exec_())
78

  
DTI_PID/DTI_PID/MainWindow.py
236 236
            self.on_show_eqp_datasheet_export)  # show eqp datasheet export dialog
237 237
        self.actionOPCRelation.triggered.connect(self.on_show_opc_relation)  # show OPC Relation dialog
238 238
        self.actionCodeTable.triggered.connect(self.onShowCodeTable)
239
        self.actionCustom_Code_Table.triggered.connect(self.onShowCustomCodeTable)
239 240
        self.actionImage_Drawing.triggered.connect(self.onViewImageDrawing)
240 241
        self.actionDrawing_Only.triggered.connect(self.onViewDrawingOnly)
241 242
        self.actionValidate.triggered.connect(self.onValidation)
......
1195 1196
                self.graphicsView.scene.removeItem(dlg.desc_area)
1196 1197
        self.graphicsView.useDefaultCommand()
1197 1198

  
1199
    def onShowCustomCodeTable(self):
1200
        from CustomCodeTablesDialog import CustomCodeTablesDialog
1201

  
1202
        dlg = CustomCodeTablesDialog(self)
1203
        dlg.show()
1204
        dlg.exec_()
1205
        self.graphicsView.useDefaultCommand()
1206

  
1198 1207
    '''
1199 1208
        @brief  show HMB data
1200 1209
        @author humkyung
DTI_PID/DTI_PID/MainWindow_UI.py
497 497
        self.actionExportEqpDatasheet.setObjectName("actionExportEqpDatasheet")
498 498
        self.actionSymbol_Training = QtWidgets.QAction(MainWindow)
499 499
        self.actionSymbol_Training.setObjectName("actionSymbol_Training")
500
        self.actionCustom_Code_Table = QtWidgets.QAction(MainWindow)
501
        self.actionCustom_Code_Table.setIcon(icon15)
502
        self.actionCustom_Code_Table.setObjectName("actionCustom_Code_Table")
500 503
        self.menu.addAction(self.actionOpen)
501 504
        self.menu.addAction(self.actionArea)
502 505
        self.menu.addAction(self.actionConfiguration)
......
513 516
        self.menu_2.addAction(self.actionOPCRelation)
514 517
        self.menu_2.addSeparator()
515 518
        self.menu_2.addAction(self.actionCodeTable)
519
        self.menu_2.addAction(self.actionCustom_Code_Table)
516 520
        self.menu_2.addSeparator()
517 521
        self.menu_2.addAction(self.actionOCR_Training)
518 522
        self.menu_2.addAction(self.actionSymbol_Training)
......
666 670
        self.actionExportEqpDatasheet.setText(_translate("MainWindow", "Export Eqp Datasheet"))
667 671
        self.actionExportEqpDatasheet.setToolTip(_translate("MainWindow", "Export Equipment Datasheet"))
668 672
        self.actionSymbol_Training.setText(_translate("MainWindow", "Symbol Training"))
673
        self.actionCustom_Code_Table.setText(_translate("MainWindow", "Custom Code Table"))
669 674

  
670 675
import MainWindow_rc
671 676

  
DTI_PID/DTI_PID/SymbolAttrCodeTableDialog.py
14 14
import SymbolAttrCodeTable_UI
15 15

  
16 16
class SymbolAttrCodeTableDialog(QCodeTableDialog):
17
    def __init__(self, parent, symbol_attribute_uid, tableDatas=None):
18
        QCodeTableDialog.__init__(self, parent, 'SymbolAttributeCodeTable')
17
    # custom code table also use this class
18
    def __init__(self, parent, symbol_attribute_uid, tableDatas=None, Table_Name='SymbolAttributeCodeTable'):
19
        QCodeTableDialog.__init__(self, parent, Table_Name)
19 20

  
20 21
        self.ui = SymbolAttrCodeTable_UI.Ui_AttributeCodeTable()
21 22
        self.ui.setupUi(self)
......
31 32
        self.ui.buttonBox.rejected.connect(self.reject)
32 33

  
33 34
        self.settingTable('SymbolAttributeCodeTable', symbol_attribute_uid=symbol_attribute_uid, tableDatas=tableDatas)
35
        
34 36
    '''
35 37
        @brief  accept dialog
36 38
    '''
DTI_PID/DTI_PID/SymbolAttrCodeTable_UI.py
62 62
        AttributeCodeTable.setWindowTitle(_translate("AttributeCodeTable", "Attribute Code Table"))
63 63
        self.label.setText(_translate("AttributeCodeTable", "Line Height : "))
64 64
        self.pushButtonRead.setText(_translate("AttributeCodeTable", "Read from Legend"))
65
        self.groupBoxTitleBlock.setTitle(_translate("AttributeCodeTable", "Attribute Table"))
65
        self.groupBoxTitleBlock.setTitle(_translate("AttributeCodeTable", "Table"))
66 66

  
67 67
import MainWindow_rc
68 68

  
DTI_PID/DTI_PID/SymbolAttrEditorDialog.py
87 87
            if column == 7:
88 88
                symbolType = self.ui.comboBoxSymbolType.currentText()
89 89

  
90
                dialog = SymbolAttrCodeTableDialog(self, str(self.ui.tableWidgetAttr.item(row, 0).tag.UID), self.ui.tableWidgetAttr.item(row, 7).tag)
90
                dialog = SymbolAttrCodeTableDialog(self, str(self.ui.tableWidgetAttr.item(row, 0).tag.UID), tableDatas=self.ui.tableWidgetAttr.item(row, 7).tag)
91 91
                (isAccept, code_data) = dialog.showDialog()
92 92
  
93 93
                if isAccept:
DTI_PID/DTI_PID/UI/CustomCodeTables.ui
1
<?xml version="1.0" encoding="UTF-8"?>
2
<ui version="4.0">
3
 <class>CustomCodeTables</class>
4
 <widget class="QDialog" name="CustomCodeTables">
5
  <property name="geometry">
6
   <rect>
7
    <x>0</x>
8
    <y>0</y>
9
    <width>496</width>
10
    <height>341</height>
11
   </rect>
12
  </property>
13
  <property name="font">
14
   <font>
15
    <family>맑은 고딕</family>
16
   </font>
17
  </property>
18
  <property name="windowTitle">
19
   <string>Custom Code Tables</string>
20
  </property>
21
  <property name="windowIcon">
22
   <iconset resource="../res/MainWindow.qrc">
23
    <normaloff>:/newPrefix/codetable.png</normaloff>:/newPrefix/codetable.png</iconset>
24
  </property>
25
  <layout class="QGridLayout" name="gridLayout">
26
   <item row="2" column="0">
27
    <layout class="QHBoxLayout" name="horizontalLayout">
28
     <item>
29
      <widget class="QDialogButtonBox" name="buttonBox">
30
       <property name="standardButtons">
31
        <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
32
       </property>
33
      </widget>
34
     </item>
35
    </layout>
36
   </item>
37
   <item row="1" column="0">
38
    <widget class="QGroupBox" name="groupBoxTitleBlock">
39
     <property name="title">
40
      <string>Custom Tables</string>
41
     </property>
42
     <layout class="QGridLayout" name="gridLayout_4">
43
      <item row="1" column="0">
44
       <layout class="QVBoxLayout" name="verticalLayout_3">
45
        <item>
46
         <layout class="QHBoxLayout" name="horizontalLayout_4">
47
          <item>
48
           <widget class="QTableWidget" name="tableWidgetCustomCodeTable">
49
            <property name="columnCount">
50
             <number>2</number>
51
            </property>
52
            <column/>
53
            <column/>
54
           </widget>
55
          </item>
56
         </layout>
57
        </item>
58
       </layout>
59
      </item>
60
      <item row="0" column="0">
61
       <layout class="QHBoxLayout" name="horizontalLayout_2">
62
        <item>
63
         <spacer name="horizontalSpacer">
64
          <property name="orientation">
65
           <enum>Qt::Horizontal</enum>
66
          </property>
67
          <property name="sizeHint" stdset="0">
68
           <size>
69
            <width>40</width>
70
            <height>20</height>
71
           </size>
72
          </property>
73
         </spacer>
74
        </item>
75
        <item>
76
         <widget class="QPushButton" name="pushButtonAdd">
77
          <property name="text">
78
           <string>+</string>
79
          </property>
80
         </widget>
81
        </item>
82
        <item>
83
         <widget class="QPushButton" name="pushButtonDelete">
84
          <property name="text">
85
           <string>-</string>
86
          </property>
87
         </widget>
88
        </item>
89
       </layout>
90
      </item>
91
     </layout>
92
    </widget>
93
   </item>
94
  </layout>
95
 </widget>
96
 <resources>
97
  <include location="../res/MainWindow.qrc"/>
98
 </resources>
99
 <connections/>
100
</ui>
DTI_PID/DTI_PID/UI/MainWindow.ui
95 95
    <addaction name="actionOPCRelation"/>
96 96
    <addaction name="separator"/>
97 97
    <addaction name="actionCodeTable"/>
98
    <addaction name="actionCustom_Code_Table"/>
98 99
    <addaction name="separator"/>
99 100
    <addaction name="actionOCR_Training"/>
100 101
    <addaction name="actionSymbol_Training"/>
......
1135 1136
    <string>Symbol Training</string>
1136 1137
   </property>
1137 1138
  </action>
1139
  <action name="actionCustom_Code_Table">
1140
   <property name="icon">
1141
    <iconset resource="../res/MainWindow.qrc">
1142
     <normaloff>:/newPrefix/codetable.png</normaloff>:/newPrefix/codetable.png</iconset>
1143
   </property>
1144
   <property name="text">
1145
    <string>Custom Code Table</string>
1146
   </property>
1147
  </action>
1138 1148
 </widget>
1139 1149
 <resources>
1140 1150
  <include location="../res/MainWindow.qrc"/>
DTI_PID/DTI_PID/UI/SymbolAttrCodeTable.ui
58 58
   <item row="1" column="0">
59 59
    <widget class="QGroupBox" name="groupBoxTitleBlock">
60 60
     <property name="title">
61
      <string>Attribute Table</string>
61
      <string>Table</string>
62 62
     </property>
63 63
     <layout class="QGridLayout" name="gridLayout_4">
64 64
      <item row="0" column="0">

내보내기 Unified diff

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