Paul,

Sorry to bother you once more, but it seems my commits are still not 
identified with my name...
Not important, but may cause some confusion

Regards,
Pedro Vale de Gato

[email protected] wrote:
> dabo Commit
> Revision 5056
> Date: 2009-02-10 15:42:58 -0800 (Tue, 10 Feb 2009)
> Author: Pedro.Gato
> Trac: http://trac.dabodev.com/changeset/5056
>
> Changed:
> U   trunk/dabo/lib/datanav/Form.py
>
> Log:
> Added support for grid columns configuration in datanav2
>
>
> Diff:
> Modified: trunk/dabo/lib/datanav/Form.py
> ===================================================================
> --- trunk/dabo/lib/datanav/Form.py    2009-02-10 15:03:04 UTC (rev 5055)
> +++ trunk/dabo/lib/datanav/Form.py    2009-02-10 23:42:58 UTC (rev 5056)
> @@ -128,6 +128,10 @@
>                       tb.appendSeparator()
>  
>               if self.FormType == "Normal":
> +                     self.appendToolBarButton(_("Configure Grid"), 
> "%s/categories/preferences-system.png" % iconPath,
> +                                     OnHit=self.onConfigGrid, 
> tip=_("Configure Grid"), 
> +                                     help=_("Configure grid columns"))
> +
>                       self.appendToolBarButton(_("Quick Report"), 
> "%s/actions/document-print-preview.png" % iconPath,
>                                       OnHit=self.onQuickReport, tip=_("Quick 
> Report"), Enabled=_has_reporting_libs,
>                                       help=_("Run a Quick Report on the 
> current dataset"))
> @@ -226,7 +230,64 @@
>  
>               return menu
>  
> +     def onConfigGrid(self, evt):
> +             try:
> +                     grid = self.PageFrame.Pages[1].BrowseGrid
> +                     ds = grid.DataSet
> +             except:
> +                     dabo.ui.info(_("Sorry, there are no records in the 
> grid, please requery first."))
> +                     return
> +             
> +             #cols
> +             cols = [col.Caption for col in grid.Columns]
> +             
> +             #keys
> +             keys = [col.DataField for col in grid.Columns]
>  
> +             class GridColumnsDialog(dabo.ui.dOkCancelDialog):
> +
> +                     def addControls(self):
> +                             self.addObject(dabo.ui.dLabel, RegID="label", 
> +                                             Caption=_("You can customize 
> grid appearence by selecting\nthe columns you wish to see bellow:"), 
> WordWrap=True)
> +                             
> +                             self.addObject(dabo.ui.dCheckList, 
> RegID="columns",
> +                                             Height=150, ValueMode="Key",
> +                                             Choices=cols, 
> +                                             Keys=keys)
> +
> +                             for col in grid.Columns:
> +                                     if col.Visible:
> +                                             
> self.columns.setSelection(col.ColumnIndex)
> +
> +                             self.Sizer.DefaultBorder = 5
> +                             self.Sizer.DefaultBorderAll = True
> +
> +                             self.Sizer.append(self.label, border=5)
> +                             self.Sizer.append1x(self.columns)
> +
> +                     def runOK(self):
> +                             self.selectedColumns = self.columns.Value
> +
> +                     def runCancel(self):
> +                             self.selectedColumns = None
> +                             
> +             d = GridColumnsDialog(self, Caption=_("Select Columns"))
> +             d.show()
> +
> +             #the user has canceled, just return
> +             if d.selectedColumns == None:
> +                     return
> +
> +             for col in grid.Columns:
> +                     if col.DataField in d.selectedColumns:
> +                             col.Visible = True
> +                     else:
> +                             col.Visible = False
> +
> +             #release the window
> +             d.release()
> +
> +
>       def onDelete(self, evt):
>               super(Form, self).onDelete(evt)
>               # Make sure that the grid is properly updated.
>
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to