Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tovid-suite opened this issue Mar 16, 2015 · 4 comments
Open

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

tovid-suite opened this issue Mar 16, 2015 · 4 comments

Comments

@tovid-suite
Copy link
Collaborator

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

Labels: Priority-High

@tovid-suite
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants