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 :

Platform: GTK
Python Version: 2.7.3 on linux2
Dabo Version: 0.9.13
UI Version: 2.8.12.1 on wxGTK (gtk2)

------------------------------------------------------------------------------------------
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 12 08:20:13 2013

@author:
"""

import dabo
dabo.ui.loadUI('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.Columns[0].Caption = 'Nº Tarjeta'
        self.Columns[0].DataField = 'name'
        self.Columns[0].Editable = False
        self.Columns[1].Caption = 'Apellido'
        self.Columns[1].DataField = 'age'
        self.Columns[1].Editable = False
        self.Columns[2].Caption = 'Nombre'
        self.Columns[2].DataField = 'coder'
        self.Columns[2].Editable = False
        self.Columns[3].Caption = 'DNI'
        self.Columns[3].DataField = 'color'
        self.Columns[3].Editable = False
        self.Columns[4].Caption = 'Domicilio'
        self.Columns[4].DataField = 'Domicilio'
        self.Columns[4].Editable = False


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.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/5231aa7e.2070...@gmail.com

Reply via email to