tovid-suite / tovid

Suite of tools for DVD authoring
http://tovid.wikia.com/wiki/Tovid_Wiki
GNU General Public License v2.0
7 stars 4 forks source link

tovid gui "Load script" fails to load FlagOpts or SpacedText #121

Open tovid-suite opened 9 years ago

tovid-suite commented 9 years ago

From wapcaplet88 on June 05, 2010 23:56:52

In tovid gui, if a FlagOpt such as '-showcase' is set, and saved using "Save script", then that script is later loaded with "Load script", the FlagOpt is correctly checked (enabled), but its associated control isn't filled with a value.

For example, here is a saved script with '-showcase' set:

!/usr/bin/env bash

PATH=/usr/local/lib/tovid:$PATH

todisc \ -files \ /home/eric/Videos/bar.avi \ /home/eric/Videos/foo.mpg \ -titles \ bar \ foo \ -out \ test \ -showcase \ /home/eric/Videos/foo.mpg \ -from-gui

When loading this script in the gui, it complains about the argument being provided to '-showcase':

$ tovid gui todisc_commands.bash Read options from /home/eric/.tovid/tovid.ini:

Loading style from config file: '/home/eric/.metagui/config' Loading script file 'todisc_commands.bash' Found option: -files Setting list to: ['/home/eric/Videos/bar.avi', '/home/eric/Videos/foo.mpg'] Found option: -titles Setting list to: ['bar', 'foo'] Found option: -out Setting value to: test Found option: -showcase Setting flag to True Unrecognized argument: /home/eric/Videos/foo.mpg Found option: -from-gui Setting flag to True Done reading 'todisc_commands.bash' :-) Successfully loaded 'todisc_commands.bash'

Original issue: http://code.google.com/p/tovid/issues/detail?id=121

tovid-suite commented 9 years ago

From wapcaplet88 on June 05, 2010 21:41:12

The root problem here is in gui.py, in the load_args method. This method naively sets Control values based on their vartype--in this case, since FlagOpt is a bool type, it simply sets the flag and moves on. This is a design flaw that might be better handled if Controls were responsible for parsing their own arguments (since they are responsible for setting them in the first place).

Consider adding a counterpart to get_args, called set_args. Currently, the Application starts off the chain of get_args, by calling all the Panels' get_args methods, which in turn call their Controls' get_args methods. A set_args method should work in much the same way, starting with a list of args that will be processed down the chain, until a Control finds options/arguments it's interested in, and pops them off the list. This chain of set_args calls should completely replace the current Application.load_args method.

tovid-suite commented 9 years ago

From wapcaplet88 on June 06, 2010 20:56:36

Labels: Priority-High

tovid-suite commented 9 years ago

From grepper@gmail.com on August 28, 2010 18:52:09

Just a note that a SpacedText "list" will also fail the load_args test. Example: tovid gui -files 1.mpg 2.mpg -rotate-thumbs 10 12 will produce a: "1" "0" in the text area, and a "Unrecognized argument: 12" in the error output.

tovid-suite commented 9 years ago

From grepper@gmail.com on August 28, 2010 18:54:52

Summary: tovid gui "Load script" fails to load FlagOpts or SpacedText