added labels, added window preservation logic

This commit is contained in:
itdominator 2023-05-07 14:50:39 -05:00
parent c8d6a6b563
commit 98ffd7c6b0
5 changed files with 161 additions and 64 deletions

View File

@ -47,18 +47,24 @@ class BaseContainer(Gtk.Box):
scroll = SinkInputList(self.pulse) scroll = SinkInputList(self.pulse)
box = scroll.get_box() box = scroll.get_box()
label2 = Gtk.Label("Playback")
label2.set_xalign(0.0)
for sink_input in self.sink_inputs: for sink_input in self.sink_inputs:
box.add( AudioSink(self.pulse, sink_input) ) box.add( AudioSink(self.pulse, sink_input) )
self.add(label2)
self.add(scroll) self.add(scroll)
self._set_pulse_event_listener() self._set_pulse_event_listener()
def _load_pulse_data(self): def _load_pulse_data(self):
try: try:
label1 = Gtk.Label("Output Devices")
pulse = pulsectl.Pulse() pulse = pulsectl.Pulse()
self.pulse_events = pulsectl.Pulse('event-printer') self.pulse_events = pulsectl.Pulse('event-printer')
si, sink_inputs, modules, clients, sink_list = pulse.server_info(), pulse.sink_input_list(), pulse.module_list(), pulse.client_list(), pulse.sink_list() si, sink_inputs, modules, clients, sink_list = pulse.server_info(), pulse.sink_input_list(), pulse.module_list(), pulse.client_list(), pulse.sink_list()
self.add(label1)
label1.set_xalign(0.0)
logger.debug(f"\n\nServer Info\n{si}\n\nSink Inputs:") logger.debug(f"\n\nServer Info\n{si}\n\nSink Inputs:")
for sink in sink_list: for sink in sink_list:
self.add( AudioSink(pulse, sink) ) self.add( AudioSink(pulse, sink) )

View File

@ -26,6 +26,7 @@ class Window(Gtk.ApplicationWindow):
def __init__(self, args, unknownargs): def __init__(self, args, unknownargs):
super(Window, self).__init__() super(Window, self).__init__()
settings.set_main_window(self)
self._controller = None self._controller = None
@ -33,27 +34,21 @@ class Window(Gtk.ApplicationWindow):
self._setup_styling() self._setup_styling()
self._setup_signals() self._setup_signals()
self._subscribe_to_events() self._subscribe_to_events()
settings.set_main_window(self)
self._load_widgets(args, unknownargs) self._load_widgets(args, unknownargs)
self.show()
# NOTE: Need to set size after show b/c get_allocation methods are initially incorrect if done beforehand...
self._set_size_constraints() self._set_size_constraints()
self.show()
def _setup_styling(self): def _setup_styling(self):
self.set_default_size(settings.get_main_window_width(),
settings.get_main_window_height())
self.set_title(f"{app_name}") self.set_title(f"{app_name}")
self.set_icon_from_file( settings.get_window_icon() ) self.set_icon_from_file( settings.get_window_icon() )
self.set_gravity(5) # 5 = CENTER self.set_gravity(5) # 5 = CENTER
self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS
def _setup_signals(self): def _setup_signals(self):
self.connect("delete-event", self._tear_down)
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self._tear_down) GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self._tear_down)
self.connect("delete-event", self._tear_down)
def _subscribe_to_events(self): def _subscribe_to_events(self):
event_system.subscribe("tear_down", self._tear_down) event_system.subscribe("tear_down", self._tear_down)
@ -62,7 +57,6 @@ class Window(Gtk.ApplicationWindow):
if settings.is_debug(): if settings.is_debug():
self.set_interactive_debugging(True) self.set_interactive_debugging(True)
self._controller = Controller(args, unknownargs) self._controller = Controller(args, unknownargs)
if not self._controller: if not self._controller:
raise ControllerStartException("Controller exited and doesn't exist...") raise ControllerStartException("Controller exited and doesn't exist...")
@ -70,10 +64,16 @@ class Window(Gtk.ApplicationWindow):
self.add( self._controller.get_base_container() ) self.add( self._controller.get_base_container() )
def _set_size_constraints(self): def _set_size_constraints(self):
self.set_default_size(settings.get_main_window_width(), _window_x = settings.get_main_window_x()
settings.get_main_window_height()) _window_y = settings.get_main_window_y()
self.set_size_request(settings.get_main_window_min_width(), _min_width = settings.get_main_window_min_width()
settings.get_main_window_min_height()) _min_height = settings.get_main_window_min_height()
_width = settings.get_main_window_width()
_height = settings.get_main_window_height()
self.move(_window_x, _window_y - 28)
self.set_size_request(_min_width, _min_height)
self.set_default_size(_width, _height)
def _set_window_data(self) -> None: def _set_window_data(self) -> None:
screen = self.get_screen() screen = self.get_screen()
@ -98,7 +98,16 @@ class Window(Gtk.ApplicationWindow):
cr.set_operator(cairo.OPERATOR_OVER) cr.set_operator(cairo.OPERATOR_OVER)
def _tear_down(self, widget=None, eve=None): def _tear_down(self, widget = None, eve = None):
size = self.get_default_size()
pos = self.get_position()
settings.set_main_window_width(size.width)
settings.set_main_window_height(size.height)
settings.set_main_window_x(pos.root_x)
settings.set_main_window_y(pos.root_y)
settings.save_settings()
settings.clear_pid() settings.clear_pid()
time.sleep(event_sleep_time) time.sleep(event_sleep_time)
Gtk.main_quit() Gtk.main_quit()

View File

@ -84,11 +84,6 @@ class Settings(StartCheckMixin, Singleton):
self._main_window = None self._main_window = None
self._main_window_w = 800
self._main_window_h = 600
self._main_window_mw = 720
self._main_window_mh = 480
self._builder = None self._builder = None
self.PAINT_BG_COLOR = (0, 0, 0, 0.54) self.PAINT_BG_COLOR = (0, 0, 0, 0.54)
@ -126,10 +121,12 @@ class Settings(StartCheckMixin, Singleton):
return monitors return monitors
def get_main_window(self) -> any: return self._main_window def get_main_window(self) -> any: return self._main_window
def get_main_window_width(self) -> any: return self._main_window_w def get_main_window_x(self) -> any: return self._settings["config"]["window_x"]
def get_main_window_height(self) -> any: return self._main_window_h def get_main_window_y(self) -> any: return self._settings["config"]["window_y"]
def get_main_window_min_width(self) -> any: return self._main_window_mw def get_main_window_width(self) -> any: return self._settings["config"]["window_width"]
def get_main_window_min_height(self) -> any: return self._main_window_mh def get_main_window_height(self) -> any: return self._settings["config"]["window_height"]
def get_main_window_min_width(self) -> any: return self._settings["config"]["window_min_width"]
def get_main_window_min_height(self) -> any: return self._settings["config"]["window_min_height"]
def get_builder(self) -> any: return self._builder def get_builder(self) -> any: return self._builder
def get_paint_bg_color(self) -> any: return self.PAINT_BG_COLOR def get_paint_bg_color(self) -> any: return self.PAINT_BG_COLOR
def get_ui_widgets_path(self) -> str: return self._UI_WIDEGTS_PATH def get_ui_widgets_path(self) -> str: return self._UI_WIDEGTS_PATH
@ -161,6 +158,13 @@ class Settings(StartCheckMixin, Singleton):
def get_ch_log_lvl(self) -> str: return self._settings["debugging"]["ch_log_lvl"] def get_ch_log_lvl(self) -> str: return self._settings["debugging"]["ch_log_lvl"]
def get_fh_log_lvl(self) -> str: return self._settings["debugging"]["fh_log_lvl"] def get_fh_log_lvl(self) -> str: return self._settings["debugging"]["fh_log_lvl"]
def set_main_window_x(self, x = 0): self._settings["config"]["window_x"] = x
def set_main_window_y(self, y = 0): self._settings["config"]["window_y"] = y
def set_main_window_width(self, width = 800): self._settings["config"]["window_width"] = width
def set_main_window_height(self, height = 600): self._settings["config"]["window_height"] = height
def set_main_window_min_width(self, width = 720): self._settings["config"]["window_min_width"] = width
def set_main_window_min_height(self, height = 480): self._settings["config"]["window_min_height"] = height
def set_trace_debug(self, trace_debug): def set_trace_debug(self, trace_debug):
self._trace_debug = trace_debug self._trace_debug = trace_debug

View File

@ -1,41 +1,118 @@
{ {
"config": { "config":{
"base_of_home": "", "base_of_home":"",
"hide_hidden_files": "true", "hide_hidden_files":"true",
"thumbnailer_path": "ffmpegthumbnailer", "thumbnailer_path":"ffmpegthumbnailer",
"go_past_home": "true", "go_past_home":"true",
"lock_folder": "false", "lock_folder":"false",
"locked_folders": "venv::::flasks", "locked_folders":"venv::::flasks",
"mplayer_options": "-quiet -really-quiet -xy 1600 -geometry 50%:50%", "mplayer_options":"-quiet -really-quiet -xy 1600 -geometry 50%:50%",
"music_app": "/opt/deadbeef/bin/deadbeef", "music_app":"/opt/deadbeef/bin/deadbeef",
"media_app": "mpv", "media_app":"mpv",
"image_app": "mirage", "image_app":"mirage",
"office_app": "libreoffice", "office_app":"libreoffice",
"pdf_app": "evince", "pdf_app":"evince",
"text_app": "leafpad", "text_app":"leafpad",
"file_manager_app": "solarfm", "file_manager_app":"solarfm",
"terminal_app": "terminator", "terminal_app":"terminator",
"remux_folder_max_disk_usage": "8589934592", "remux_folder_max_disk_usage":"8589934592",
"make_transparent": 0 "make_transparent":0,
"window_x":720,
"window_y":720,
"window_min_width":720,
"window_min_height":480,
"window_width":800,
"window_height":600
}, },
"filters": { "filters":{
"meshs": [".blend", ".dae", ".fbx", ".gltf", ".obj", ".stl"], "meshs":[
"code": [".cpp", ".css", ".c", ".go", ".html", ".htm", ".java", ".js", ".json", ".lua", ".md", ".py", ".rs", ".toml", ".xml", ".pom"], ".blend",
"videos": [".mkv", ".mp4", ".webm", ".avi", ".mov", ".m4v", ".mpg", ".mpeg", ".wmv", ".flv"], ".dae",
"office": [".doc", ".docx", ".xls", ".xlsx", ".xlt", ".xltx", ".xlm", ".ppt", ".pptx", ".pps", ".ppsx", ".odt", ".rtf"], ".fbx",
"images": [".png", ".jpg", ".jpeg", ".gif", ".ico", ".tga", ".webp"], ".gltf",
"text": [".txt", ".text", ".sh", ".cfg", ".conf", ".log"], ".obj",
"music": [".psf", ".mp3", ".ogg", ".flac", ".m4a"], ".stl"
"pdf": [".pdf"] ],
"code":[
".cpp",
".css",
".c",
".go",
".html",
".htm",
".java",
".js",
".json",
".lua",
".md",
".py",
".rs",
".toml",
".xml",
".pom"
],
"videos":[
".mkv",
".mp4",
".webm",
".avi",
".mov",
".m4v",
".mpg",
".mpeg",
".wmv",
".flv"
],
"office":[
".doc",
".docx",
".xls",
".xlsx",
".xlt",
".xltx",
".xlm",
".ppt",
".pptx",
".pps",
".ppsx",
".odt",
".rtf"
],
"images":[
".png",
".jpg",
".jpeg",
".gif",
".ico",
".tga",
".webp"
],
"text":[
".txt",
".text",
".sh",
".cfg",
".conf",
".log"
],
"music":[
".psf",
".mp3",
".ogg",
".flac",
".m4a"
],
"pdf":[
".pdf"
]
}, },
"theming":{ "theming":{
"success_color":"#88cc27", "success_color":"#88cc27",
"warning_color":"#ffa800", "warning_color":"#ffa800",
"error_color":"#ff0000" "error_color":"#ff0000"
}, },
"debugging": { "debugging":{
"ch_log_lvl": 20, "ch_log_lvl":20,
"fh_log_lvl": 20 "fh_log_lvl":20
} }
} }

View File

@ -1,7 +1,8 @@
/* * { * {
background: rgba(0, 0, 0, 0.14); /* background: rgba(0, 0, 0, 0.14); */
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
} */ border: 2px solid rgba(0, 0, 0, 0.0);
}
.sink-list-container { .sink-list-container {
/* Neon Blue 00e8ff border */ /* Neon Blue 00e8ff border */