From 13ea9b7539534b19ce61d2694c0cf3832a6ec35e Mon Sep 17 00:00:00 2001 From: Chandler J Date: Fri, 1 Mar 2024 11:08:46 -0700 Subject: created some ideas for things to do with project during hackusu --- hackusu.md | 22 ++++++++ src/appearance.py | 14 +++++ src/get_i3_appearence.py | 12 +++++ src/tui.py | 136 ++++++++++++++++++++++++++--------------------- 4 files changed, 123 insertions(+), 61 deletions(-) create mode 100644 hackusu.md create mode 100644 src/appearance.py create mode 100644 src/get_i3_appearence.py diff --git a/hackusu.md b/hackusu.md new file mode 100644 index 0000000..5ae6359 --- /dev/null +++ b/hackusu.md @@ -0,0 +1,22 @@ +# Features I *could* add to `InstantRice` during HackUSU +*number after item indicates anticipated level of difficulty out of 5* +- [] Using a central config file instead of a python dictionary | 2 +- [] Completing the TUI | 4 + - [] Creating classes that store configuration settings and persist changes made to config | 2 + - [] Class will need to grab initial state of configuration files | 2 +- [] Add support for compiling dmenu with predetermined list of plugins | 5 +- [] Add support for `dwm` | 5 +- [] Add support for `sway` (*should* be trivial) | 1 +- [] Rewrite K-means clustering algorithm using builtins instead of `scikit-learn` | 4 +- [] Implement native terminal image viewer (or find python lib that covers functionality) | 5 +- [] Minimize number of `sys` package usage | 5 +- [] add features to randomized color selector | 5 + - [] preview what colors will be used for what aspects of the system color scheme | 1 + - [] Add ability to customize what colors are used for different aspects of the system | 3 + - [] Add ability to 'keep' colors and regenerate other colors. | 1 + - [] Detection of when colors do not have enough contrast from one another and generate new scheme | 3 + - [] Provide ability to save color schemes to use independent of wallpaper | 2 + - [] Ability to load preset color scheme | 1 + - [] Provide ability to pass in separate image to provide colors than image being used for background | 1 +- [] Put program in a state to publish on AUR/pip | 2 + - [] Create build process using `PKGBUILD` or `PyInstaller` | 2 diff --git a/src/appearance.py b/src/appearance.py new file mode 100644 index 0000000..013d5fc --- /dev/null +++ b/src/appearance.py @@ -0,0 +1,14 @@ + + +class Appearance: + """ + Generic object to get configuration settings for a given program + + path - path to the configuration file + """ + def __init__(self, path): + print("hello from appearance") + self.path = path + + def get(self): + pass diff --git a/src/get_i3_appearence.py b/src/get_i3_appearence.py new file mode 100644 index 0000000..961740d --- /dev/null +++ b/src/get_i3_appearence.py @@ -0,0 +1,12 @@ + +from appearance import Appearance + +class i3_Appearence(Appearance): + + def __init__(self, path): + super().__init__(self) + + def get(self): + pass + +test = i3_Appearence("test") diff --git a/src/tui.py b/src/tui.py index c73c3f2..a593293 100644 --- a/src/tui.py +++ b/src/tui.py @@ -13,70 +13,84 @@ appearence_settings = { "i3-font-size": "10" } +# initialize appearance settings dictionary +def initialize_appearence_settings(): + """ + Read in information from configuration files and update the + apperaance settings dictionary to the appropiate settings based on the + configuration currently set in the config file + """ + pass + + # callback functions def set_window_gaps(state) -> None: appearence_settings['window_gaps'] = state - -with ptg.WindowManager() as manager: - #layout = ptg.Layout() - #layout.add_slot("Body Left", index=0) - #layout.add_slot("Body Right", width=0.5, index=1) - i3window = ( - ptg.Window( - "[bold]i3 Configuration Settings", - ptg.Label("[italic gray]gaps", parent_align=0), - ptg.Splitter( - ptg.Label( - "Window gaps", - parent_align=0 - ), - ptg.Checkbox( - parent_align=2, - callback=set_window_gaps, - checked=appearence_settings["window_gaps"] - ) - ), - ptg.InputField(prompt="Inner Gaps: ", value=appearence_settings["inner_gap_sz"]), - ptg.InputField(prompt="Outer Gaps: ", value=appearence_settings["outter_gap_sz"]), - ptg.Label(""), - ptg.Label("[italic gray]Window Boarders", parent_align=0), - ptg.Splitter( - ptg.Label( - "Titlebars", - parent_align=0 - ), - ptg.Checkbox( - parent_align=2 - ) - ), - ptg.Splitter(ptg.Label("Window Boarders", parent_align=0), ptg.Checkbox(parent_align=2)), - ptg.InputField(prompt="Boarder Width: "), - ptg.Label(""), - ptg.Label("[italic gray]Font", parent_align=0), - ptg.InputField(prompt="Font: ", value=appearence_settings["i3-font"]), - ptg.InputField(prompt="Font Size: ", value=appearence_settings["i3-font-size"]), - ptg.Button("Save Changes") - ) - .set_title("[italic inverse !gradient(60)]i3 Configuration[/!]") - ) - polybar_window = ( - ptg.Window( - "[bold]Polybar Configuration Settings", - ptg.Label("[italic gray]Font", parent_align=0), - ptg.InputField(prompt="Font: ", value=appearence_settings["i3-font"]), - ptg.InputField(prompt="Font Size: ", value=appearence_settings["i3-font-size"]), - ptg.Label(""), - ptg.Label("[italic gray]Modules", parent_align=0), - ptg.InputField(prompt="Font: ", value=appearence_settings["i3-font"]), - ptg.InputField(prompt="Font Size: ", value=appearence_settings["i3-font-size"]), - - ptg.Button("Save Changes") - ) - .set_title("[italic inverse !gradient(45)]Polybar Configuration")) +def tui_runner(): + with ptg.WindowManager() as manager: + #layout = ptg.Layout() + #layout.add_slot("Body Left", index=0) + #layout.add_slot("Body Right", width=0.5, index=1) + + i3window = ( + ptg.Window( + "[bold]i3 Configuration Settings", + ptg.Label("[italic gray]gaps", parent_align=0), + ptg.Splitter( + ptg.Label( + "Window gaps", + parent_align=0 + ), + ptg.Checkbox( + parent_align=2, + callback=set_window_gaps, + checked=appearence_settings["window_gaps"] + ) + ), + ptg.InputField(prompt="Inner Gaps: ", value=appearence_settings["inner_gap_sz"]), + ptg.InputField(prompt="Outer Gaps: ", value=appearence_settings["outter_gap_sz"]), + ptg.Label(""), + ptg.Label("[italic gray]Window Boarders", parent_align=0), + ptg.Splitter( + ptg.Label( + "Titlebars", + parent_align=0 + ), + ptg.Checkbox( + parent_align=2 + ) + ), + ptg.Splitter(ptg.Label("Window Boarders", parent_align=0), ptg.Checkbox(parent_align=2)), + ptg.InputField(prompt="Boarder Width: "), + ptg.Label(""), + ptg.Label("[italic gray]Font", parent_align=0), + ptg.InputField(prompt="Font: ", value=appearence_settings["i3-font"]), + ptg.InputField(prompt="Font Size: ", value=appearence_settings["i3-font-size"]), + ptg.Button("Save Changes") + ) + .set_title("[italic inverse !gradient(60)]i3 Configuration[/!]") + ) + polybar_window = ( + ptg.Window( + "[bold]Polybar Configuration Settings", + ptg.Label("[italic gray]Font", parent_align=0), + ptg.InputField(prompt="Font: ", value=appearence_settings["i3-font"]), + ptg.InputField(prompt="Font Size: ", value=appearence_settings["i3-font-size"]), + ptg.Label(""), + ptg.Label("[italic gray]Modules", parent_align=0), + ptg.InputField(prompt="Font: ", value=appearence_settings["i3-font"]), + ptg.InputField(prompt="Font Size: ", value=appearence_settings["i3-font-size"]), - #layout.assign(polybar_window, index=0) - #layout.assign(i3window, index=1) - manager.add(i3window) - manager.add(polybar_window) + ptg.Button("Save Changes") + ) + .set_title("[italic inverse !gradient(45)]Polybar Configuration")) + + #layout.assign(polybar_window, index=0) + #layout.assign(i3window, index=1) + manager.add(i3window) + manager.add(polybar_window) +tui_runner() +print(appearence_settings) +a_pause = input("this is a pause that should run after the tui is closed > ") -- cgit v1.2.3