Skip to content

Commit

Permalink
feat: disable license button, if no license found. Print error for cli.
Browse files Browse the repository at this point in the history
  • Loading branch information
WyvernIXTL committed Nov 4, 2024
1 parent e539534 commit 88b819d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 12 additions & 2 deletions gamepadla_plus/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,22 @@ def license():
"""
Print license of this project.
"""
print(read_license(license_file_name=LICENSE_FILE_NAME))
license = read_license(license_file_name=LICENSE_FILE_NAME)
if license != "":
print(license)
else:
rprint("[red]Failed to fetch license.[/red]")
exit(1)


@app.command()
def third_party_licenses():
"""
Prints third party licenses.
"""
print(read_license(THIRD_PARTY_LICENSE_FILE_NAME))
licenses = read_license(license_file_name=THIRD_PARTY_LICENSE_FILE_NAME)
if licenses != "":
print(licenses)
else:
rprint("[red]Failed to fetch licenses.[/red]")
exit(1)
6 changes: 5 additions & 1 deletion gamepadla_plus/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ def gui():
layout = [
[
sg.Push(),
sg.Button("Licenses", key="-SHOW-LICENSES-BUTTON-"),
sg.Button(
"Licenses",
key="-SHOW-LICENSES-BUTTON-",
disabled=(read_license(LICENSE_FILE_NAME) == ""),
),
],
[
sg.Listbox(
Expand Down

0 comments on commit 88b819d

Please sign in to comment.