Skip to content

Commit

Permalink
Small fix for steam-library with vertical nav bar, add Game Page Layo…
Browse files Browse the repository at this point in the history
…ut to default variables
  • Loading branch information
Jonius7 committed Nov 28, 2020
1 parent 99911da commit 2191dd9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 51 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Check `/dev` branch for in-progress tweaks.

Other files are copied from the`Steam\steamui` directory as required.

`config.css` for Shiina's steam-library theme will be created from config.css.original the first time you enable the theme. Alternatively, you can put your existing `config.css` file here and the app will use it.

![https://i.imgur.com/A85LCCn.png](https://i.imgur.com/A85LCCn.png)

#### JavaScript Tweaks
Expand Down
16 changes: 14 additions & 2 deletions backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@
"options": {"16px", "5px"},
"desc" : "Corresponds with JavaScript tweak - Home Page Grid Spacing."}
},
"Game Page Layout" : {
"--FriendsDLCScreenshotsColumnWidth" : {
"default" : "33%",
"current" : "57%",
"options": {"33%", "57%"},
"desc" : "Determines width of the Friends Who Play/Achievements/Screenshots/DLC/Trading Cards column. Friend Activity/News column will fill the rest."},
"--SwapColumns" : {
"default" : "right",
"current" : "left",
"options": {"left", "right"},
"desc" : "Set left to swap columns."}
},
"Game Page Background" : {
"--AppPageBlur" : {
"default" : "8px",
Expand All @@ -126,7 +138,7 @@
"current" : "black",
"options": {"black 80%", "black", "rgba(0,0,0,0)"},
"desc" : "Set to rgba(0,0,0,0) to remove"}
},
},
"Other" : {
"--VerticalNavBarOffset" : {
"default" : "0px",
Expand Down Expand Up @@ -914,7 +926,7 @@ def clear_js_working_files():
for file in files_to_remove:
w_file = Path(file)
w_file.unlink(missing_ok=True)
print("Local " file + " deleted.")
print("Local " + file + " deleted.")
except:
print("Was not able to remove " + file, file=sys.stderr)
print("~~~~~~~~~~")
Expand Down
58 changes: 9 additions & 49 deletions old_glory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class OldGloryApp(tk.Tk):
def __init__(self, *args, **kwargs):
self.version = "v0.9.4.2 Beta"
self.version = "v0.9.4.3 Beta"

### Window, Title, Icon setup
tk.Tk.__init__(self, *args, **kwargs)
Expand Down Expand Up @@ -283,7 +283,6 @@ def __init__(self, parent, controller):
frameCheck.pack()
frameLog.pack(pady=(10,0))
frameConfirm.pack(pady=(7, 20), side="bottom", fill="x")
#frameConfirm.pack(pady=(7, 20), side="bottom")
frameMode.pack(pady=(2, 0), side="bottom")

### Getters
Expand Down Expand Up @@ -639,15 +638,18 @@ def dropdown_click(event, page):
def install_click(event, page, controller):
print("=================")
#get settings
settings_to_apply, settings_values = get_settings_from_gui(event, page)
settings_to_apply, settings_values = get_settings_from_gui(event, page)

#make any js_config enable/disable required
settings_values = apply_changes_to_config(controller, settings_values)

#write fixes.txt before apply
#print(controller.js_config)
backend.write_js_fixes(controller.js_config, controller.special_js_config)
backend.write_js_fixes(controller.js_config, controller.special_js_config)

#applying settings
apply_settings_from_gui(page, controller, settings_to_apply, settings_values)
backend.write_config(settings_values)

#add/remove theme
apply_css_theme(controller.frames[StartPage])

Expand Down Expand Up @@ -690,20 +692,12 @@ def apply_changes_to_config(controller, settings_values):
if "EnableVerticalNavBar" in settings_values.keys():
controller.js_config["Vertical Nav Bar (beta, working)"] = str(settings_values["EnableVerticalNavBar"])
controller.frames[PageTwo].js_gui.checkvars["Vertical Nav Bar (beta, working)"].set(settings_values["EnableVerticalNavBar"])
#print("WOINGEI")
#print(controller.frames[PageTwo].js_gui.checkvars["Vertical Nav Bar (beta, working)"].get())
#print(settings_values)
#js_gui.checkvars["Vertical Nav Bar (beta, working)"] = settings_values["EnableVerticalNavBar"]

#settings_values["EnableVerticalNavBar"] = str(controller.frames[PageTwo].js_gui.checkvars["Vertical Nav Bar (beta, working)"].get())
#print(settings_values["EnableVerticalNavBar"])
if "EnableClassicLayout" in settings_values.keys():
if settings_values["EnableClassicLayout"] == 1 and settings_values["EnableVerticalNavBar"] == 0:
settings_values["EnableClassicLayout"] = 0
if "LandscapeImages" in settings_values.keys():
controller.js_config["Landscape Images JS Tweaks (beta, working, some layout quirks with shelves)"] = str(settings_values["LandscapeImages"])
controller.frames[PageTwo].js_gui.checkvars["Landscape Images JS Tweaks (beta, working, some layout quirks with shelves)"].set(settings_values["LandscapeImages"])
#print("WAOYGEION")
for key in controller.special_js_config:
if "Change Game Image Grid Sizes" in key:
sizes = ["Small", "Medium", "Large"]
Expand All @@ -723,7 +717,6 @@ def apply_settings_from_gui(page, controller, settings_to_apply, settings_values
### Run js_tweaker if required

change_javascript = 0
#print("~!)!(!~~)~~~~~~~~")
#print(settings_values)
for setting in settings_values:
#print("javascript" in CONFIG_MAP[setting])
Expand Down Expand Up @@ -787,12 +780,8 @@ def apply_css_theme(page):
print("Cleared current CSS Themes")
page.change_theme = 0

#update loaded_config on Install click
def update_loaded_config(page):
#update loaded_config on Install click
#print("YOU ERROR?")
#print(page.getCheckbuttonVal("var1").get())
#print(page.loaded_config)
#print(page.getCheckbuttonVal(CONFIG_MAP[key]["value"])
for key in page.loaded_config:
if "value" in CONFIG_MAP[key]:
page.loaded_config[key] = str(page.getCheckbuttonVal(CONFIG_MAP[key]["value"]).get())
Expand All @@ -803,7 +792,6 @@ def update_loaded_config(page):
### RELOAD Functions
### ================================
def reload_click(event, controller):
#.frames[StartPage].text1
print("=================")
controller.css_config = backend.load_css_configurables()
controller.js_config, controller.special_js_config = backend.load_js_fixes()
Expand Down Expand Up @@ -1070,14 +1058,9 @@ def returnPresetFrame(self):
### change container.css_config
### Recursion
def apply_css_config_values(controller, propValues):
#print("~~~pv~~~~~~~~~~")
#print(propValues)
returns = []
for key, value in propValues.items():
controller.config_dict = replace_item(key, value, controller.css_config)
#print(controller.css_config)
#print("~~~g~")
#print(controller.css_config)


### Recursion
Expand All @@ -1087,19 +1070,12 @@ def replace_item(key, value, config_dict):
if isinstance(v, dict):
config_dict[k] = replace_item(key, value, v)
if key in config_dict:
#print("wAZOO")
#print(str(key) + "~~" + str(value))
#print(config_dict[key]["current"])
config_dict[key]["current"] = value
#print("CHANGED")
#print(config_dict[key]["current"])
return config_dict

### Recursion
def get_item(key, config_dict):
if key in config_dict:
#print("WGOINGE")

if key in config_dict:
return config_dict[key]["current"]
for value in config_dict.values():
if isinstance(value, dict):
Expand All @@ -1112,18 +1088,12 @@ def get_item(key, config_dict):


def update_css_gui(page, controller, config):
#print(page.frameCSS)
#print(dir(page.frameCSS))
test_css_gui_reach(page, controller, config)

#for entrybox in page.css_gui.entryboxes:
#config.get(sectionkey, {}).get(propkey)

def test_css_gui_reach(page, controller, config):
print("TODO")
#print(page.css_gui.labels[0]["text"])
#print(page.css_gui.entryboxes["--WhatsNew"].get())
#print(page.css_gui.entryboxes["--WhatsNew"].set("lamb"))

def formatted_hover_text(default, desc):
return "Default: " + default + ". " + desc
Expand All @@ -1146,13 +1116,11 @@ def __init__(self, page, controller):

label_js_head = tk.Label(self.frameJSInner, text="JS Options")
label_js_head.grid(row=0, column=0, columnspan=2)
#label_js_head.grid(row=0, column=0)

self.checkvars = {}
self.comboboxes = {}
self.create_frameJSInner(self.controller)
self.frameJSInner.pack()
#self.frameJSInner.grid()

### PRESET Click funtion
def js_click(self, controller, fixname):
Expand All @@ -1169,8 +1137,6 @@ def create_frameJSInner(self, controller):
rownum = 1
self.checkvars = {}
for i, (fixname, value) in enumerate(self.controller.js_config.items()):
#print("WILD")
#print(type(value))
_checkvar = tk.IntVar()
self.checkvars[fixname] = _checkvar
self.checkvars[fixname].set(int(value))
Expand All @@ -1190,7 +1156,6 @@ def create_frameJSInner(self, controller):

rownum += 1
if fixname in self.controller.special_js_config:
#print("YOU GOT IT" + fixname)
#print(self.controller.special_js_config["Change Game Image Grid Sizes (optional) - default widths 111, 148, 222"])
self.sizesFrame = tk.Frame(self.frameJSInner)
special_js_key_name = "Change Game Image Grid Sizes (optional) - default widths 111, 148, 222"
Expand Down Expand Up @@ -1228,21 +1193,16 @@ def returnframeJS(self):
### ================================
def reset_all_tweaks(event, controller):
js_tweaker.setup_library(1)
#controller.frames[StartPage].text1.update_idletasks()
backend.clean_slate_css()
#controller.frames[StartPage].text1.update_idletasks()
backend.reset_html()
#controller.frames[StartPage].text1.update_idletasks()
backend.clear_js_working_files()
#controller.frames[StartPage].text1.update_idletasks()

def remake_js(event, controller):
backend.clear_js_working_files()

thread = Thread(target = run_js_tweaker, args = (controller.frames[StartPage].text1, ))
thread.start()
#thread.join()

#run_js_tweaker(controller.frames[StartPage].text1)


Expand Down
Binary file modified oldglory Design Document Brief.docx
Binary file not shown.
1 change: 1 addition & 0 deletions themes/shiina.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
.appdetailsoverview_Container_27RcN {
backdrop-filter: opacity(50%) !important;
background: linear-gradient(0deg, rgba(40, 41, 49, 0) 0%, rgba(51, 51, 51, 0.2) 35%, rgba(51, 51, 51, 0.5) 100%) !important;
display: flex !important;
}

/* === END steam-library tweaks for SteamUI-OldGlory === */

0 comments on commit 2191dd9

Please sign in to comment.