On 09/12/2013 04:50 AM, Ricardo Aráoz wrote:
El 12/09/13 08:02, Ricardo Aráoz escribió:
El 12/09/13 01:46, Paul McNett escribió:
On 9/11/13 8:40 PM, Ricardo Aráoz wrote:
I've tried this (see below), and yet the grid won't remember the
column widths. The
window and other stuff are remembered.
I've also tried the code with the "import dabo.dPref as dPref" and
"app.PreferenceManager =....." commented out, i.e. with no code
referring to the
Preferences, and it doesn't work either.
Can you make sure it works in a plain dabo app? Run
dabo/dabo/ui/uiwx/dGrid.py,
adjust the column width of a column, and quit. Then run it again.
Did that work?
dGrid.py works ok. I'll take a look at it's code and try to figure
out what's going on. Or I'll get the smallest app that shows the
behaviour.
Thanks
Ok, couldn't understand dGrid.py test (too complicated for me). So I
got a working example that displays said behaviour (see code below).
That is, you adjust the column widths and the adjustment won't persist.
This is :
Try below. But notice I add the columns and I set the BasePrefKey. You
need to set the BasePrefKey because you might have a namespace (I guess
that's what you call it when dealing with user preferences for objects)
conflict. I think you were resetting the columns each time.
import dabo
dabo.ui.loadUI('wx')
import wx
import datetime
thisYear = datetime.datetime.now().year
ds = [{"name": "Ed Leafe", "age": thisYear - 1957, "coder": True,
"color": "cornsilk"},
{"name": "Paul McNett", "age": thisYear - 1969, "coder": True,
"color": "wheat"},
{"name": "Ted Roche", "age": thisYear - 1958, "coder": True,
"color": "goldenrod"},
{"name": "Derek Jeter", "age": thisYear - 1974,
"coder": False, "color": "white"},
{"name": "Halle Berry", "age": thisYear - 1966,
"coder": False, "color": "orange"},
{"name": "Steve Wozniak", "age": thisYear - 1950,
"coder": True, "color": "yellow"},
{"name": "LeBron James", "age": thisYear - 1984,
"coder": False, "color": "gold"},
{"name": "Madeline Albright", "age": thisYear - 1937,
"coder": False, "color": "red"}]
class gridTarjetas(dabo.ui.dGrid):
def initProperties(self):
self.prevRow = -1
self.AlternateRowColoring = True
#self.ColumnCount = 5
self.SelectionMode = 'Row'
self.Editable = True
def afterInit(self):
self.RegID = 'GridTarjetas'
self.DataSet = ds
self.addColumn(Name="nameid", Order=10, DataField="name",
DataType="string", Caption="Nº Tarjeta",
Sortable=True, Searchable=False,
HorizontalAlignment = 'Center')
self.addColumn(Name="ageid", Order=20, DataField="age",
DataType="string", Caption="Apellido",
Sortable=True, Searchable=False,
HorizontalAlignment = 'Center')
self.addColumn(Name="ageid", Order=30, DataField="coder",
DataType="string", Caption="Nombre",
Sortable=True, Searchable=False,
HorizontalAlignment = 'Center')
self.addColumn(Name="ageid", Order=40, DataField="color",
DataType="string", Caption="DNI",
Sortable=True, Searchable=False,
HorizontalAlignment = 'Center')
self.addColumn(Name="ageid", Order=50, DataField="Domicilio",
DataType="string",
Caption="Domicilio",
Sortable=True, Searchable=False,
HorizontalAlignment = 'Center')
class WinProx(dabo.ui.dForm):
def initProperties(self):
self.Caption = 'WinProx'
self.ShowStatusBar = False
self.frmFoto = None
self.activeDataSource = None # DataSource del ult. grid activo
# self.MenuBarClass = None # deshabilita el menú
def afterInit(self):
self.Centered = True
self.SetMinSize((900, 500))
pnl = dabo.ui.dPanel(self,
BackColor='darkgrey')
pnl.Sizer = dabo.ui.dSizer('v')
grid = gridTarjetas(self)
pnl.Sizer.append1x(grid, border=10)
pnl.layout()
self.Sizer.append1x(pnl)
# Needed starting with wx 2.7, for the first control to have the
focus:
self.setFocus()
if __name__ == "__main__":
app = dabo.dApp()
app.BasePrefKey = "GridED"
app.setAppInfo("appName", "grid test")
app.setAppInfo("appShortName", "gridtest")
app.MainFormClass = WinProx
app.start()
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/5231d13a.1050...@jfcomputer.com