-
Notifications
You must be signed in to change notification settings - Fork 21
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
Basic randomization implementation. #64
base: master
Are you sure you want to change the base?
Conversation
@@ -156,7 +174,8 @@ def getScreen(): | |||
|
|||
# Assign the important arguments on module init. | |||
verbose = True if args.verbose else False | |||
if args.screen == None or (args.screen == None and args.help == True): | |||
use_random = True if args.random else False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the parser addition you made already takes care of this check with the "default" option... both the verbose and the rnadom should be just used as is from 'args'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think this was done before that PR was merged, so I was trying to not use its functionality. Been a while since I've thought about it.
@@ -131,6 +132,22 @@ def entryPoint(): | |||
|
|||
def getScreen(): | |||
verbose = False | |||
use_random = False | |||
available_random_screens = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to hard code the screen as opposed to use the get_available_screens? (this one checks the file system instead so you would not have to do this manually)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original intent was, so we could limit the random screens to omit any potential NSFW screens. Perhaps we could move that into a flag for the screens themselves instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, that looks better.
for s in get_available_screens(): | ||
# Create the parsers for each screen. | ||
parsers[s.__name__.lower()] = screenparsers.add_parser(s.__name__.lower(), formatter_class=SmartFormatter, conflict_handler='resolve') | ||
if s().name.lower() == args.screen: | ||
screen = s | ||
if use_random is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in line 189 you could just choose to override the args.screen value so then you don't need to change anything in the code below (confirming again the random argument within the available screens loop)... what do you think?
This is a pretty simple implementation that choose a random screen on --random. I figure, in the future, when people want to have this auto-launch somehow, randomizing the selected screen per run might be fun.
It chooses from one of the following screens that do not require parameters: