Author: reinhard Date: 2011-06-18 04:18:06 -0500 (Sat, 18 Jun 2011) New Revision: 10327
Modified: trunk/gnue-designer/ trunk/gnue-designer/src/templates/forms/FormBuilder.py trunk/gnue-designer/src/templates/forms/Simple.py Log: Implement Labels-Above by hbox in vbox. Update FormBuilder to match Simple form wizard. Property changes on: trunk/gnue-designer ___________________________________________________________________ Name: bzr:revision-info - timestamp: 2011-06-03 18:08:05.282999992 -0700 committer: whizman properties: branch-nick: designer + timestamp: 2011-06-09 13:52:51.492000103 -0700 committer: whizman properties: branch-nick: designer Name: bzr:file-ids - src/forms/PagePainter/PagePainter.py 8290@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:src%2Fforms%2FPagePainter%2FPagePainter.py src/forms/PagePainter/skins/default.py 8340@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:src%2Fforms%2FPagePainter%2Fskins%2Fdefault.py src/forms/document.py 8389@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:src%2Fforms%2Fdocument.py src/templates/forms/FormBuilder.py 2490@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:src%2Ftemplates%2Fforms%2FFormBuilder.py src/templates/forms/Simple.py 1411@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:src%2Ftemplates%2Fforms%2FSimple.py + src/templates/forms/FormBuilder.py 2490@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:src%2Ftemplates%2Fforms%2FFormBuilder.py src/templates/forms/Simple.py 1411@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:src%2Ftemplates%2Fforms%2FSimple.py Name: bzr:revision-id:v4 - 937 reinhard.muel...@bytewise.at-20100426083744-iq5ahvdxf38ltx6r 938 whizman_software_solutions_www.whizman.com-20110131201023-bmx4kgkf4erlim85 939 whizman_software_solutions_www.whizman.com-20110226005239-cn6eioyybe5p62rh 940 whizman-20110504201148-w669gtbff176vhop 941 whizman-20110505231025-243w4sfxhzqcbzt2 942 whizman-20110509181949-gnbxobve89qk8pr5 943 whizman-20110509204654-xx9cb9tiuszib409 944 whizman-20110519181636-ighctsn5h1uftknz 945 whizman-20110527230256-kqjr2eb33a29zy9o 946 whizman-20110527235820-zqeownp0345308ww 947 whizman-20110601222222-rvg8tu47q0x6y6rf 948 whizman-20110602174655-bbnm4cs5i6ht5mbg 949 whizman-20110604010805-vqpv6d319epfvvq0 + 937 reinhard.muel...@bytewise.at-20100426083744-iq5ahvdxf38ltx6r 938 whizman_software_solutions_www.whizman.com-20110131201023-bmx4kgkf4erlim85 939 whizman_software_solutions_www.whizman.com-20110226005239-cn6eioyybe5p62rh 940 whizman-20110504201148-w669gtbff176vhop 941 whizman-20110505231025-243w4sfxhzqcbzt2 942 whizman-20110509181949-gnbxobve89qk8pr5 943 whizman-20110509204654-xx9cb9tiuszib409 944 whizman-20110519181636-ighctsn5h1uftknz 945 whizman-20110527230256-kqjr2eb33a29zy9o 946 whizman-20110527235820-zqeownp0345308ww 947 whizman-20110601222222-rvg8tu47q0x6y6rf 948 whizman-20110602174655-bbnm4cs5i6ht5mbg 949 whizman-20110604010805-vqpv6d319epfvvq0 950 whizman-20110609205251-fos3f8ur2m1bnkgv Name: bzr:text-parents - src/forms/PagePainter/skins/default.py svn-v3-single1-dHJ1bmsvZ251ZS1kZXNpZ25lcg..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:9955 src/forms/document.py whizman-20110527230256-kqjr2eb33a29zy9o src/templates/forms/FormBuilder.py svn-v3-single1-dHJ1bmsvZ251ZS1kZXNpZ25lcg..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:9955 src/templates/forms/Simple.py svn-v3-single1-dHJ1bmsvZ251ZS1kZXNpZ25lcg..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-designer:9955 + Modified: trunk/gnue-designer/src/templates/forms/FormBuilder.py =================================================================== --- trunk/gnue-designer/src/templates/forms/FormBuilder.py 2011-06-18 09:18:03 UTC (rev 10326) +++ trunk/gnue-designer/src/templates/forms/FormBuilder.py 2011-06-18 09:18:06 UTC (rev 10327) @@ -404,7 +404,8 @@ # We will need a block to hold our fields... # The basic attributes for a block - attrs = {'name' : 'blk%s' % tableKey, + blockName = 'blk%s' % tableKey + attrs = {'name' : blockName, 'datasource': datasource['name']} # Create the block @@ -486,16 +487,16 @@ # based on the layout arrangement selected by the user. # - # # If this is a multirecord form, set rows at the block level. - # if multirecord: - # attrs['rows'] = 10 - # Grid/multirecord layout if multirecord: height += 13 width = 1 x = 1 + curParent = self.AddElement('grid', page, + {'block': blockName, + 'rows': 10}) + curParent = self.AddElement('gridline', curParent) for i in range(len(entryQueue)): field = entryQueue[i][0] @@ -508,13 +509,8 @@ entryQueue[i][2] = basey + 2 # If label width is larger than entry width, center the entry - # if hasattr(field, 'length'): - # entryWidth = min(field.length,40) or defaultWidth # beware None - # # max(min(field.length, 40),0) or defaultWidth - # else: - # entryWidth = defaultWidth try: - entryWidth = min(field['length'],40) + entryWidth = min(field['length'],40) or defaultWidth except KeyError: entryWidth = defaultWidth if entryWidth < textLen: @@ -533,6 +529,8 @@ # Assign the starting (x,y) values for labels (l) and fields (f) # as well as the delta (x,y) values. + curParent = self.AddElement('vbox', page, + {'block': blockName}) if leftlabels: # Labels to the left of the entries lx, ly, ldx, ldy = (1, 1, 0, 1) @@ -570,16 +568,21 @@ # for i in range(len(entryQueue)): + entryParent = curParent + # Labels above + if not multirecord and not leftlabels: + entryParent = self.AddElement('hbox', curParent, + {'block': blockName}) # - # First, the label + # Legacy was separate labels # - text, x, y = labelQueue[i] - self.AddElement( 'label', page, - {'Char:x': x, - 'Char:y': y, - 'name': "lbl%s" % fieldKey, - 'text': text, - 'Char:width': len(text)}) + labelText, x, y = labelQueue[i] + # self.AddElement( 'label', page, + # {'_posx': x, + # '_posy': y, + # 'name': "lbl%s" % fieldKey, + # 'text': text, + # '_poswidth': len(text)}) # # And the entry... @@ -588,19 +591,20 @@ attrs={'name': "ent%s" % field['name'][3:], 'field': field['name'], 'block': block['name'], - 'Char:x': x, - 'Char:y': y, - 'Char:width': defaultWidth } + 'label': labelText, + '_posx': x, + '_posy': y, + '_poswidth': defaultWidth } # If we have a length for the field, use this as the length # for the entry. Also, adjust the display width if necessary. try: - attrs['Char:width'] = min(field['length'], 40) + attrs['_poswidth'] = min(field['length'], 40) except KeyError: pass # Create the entry element - self.AddElement('entry', page, attrs) + self.AddElement('entry', entryParent, attrs) formwidth = max(formwidth, width) @@ -611,8 +615,8 @@ # Set the basic attributes of the form # self.form['title'] = self.variables['title'] - layout['Char:width'] = formwidth - layout['Char:height'] = formheight + layout['_poswidth'] = formwidth + layout['_posheight'] = formheight return 1 Modified: trunk/gnue-designer/src/templates/forms/Simple.py =================================================================== --- trunk/gnue-designer/src/templates/forms/Simple.py 2011-06-18 09:18:03 UTC (rev 10326) +++ trunk/gnue-designer/src/templates/forms/Simple.py 2011-06-18 09:18:06 UTC (rev 10327) @@ -276,15 +276,11 @@ # based on the layout arrangement selected by the user. # curParent = page - # If this is a multirecord form, set rows at the block level. - # managed-layout GFD: layout-grid rather than logic-block - # if multirecord: - # attrs['rows'] = 10 # Grid/multirecord layout if multirecord: - #height = 13 + height = 13 width = 1 x = 1 curParent = self.AddElement('grid', page, @@ -303,8 +299,8 @@ # If label width is larger than entry width, center the entry if hasattr(field, 'length'): - entryWidth = min(field.length,40) or defaultWidth # beware None - # max(min(field.length, 40),0) or defaultWidth + entryWidth = min(field['length'],40) or defaultWidth # beware None + # max(min(field['length'], 40),0) or defaultWidth else: entryWidth = defaultWidth if entryWidth < textLen: @@ -322,44 +318,43 @@ # Assign the starting (x,y) values for labels (l) and fields (f) # as well as the delta (x,y) values. + curParent = self.AddElement('vbox', page, + {'block': blockName}) if leftlabels: # Labels to the left of the entries - # lx, ly, ldx, ldy = (1, 1, 0, 1) - # fx, fy, fdx, fdy = (largestLabel + 2, 1, 0, 1) + lx, ly, ldx, ldy = (1, 1, 0, 1) + fx, fy, fdx, fdy = (largestLabel + 2, 1, 0, 1) # Set form width - # width = largestField + largestLabel + 3 - boxTag = 'vbox' + width = largestField + largestLabel + 3 + #boxTag = 'vbox' else: # Labels above the entries - boxTag = 'hbox' - # lx, ly, ldx, ldy = (1, 1, 0, 3) - # fx, fy, fdx, fdy = (1, 2, 0, 3) - # # Set the form width - # width = 2 + max(largestField, largestLabel) + #boxTag = 'hbox' + lx, ly, ldx, ldy = (1, 1, 0, 3) + fx, fy, fdx, fdy = (1, 2, 0, 3) + # Set the form width + width = 2 + max(largestField, largestLabel) - # Add appropriate box container - curParent = self.AddElement(boxTag, page, - {'block': blockName}) # Rearrange - #height = fy+2-fdy + height = fy+2-fdy for i in range(len(entryQueue)): - labelQueue[i][1] = 0 #lx - labelQueue[i][2] = 0 #ly - entryQueue[i][1] = 0 #fx - entryQueue[i][2] = 0 #fy + labelQueue[i][1] = lx + labelQueue[i][2] = ly + entryQueue[i][1] = fx + entryQueue[i][2] = fy - # ly = ly + ldy - # lx = lx + ldx - # fy = fy + fdy - # fx = fx + fdx - # height += fdy + ly = ly + ldy + lx = lx + ldx + fy = fy + fdy + fx = fx + fdx + height += fdy # # Resize the layout screen to fit our form # - # layout['Char:width'] = width - # layout['Char:height'] = height + # layout['_poswidth'] = width + # layout['_posheight'] = height # @@ -367,16 +362,21 @@ # for i in range(len(entryQueue)): + entryParent = curParent + # Labels above + if not multirecord and not leftlabels: + entryParent = self.AddElement('hbox', curParent, + {'block': blockName}) # # First, the label # labelText, x, y = labelQueue[i] # self.AddElement( 'label', curParent, - # {'Char:x': x, - # 'Char:y': y, + # {'_posx': x, + # '_posy': y, # 'name': "lbl%s" % (text[-1]==':' and text[:-1] or text), # 'text': text, - # 'Char:width': len(text)}) + # '_poswidth': len(text)}) # # And the entry... @@ -385,10 +385,10 @@ attrs={'name': "ent%s" % field['name'][3:], 'field': field['name'], 'block': block['name'], - 'label': labelText - #'Char:x': x, - #'Char:y': y, - #'Char:width': defaultWidth + 'label': labelText, + '_posx': x, + '_posy': y, + '_poswidth': defaultWidth } # If we have a length for the field, use this as the length @@ -396,13 +396,13 @@ # 2011-06: change to managed layout # if do anything with this in meantime, see hasattr above # try: - # attrs['Char:width'] = min(field['length'], 40) \ + # attrs['_poswidth'] = min(field['length'], 40) \ # or defaultWidth # beware None # except KeyError: # pass # Create the entry element - self.AddElement('entry', curParent, attrs) + self.AddElement('entry', entryParent, attrs) # That's it... we're done. _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org https://lists.gnu.org/mailman/listinfo/commit-gnue