Skip to content

Commit

Permalink
about page
Browse files Browse the repository at this point in the history
  • Loading branch information
not-nef committed Oct 30, 2022
1 parent eff744f commit 2732d12
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
Binary file added assets/github_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/github_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/about.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import tkinter, darkdetect, webbrowser
from tkinter import ttk
import vars as v

def dark():
if v.cfg["theme"] == "Dark" or (v.cfg["theme"] == "System" and darkdetect.isDark()):
return True
else:
return False

def build():
root = tkinter.Toplevel()
root.title("About Onyx")
root.geometry("550x200")
root.resizable(False, False)

logolabel = tkinter.Label(root, image=v.logo).place(x=10, y=20)
name = tkinter.Label(root, text="Onyx", font=("Segoe UI", 40, "bold")).place(x=210, y=30)
version = tkinter.Label(root, text="Version {}".format(v.ver.split(" ")[0]), font=("Segoe UI", 20, "")).place(x=370, y=57)
versiontype = tkinter.Label(root, text="Beta" if v.ver.endswith("beta") else "Stable", font=("Segoe UI", 20, "bold"), fg="orange" if v.ver.endswith("beta") else "green").place(x=210, y=105)
github = ttk.Button(root, text=" Github Repo", image=v.github_light if dark() else v.github_dark, compound="left", command=lambda:webbrowser.open("https://github.com/not-nef/onyx")).place(x=330, y=105)
7 changes: 4 additions & 3 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ver = "0.6"
ver = "0.6 beta"

import tkinter, ntkutils, pygments, darkdetect, sv_ttk
from tkinter.font import Font
Expand All @@ -7,7 +7,7 @@
from tkinterdnd2 import *
from tklinenums import TkLineNumbers

import config, tabmanager
import config, tabmanager, about
import settings.UI as settingsui
from settings.images import setimages
import generatesize as size
Expand Down Expand Up @@ -95,7 +95,7 @@ def closepreview():
filemenu.add_command(label="Close Preview", command=closepreview, foreground="black")

settingsmenu.add_command(label="Open Settings", command=settingsui.build, foreground="black")
settingsmenu.add_command(label="About", state="disabled")
settingsmenu.add_command(label="About", command=about.build, foreground="black")

if cfg["mica"]:
if cfg["theme"] == "Dark" or (cfg["theme"] == "System" and darkdetect.isDark()):
Expand Down Expand Up @@ -137,6 +137,7 @@ def filedrop(event):
v.footer = footer
v.closeimg = closeimg
v.theme = theme
v.ver = ver

setimages()

Expand Down
5 changes: 4 additions & 1 deletion src/settings/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ def setimages():
v.keyboard_light = tkinter.PhotoImage(master=v.root, file="./assets/keyboard_light.png")
v.keyboard_dark = tkinter.PhotoImage(master=v.root, file="./assets/keyboard_dark.png")
v.warn_light = tkinter.PhotoImage(master=v.root, file="./assets/warn_light.png")
v.warn_dark = tkinter.PhotoImage(master=v.root, file="./assets/warn_dark.png")
v.warn_dark = tkinter.PhotoImage(master=v.root, file="./assets/warn_dark.png")
v.logo = tkinter.PhotoImage(master=v.root, file="./assets/logo.png")
v.github_dark = tkinter.PhotoImage(master=v.root, file="./assets/github_dark.png")
v.github_light = tkinter.PhotoImage(master=v.root, file="./assets/github_light.png")
6 changes: 5 additions & 1 deletion src/vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
tabbar = ""
footer = ""
theme = ""
ver = ""

brush_light = ""
brush_dark = ""
keyboard_light = ""
keyboard_dark = ""
warn_light = ""
warn_dark = ""
warn_dark = ""
logo = ""
github_dark = ""
github_light = ""

0 comments on commit 2732d12

Please sign in to comment.