generated from itdominator/Python-With-Gtk-Template
added labels, added window preservation logic
This commit is contained in:
parent
c8d6a6b563
commit
98ffd7c6b0
|
@ -47,18 +47,24 @@ class BaseContainer(Gtk.Box):
|
|||
|
||||
scroll = SinkInputList(self.pulse)
|
||||
box = scroll.get_box()
|
||||
label2 = Gtk.Label("Playback")
|
||||
label2.set_xalign(0.0)
|
||||
for sink_input in self.sink_inputs:
|
||||
box.add( AudioSink(self.pulse, sink_input) )
|
||||
|
||||
self.add(label2)
|
||||
self.add(scroll)
|
||||
self._set_pulse_event_listener()
|
||||
|
||||
def _load_pulse_data(self):
|
||||
try:
|
||||
label1 = Gtk.Label("Output Devices")
|
||||
pulse = pulsectl.Pulse()
|
||||
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()
|
||||
|
||||
self.add(label1)
|
||||
label1.set_xalign(0.0)
|
||||
logger.debug(f"\n\nServer Info\n{si}\n\nSink Inputs:")
|
||||
for sink in sink_list:
|
||||
self.add( AudioSink(pulse, sink) )
|
||||
|
|
|
@ -26,6 +26,7 @@ class Window(Gtk.ApplicationWindow):
|
|||
|
||||
def __init__(self, args, unknownargs):
|
||||
super(Window, self).__init__()
|
||||
settings.set_main_window(self)
|
||||
|
||||
self._controller = None
|
||||
|
||||
|
@ -33,27 +34,21 @@ class Window(Gtk.ApplicationWindow):
|
|||
self._setup_styling()
|
||||
self._setup_signals()
|
||||
self._subscribe_to_events()
|
||||
|
||||
settings.set_main_window(self)
|
||||
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.show()
|
||||
|
||||
|
||||
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_icon_from_file( settings.get_window_icon() )
|
||||
self.set_gravity(5) # 5 = CENTER
|
||||
self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS
|
||||
|
||||
def _setup_signals(self):
|
||||
self.connect("delete-event", 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):
|
||||
event_system.subscribe("tear_down", self._tear_down)
|
||||
|
@ -62,7 +57,6 @@ class Window(Gtk.ApplicationWindow):
|
|||
if settings.is_debug():
|
||||
self.set_interactive_debugging(True)
|
||||
|
||||
|
||||
self._controller = Controller(args, unknownargs)
|
||||
if not self._controller:
|
||||
raise ControllerStartException("Controller exited and doesn't exist...")
|
||||
|
@ -70,10 +64,16 @@ class Window(Gtk.ApplicationWindow):
|
|||
self.add( self._controller.get_base_container() )
|
||||
|
||||
def _set_size_constraints(self):
|
||||
self.set_default_size(settings.get_main_window_width(),
|
||||
settings.get_main_window_height())
|
||||
self.set_size_request(settings.get_main_window_min_width(),
|
||||
settings.get_main_window_min_height())
|
||||
_window_x = settings.get_main_window_x()
|
||||
_window_y = settings.get_main_window_y()
|
||||
_min_width = settings.get_main_window_min_width()
|
||||
_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:
|
||||
screen = self.get_screen()
|
||||
|
@ -99,6 +99,15 @@ class Window(Gtk.ApplicationWindow):
|
|||
|
||||
|
||||
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()
|
||||
time.sleep(event_sleep_time)
|
||||
Gtk.main_quit()
|
||||
|
|
|
@ -84,11 +84,6 @@ class Settings(StartCheckMixin, Singleton):
|
|||
|
||||
|
||||
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.PAINT_BG_COLOR = (0, 0, 0, 0.54)
|
||||
|
||||
|
@ -126,10 +121,12 @@ class Settings(StartCheckMixin, Singleton):
|
|||
return monitors
|
||||
|
||||
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_height(self) -> any: return self._main_window_h
|
||||
def get_main_window_min_width(self) -> any: return self._main_window_mw
|
||||
def get_main_window_min_height(self) -> any: return self._main_window_mh
|
||||
def get_main_window_x(self) -> any: return self._settings["config"]["window_x"]
|
||||
def get_main_window_y(self) -> any: return self._settings["config"]["window_y"]
|
||||
def get_main_window_width(self) -> any: return self._settings["config"]["window_width"]
|
||||
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_paint_bg_color(self) -> any: return self.PAINT_BG_COLOR
|
||||
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_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):
|
||||
self._trace_debug = trace_debug
|
||||
|
||||
|
|
|
@ -16,18 +16,95 @@
|
|||
"file_manager_app":"solarfm",
|
||||
"terminal_app":"terminator",
|
||||
"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":{
|
||||
"meshs": [".blend", ".dae", ".fbx", ".gltf", ".obj", ".stl"],
|
||||
"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"]
|
||||
|
||||
"meshs":[
|
||||
".blend",
|
||||
".dae",
|
||||
".fbx",
|
||||
".gltf",
|
||||
".obj",
|
||||
".stl"
|
||||
],
|
||||
"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":{
|
||||
"success_color":"#88cc27",
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/* * {
|
||||
background: rgba(0, 0, 0, 0.14);
|
||||
* {
|
||||
/* background: rgba(0, 0, 0, 0.14); */
|
||||
color: rgba(255, 255, 255, 1);
|
||||
} */
|
||||
border: 2px solid rgba(0, 0, 0, 0.0);
|
||||
}
|
||||
|
||||
.sink-list-container {
|
||||
/* Neon Blue 00e8ff border */
|
||||
|
|
Loading…
Reference in New Issue