UI/SymbolsWidget.py

changeset 367
e66ebdb3b6a2
parent 366
58f2122a5d6a
child 369
64d423a83450
equal deleted inserted replaced
366:58f2122a5d6a 367:e66ebdb3b6a2
161 @param index index of the character table (integer) 161 @param index index of the character table (integer)
162 @return first and last character position (integer, integer) 162 @return first and last character position (integer, integer)
163 """ 163 """
164 return self.__tables[index][0], self.__tables[index][1] 164 return self.__tables[index][0], self.__tables[index][1]
165 165
166 def getTableIndex(self):
167 """
168 Private method to get the current table index.
169
170 @return current table index (integer)
171 """
172 return self.__currentTableIndex
173
166 def selectTable(self, index): 174 def selectTable(self, index):
167 """ 175 """
168 Public method to select the shown character table. 176 Public method to select the shown character table.
169 177
170 @param index index of the character table (integer) 178 @param index index of the character table (integer)
343 351
344 index = self.__model.index( 352 index = self.__model.index(
345 int(Preferences.Prefs.settings.value("Symbols/Top", 0)), 353 int(Preferences.Prefs.settings.value("Symbols/Top", 0)),
346 0) 354 0)
347 self.symbolsTable.scrollTo(index, QAbstractItemView.PositionAtTop) 355 self.symbolsTable.scrollTo(index, QAbstractItemView.PositionAtTop)
348 self.symbolsTable.selectionModel().select(index, 356 self.symbolsTable.selectionModel().setCurrentIndex(index,
349 QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows) 357 QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows)
350 358
351 @pyqtSlot(QModelIndex) 359 @pyqtSlot(QModelIndex)
352 def on_symbolsTable_activated(self, index): 360 def on_symbolsTable_activated(self, index):
353 """ 361 """
363 def on_symbolSpinBox_editingFinished(self): 371 def on_symbolSpinBox_editingFinished(self):
364 """ 372 """
365 Private slot to move the table to the entered symbol id. 373 Private slot to move the table to the entered symbol id.
366 """ 374 """
367 id = self.symbolSpinBox.value() 375 id = self.symbolSpinBox.value()
368 self.symbolsTable.selectRow(id) 376 first, last = self.__model.getTableBoundaries(self.__model.getTableIndex())
377 row = id - first
378 self.symbolsTable.selectRow(row)
369 self.symbolsTable.scrollTo( 379 self.symbolsTable.scrollTo(
370 self.__model.index(id, 0), QAbstractItemView.PositionAtCenter) 380 self.__model.index(row, 0), QAbstractItemView.PositionAtCenter)
371 381
372 @pyqtSlot(int) 382 @pyqtSlot(int)
373 def on_tableCombo_currentIndexChanged(self, index): 383 def on_tableCombo_currentIndexChanged(self, index):
374 """ 384 """
375 Private slot to select the current character table. 385 Private slot to select the current character table.

eric ide

mercurial