diff --git a/src/OSBC.py b/src/OSBC.py index 5d2bf935..af4b0318 100644 --- a/src/OSBC.py +++ b/src/OSBC.py @@ -13,14 +13,14 @@ from model import Bot, RuneLiteBot from utilities.game_launcher import Launchable from view import * -from view.fonts import * +from view.fonts.fonts import * customtkinter.set_appearance_mode("Dark") # Modes: "System" (standard), "Dark", "Light" customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue" class App(customtkinter.CTk): - WIDTH = 650 + WIDTH = 680 HEIGHT = 480 DEFAULT_GRAY = ("gray50", "gray30") @@ -114,6 +114,8 @@ def build_ui(self): # sourcery skip: merge-list-append, move-assign-in-block # Dropdown menu for selecting a game self.menu_game_selector = customtkinter.CTkOptionMenu( master=self.frame_left, + font=body_large_font(), + dropdown_font=body_med_font(), values=list(self.btn_map.keys()), command=self.__on_game_selector_change, ) @@ -146,7 +148,7 @@ def build_ui(self): # sourcery skip: merge-list-append, move-assign-in-block fg_color="#2a2d2e", hover_color=self.DEFAULT_GRAY, text="Settings", - font=button_font(), + font=button_med_font(), image=self.img_settings, command=self.__on_settings_clicked, ) @@ -177,7 +179,7 @@ def __create_button(self, bot_key: str, launchable: bool = False): else: text = text tooltip = False - font = button_font(10) if len(self.models[bot_key].bot_title) > shrink_length else button_font(12) + font = button_small_font() if len(self.models[bot_key].bot_title) > shrink_length else button_med_font() btn = customtkinter.CTkButton( master=self.scrollable_frame_left, diff --git a/src/utilities/options_builder.py b/src/utilities/options_builder.py index 32b3fabd..1c973df9 100644 --- a/src/utilities/options_builder.py +++ b/src/utilities/options_builder.py @@ -2,7 +2,7 @@ import customtkinter -from view.fonts import * +from view.fonts.fonts import * class OptionsBuilder: @@ -131,7 +131,7 @@ def __init__(self, parent, title: str, option_info: dict, controller): raise Exception("Unknown option type") # Save button - self.btn_save = customtkinter.CTkButton(master=self, text="Save", font=button_font(), command=lambda: self.save(window=parent)) + self.btn_save = customtkinter.CTkButton(master=self, text="Save", font=button_med_font(), command=lambda: self.save(window=parent)) self.btn_save.grid(row=self.num_of_options + 2, column=0, columnspan=2, pady=20, padx=20) def change_slider_val(self, key, value): diff --git a/src/view/fonts.py b/src/view/fonts/fonts.py similarity index 53% rename from src/view/fonts.py rename to src/view/fonts/fonts.py index ef6284fe..d7258e06 100644 --- a/src/view/fonts.py +++ b/src/view/fonts/fonts.py @@ -1,6 +1,6 @@ import customtkinter as ctk -default_font_family = "Roboto" +default_font_family = "Trebuchet MS" default_font_size = 14 @@ -15,50 +15,64 @@ def title_font(): return get_font(size=24, weight="bold") -def heading_font(): +def heading_font(size=18): """ Preset for headings. """ - return get_font(size=18, weight="bold") + return get_font(size=size, weight="bold") -def subheading_font(): +def subheading_font(size=16): """ Preset for subheadings. """ - return get_font(size=16, weight="bold") + return get_font(size=size, weight="bold") + + +def body_large_font(size=15): + """ + Preset for body text. + """ + return get_font(size=size) -def body_font(): +def body_med_font(size=14): """ Preset for body text. """ - return get_font(size=14) + return get_font(size=size) + + +def button_med_font(size=14): + """ + Preset for button text. + """ + return get_font(size=size, weight="bold") -def button_font(size=12): +def button_small_font(size=12): """ Preset for button text. """ return get_font(size=size, weight="bold") -def small_font(): +def small_font(size=12): """ Preset for small text, such as captions or footnotes. """ - return get_font(size=12) + return get_font(size=size) -def micro_font(): +def micro_font(size=10): """ Preset for micro text, such as version stamps. """ - return get_font(size=10) + return get_font(size=size) -def log_font(): +def log_font(size=12): """ Preset for log text. """ - return get_font(family="Courier", size=12) + return get_font(family="Cascadia Code", size=size) diff --git a/src/view/home_view.py b/src/view/home_view.py index 66ff8b31..9b939177 100644 --- a/src/view/home_view.py +++ b/src/view/home_view.py @@ -1,6 +1,6 @@ import customtkinter -from view.fonts import * +from view.fonts.fonts import * class HomeView(customtkinter.CTkFrame): @@ -33,7 +33,7 @@ def __init__(self, parent, main, game_title: str): "Basic HomeViews are not fully implemented yet. Once support for non-RuneLite games is added to OSBC, this will be updated. . Click the button below to unlock the scripts." ) - self.label_note = customtkinter.CTkLabel(master=self, text=self.note, font=body_font()) + self.label_note = customtkinter.CTkLabel(master=self, text=self.note, font=body_med_font()) self.label_note.bind( "", lambda e: self.label_note.configure(wraplength=self.label_note.winfo_width() - 20), @@ -45,7 +45,7 @@ def __init__(self, parent, main, game_title: str): self.label_warning = customtkinter.CTkLabel( master=self, text=self.warning, - font=body_font(), + font=body_med_font(), text_color="orange", ) self.label_warning.bind( @@ -58,7 +58,7 @@ def __init__(self, parent, main, game_title: str): self.btn_skip = customtkinter.CTkButton( master=self, text="I Understand", - font=button_font(), + font=button_med_font(), fg_color="gray40", hover_color="gray25", command=self.__skip, @@ -66,7 +66,7 @@ def __init__(self, parent, main, game_title: str): self.btn_skip.grid(row=5, column=0, sticky="nwes", padx=40, pady=(0, 15)) # Status label - self.label_status = customtkinter.CTkLabel(master=self, text="", font=body_font()) + self.label_status = customtkinter.CTkLabel(master=self, text="", font=body_med_font()) self.label_status.grid(row=6, column=0, sticky="nwes") self.label_status.bind( "", diff --git a/src/view/home_view_runelite.py b/src/view/home_view_runelite.py index 0cb90768..9edf551d 100644 --- a/src/view/home_view_runelite.py +++ b/src/view/home_view_runelite.py @@ -1,7 +1,7 @@ import customtkinter import utilities.game_launcher as launcher -from view.fonts import * +from view.fonts.fonts import * class RuneLiteHomeView(customtkinter.CTkFrame): @@ -45,7 +45,7 @@ def __init__(self, parent, main, game_title: str): + "step if you know your client is already configured. If a script has a rocket icon next to its name, RuneLite should instead be launched using" " the dedicated button provided by the script." ) - self.label_note = customtkinter.CTkLabel(master=self, text=self.note, font=body_font()) + self.label_note = customtkinter.CTkLabel(master=self, text=self.note, font=body_med_font()) self.label_note.bind( "", lambda e: self.label_note.configure(wraplength=self.label_note.winfo_width() - 20), @@ -57,7 +57,7 @@ def __init__(self, parent, main, game_title: str): self.label_warning = customtkinter.CTkLabel( master=self, text=self.warning, - font=body_font(), + font=body_med_font(), text_color="orange", ) self.label_warning.bind( @@ -70,7 +70,7 @@ def __init__(self, parent, main, game_title: str): self.btn_replace = customtkinter.CTkButton( master=self, text=f"Launch {game_title}", - font=button_font(), + font=button_med_font(), command=self.__launch, ) self.btn_replace.grid(row=5, column=0, sticky="nwes", padx=40, pady=(0, 15)) @@ -79,7 +79,7 @@ def __init__(self, parent, main, game_title: str): self.btn_skip = customtkinter.CTkButton( master=self, text="Skip", - font=button_font(), + font=button_med_font(), fg_color="gray40", hover_color="gray25", command=self.__skip, @@ -90,7 +90,7 @@ def __init__(self, parent, main, game_title: str): self.btn_skip = customtkinter.CTkButton( master=self, text="Reset Saved Path", - font=button_font(), + font=button_med_font(), fg_color="DarkRed", hover_color="red", command=self.__reset_saved_path, @@ -98,7 +98,7 @@ def __init__(self, parent, main, game_title: str): self.btn_skip.grid(row=7, column=0, sticky="ns", padx=10, pady=(0, 15)) # Status label - self.label_status = customtkinter.CTkLabel(master=self, text="", font=body_font()) + self.label_status = customtkinter.CTkLabel(master=self, text="", font=body_med_font()) self.label_status.grid(row=8, column=0, sticky="nwes") self.label_status.bind( "", diff --git a/src/view/info_frame.py b/src/view/info_frame.py index 3e6c65b2..9ab44476 100644 --- a/src/view/info_frame.py +++ b/src/view/info_frame.py @@ -7,7 +7,7 @@ import utilities.settings as settings from utilities.game_launcher import Launchable -from view.fonts import * +from view.fonts.fonts import * class InfoFrame(customtkinter.CTkFrame): @@ -45,7 +45,7 @@ def __init__(self, parent, title, info): # sourcery skip: merge-nested-ifs self.lbl_script_title.grid(column=0, row=0, sticky="wns", padx=20, pady=15) # -- script description - self.lbl_script_desc = customtkinter.CTkLabel(master=self, text=info, font=small_font(), justify=tkinter.CENTER) + self.lbl_script_desc = customtkinter.CTkLabel(master=self, text=info, font=body_med_font(), justify=tkinter.CENTER) self.lbl_script_desc.grid(column=0, row=2, sticky="nwes", padx=15) self.lbl_script_desc.bind( "", @@ -97,7 +97,7 @@ def __init__(self, parent, title, info): # sourcery skip: merge-nested-ifs self.btn_play = customtkinter.CTkButton( master=self.btn_frame, text="Play", - font=button_font(), + font=button_med_font(), text_color="white", image=self.img_play, command=self.play_btn_clicked, @@ -109,7 +109,7 @@ def __init__(self, parent, title, info): # sourcery skip: merge-nested-ifs self.btn_stop = customtkinter.CTkButton( master=self.btn_frame, text="Stop", - font=button_font(), + font=button_med_font(), text_color="white", fg_color="#910101", hover_color="#690101", @@ -122,7 +122,7 @@ def __init__(self, parent, title, info): # sourcery skip: merge-nested-ifs self.btn_options = customtkinter.CTkButton( master=self.btn_frame, text="Options", - font=button_font(), + font=button_med_font(), text_color="white", fg_color="#d97b00", hover_color="#b36602", @@ -134,7 +134,7 @@ def __init__(self, parent, title, info): # sourcery skip: merge-nested-ifs self.btn_launch = customtkinter.CTkButton( master=self.btn_frame, text="Launch Game", - font=button_font(), + font=button_med_font(), text_color="white", fg_color="#616161", image=self.img_start, diff --git a/src/view/output_log_frame.py b/src/view/output_log_frame.py index 6076914e..ba5938aa 100644 --- a/src/view/output_log_frame.py +++ b/src/view/output_log_frame.py @@ -2,7 +2,7 @@ import customtkinter -from view.fonts import * +from view.fonts.fonts import * class OutputLogFrame(customtkinter.CTkFrame): diff --git a/src/view/settings_view.py b/src/view/settings_view.py index 906a2cf8..fc854a6f 100644 --- a/src/view/settings_view.py +++ b/src/view/settings_view.py @@ -12,7 +12,7 @@ from PIL import Image, ImageTk import utilities.settings as settings -from view.fonts import * +from view.fonts.fonts import * class SettingsView(customtkinter.CTkFrame): @@ -46,7 +46,7 @@ def __init__(self, parent): self.frame_keybinds.columnconfigure(0, weight=1) # lbl label self.frame_keybinds.columnconfigure(1, weight=0) # lbl keybind self.frame_keybinds.columnconfigure(2, weight=0) # btn set - self.lbl_keybinds = customtkinter.CTkLabel(master=self.frame_keybinds, text="Bot start/stop keybind: ", font=body_font()) + self.lbl_keybinds = customtkinter.CTkLabel(master=self.frame_keybinds, text="Bot start/stop keybind: ", font=body_med_font()) self.lbl_keybinds.grid(row=0, column=0, padx=20, pady=20) self.entry_keybinds = customtkinter.CTkLabel( master=self.frame_keybinds, text=f"{settings.keybind_to_text(self.current_keys) if self.current_keys else 'None'}" @@ -84,7 +84,7 @@ def __init__(self, parent): widget_list[i].grid(row=i, column=0, columnspan=2, sticky="nsew", padx=20, pady=20) # Save button - self.btn_save = customtkinter.CTkButton(master=self, text="Save", font=button_font(), command=lambda: self.save(window=parent)) + self.btn_save = customtkinter.CTkButton(master=self, text="Save", font=button_med_font(), command=lambda: self.save(window=parent)) self.btn_save.grid(row=self.num_of_widgets + 2, column=0, columnspan=2, pady=20, padx=20) def __modify_keybind(self): diff --git a/src/view/sprite_scraper_view.py b/src/view/sprite_scraper_view.py index 9b64413f..c27a5439 100644 --- a/src/view/sprite_scraper_view.py +++ b/src/view/sprite_scraper_view.py @@ -4,7 +4,7 @@ import customtkinter from utilities.sprite_scraper import SpriteScraper -from view.fonts import * +from view.fonts.fonts import * scraper = SpriteScraper() diff --git a/src/view/title_view.py b/src/view/title_view.py index c9811aeb..63220421 100644 --- a/src/view/title_view.py +++ b/src/view/title_view.py @@ -4,7 +4,7 @@ import customtkinter from PIL import Image, ImageTk -from view.fonts import * +from view.fonts.fonts import * from view.sprite_scraper_view import SpriteScraperView @@ -31,7 +31,7 @@ def __init__(self, parent, main): Image.open(f"{self.logo_path}/images/ui/logo.png").resize((411, 64)), Image.ANTIALIAS, ) - self.label_logo = customtkinter.CTkLabel(self, image=self.logo, text="", font=body_font()) + self.label_logo = customtkinter.CTkLabel(self, image=self.logo, text="", font=body_med_font()) self.label_logo.grid(row=1, column=0, columnspan=3, sticky="nsew", padx=15, pady=15) # Description label @@ -55,7 +55,7 @@ def __init__(self, parent, main): self.btn_github = customtkinter.CTkButton( master=self, text="GitHub", - font=button_font(), + font=button_med_font(), image=self.github_logo, width=BTN_WIDTH, height=BTN_HEIGHT, @@ -74,7 +74,7 @@ def __init__(self, parent, main): self.btn_feedback = customtkinter.CTkButton( master=self, text="Feedback", - font=button_font(), + font=button_med_font(), image=self.feedback_logo, width=BTN_WIDTH, height=BTN_HEIGHT, @@ -93,7 +93,7 @@ def __init__(self, parent, main): self.btn_feedback = customtkinter.CTkButton( master=self, text="Report Bug", - font=button_font(), + font=button_med_font(), image=self.bug_logo, width=BTN_WIDTH, height=BTN_HEIGHT, @@ -113,7 +113,7 @@ def __init__(self, parent, main): self.btn_sprite_scraper = customtkinter.CTkButton( master=self, text="Scraper", - font=button_font(), + font=button_med_font(), image=self.scraper_logo, width=BTN_WIDTH, height=BTN_HEIGHT,