Author: reinhard Date: 2010-12-02 14:47:40 -0600 (Thu, 02 Dec 2010) New Revision: 10251
Modified: trunk/gnue-forms/ trunk/gnue-forms/src/GFForm.py trunk/gnue-forms/src/GFObjects/GFBlock.py trunk/gnue-forms/src/GFObjects/GFEntry.py trunk/gnue-forms/src/GFObjects/GFField.py trunk/gnue-forms/src/GFObjects/GFTabStop.py trunk/gnue-forms/src/input/displayHandlers/Checkbox.py trunk/gnue-forms/src/input/displayHandlers/Cursor.py Log: Changed some function parameters for record index from relative offset to absolute number, so these functions can still work when there is no current record. Property changes on: trunk/gnue-forms ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2010-12-02 17:00:21.529000044 +0100 committer: Reinhard Müller <reinhard.muel...@bytewise.at> properties: branch-nick: forms + timestamp: 2010-12-02 18:46:43.677000046 +0100 committer: Reinhard Müller <reinhard.muel...@bytewise.at> properties: branch-nick: forms Name: bzr:file-ids - src/GFObjects/GFObj.py 1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFObj.py src/GFObjects/GFTabStop.py 3...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFTabStop.py src/input/displayHandlers/Cursor.py 7...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Finput%2FdisplayHandlers%2FCursor.py + src/GFForm.py 6...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFForm.py src/GFObjects/GFBlock.py 1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFBlock.py src/GFObjects/GFEntry.py 1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFEntry.py src/GFObjects/GFField.py 1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFField.py src/GFObjects/GFTabStop.py 3...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFTabStop.py src/input/displayHandlers/Checkbox.py 7...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Finput%2FdisplayHandlers%2FCheckbox.py src/input/displayHandlers/Cursor.py 7...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Finput%2FdisplayHandlers%2FCursor.py Name: bzr:revision-id:v4 - 3116 reinhard.muel...@bytewise.at-20100426083500-vtmq0qvd7htz02zx 3117 reinhard.muel...@bytewise.at-20100512151744-2jx8tmtop30kl5n0 3118 reinhard.muel...@bytewise.at-20100705094014-ks9yv7b8gs6ychrb 3119 reinhard.muel...@bytewise.at-20100706085143-hyxadj30ayg28jpx 3120 reinhard.muel...@bytewise.at-20100706140804-sn3npws1ykm81ubx 3121 reinhard.muel...@bytewise.at-20100909134008-5p7jq048nkutldse 3122 reinhard.muel...@bytewise.at-20100923144753-e8hthxho7n5mwg9z 3123 reinhard.muel...@bytewise.at-20100929193018-7r3injoy8g28fwm6 3124 reinhard.muel...@bytewise.at-20100930073631-ilf6smgjt6mfvkpz 3125 reinhard.muel...@bytewise.at-20101011191957-yaj9rkqbervc91ac 3126 reinhard.muel...@bytewise.at-20101020084039-jmfxjbctt6vc2usd 3127 reinhard.muel...@bytewise.at-20101020124425-0dpprxsmanmaenty 3128 reinhard.muel...@bytewise.at-20101020124541-zppkmzww1lnsk8x4 3129 reinhard.muel...@bytewise.at-20101020141905-vjg7r3wihnm7mxam 3130 reinhard.muel...@bytewise.at-20101020143045-pf9ywx1s3hdqbsh7 3131 reinhard.muel...@bytewise.at-20101020143328-ctfmr3fpp5quq1eo 3132 reinhard.muel...@bytewise.at-20101020152139-rlllh9m2qn45atcz 3133 reinhard.muel...@bytewise.at-20101020163022-tgnjcv18nzrc5sfw 3134 reinhard.muel...@bytewise.at-20101020165411-krluvclyw61ef9zp 3135 reinhard.muel...@bytewise.at-20101020185529-pmdkwkm59c1h630f 3136 reinhard.muel...@bytewise.at-20101020195954-1kd9avbmzkrzwzbt 3137 reinhard.muel...@bytewise.at-20101020202048-8q84nx5a54ifxkla 3138 reinhard.muel...@bytewise.at-20101027211256-o7pi879h2x1ceri2 3139 reinhard.muel...@bytewise.at-20101028135833-wftnu2r1cocknxyf 3140 reinhard.muel...@bytewise.at-20101028144709-dbamfa759xoeh127 3141 reinhard.muel...@bytewise.at-20101028145355-uhqftv7n1bcvuz8l 3142 reinhard.muel...@bytewise.at-20101028151042-ueeqwlufysjbke01 3143 reinhard.muel...@bytewise.at-20101028153459-522p7574jw2e11jj 3144 reinhard.muel...@bytewise.at-20101028164956-gua27xm7ad12a218 3145 reinhard.muel...@bytewise.at-20101028181046-hxaehghl84zx9ye0 3146 reinhard.muel...@bytewise.at-20101028194606-598w1lqua0te1m7j 3147 reinhard.muel...@bytewise.at-20101028205855-5k1f08wfdgofenjd 3148 reinhard.muel...@bytewise.at-20101102154340-basdvi9wrxzbx4va 3149 reinhard.muel...@bytewise.at-20101102155520-bbh74pv3qjur1epo 3150 reinhard.muel...@bytewise.at-20101112154024-57tv8mf0wbiycuw1 3151 reinhard.muel...@bytewise.at-20101112155954-ky2g6irsodlzg6yy 3152 reinhard.muel...@bytewise.at-20101114210345-8zsz8bdxtwjytkss 3153 reinhard.muel...@bytewise.at-20101114213813-m10tqf7r2elldh6l 3154 reinhard.muel...@bytewise.at-20101115202536-k0zrvggyt6jy8h0y 3155 reinhard.muel...@bytewise.at-20101122074637-ydmqkqy3udno2n5m 3156 reinhard.muel...@bytewise.at-20101122083336-1n0xys8y4ivtfzo4 3157 reinhard.muel...@bytewise.at-20101201210052-n8pz9fkj6z95zlo2 3158 reinhard.muel...@bytewise.at-20101202012351-kou0f0zchuws25al 3159 reinhard.muel...@bytewise.at-20101202125150-izgvlp3p35t6ny4q 3160 reinhard.muel...@bytewise.at-20101202145210-pf97mpvy5nvhkzqz 3161 reinhard.muel...@bytewise.at-20101202160021-cwhtwpidejk31t6w + 3116 reinhard.muel...@bytewise.at-20100426083500-vtmq0qvd7htz02zx 3117 reinhard.muel...@bytewise.at-20100512151744-2jx8tmtop30kl5n0 3118 reinhard.muel...@bytewise.at-20100705094014-ks9yv7b8gs6ychrb 3119 reinhard.muel...@bytewise.at-20100706085143-hyxadj30ayg28jpx 3120 reinhard.muel...@bytewise.at-20100706140804-sn3npws1ykm81ubx 3121 reinhard.muel...@bytewise.at-20100909134008-5p7jq048nkutldse 3122 reinhard.muel...@bytewise.at-20100923144753-e8hthxho7n5mwg9z 3123 reinhard.muel...@bytewise.at-20100929193018-7r3injoy8g28fwm6 3124 reinhard.muel...@bytewise.at-20100930073631-ilf6smgjt6mfvkpz 3125 reinhard.muel...@bytewise.at-20101011191957-yaj9rkqbervc91ac 3126 reinhard.muel...@bytewise.at-20101020084039-jmfxjbctt6vc2usd 3127 reinhard.muel...@bytewise.at-20101020124425-0dpprxsmanmaenty 3128 reinhard.muel...@bytewise.at-20101020124541-zppkmzww1lnsk8x4 3129 reinhard.muel...@bytewise.at-20101020141905-vjg7r3wihnm7mxam 3130 reinhard.muel...@bytewise.at-20101020143045-pf9ywx1s3hdqbsh7 3131 reinhard.muel...@bytewise.at-20101020143328-ctfmr3fpp5quq1eo 3132 reinhard.muel...@bytewise.at-20101020152139-rlllh9m2qn45atcz 3133 reinhard.muel...@bytewise.at-20101020163022-tgnjcv18nzrc5sfw 3134 reinhard.muel...@bytewise.at-20101020165411-krluvclyw61ef9zp 3135 reinhard.muel...@bytewise.at-20101020185529-pmdkwkm59c1h630f 3136 reinhard.muel...@bytewise.at-20101020195954-1kd9avbmzkrzwzbt 3137 reinhard.muel...@bytewise.at-20101020202048-8q84nx5a54ifxkla 3138 reinhard.muel...@bytewise.at-20101027211256-o7pi879h2x1ceri2 3139 reinhard.muel...@bytewise.at-20101028135833-wftnu2r1cocknxyf 3140 reinhard.muel...@bytewise.at-20101028144709-dbamfa759xoeh127 3141 reinhard.muel...@bytewise.at-20101028145355-uhqftv7n1bcvuz8l 3142 reinhard.muel...@bytewise.at-20101028151042-ueeqwlufysjbke01 3143 reinhard.muel...@bytewise.at-20101028153459-522p7574jw2e11jj 3144 reinhard.muel...@bytewise.at-20101028164956-gua27xm7ad12a218 3145 reinhard.muel...@bytewise.at-20101028181046-hxaehghl84zx9ye0 3146 reinhard.muel...@bytewise.at-20101028194606-598w1lqua0te1m7j 3147 reinhard.muel...@bytewise.at-20101028205855-5k1f08wfdgofenjd 3148 reinhard.muel...@bytewise.at-20101102154340-basdvi9wrxzbx4va 3149 reinhard.muel...@bytewise.at-20101102155520-bbh74pv3qjur1epo 3150 reinhard.muel...@bytewise.at-20101112154024-57tv8mf0wbiycuw1 3151 reinhard.muel...@bytewise.at-20101112155954-ky2g6irsodlzg6yy 3152 reinhard.muel...@bytewise.at-20101114210345-8zsz8bdxtwjytkss 3153 reinhard.muel...@bytewise.at-20101114213813-m10tqf7r2elldh6l 3154 reinhard.muel...@bytewise.at-20101115202536-k0zrvggyt6jy8h0y 3155 reinhard.muel...@bytewise.at-20101122074637-ydmqkqy3udno2n5m 3156 reinhard.muel...@bytewise.at-20101122083336-1n0xys8y4ivtfzo4 3157 reinhard.muel...@bytewise.at-20101201210052-n8pz9fkj6z95zlo2 3158 reinhard.muel...@bytewise.at-20101202012351-kou0f0zchuws25al 3159 reinhard.muel...@bytewise.at-20101202125150-izgvlp3p35t6ny4q 3160 reinhard.muel...@bytewise.at-20101202145210-pf97mpvy5nvhkzqz 3161 reinhard.muel...@bytewise.at-20101202160021-cwhtwpidejk31t6w 3162 reinhard.muel...@bytewise.at-20101202174643-d9ydcs06o8kfy8h7 Name: bzr:text-parents - src/GFObjects/GFObj.py svn-v3-single1-dHJ1bmsvZ251ZS1mb3Jtcw..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:10149 src/GFObjects/GFTabStop.py reinhard.muel...@bytewise.at-20101112154024-57tv8mf0wbiycuw1 src/input/displayHandlers/Cursor.py reinhard.muel...@bytewise.at-20100706140804-sn3npws1ykm81ubx + src/GFForm.py reinhard.muel...@bytewise.at-20101201210052-n8pz9fkj6z95zlo2 src/GFObjects/GFBlock.py reinhard.muel...@bytewise.at-20101202145210-pf97mpvy5nvhkzqz src/GFObjects/GFEntry.py reinhard.muel...@bytewise.at-20101122083336-1n0xys8y4ivtfzo4 src/GFObjects/GFField.py reinhard.muel...@bytewise.at-20101201210052-n8pz9fkj6z95zlo2 src/input/displayHandlers/Checkbox.py reinhard.muel...@bytewise.at-20100706140804-sn3npws1ykm81ubx Modified: trunk/gnue-forms/src/GFForm.py =================================================================== --- trunk/gnue-forms/src/GFForm.py 2010-12-02 20:47:36 UTC (rev 10250) +++ trunk/gnue-forms/src/GFForm.py 2010-12-02 20:47:40 UTC (rev 10251) @@ -489,7 +489,7 @@ # ------------------------------------------------------------------------- - def _event_focus_changed(self, target, row_offset): + def _event_focus_changed(self, target, record_number): """ Notify the form that the user has moved the focus with a mouse click. @@ -503,7 +503,7 @@ try: self.endEditing() try: - self.__move_focus(target, row_offset) + self.__move_focus(target, record_number) finally: self.beginEditing() except: @@ -894,7 +894,7 @@ # If we've not yet reached the end of the entry list, we just forward # the focus to the next entry. if nextEntry != firstEntry: - self.change_focus(nextEntry, 0) + self.change_focus(nextEntry) return # We have reached the end of the entry list. Do we want to navigate to @@ -903,12 +903,12 @@ if currentBlock.autoNextRecord and \ operation in currentBlock.get_possible_operations(): if reverse: - offset = -1 + direction = "-" else: - offset = 1 + direction = "+" else: - offset = 0 - self.change_focus(nextEntry, offset) + direction = None + self.change_focus(nextEntry, direction) return # We've reached the end of the page. Do we want to jump to the next @@ -919,7 +919,7 @@ list = pages[i+1:] + pages[:i] self.__find_and_change_focus(list, reverse) else: - self.change_focus(nextEntry, 0) + self.change_focus(nextEntry) # ------------------------------------------------------------------------- @@ -1003,7 +1003,7 @@ entry = self.__find_focus(list, last) if entry: - self.change_focus(entry, 0) + self.change_focus(entry) # ------------------------------------------------------------------------- @@ -1076,19 +1076,23 @@ # Changes to the requested entry object requested by an event source # ------------------------------------------------------------------------- - def change_focus(self, widget, row_offset): + def change_focus(self, widget, record_number=None): """ Changes focus to the requested entry object on GF and UI layer. @param widget: entry or page to put focus on. If it is a page, the form changes to that page and does not focus any widget. This is useful to activate a page without a focusable widget on it. + + @param record_number: record number to jump to, or None to keep the + current record, or "+" to move to the next record, or "-" to move + to the previous record. """ self.endEditing() old_page = self._currentPage try: - self.__move_focus(widget, row_offset) + self.__move_focus(widget, record_number) if self._currentPage != old_page: self.uiWidget._ui_goto_page_(self._currentPage.uiWidget) finally: @@ -1101,14 +1105,8 @@ # Changes to the requested entry object requested by an event source # ------------------------------------------------------------------------- - def __move_focus(self, widget, row_offset): - """ - Changes focus to the requested entry object on GF layer. + def __move_focus(self, widget, record_number): - @param widget: entry to put focus on - @param row_offset: number of rows to jump up or down in new widget - """ - assert gDebug(5, "Change focus: %s->%s" % (self._currentEntry, widget)) if isinstance(widget, GFTabStop): @@ -1126,7 +1124,7 @@ # if we move the record pointer, we also want to run the block-level # focus in and focus out triggers - blockChange = (new_block != self._currentBlock) or row_offset != 0 + blockChange = (new_block != self._currentBlock) or record_number is not None pageChange = (new_page != self._currentPage) self.__editing_blocked = True @@ -1158,11 +1156,12 @@ self._currentEntry = None self._currentBlock = None - if row_offset == 1: - # Special case: next_record() can also trigger a new_record() + if record_number == '+': new_block.next_record() - elif row_offset != 0: - new_block.jump_records(row_offset) + elif record_number == '-': + new_block.prev_record() + elif record_number is not None: + new_block.goto_record(record_number) self._currentEntry = new_entry self._currentBlock = new_block Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py =================================================================== --- trunk/gnue-forms/src/GFObjects/GFBlock.py 2010-12-02 20:47:36 UTC (rev 10250) +++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2010-12-02 20:47:40 UTC (rev 10251) @@ -57,11 +57,11 @@ L{next_record}, L{last_record}, L{goto_record}, L{jump_records}, and L{search_record} methods. - Read and write access to the data of the current record (and the - surrounding records) is possible with the L{get_value} and L{set_value} - methods. New records can be inserted with the L{new_record} and - L{duplicate_record} methods. Records can be marked for deletion at next - commit with the L{delete_record} method and this mark can be undone with + Read and write access to the data of the current record (and to any other + record) is possible with the L{get_value} and L{set_value} methods. New + records can be inserted with the L{new_record} and L{duplicate_record} + methods. Records can be marked for deletion at next commit with the + L{delete_record} method and this mark can be undone with L{undelete_record}. The L{post} and L{requery} methods are available to write the block's @@ -930,34 +930,40 @@ # Status information # ------------------------------------------------------------------------- - def get_record_status(self, offset=0): + def get_record_status(self, record_number=None): """ - Find out about the status of the record. + Find out about the status of a record. The status can be one of 'empty', 'inserted', 'void', 'clean', - 'modified', or 'deleted', or C{None} if there is no current record. + 'modified', or 'deleted', or C{None} if the block is unbound or in + query mode, the given record doesn't exist, or the current record was + selected and there is no current record. + + @param record_number: the record number to investigate, or None for the + current record. """ if self._dataSourceLink.type == 'unbound': return None - elif self.mode == 'query': + if self.mode == 'query': return None - elif self.mode == 'init': + if self.mode == 'init' and record_number is None: rec = self.__initializing_record - else: if self.__resultset is None: return None - record_number = self.__resultset.getRecordNumber() + offset + if record_number is None: + record_number = self.__resultset.getRecordNumber() + if record_number < 0 or \ record_number >= self.__resultset.getRecordCount(): return None - else: - rec = self.__resultset[record_number] + rec = self.__resultset[record_number] + # try functions that do not depend on detail records first, because # they are faster if rec.isVoid(): @@ -1100,40 +1106,39 @@ # Field access # ------------------------------------------------------------------------- - def get_value(self, field, offset): + def get_value(self, field, record_number): """ Return the value of the given field, depending on the block's state. @param field: the GFField object. - @param offset: the offset from the current record (to get data for - records other than the current one). + @param record_number: the record number to get the value from, or None + for the current record. """ - if offset == 0: - if self.mode == 'query' and self.queryable: - value = self.__query_values.get(field) + if self.mode == 'query' and self.queryable: + if record_number is None or record_number == 0: + return self.__query_values.get(field) + else: + return None - elif self.mode == 'init': - value = self.__initializing_record[field.field] - + if self.mode == 'init': + if record_number is None: + return self.__initializing_record[field.field] else: - if self.__resultset and self.__resultset.current: - value = self.__resultset.current[field.field] - else: - value = None - else: - if self.mode in ['query', 'init'] or self.__resultset is None: - value = None - else: - record_number = self.__resultset.getRecordNumber() + offset - if record_number < 0 or \ - record_number >= self.__resultset.getRecordCount(): - value = None - else: - value = self.__resultset[record_number][field.field] + return None - return value + if self.__resultset is None: + return None + if record_number is None: + record_number = self.__resultset.getRecordNumber() + + if record_number < 0 or \ + record_number >= self.__resultset.getRecordCount(): + return None + + return self.__resultset[record_number][field.field] + # ------------------------------------------------------------------------- def set_value(self, field, value): @@ -1394,11 +1399,10 @@ self.mode = 'normal' try: - for recno in xrange(0, self.__resultset.getRecordCount()): - offset = recno - self.__resultset.getRecordNumber() + for record_number in xrange(0, self.__resultset.getRecordCount()): add = {} for field in fields: - add[field.name] = field.get_value(offset) + add[field.name] = field.get_value(record_number) result.append(add) finally: self.mode = save_mode Modified: trunk/gnue-forms/src/GFObjects/GFEntry.py =================================================================== --- trunk/gnue-forms/src/GFObjects/GFEntry.py 2010-12-02 20:47:36 UTC (rev 10250) +++ trunk/gnue-forms/src/GFObjects/GFEntry.py 2010-12-02 20:47:40 UTC (rev 10251) @@ -122,10 +122,10 @@ # Consider empty labels disabled. This makes a difference for # the enclosing boxes. if index is None: - offset = 0 + record_number = None else: - offset = index - self._visibleIndex - return (self._field.get_value(offset) is not None) + record_number = self.visible_offset + index + return (self._field.get_value(record_number) is not None) else: return GFFieldBound._is_enabled_(self, index) Modified: trunk/gnue-forms/src/GFObjects/GFField.py =================================================================== --- trunk/gnue-forms/src/GFObjects/GFField.py 2010-12-02 20:47:36 UTC (rev 10250) +++ trunk/gnue-forms/src/GFObjects/GFField.py 2010-12-02 20:47:40 UTC (rev 10251) @@ -284,7 +284,7 @@ # Determine wether a field is editable or not # ------------------------------------------------------------------------- - def is_editable(self, offset=0): + def is_editable(self, record_number=None): if self._block.mode == 'query' or self.autosearch: return self._block.queryable @@ -297,7 +297,7 @@ if self.editable == 'N': return False - new = (self._block.get_record_status(offset) \ + new = (self._block.get_record_status(record_number) \ in ['empty', 'inserted', 'void']) if self._block.editable == 'new' and not new: @@ -310,7 +310,8 @@ if self.editable == 'update' and new: return False - if self.editable == 'null' and self.__get_value(offset) is not None: + if self.editable == 'null' \ + and self.__get_value(record_number) is not None: return False return True @@ -402,16 +403,16 @@ # Reading and writing the user value of the field # ------------------------------------------------------------------------- - def get_value(self, offset=0): + def get_value(self, record_number=None): """ Return the current user value of the field. For lookup fields, this is the foreign key description. """ if not self.__is_lookup: - return self.__get_value(offset) + return self.__get_value(record_number) - db_value = self.__get_value(offset) + db_value = self.__get_value(record_number) if self._block.mode == 'query' and db_value == chr(0): return u_("(empty)") @@ -450,17 +451,10 @@ # Reading and writing the DB value of a field # ------------------------------------------------------------------------- - def __get_value(self, offset=0): - """ - Return the current value of the field, depending on the state of the - form and the block. + def __get_value(self, record_number=None): - @param offset: offset from the current record (to get values of records - other than the current record). - """ + value = self._block.get_value(self, record_number) - value = self._block.get_value(self, offset) - if isinstance(value, datatypes.InvalidValueType): raise value.exception Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py =================================================================== --- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2010-12-02 20:47:36 UTC (rev 10250) +++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2010-12-02 20:47:40 UTC (rev 10251) @@ -143,7 +143,8 @@ and index == self._visibleIndex: return - self._form._event_focus_changed(self, index - self._visibleIndex) + self._form._event_focus_changed(self, + self.__first_visible_record + index) # ------------------------------------------------------------------------- @@ -232,6 +233,39 @@ # ------------------------------------------------------------------------- + # Information about the visible records + # ------------------------------------------------------------------------- + + @property + def visible_offset(self): + """ + Record number of the first visible record in this entry. + + If this entry is part of a grid, this property contains the record + number of the record visible in the first line. This is equal to the + number of records which have scrolled out through the top of the grid. + + If this entry is not part of a grid, this property simply contains the + record number currently visible in the entry, or None if no record is + visible (because there is no current record). + """ + return self.__first_visible_record + + @property + def visible_index(self): + """ + Zero-based index of the current record within the visible records. + + If this entry is part of a grid, this property contains the row number + that holds the current record. Numbering starts with zero. If the + current record is not visible in the grid (for example, because there + is no current record set), this property holds None. + + If this entry is not part of a grid, this property always contains 0. + """ + return self._visibleIndex + + # ------------------------------------------------------------------------- # Recalculate the visible index of an object # ------------------------------------------------------------------------- @@ -395,7 +429,7 @@ return False # Attached field is not editable in current mode: not navigable. - if isinstance(self, GFFieldBound) and not self._field.is_editable(0): + if isinstance(self, GFFieldBound) and not self._field.is_editable(): return False # Control not navigable in query mode. @@ -415,7 +449,7 @@ Move the UI and GF focus to this object. """ - self._form.change_focus(self, index - self._visibleIndex) + self._form.change_focus(self, self.__first_visible_record + index) # ------------------------------------------------------------------------- @@ -595,10 +629,10 @@ return False else: if index is None: - offset = 0 + record_number = None else: - offset = index - self._visibleIndex - return self._field.is_editable(offset) + record_number = self.visible_offset + index + return self._field.is_editable(record_number) # ------------------------------------------------------------------------- @@ -717,7 +751,7 @@ if not (index == self._visibleIndex \ and self._displayHandler.editing): try: - value = self._field.get_value(index - self._visibleIndex) + value = self._field.get_value(self.visible_offset + index) except Exception: # invalid value value = None display = self._displayHandler.build_display(value, False) Modified: trunk/gnue-forms/src/input/displayHandlers/Checkbox.py =================================================================== --- trunk/gnue-forms/src/input/displayHandlers/Checkbox.py 2010-12-02 20:47:36 UTC (rev 10250) +++ trunk/gnue-forms/src/input/displayHandlers/Checkbox.py 2010-12-02 20:47:40 UTC (rev 10251) @@ -116,7 +116,7 @@ def beginEdit(self): - self.editing = self.field.is_editable(0) + self.editing = self.field.is_editable() self.display = self.build_display(self.field.get_value(), self.editing) self.modified = False self._cursor = 0 Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py =================================================================== --- trunk/gnue-forms/src/input/displayHandlers/Cursor.py 2010-12-02 20:47:36 UTC (rev 10250) +++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py 2010-12-02 20:47:40 UTC (rev 10251) @@ -139,7 +139,7 @@ with this display handler, and creates the string to display in the form. """ - self.editing = self.field.is_editable(0) + self.editing = self.field.is_editable() self.modified = False self.display = self.build_display(self.field.get_value(), self.editing) self._cursor = len(self.display) _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue