diff options
Diffstat (limited to 'gamechest/cli.py')
-rw-r--r-- | gamechest/cli.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gamechest/cli.py b/gamechest/cli.py new file mode 100644 index 0000000..d0b457e --- /dev/null +++ b/gamechest/cli.py @@ -0,0 +1,66 @@ +#!python3 + +''' +Usage: gamechest.py --gamelist=GAMELIST.YAML --gamedir=GAMEDIR +''' + +import logging +import os +from logging import debug, info, warning, critical + + +import docopt +import yaml +import gamemanager + + +def main(): + logging.basicConfig(level=logging.DEBUG) + logging.getLogger().handlers[0].setFormatter(logging.Formatter( + "gamechest: %(levelname)s: %(funcName)s:%(lineno)s: %(message)s")) + + args = docopt.docopt(__doc__) + debug('args: %s', args) + + gamelist_dir = ( + os.path.dirname(args['--gamelist']) + + '/.' + + os.path.basename(args['--gamelist']) + + '.d' + ) + gamelist = GameList(args['--gamelist'], args['--gamedir']) + + builder = gtk.Builder() + builder.add_from_file('gamechest.glade') + builder.connect_signals( + Handler(builder, gamelist, gamelist_dir, args['--gamedir'])) + + window = builder.get_object('window2') + window.show_all() + + gamelist_store = builder.get_object('gamelist_store') + gamelist_store.clear() + for index, game in enumerate(gamelist.yaml_data['games']): + gamelist_store.append((False, game['title'], index)) + info('%d games loaded', len(gamelist.yaml_data['games'])) + + gtk.main() + +def main(): + import sys + gamelist_path = sys.argv[1] + gamedir_path = sys.argv[2] + action_name = sys.argv[3] + game_name = sys.argv[4] # used to determine game_id + + # TODO: + # - parse gamelist (conf) + # - parse package installed info or empty (conf) + # - follow action (install, remove, update) + # - use name on game name + # - update status bar from polling (with a timer, or a simple sleep) + # - if run, run the game. + + +if __name__ == '__main__': + main() |