gtk: Run the application in the done() function handler
I still build the arguments to the application in the main do_command() handler, but delay running it so the database won't be locked allowing other commands to still work. Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
This commit is contained in:
parent
2e85870c87
commit
79fae64f37
|
@ -100,17 +100,19 @@ class Command(commands.Command):
|
|||
|
||||
def do_command(self, args: argparse.Namespace) -> None:
|
||||
"""Run the Gtk UI."""
|
||||
app_args = []
|
||||
args.app_args = []
|
||||
|
||||
if args.runid is not None:
|
||||
if self.sql("SELECT 1 FROM xfstests_runs WHERE runid=?",
|
||||
args.runid).fetchone():
|
||||
app_args.append(f"runid={args.runid}")
|
||||
args.app_args.append(f"runid={args.runid}")
|
||||
else:
|
||||
print(f"error: run #{args.runid} does not exist",
|
||||
file=sys.stderr)
|
||||
sys.exit(errno.ENOENT)
|
||||
else:
|
||||
app_args.append("show-sidebar")
|
||||
args.app_args.append("show-sidebar")
|
||||
|
||||
Application(self.sql).run(app_args)
|
||||
def do_done(self, args: argparse.Namespace) -> None:
|
||||
"""Run the application outside of a transaction."""
|
||||
Application(self.sql).run(args.app_args)
|
||||
|
|
Loading…
Reference in New Issue