<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.

> 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. 
> 
> What is the downside of this cheating: passing popt table to the
> gnome.init()
> (so that --help and --usage list my options) while actually using
> getopt for parsing the command line?
> 
> Unless I'm missing something, this is the best of both worlds,
> at least for my situation, isn't it?
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.

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.

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

Hope this helps
Rubens



                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 
_______________________________________________
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