Adjusted the UI

This commit is contained in:
jyamihud 2022-03-31 21:08:42 +03:00
parent 55648f5629
commit 982f2c9a53
3 changed files with 22 additions and 36 deletions

View file

@ -16,25 +16,32 @@ def html(page, json):
if "licenses" in json and json["licenses"]: if "licenses" in json and json["licenses"]:
free = True free = True
page = page + "\n <h1>" page = page + "\n <h1>"
try: try:
page = page + '\n<img src="'+ json["links"]["icon"] + '" alt="Logo" style="width:50px;">' page = page + '\n<img src="'+ json["links"]["icon"] + '" alt="Logo" style="width:50px;">'
except: except:
pass pass
# Name / Website link
name = json.get("names",["Unknown"])[0] name = json.get("names",["Unknown"])[0]
page = page + "\n" + name page = page + "\n" + name
page = page + "</h1>" page = page + "</h1>"
# Few words about it # Few words about it
page = page + "<p>"+json.get("comment","")+"</p>" page = page + "<p>"+json.get("comment","")+"</p>"
# I want to show nothing else from if it's proprietary
if not free:
l = json.get("issues", [])
page = page +"<h2>Anti-Features / Problems:</h2>"
for i in l:
page = page + "<br>&nbsp;&nbsp;"+i
return page
# Links # Links
# <table> # <table>
@ -55,36 +62,15 @@ def html(page, json):
""" """
page = page + "<table><tr>" page = page + "<table><tr>"
website = json.get("links",{}).get("website", "")
if free and website:
page = page + """
<th><form action=\""""+website+"""\">
<button type="submit">Website</button>
</form></th>
"""
git = json.get("links",{}).get("git", "") links = json.get("links", {})
if git: for website in links:
if website in ["icon"]:
continue
link = links[website]
page = page + """ page = page + """
<th><form action=\""""+git+"""\"> <th><form action=\""""+link+"""\">
<button type="submit">Source Code</button> <button title=\""""+link+"""\" type="submit">"""+website.upper()+"""</button>
</form></th>
"""
wikipedia = json.get("links",{}).get("wikipedia", "")
if wikipedia:
page = page + """
<th><form action=\""""+wikipedia+"""\">
<button type="submit">Wikipedia</button>
</form></th>
"""
documentation = json.get("links",{}).get("documentation", "")
if documentation:
page = page + """
<th><form action=\""""+documentation+"""\">
<button type="submit">Documentation</button>
</form></th> </form></th>
""" """
@ -108,10 +94,10 @@ def html(page, json):
continue continue
page = page + "<details>" page = page + "<details>"
page = page +"<summary>"+categories[c]+"</summary>" page = page +"<summary>"+categories[c]+":</summary>"
for i in l: for i in l:
page = page + "<span>&nbsp;&nbsp;"+i+"</span><br>" page = page + "&nbsp;&nbsp;"+i+"<br>"
page = page + "</details>" page = page + "</details>"