Author: reinhard Date: 2010-10-20 07:46:14 -0500 (Wed, 20 Oct 2010) New Revision: 10205
Modified: trunk/gnue-forms/ trunk/gnue-forms/src/GFObjects/GFImage.py trunk/gnue-forms/src/uidrivers/wx/widgets/image.py Log: Honor label attribute for image elements. Property changes on: trunk/gnue-forms ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2010-10-20 14:44:25.436000109 +0200 committer: Reinhard Müller <reinhard.muel...@bytewise.at> properties: branch-nick: forms + timestamp: 2010-10-20 14:45:41.104000092 +0200 committer: Reinhard Müller <reinhard.muel...@bytewise.at> properties: branch-nick: forms Name: bzr:file-ids - src/GFParser.py 1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFParser.py + src/GFObjects/GFImage.py 3...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFImage.py src/uidrivers/wx/widgets/image.py 10...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Fuidrivers%2Fwx%2Fwidgets%2Fimage.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 + 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 Name: bzr:text-parents - src/GFParser.py reinhard.muel...@bytewise.at-20100512151744-2jx8tmtop30kl5n0 + src/GFObjects/GFImage.py svn-v3-single1-dHJ1bmsvZ251ZS1mb3Jtcw..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:10015 src/uidrivers/wx/widgets/image.py svn-v3-single1-dHJ1bmsvZ251ZS1mb3Jtcw..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:10117 Modified: trunk/gnue-forms/src/GFObjects/GFImage.py =================================================================== --- trunk/gnue-forms/src/GFObjects/GFImage.py 2010-10-20 12:46:11 UTC (rev 10204) +++ trunk/gnue-forms/src/GFObjects/GFImage.py 2010-10-20 12:46:14 UTC (rev 10205) @@ -43,6 +43,7 @@ # Default attributes (these may be replaced by parser) self.type = "URL" + self.label = None # ------------------------------------------------------------------------- @@ -55,7 +56,7 @@ # ------------------------------------------------------------------------- - # Implementation of virtual methods + # Phase 1 init # ------------------------------------------------------------------------- def _phase_1_init_(self): @@ -64,3 +65,15 @@ if not hasattr(self, 'Char__height'): self.Char__height = int(gConfigForms('widgetHeight')) + + # ------------------------------------------------------------------------- + # Indicate whether this widget makes use of the separate label column + # ------------------------------------------------------------------------- + + def __get_has_label(self): + + return (self.label is not None and self.style != 'checkbox') + + has_label = property(__get_has_label) + + Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/image.py =================================================================== --- trunk/gnue-forms/src/uidrivers/wx/widgets/image.py 2010-10-20 12:46:11 UTC (rev 10204) +++ trunk/gnue-forms/src/uidrivers/wx/widgets/image.py 2010-10-20 12:46:14 UTC (rev 10205) @@ -199,6 +199,15 @@ self.widget = ImageViewer(parent, self.image_size, self._gfObject.fit) + if self._gfObject.label: + # Replace blanks by non-breaking space to avoid random linebreaks + # in labels (sometimes done by wx, probably due to rounding errors + # in size calculations) + text = self._gfObject.label.replace(u" ", u"\240") + self.label = wx.StaticText(parent, -1, text) + else: + self.label = None + self.getParent().add_widgets(self, spacer) return self.widget @@ -248,6 +257,21 @@ pass + # ------------------------------------------------------------------------- + # Indicate whether this widget is growable + # ------------------------------------------------------------------------- + + def can_grow_x(self): + + return True + + # ------------------------------------------------------------------------- + + def can_grow_y(self): + + return True + + # ============================================================================= # Configuration data # ============================================================================= _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue