Hehe,=20
Just an update, having the columnHeading stuff in the resource file look=20
like this -=20
columnHeadings':[
[ 'Job number',-1,2],
[ 'Inquiry date', -1,2],
[ 'Job date', -1,2],
[ 'Job time', -1,2],
[ 'Fixed?', -1,2],
[ 'Job type', -1,2],
[ 'Job subtype'-1,2],
],=20
which I thought would work gives this error -=20
Traceback (most recent call last):
File "C:\Python23\lib\site-packages\PythonCard\widget.py", line 402, in=20
_dispatch
handler(background, aWxEvent)
File "C:\Python23\SEDB\search.py", line 61, in=20
on_searchResults_itemActivated
(parent, clientWindow) =3D self.clientChild()
File "C:\Python23\SEDB\search.py", line 69, in clientChild
clientWindow =3D model.childWindow(parent, client.ClientDetails)
File "C:\Python23\lib\site-packages\PythonCard\model.py", line 176, in=20
childWindow
rsrc =3D resource.ResourceFile(filename).getResource()
File "C:\Python23\lib\site-packages\PythonCard\resource.py", line 45, in=20
__init__
self.dictionary =3D util.readAndEvalFile(rsrcFileName)
File "C:\Python23\lib\site-packages\PythonCard\util.py", line 33, in=20
readAndEvalFile
return eval(txt, globals())
File "<string>", line 0, in ?
TypeError: unsupported operand type(s) for -: 'str' and 'int'
but, the following do work -=20
leftAligned =3D self.components.jobs.GetColumnHeadingInfo()
centreAligned =3D []
for item in leftAligned:
k =3D [item[0],item[1], 2]
centreAligned.append(k)
self.components.jobs.columnHeadings =3D centreAligned
or
foo =3D self.components.jobs
foo.columnHeadings =3D [[item[0], item[1], 2] for item in=20
foo.GetColumnHeadingInfo()]
Hmm....
Or am I doing the resource file part wrong?
On Apr 12, 2005 11:38 AM, Liam Clarke <cyresse@...> wrote:
>=20
> Hi Alex,=20
>=20
> There's a hint in the sample/multicolumnexample.py in the comments at
> the head.
> Playing around a bit with that, I think you pass in a list like
> [ ["header", width, format], ...]
> width is an integer value :
> -1 =3D auto_size
> positive value is an actual column width
> (note you must have ALL columns set to auto_size to get autosizing)
>=20
> format is one of
> wxLIST_FORMAT_LEFT : 0
> wxLIST_FORMAT_RIGHT : 1
> wxLIST_FORMAT_CENTRE : 2
>=20
> On Apr 12, 2005 8:53 AM, Alex Tweedly <alex@...> wrote:
> >=20
> > Liam Clarke wrote:
> >=20
> > > Hello again,
> > >
> > > Feeling kind of silly, just looked more closely at MCL, and found
> > > lines 330-338 under the method
> > > _setColumnHeadings(self, aList):
> > >
> > > elif w =3D=3D 3 and \
> > > isinstance(aList[0][0], StringType) and \
> > > isinstance(aList[0][1], IntType) and \
> > > isinstance(aList[0][2], IntType):
> > > flag =3D 0
> > > for i in xrange(numcols):
> > > if aList[i][1] !=3D wx.LIST_AUTOSIZE:
> > > flag =3D 1
> > > self.InsertColumn(i, aList[i][0],
> > > format=3DaList[i][2], width=3DaList[i][1])
> > >
> > > So, I get the feeling that if I create my ColumnHeadings as a list of
> > > [ "Column name", x, y]
> > > where x and y are both integers, then it'll come through to this
> > > InsertColumn method...
> > >
> > > But, what values are legitimate values? If x and y have to be ints,
> > > how does that fit in with InsertColumn? I'm used to wx.LIST_AUTOSIZE
> > > and so forth.
> >=20
> > There's a hint in the sample/multicolumnexample.py in the comments at
> > the head.
> > Playing around a bit with that, I think you pass in a list like
> > [ ["header", width, format], ...]
> > width is an integer value :
> > -1 =3D auto_size
> > positive value is an actual column width
> > (note you must have ALL columns set to auto_size to get autosizing)
> >=20
> > format is one of
> > wxLIST_FORMAT_LEFT : 0
> > wxLIST_FORMAT_RIGHT : 1
> > wxLIST_FORMAT_CENTRE : 2
> >=20
> > Here's a snippet from my "play" code version of multicolumnexample.py
> > (from on_loadButton_mouseClick
> >=20
> > I changed
> >=20
> > > self.components.theList.columnHeadings =3D items[0]
> > > self.components.theList.items =3D items[1:]
> >=20
> > to
> >=20
> > > self.components.theList.columnHeadings =3D items[0]
> > > headings =3D self.components.theList.GetColumnHeadingInfo()
> > > print "here with", headings
> > > headings[0][1] =3D 80
> > > headings[1][2] =3D 1 -- try various values here
> > > self.components.theList.columnHeadings =3D headings
> > > headings =3D self.components.theList.GetColumnHeadingInfo()
> > > print "and now", headings
> > > self.components.theList.items =3D items[1:]
> > >
> >=20
> > P.S. I couldn't figure out the right way to use the wxLIST_FORMAT_*
> > constants. I'm sure you should be able to do something like
> > import wx
> > and then use wx.wxLIST_FORMAT_LEFT
> > but that didn't work - I finished up doing
> > import wx
> > print wx._controls.wxLIST_FORMAT_LEFT
> > to check what the values were.
> >=20
> >=20
> > --
> > Alex Tweedly http://www.tweedly.net
> >=20
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.9.5 - Release Date: 07/04/2005
> >=20
> >=20
> Of course.... I should've tried -1... thanks for that Alex.
>=20
>=20
> Regards,=20
>=20
>=20
> Liam Clarke
>=20
> --=20
> 'There is only one basic human right, and that is to do as you damn well=
=20
> please.
> And with it comes the only basic human duty, to take the consequences.'=
=20
>=20
--=20
'There is only one basic human right, and that is to do as you damn well=20
please.
And with it comes the only basic human duty, to take the consequences.'
|