개정판 892c2550
issue #000: add arrow key in text data list
Change-Id: I23eb2deb49d11fc16ecb16b8720beb5eb6d8e2ad
DTI_PID/DTI_PID/TextDataListDialog.py | ||
---|---|---|
45 | 45 |
|
46 | 46 |
self.ui.tableWidget.verticalHeader().setDefaultSectionSize(60) |
47 | 47 |
self.ui.tableWidget.setRowCount(len(self.textItems)) |
48 |
self.ui.tableWidget.keyPressEvent = self.keyPressEvent |
|
48 | 49 |
|
49 | 50 |
row = 0 |
50 | 51 |
allowed_error = 0.001 |
... | ... | |
126 | 127 |
# item already was deleted from scene |
127 | 128 |
QMessageBox.warning(self, 'Notice', 'The item does not exist in the scene.') |
128 | 129 |
self.ui.tableWidget.removeRow(row) |
130 |
|
|
131 |
def listCellClicked(self, row, col): |
|
132 |
from HighlightCommand import HighlightCommand |
|
133 |
|
|
134 |
HighlightCommand(self.graphicsView).execute(self.ui.tableWidget.item(row, 1).tag) |
|
129 | 135 |
|
130 | 136 |
def keyPressEvent(self, event): |
131 | 137 |
try: |
132 | 138 |
if event.key() == Qt.Key_Delete: |
133 | 139 |
self.pushButtonDeleteClicked() |
134 |
|
|
135 |
QDialog.keyPressEvent(self, event) |
|
140 |
|
|
141 |
try: |
|
142 |
row = self.ui.tableWidget.selectedIndexes()[0].row() |
|
143 |
col = self.ui.tableWidget.selectedIndexes()[0].column() |
|
144 |
from HighlightCommand import HighlightCommand |
|
145 |
if event.key() == Qt.Key_Up: |
|
146 |
if row is not 0: |
|
147 |
row -= 1 |
|
148 |
HighlightCommand(self.graphicsView).execute(self.ui.tableWidget.item(row, 1).tag) |
|
149 |
self.ui.tableWidget.setCurrentItem(self.ui.tableWidget.item(row, col)) |
|
150 |
self.ui.tableWidget.scrollToItem(self.ui.tableWidget.item(row, col), QAbstractItemView.EnsureVisible) |
|
151 |
elif event.key() == Qt.Key_Down: |
|
152 |
if row is not self.ui.tableWidget.rowCount() - 1: |
|
153 |
row +=1 |
|
154 |
HighlightCommand(self.graphicsView).execute(self.ui.tableWidget.item(row, 1).tag) |
|
155 |
self.ui.tableWidget.setCurrentItem(self.ui.tableWidget.item(row, col)) |
|
156 |
self.ui.tableWidget.scrollToItem(self.ui.tableWidget.item(row, col), QAbstractItemView.EnsureVisible) |
|
157 |
except Exception as ex: |
|
158 |
pass |
|
159 |
|
|
160 |
#QDialog.keyPressEvent(self, event) |
|
161 |
|
|
136 | 162 |
except Exception as ex: |
137 | 163 |
from App import App |
138 | 164 |
from AppDocData import MessageType |
139 | 165 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
140 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
141 |
|
|
142 |
def listCellClicked(self, row, col): |
|
143 |
from HighlightCommand import HighlightCommand |
|
144 |
|
|
145 |
HighlightCommand(self.graphicsView).execute(self.ui.tableWidget.item(row, 1).tag) |
|
166 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
내보내기 Unified diff