프로젝트

일반

사용자정보

개정판 5588887a

ID5588887acf863cb34b95738f1107f325a77a256c
상위 95ff73f1
하위 01f38883

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

issue #665: row highlight

차이점 보기:

DTI_PID/DTI_PID/ItemDataFormatDialog.py
103 103
        self.emptys.append(self.instrumentEmptyClicked)
104 104
        self.emptys.append(self.noteEmptyClicked)
105 105

  
106
        # attribute list setting
107
        for index in range(len(self.listWidgets)):
108
            self.listWidgets[index].itemDoubleClicked.connect(self.items[index])
109
            for header in range(1, len(columnListAll[index])):
110
                item = QListWidgetItem(columnListAll[index][header], self.listWidgets[index])
111
                self.listWidgets[index].addItem(item)
112

  
113 106
        # tableWidget setting
114 107
        for index in range(len(self.tableWidgets)):
115 108
            self.tableWidgets[index].horizontalHeader().setSectionsMovable(True)
......
135 128
                self.tableWidgets[index].setColumnWidth(listIndex, len(headers[listIndex]) * 8 + 10)
136 129
            self.tableWidgets[index].hideColumn(0)
137 130

  
131
        savedBackground = False
132
        self.originBackground = None
133
        self.selectionBackground = QColor(255, 255, 255)
134

  
135
        # attribute list setting
136
        for index in range(len(self.listWidgets)):
137
            self.listWidgets[index].itemDoubleClicked.connect(self.items[index])
138
            for header in range(1, len(columnListAll[index])):
139
                item = QListWidgetItem(columnListAll[index][header])
140
                self.listWidgets[index].addItem(item)
141
                if savedBackground == False:
142
                    self.originBackground = item.background()
143
                    savedBackground = True
144
                for logical in range(self.tableWidgets[index].columnCount()):
145
                    if item.text() == self.tableWidgets[index].horizontalHeaderItem(logical).text():
146
                        item.setBackground(self.selectionBackground)
147
                        break
148

  
138 149
        self.ui.pushButtonApply.clicked.connect(self.pushButtonApplyClicked)
139 150
        self.ui.pushButtonClose.clicked.connect(self.pushButtonCloseClicked)
140 151

  
......
198 209
        @author     euisung
199 210
        @date       2018.10.25
200 211
    '''
201
    def listItemDoubleClicked(self, table, item):
212
    def listItemDoubleClicked(self, table, item, alist):
202 213
        if item == None:
203 214
            return
204 215
        for index in range(table.columnCount()):
......
208 219
        table.setColumnCount(table.columnCount() + 1)
209 220
        table.setHorizontalHeaderItem(table.columnCount() - 1, QTableWidgetItem(item.text()))
210 221
        table.setItem(0, table.columnCount() - 1, QTableWidgetItem(item.text()))
222
        table.horizontalHeaderItem(table.columnCount() - 1).setSizeHint(QSize(25, 25))
223
        table.setColumnWidth(table.columnCount() - 1, len(item.text()) * 8 + 10)
211 224
        table.horizontalHeader().moveSection(table.columnCount() - 1, 1)
225
        for logical in range(alist.count()):
226
            if item.text() == alist.item(logical).text():
227
                alist.item(logical).setBackground(self.selectionBackground)
228
                break
229
        
212 230

  
213 231
    def lineItemDoubleCliked(self, item):
214
        self.listItemDoubleClicked(self.tableWidgets[0], item)
232
        self.listItemDoubleClicked(self.tableWidgets[0], item, self.listWidgets[0])
215 233

  
216 234
    def equipmentItemDoubleCliked(self, item):
217
        self.listItemDoubleClicked(self.tableWidgets[1], item)
235
        self.listItemDoubleClicked(self.tableWidgets[1], item, self.listWidgets[1])
218 236
    
219 237
    def valveItemDoubleCliked(self, item):
220
        self.listItemDoubleClicked(self.tableWidgets[2], item)
238
        self.listItemDoubleClicked(self.tableWidgets[2], item, self.listWidgets[2])
221 239
    
222 240
    def instrumentItemDoubleCliked(self, item):
223
        self.listItemDoubleClicked(self.tableWidgets[3], item)
241
        self.listItemDoubleClicked(self.tableWidgets[3], item, self.listWidgets[3])
224 242
    
225 243
    def noteItemDoubleCliked(self, item):
226
        self.listItemDoubleClicked(self.tableWidgets[4], item)
244
        self.listItemDoubleClicked(self.tableWidgets[4], item, self.listWidgets[4])
227 245

  
228 246
    '''
229 247
        @brief      close without save
......
241 259
    def keyPressEvent(self, event):
242 260
        try:
243 261
            if event.key() == Qt.Key_Delete and self.selectedCol is not None:
262
                for logical in range(self.selectedCol[2].count()):
263
                    if self.selectedCol[0].horizontalHeaderItem(self.selectedCol[1]).text() == self.selectedCol[2].item(logical).text():
264
                        self.selectedCol[2].item(logical).setBackground(self.originBackground)
265
                        break
244 266
                self.selectedCol[0].removeColumn(self.selectedCol[1])
245 267
                self.selectedCol[0].setCurrentCell(0, self.selectedCol[1])
246 268
                
247 269
            QDialog.keyPressEvent(self, event)
248 270
        except Exception as ex:
271
            print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno))
272
            from App import App
273
            from AppDocData import MessageType
274

  
249 275
            message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
250
            self.addMessage.emit(MessageType.Error, message)
276
            App.mainWnd().addMessage.emit(MessageType.Error, message)
277
            return None
251 278

  
252 279
    '''
253 280
        @brief      add column by button clicked
254 281
        @author     euisung
255 282
        @date       2018.10.25
256 283
    '''
257
    def addClicked(self, table, attList):
258
        item = attList.currentItem()
259
        self.listItemDoubleClicked(table, item)
284
    def addClicked(self, table, alist):
285
        item = alist.currentItem()
286
        self.listItemDoubleClicked(table, item, alist)
260 287

  
261 288
    def lineAddClicked(self):
262 289
        self.addClicked(self.tableWidgets[0], self.listWidgets[0])
......
278 305
        @author     euisung
279 306
        @date       2018.10.25
280 307
    '''
281
    def deleteClicked(self, table):
308
    def deleteClicked(self, table, alist):
309
        if self.selectedCol is None:
310
            return
311
        for logical in range(self.selectedCol[2].count()):
312
            if self.selectedCol[0].horizontalHeaderItem(self.selectedCol[1]).text() == self.selectedCol[2].item(logical).text():
313
                self.selectedCol[2].item(logical).setBackground(self.originBackground)
314
                break
282 315
        table.removeColumn(table.currentColumn())
283 316
        self.selectedCol = []
284 317

  
285 318
    def lineDeleteClicked(self):
286
        self.deleteClicked(self.tableWidgets[0])
319
        self.deleteClicked(self.tableWidgets[0], self.listWidgets[0])
287 320

  
288 321
    def equipmentDeleteClicked(self):
289
        self.deleteClicked(self.tableWidgets[1])
322
        self.deleteClicked(self.tableWidgets[1], self.listWidgets[1])
290 323

  
291 324
    def valveDeleteClicked(self):
292
        self.deleteClicked(self.tableWidgets[2])
325
        self.deleteClicked(self.tableWidgets[2], self.listWidgets[2])
293 326

  
294 327
    def instrumentDeleteClicked(self):
295
        self.deleteClicked(self.tableWidgets[3])
328
        self.deleteClicked(self.tableWidgets[3], self.listWidgets[3])
296 329

  
297 330
    def noteDeleteClicked(self):
298
        self.deleteClicked(self.tableWidgets[4])
331
        self.deleteClicked(self.tableWidgets[4], self.listWidgets[4])
299 332

  
300 333
    '''
301 334
        @brief      table section clicked event, set selected column
302 335
        @author     euisung
303 336
        @date       2018.10.25
304 337
    '''
305
    def sectionClicked(self, table, logicalIndex):
338
    def sectionClicked(self, table, logicalIndex, alist):
306 339
        table.setCurrentCell(0, logicalIndex)
307
        self.selectedCol = [table, logicalIndex]
340
        self.selectedCol = [table, logicalIndex, alist]
308 341

  
309 342
    def lineSectionClicked(self, logicalIndex):
310
        self.sectionClicked(self.tableWidgets[0], logicalIndex)
343
        self.sectionClicked(self.tableWidgets[0], logicalIndex, self.listWidgets[0])
311 344

  
312 345
    def equipmentSectionClicked(self, logicalIndex):
313
        self.sectionClicked(self.tableWidgets[1], logicalIndex)
346
        self.sectionClicked(self.tableWidgets[1], logicalIndex, self.listWidgets[1])
314 347

  
315 348
    def valveSectionClicked(self, logicalIndex):
316
        self.sectionClicked(self.tableWidgets[2], logicalIndex)
349
        self.sectionClicked(self.tableWidgets[2], logicalIndex, self.listWidgets[2])
317 350

  
318 351
    def instrumentSectionClicked(self, logicalIndex):
319
        self.sectionClicked(self.tableWidgets[3], logicalIndex)
352
        self.sectionClicked(self.tableWidgets[3], logicalIndex, self.listWidgets[3])
320 353

  
321 354
    def noteSectionClicked(self, logicalIndex):
322
        self.sectionClicked(self.tableWidgets[4], logicalIndex)
355
        self.sectionClicked(self.tableWidgets[4], logicalIndex, self.listWidgets[4])
323 356

  
DTI_PID/DTI_PID/ItemDataFormat_UI.py
90 90
        self.splitter_2.setObjectName("splitter_2")
91 91
        self.listWidgetEquipment = QtWidgets.QListWidget(self.splitter_2)
92 92
        self.listWidgetEquipment.setMaximumSize(QtCore.QSize(200, 16777215))
93
        font = QtGui.QFont()
94
        font.setBold(False)
95
        font.setWeight(50)
96
        self.listWidgetEquipment.setFont(font)
93 97
        self.listWidgetEquipment.setObjectName("listWidgetEquipment")
94 98
        self.verticalLayoutWidget_2 = QtWidgets.QWidget(self.splitter_2)
95 99
        self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2")
......
245 249

  
246 250
    def retranslateUi(self, ItemDataFormatDialog):
247 251
        _translate = QtCore.QCoreApplication.translate
248
        ItemDataFormatDialog.setWindowTitle(_translate("ItemDataFormatDialog", "리스트 양식 설정"))
252
        ItemDataFormatDialog.setWindowTitle(_translate("ItemDataFormatDialog", "리스트 추출 양식 설정"))
249 253
        self.pushButtonApply.setText(_translate("ItemDataFormatDialog", "Apply"))
250 254
        self.pushButtonClose.setText(_translate("ItemDataFormatDialog", "Close"))
251 255
        self.pushButtonLineAdd.setText(_translate("ItemDataFormatDialog", "선택 속성 추가"))
DTI_PID/DTI_PID/UI/ItemDataFormat.ui
18 18
   </font>
19 19
  </property>
20 20
  <property name="windowTitle">
21
   <string>리스트 양식 설정</string>
21
   <string>리스트 추출 양식 설정</string>
22 22
  </property>
23 23
  <property name="modal">
24 24
   <bool>true</bool>
......
191 191
            <height>16777215</height>
192 192
           </size>
193 193
          </property>
194
          <property name="font">
195
           <font>
196
            <weight>50</weight>
197
            <bold>false</bold>
198
           </font>
199
          </property>
194 200
         </widget>
195 201
         <widget class="QWidget" name="verticalLayoutWidget_2">
196 202
          <layout class="QVBoxLayout" name="verticalLayout_2">

내보내기 Unified diff

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