def do_command_line(self, args):
'''
GTK.Application command line handler
called if Gio.ApplicationFlags.HANDLES_COMMAND_LINE is set.
must call the self.do_activate() to get the application up and running.
'''
Gtk.Application.do_command_line(self, args) # call the default commandline handler
# make a command line parser
parser = argparse.ArgumentParser(prog='gui')
# add a -c/--color option
parser.add_argument('-q', '--quit-after-init', dest='quit_after_init', action='store_true', help='initialize application (e.g. for macros initialization on system startup) and quit')
# parse the command line stored in args, but skip the first element (the filename)
self.args = parser.parse_args(args.get_arguments()[1:])
# call the main program do_activate() to start up the app
self.do_activate()
return 0
评论列表
文章目录