def _get_row(self, row, autoadjust=False, require=True): """Return the row number 'row' from the database as a 'PresentedRow' instance. Arguments: row -- row number within the *database select*, starting from 0 autoadjust -- when true, 'row' is decreased by one if it is located behind an edited *new* row. Also when the 'row', equals to the number of the currently edited row (whether new or existing), this edited row is returned. require -- when true, the requested row must exist, otherwise 'None' is returned if the given row doesn't exist """ edited = self._edited_row if edited and row == edited.row: return edited.the_row elif edited and autoadjust and edited.the_row.new() and row > edited.row: row_ = row - 1 else: row_ = row success, result = db_operation(self._retrieve_row, row_, require=require) if not success: self._panic() return result
def _get_row(self, row, autoadjust=False, require=True): """Return the row number 'row' from the database as a 'PresentedRow' instance. Arguments: row -- row number within the *database select*, starting from 0 autoadjust -- when true, 'row' is decreased by one if it is located behind an edited *new* row. Also when the 'row', equals to the number of the currently edited row (whether new or existing), this edited row is returned. require -- when true, the requested row must exist, otherwise 'None' is returned if the given row doesn't exist """ edited = self._edited_row if edited and row == edited.row: return edited.the_row elif edited and autoadjust and edited.the_row.new( ) and row > edited.row: row_ = row - 1 else: row_ = row success, result = db_operation(self._retrieve_row, row_, require=require) if not success: self._panic() return result
def rewind(self, position=None): """Přesuň datové ukazovátko na začátek dat. Jestliže 'position' není 'None', přesuň ukazovátko na 'position'. """ if self._current_row is None: return if position is None: self._data.rewind() self._cache = self._DisplayCache() self._current_row = None elif position < -1 or position >= self.number_of_rows() - 1: pass else: row = position success, result = db_operation(self._retrieve_row, row) if not success: self._panic() self._presented_row.set_row(result) self._current_row = self._CurrentRow(row, copy.copy(self._presented_row))
def rewind(self, position=None): """Přesuň datové ukazovátko na začátek dat. Jestliže 'position' není 'None', přesuň ukazovátko na 'position'. """ if self._current_row is None: return if position is None: self._data.rewind() self._cache = self._DisplayCache() self._current_row = None elif position < -1 or position >= self.number_of_rows() - 1: pass else: row = position success, result = db_operation(self._retrieve_row, row) if not success: self._panic() self._presented_row.set_row(result) self._current_row = self._CurrentRow( row, copy.copy(self._presented_row))