Rubens,

On Wed, Jun 16, 2004 at 04:26:14PM -0700, Rubens Ramos wrote:
> <snip>
> > I guess so, but it's uglier. Not only that, the actual problem is that
> > I want the program to guess formats if they are not explicitly supplied
> > on the command line. So it should be possible to say
> > 
> >    ./myprog -i file1 -i file2 -f format2
> > 
> > which means that the file1's format should be guessed. In your scenario,
> >    -i "file1,file2" -f "format2"
> > becomes uncertain: is format2 applying to file1 or file2?
> Hmm - I was afraid you were going to say this - unfortunately,
> I dont know of a way to do it with the current implementation, 
> unless you do something like:
> 
>     -i "file1,file2" -f ",format2"
> 
>  which is even uglier.

Right, so I guess I better stick with using getopt, which brings us
right to the next point. 

> > Let me ask you this: I had no problem parsing the above type of
> > arguments using getopt. However, I thought I'd want to use popt, 
> > if not for anything else then just to have the application options 
> > appear on ./myprog -- help and ./myprog --usage. 
[snip]
> Now, thanks for asking this question ;-)
> To do this, you would need to:
> 
> * Have all options defined in a popt table, and pass it to gnome.init().
>   This is so that popt will not scream about your application's 
>   options.
> * gnome.init() will call the popt parser anyway, but you wouldnt
>   use the results of that;
> * After this is done, you then have to use getopt to check for your
>   own options.

That's exactly what I had in mind. 

> Note, I am not in front of my Linux box now to try it, but I think 
> this was the main problem with this approach:
> 
> The real issue with all this is that (I assume you are referring
> to the standard Python getopt package), to use getopt, you need
> to give it the full list of options - so this would have to include
> all options (yes, the gnome/gtk ones as well), which is pretty
> annoying (Otherwise you then get a getopt.GetoptError).
> And this is because popt does not change the list of parameters
> after it has finished parsing it.

This is OK -- I need to do it only once :-)

> IMHO, it boils down to: do you want/need the gnome/gtk standard
> command line options, or not?

I do. As I understand it, I don't have to do anything about the standard
options -- they are taken care of by the gnome libs, right?

Thanks again,
Alex

-- 
Alexander Roitman   http://ebner.neuroscience.umn.edu/people/alex.html
Dept. of Neuroscience, Lions Research Building
2001 6th Street SE, Minneapolis, MN  55455
Tel (612) 625-7566   FAX (612) 626-9201

Attachment: signature.asc
Description: Digital signature

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to