Author: reinhard Date: 2010-10-28 13:52:32 -0500 (Thu, 28 Oct 2010) New Revision: 10221
Modified: trunk/gnue-forms/ trunk/gnue-forms/src/GFObjects/GFBlock.py Log: Disallow "normal" insert operations when a block has an autosearch field, since inserts in such blocks have to be done by entering the new key. Property changes on: trunk/gnue-forms ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2010-10-27 23:12:56.453000069 +0200 committer: Reinhard Müller <reinhard.muel...@bytewise.at> properties: branch-nick: forms + timestamp: 2010-10-28 15:58:33.852999926 +0200 committer: Reinhard Müller <reinhard.muel...@bytewise.at> properties: branch-nick: forms Name: bzr:file-ids - src/uidrivers/wx/widgets/button.py 10...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Fuidrivers%2Fwx%2Fwidgets%2Fbutton.py src/uidrivers/wx/widgets/entry.py 10...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Fuidrivers%2Fwx%2Fwidgets%2Fentry.py + src/GFObjects/GFBlock.py 1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFBlock.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 + 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 Name: bzr:text-parents - src/uidrivers/wx/widgets/button.py svn-v3-single1-dHJ1bmsvZ251ZS1mb3Jtcw..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:10116 src/uidrivers/wx/widgets/entry.py reinhard.muel...@bytewise.at-20100909134008-5p7jq048nkutldse + src/GFObjects/GFBlock.py reinhard.muel...@bytewise.at-20101020202048-8q84nx5a54ifxkla Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py =================================================================== --- trunk/gnue-forms/src/GFObjects/GFBlock.py 2010-10-28 18:52:29 UTC (rev 10220) +++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2010-10-28 18:52:32 UTC (rev 10221) @@ -365,7 +365,7 @@ self.__scrolling_blocked = True try: if not self.__resultset.firstRecord(): - if self.editable in ('Y', 'new'): + if self.__can_insert(): self.__resultset.insertRecord(self._lastValues) finally: self.__scrolling_blocked = False @@ -772,7 +772,7 @@ if self.__resultset.isLastRecord(): if self.autoCreate and self.get_record_status() != 'empty' and \ - not self.editable in('update', 'N'): + self.__can_insert(): self.new_record() return True return False @@ -1003,18 +1003,17 @@ result.append('last_record') result.append('goto_record') - if not self._form.readonly: - if self.editable in ('Y', 'new') and status != 'empty': - result.append('new_record') - result.append('duplicate_record') - if self.autoCreate and rs.isLastRecord(): - result.append('next_record') + if self.__can_insert() and status != 'empty': + result.append('new_record') + result.append('duplicate_record') + if self.autoCreate and rs.isLastRecord(): + result.append('next_record') - if self.deletable: - if status not in ('void', 'deleted'): - result.append('delete_record') - else: - result.append('undelete_record') + if self.__can_delete(): + if status not in ('void', 'deleted'): + result.append('delete_record') + else: + result.append('undelete_record') return result @@ -1637,6 +1636,34 @@ # ------------------------------------------------------------------------- + # Operations available through the user interface + # ------------------------------------------------------------------------- + + def __can_insert(self): + + if self._form.readonly: + return False + + if self.editable in ['N', 'update']: + return False + + for field in self._fieldMap.itervalues(): + if field.autosearch: + return False + + return True + + # ------------------------------------------------------------------------- + + def __can_delete(self): + + if self._form.readonly: + return False + + return self.deletable + + + # ------------------------------------------------------------------------- # Create a condition tree # ------------------------------------------------------------------------- _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue