Extracting Name from Panel

I just about have this part of the application working as intended. What I
have not been able to do successfully is have the file name (line 55) be
assigned based on the name of the panel in which strings have been entered.
The panel names are in Data['title'] (line 15), and the names are assigned in
lines 73, 75, and 77. Despite thinking and experimenting, I cannot get the
name assigned to the file.

   FWIW, I tried to post this last Monday but my DSL line went down. Tuesday evening the TelCo tech identified the cause as a short in the card at the CO.
He moved my line to a different card on a different shelf, but it was the
incorrect protocol. We finally got that straighened out last evening -- late
-- but I still could not ping or otherwise get out past the firewall. This
morning, in a flash of insight, I restarted the inetd daemon and that cleared
the last blockage. Whew! Not a fun week.

Rich

rich.ScopingPage.py (3.2 KB)

···

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Thursday, December 22, 2005, 8:19:40 PM, Rich Shepard wrote:

I just about have this part of the application working as intended.
What I have not been able to do successfully is have the file name
(line 55) be assigned based on the name of the panel in which
strings have been entered. The panel names are in Data['title']
(line 15), and the names are assigned in lines 73, 75, and 77.
Despite thinking and experimenting, I cannot get the name assigned
to the file.

Insert a line like this right after your wx.Panel.__init__ (the
'[:-1]' supresses the trailing ":" from the name):

    self.name = Data['title'][:-1]

Then change
    fh = open(name + '.in', 'a')
to
    fh = open(self.name + '.in', 'a')

-- tacao

No bits were harmed during the making of this e-mail.

tacao,

   Thank you _very_ much. I got close, but didn't get the 'self.' prefix.
While I'm starting to get a better sense of how Python implements OO, I still
have a way to go.

Rich

···

On Fri, 23 Dec 2005, E. A. Tacao wrote:

Insert a line like this right after your wx.Panel.__init__ (the
'[:-1]' supresses the trailing ":" from the name):

   self.name = Data['title'][:-1]

Then change
   fh = open(name + '.in', 'a')
to
   fh = open(self.name + '.in', 'a')

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

   Thank you _very_ much. I got close, but didn't get the 'self.' prefix.
While I'm starting to get a better sense of how Python implements OO, I still
have a way to go.

C++ and Java use an implicit 'this' parameter.
Python uses an explicit 'self' parameter.

- Josiah

Josiah,

   Yes. I mis-wrote. I had tried to use self.Data and had not assigned Data to
a variable named self.name. I was still close, but no cigars. Only an E for
effort.

Rich

···

On Fri, 23 Dec 2005, Josiah Carlson wrote:

C++ and Java use an implicit 'this' parameter. Python uses an explicit
'self' parameter.

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Insert a line like this right after your wx.Panel.__init__ (the '[:-1]'
supresses the trailing ":" from the name):

   self.name = Data['title'][:-1]

E.A.:

   I have two wx.Panel.__init__: one for ListPanel, the other for ModScoping.
Unfortunately, no matter where I put the above I'm not getting the desired
results.

Then change
   fh = open(name + '.in', 'a')
to
   fh = open(self.name + '.in', 'a')

   Did this, too.

   The results are either no file written to disk or a Python error that the
file name is being used before it is defined. The latest incarnation is
attached. I'll keep working on this and see what winpdb shows me.

Merry Christmas, all,

Rich

···

On Fri, 23 Dec 2005, E. A. Tacao wrote:

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

Mea culpa! It put the file name with an initial capital and I kept looking
for it with an initial lowercase letter. It _does_ work as advertised.

   I now return you to your regularly scheduled holiday.

Rich

···

On Sat, 24 Dec 2005, Rich Shepard wrote:

Unfortunately, no matter where I put the above I'm not getting the desired
results.

--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863