Skip to content

Commit 7ce5f0d

Browse files
committed
Add an hyperlink to author's Github profile
1 parent fef2834 commit 7ce5f0d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

configure.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import os
2424
import subprocess
2525
import sys
26+
import webbrowser
2627

2728
MIN_PYTHON = (3, 8)
2829
if sys.version_info < MIN_PYTHON:
@@ -155,7 +156,7 @@ def __init__(self):
155156
self.theme_preview = ttk.Label(self.window)
156157
self.theme_preview.place(x=10, y=10)
157158

158-
self.theme_author = ttk.Label(self.window, foreground='#a3a3a3')
159+
self.theme_author = ttk.Label(self.window)
159160

160161
sysmon_label = ttk.Label(self.window, text='Display configuration', font='bold')
161162
sysmon_label.place(x=320, y=0)
@@ -255,7 +256,14 @@ def load_theme_preview(self):
255256
self.theme_preview.config(image=self.theme_preview_img)
256257

257258
theme_data = get_theme_data(self.theme_cb.get())
258-
self.theme_author.config(text="Author: " + theme_data.get('author', 'unknown'))
259+
author_name = theme_data.get('author', 'unknown')
260+
self.theme_author.config(text="Author: " + author_name)
261+
if author_name.startswith("@"):
262+
self.theme_author.config(foreground="#a3a3ff", cursor="hand2")
263+
self.theme_author.bind("<Button-1>", lambda e: webbrowser.open_new_tab("https://github.com/" + author_name[1:]))
264+
else:
265+
self.theme_author.config(foreground="#a3a3a3", cursor="")
266+
self.theme_author.unbind("<Button-1>")
259267
self.theme_author.place(x=10, y=self.theme_preview_img.height() + 15)
260268

261269
def load_config_values(self):

0 commit comments

Comments
 (0)