diff --git a/backend.py b/backend.py index ab20035..473c25a 100644 --- a/backend.py +++ b/backend.py @@ -197,11 +197,11 @@ def is_css_patched(): try: with open(library_dir() + "/css/libraryroot.css", newline='', encoding="UTF-8") as f: first_line = f.readline() - if PATCHED_TEXT not in first_line: - print("css\libraryroot.css not patched. Download SteamFriendsPatcher from\n" \ - "https://github.com/PhantomGamers/SteamFriendsPatcher/releases", file=sys.stderr) - else: + if PATCHED_TEXT in first_line: patched = True + else: + pass + #print("css\libraryroot.css not patched.", file=sys.stderr) f.close() except: print("css\libraryroot.css not found", file=sys.stderr) diff --git a/libraryroot.custom.css b/libraryroot.custom.css index 20b1adb..f9b1a3a 100644 --- a/libraryroot.custom.css +++ b/libraryroot.custom.css @@ -9,7 +9,7 @@ --WhatsNewOrder: 2; /* Default: 0. Set 0 to put to top, 1 or higher to put to bottom */ /* Left Sidebar - Games List */ - --HoverOverlayPosition: unset; /* Default: 0. Set 0 if default JS, unset if tweaked JS */ + --HoverOverlayPosition: 0; /* Default: 0. Set 0 if default JS, unset if tweaked JS */ --GameListEntrySize: 16px; /* Default: 16px. */ --CategoryNameHeaderSize: 13px; /* Default: 13px. */ --GameListZoomSize: 75%; /* Default: 100%. 75% highly recommended for Game List similar to old Library UI. Affects GameListEntrySize and CategoryNameHeaderSize */ diff --git a/old_glory.py b/old_glory.py index bba0306..3e0687a 100644 --- a/old_glory.py +++ b/old_glory.py @@ -277,7 +277,7 @@ def __init__(self, parent, controller): ### Running functions after much of StartPage has been initialised ### Check if CSS Patched ### Check for new version - check_if_css_patched() + check_if_css_patched(self) update_check(self, controller.release) ### Set GUI from config @@ -504,14 +504,15 @@ def show_PageTwo(controller): ### Initialisation ### ================================ ### Check SteamFriendsPatcher -def check_if_css_patched(): - backend.is_css_patched() - ''' +def check_if_css_patched(page): + if not backend.is_css_patched(): - print("POPUP Here") - else: - print("NO POPUP") - ''' + hyperlink = HyperlinkManager(page.text1) + page.text1.tag_configure("err", foreground="red") + page.text1.insert(tk.INSERT, "css\libraryroot.css not patched. ", ("err")) + page.text1.insert(tk.INSERT, "Download ") + page.text1.insert(tk.INSERT, "SteamFriendsPatcher\n", hyperlink.add(partial(webbrowser.open, "https://github.com/PhantomGamers/SteamFriendsPatcher/"))) + ### Check if newer version def update_check(page, current_release): @@ -1324,7 +1325,7 @@ def settings_window(event, controller): about.insert(tk.END, "and provide some extra functionality where possible.\n\n") about.insert(tk.END, 'Github: ') about.insert(tk.END, "github.com/Jonius7/SteamUI-OldGlory/", hyperlink.add(partial(webbrowser.open, "https://github.com/Jonius7/SteamUI-OldGlory/"))) - about.insert(tk.END, "\n\nTo be used with SteamFriendsPatcher\n") + about.insert(tk.END, "\n\nTo be used with SteamFriendsPatcher:\n") about.insert(tk.END, "github.com/PhantomGamers/SteamFriendsPatcher/", hyperlink.add(partial(webbrowser.open, "https://github.com/PhantomGamers/SteamFriendsPatcher/"))) about.config(state='disabled') diff --git a/tkHyperlinkManager.py b/tkHyperlinkManager.py new file mode 100644 index 0000000..28bd2cb --- /dev/null +++ b/tkHyperlinkManager.py @@ -0,0 +1,44 @@ +# from http://effbot.org/zone/tkinter-text-hyperlink.htm + +import tkinter as tk + +class HyperlinkManager(object): + """A class to easily add clickable hyperlinks to Text areas. + Usage: + callback = lambda : webbrowser.open("http://www.google.com/") + text = tk.Text(...) + hyperman = tkHyperlinkManager.HyperlinkManager(text) + text.insert(tk.INSERT, "click me", hyperman.add(callback)) + From http://effbot.org/zone/tkinter-text-hyperlink.htm + """ + def __init__(self, text): + self.text = text + self.text.tag_config("hyper", foreground="blue", underline=1) + self.text.tag_bind("hyper", "", self._enter) + self.text.tag_bind("hyper", "", self._leave) + self.text.tag_bind("hyper", "", self._click) + self.reset() + + def reset(self): + self.links = {} + + def add(self, action): + """Adds an action to the manager. + :param action: A func to call. + :return: A clickable tag to use in the text widget. + """ + tag = "hyper-%d" % len(self.links) + self.links[tag] = action + return ("hyper", tag) + + def _enter(self, event): + self.text.config(cursor="hand2") + + def _leave(self, event): + self.text.config(cursor="") + + def _click(self, event): + for tag in self.text.tag_names(tk.CURRENT): + if (tag[:6] == "hyper-"): + self.links[tag]() + return