Updated README

This commit is contained in:
itdominator 2023-03-06 21:26:48 -06:00
parent 01dbba558f
commit 628bd296c2
4 changed files with 29 additions and 9 deletions

View File

@ -3,12 +3,18 @@ A template project for Python with Gtk applications.
### Requirements ### Requirements
* PyGObject * PyGObject
* setproctitle
* pyxdg
### Note ### Note
There is a "\<change_me\>" string that needs to be set according to your app's name located at: There are a "\<change_me\>" strings and files that need to be set according to your app's name located at:
* \_\_builtins\_\_.py * \_\_builtins\_\_.py
* user_config/bin/app_name
* user_config/usr/share/app_name * user_config/usr/share/app_name
* user_config/usr/share/app_name/icons/app_name.png
* user_config/usr/share/app_name/icons/app_name-64x64.png
* user_config/usr/share/applications/app_name.desktop
For the user_config, traverse all the way down and copy the contents to either:
* /usr/share/\<your_app_name_as_all_lowercase\> For the user_config, after changing names and files, copy all content to their respective destinations.
* /\<your_home_dir\>/.config/\<your_app_name_as_all_lowercase\> The logic follows Debian Dpkg packaging and its placement logic.

View File

@ -41,7 +41,8 @@ class Window(Gtk.ApplicationWindow):
def _setup_styling(self): def _setup_styling(self):
self.set_default_size(1670, 830) 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
@ -55,8 +56,11 @@ class Window(Gtk.ApplicationWindow):
event_system.subscribe("tear_down", self._tear_down) event_system.subscribe("tear_down", self._tear_down)
def _load_widgets(self, args, unknownargs): def _load_widgets(self, args, unknownargs):
self._controller = Controller(args, unknownargs) if settings.is_debug():
self.set_interactive_debugging(True)
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...")

View File

@ -38,11 +38,17 @@ class EventSystem:
def emit_and_await(self, event_type, data = None): def emit_and_await(self, event_type, data = None):
""" NOTE: Should be used when signal has only one listener and vis-a-vis """ """ NOTE: Should be used when signal has only one listener and vis-a-vis """
if event_type in self.subscribers: if event_type in self.subscribers:
response = None
for fn in self.subscribers[event_type]: for fn in self.subscribers[event_type]:
if data: if data:
if hasattr(data, '__iter__') and not type(data) is str: if hasattr(data, '__iter__') and not type(data) is str:
return fn(*data) response = fn(*data)
else: else:
return fn(data) response = fn(data)
else: else:
return fn() response = fn()
if not response in (None, ''):
break
return response

View File

@ -70,6 +70,8 @@ class Settings(StartCheckMixin):
keybindings.configure(bindings) keybindings.configure(bindings)
self._main_window = None self._main_window = None
self._main_window_w = 800
self._main_window_h = 600
self._builder = None self._builder = None
self._trace_debug = False self._trace_debug = False
@ -106,6 +108,8 @@ class Settings(StartCheckMixin):
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) -> Gtk.ApplicationWindow: return self._main_window_w
def get_main_window_height(self) -> Gtk.ApplicationWindow: return self._main_window_h
def get_builder(self) -> any: return self._builder def get_builder(self) -> any: return self._builder
def get_glade_file(self) -> str: return self._GLADE_FILE def get_glade_file(self) -> str: return self._GLADE_FILE