Skip to content

Commit

Permalink
4.1.1 Fixed bugs with GUI scaling, hyperlinks, and Friend icon position
Browse files Browse the repository at this point in the history
merge branch dev into 'master'
  • Loading branch information
Jonius7 committed Dec 19, 2020
1 parent 067f6fa commit 5852d21
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 14 deletions.
8 changes: 4 additions & 4 deletions backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion libraryroot.custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
19 changes: 10 additions & 9 deletions old_glory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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')
Expand Down
44 changes: 44 additions & 0 deletions tkHyperlinkManager.py
Original file line number Diff line number Diff line change
@@ -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", "<Enter>", self._enter)
self.text.tag_bind("hyper", "<Leave>", self._leave)
self.text.tag_bind("hyper", "<Button-1>", 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

0 comments on commit 5852d21

Please sign in to comment.