Initial tableting structure

This commit is contained in:
itdominator 2023-03-29 19:44:01 -05:00
parent 0f1b0a9b94
commit c5d80b6c25
36 changed files with 284 additions and 80 deletions

View File

@ -29,7 +29,7 @@ def daemon_threaded_wrapper(fn):
# NOTE: Just reminding myself we can add to builtins two different ways...
# __builtins__.update({"event_system": Builtins()})
builtins.app_name = "<change_me>"
builtins.app_name = "Coherence"
builtins.keybindings = Keybindings()
builtins.event_system = EventSystem()
builtins.endpoint_registry = EndpointRegistry()

View File

@ -10,14 +10,12 @@ from gi.repository import GLib
# Application imports
from .mixins.signals_mixins import SignalsMixins
from .mixins.dummy_mixin import DummyMixin
from .controller_data import ControllerData
from .core_widget import CoreWidget
from .widgets.sections.sections_widget import Sections
class Controller(DummyMixin, SignalsMixins, ControllerData):
class Controller(SignalsMixins, ControllerData):
def __init__(self, args, unknownargs):
self.setup_controller_data()
@ -25,8 +23,6 @@ class Controller(DummyMixin, SignalsMixins, ControllerData):
self._setup_signals()
self._subscribe_to_events()
self.print_hello_world() # A mixin method from the DummyMixin file
logger.info(f"Made it past {self.__class__} loading...")
@ -48,7 +44,7 @@ class Controller(DummyMixin, SignalsMixins, ControllerData):
self.builder.expose_object("main_window", self.window)
settings.set_builder(self.builder)
self.core_widget = CoreWidget()
self.core_widget = Sections()
settings.register_signals_to_builder([self, self.core_widget])

View File

@ -1,44 +0,0 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
class CoreWidget(Gtk.Box):
def __init__(self):
super(CoreWidget, self).__init__()
self._builder = settings.get_builder()
self._setup_styling()
self._setup_signals()
self._load_widgets()
self.show_all()
def _setup_styling(self):
self.set_orientation(1)
def _setup_signals(self):
...
def _load_widgets(self):
glade_box = self._builder.get_object("glade_box")
button = Gtk.Button(label="Click Me!")
button.connect("clicked", self._hello_world)
self.add(button)
self.add(glade_box)
def _hello_world(self, widget=None, eve=None):
print("Hello, World!")

View File

@ -1,14 +0,0 @@
# Python imports
# Lib imports
# Application imports
class DummyMixin:
""" DummyMixin is an example of how mixins are used and structured in a project. """
def print_hello_world(self) -> None:
print("Hello, World!")

View File

@ -0,0 +1,3 @@
"""
Widgets Module
"""

View File

@ -0,0 +1,47 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from .pages_tab_widget import PagesTabWidget
class Page(Gtk.ScrolledWindow):
def __init__(self, close_tab):
super(Page, self).__init__()
self._close_tab = close_tab
self._tab_widget = PagesTabWidget(self, self._close_tab)
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets()
def _setup_styling(self):
...
def _setup_signals(self):
...
def _subscribe_to_events(self):
# event_system.subscribe("handle_file_from_ipc", self.handle_file_from_ipc)
...
def _load_widgets(self):
viewport = Gtk.Viewport()
viewport.set_vexpand(True)
viewport.set_hexpand(True)
fixed = Gtk.Fixed()
viewport.add(fixed)
self.add(viewport)
def get_tab_widget(self):
return self._tab_widget

View File

@ -0,0 +1,3 @@
"""
Pages Module
"""

View File

@ -0,0 +1,51 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from ..sections_tab_widget import SectionsTabWidget
from ..page_widget import Page
class Pages(Gtk.Notebook):
def __init__(self, close_tab):
super(Pages, self).__init__()
self._close_tab = close_tab
self._tab_widget = SectionsTabWidget(self, self._close_tab)
self._setup_styling()
self._setup_signals()
self._load_widgets()
self.show_all()
def _setup_styling(self):
self.set_tab_pos(1) # NOTE: LEFT = 0, RIGHT = 1, TOP = 2, BOTTOM = 3
def _setup_signals(self):
...
def _load_widgets(self):
page = Page(self.close_tab)
page_num = self.append_page(page, page.get_tab_widget())
self.set_tab_detachable(page, False)
self.set_tab_reorderable(page, True)
self.show_all()
self.set_current_page(page_num)
def get_tab_widget(self):
return self._tab_widget
def close_tab(self, button, page, eve = None):
page_num = self.page_num(page)
self.remove_page(page_num)

View File

@ -0,0 +1,24 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from .template.tab_header_template import TabHeaderTemplate
class PagesTabWidget(TabHeaderTemplate):
""" docstring for PagesTabWidget """
ccount = 0
def __new__(cls, *args, **kwargs):
obj = super(PagesTabWidget, cls).__new__(cls)
cls.ccount += 1
return obj
def __init__(self, container, close_tab):
super(PagesTabWidget, self).__init__(container, close_tab)

View File

@ -0,0 +1,3 @@
"""
Sections Module
"""

View File

@ -0,0 +1,46 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from ..pages.pages_widget import Pages
class Sections(Gtk.Notebook):
def __init__(self):
super(Sections, self).__init__()
self._setup_styling()
self._setup_signals()
self._load_widgets()
self.show_all()
def _setup_styling(self):
...
def _setup_signals(self):
...
def _load_widgets(self):
self.create_view()
...
def create_view(self, widget = None, eve = None, gfile = None):
pages = Pages(self.close_tab)
page_num = self.append_page(pages, pages.get_tab_widget())
self.set_tab_detachable(pages, True)
self.set_tab_reorderable(pages, True)
self.show_all()
self.set_current_page(page_num)
def close_tab(self, button, pages, eve = None):
page_num = self.page_num(pages)
self.remove_page(page_num)

View File

@ -0,0 +1,17 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from .template.tab_header_template import TabHeaderTemplate
class SectionsTabWidget(TabHeaderTemplate):
""" docstring for SectionsTabWidget """
def __init__(self, container, close_tab):
super(SectionsTabWidget, self).__init__(container, close_tab)

View File

@ -0,0 +1,3 @@
"""
Teplate Module
"""

View File

@ -0,0 +1,69 @@
# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
class TabHeaderTemplate(Gtk.Box):
""" docstring for TabHeaderTemplate """
ccount = 0
def __new__(cls, *args, **kwargs):
obj = super(TabHeaderTemplate, cls).__new__(cls)
cls.ccount += 1
return obj
def __init__(self, container, close_tab):
super(TabHeaderTemplate, self).__init__()
self.INDEX = self.ccount
self.NAME = f"tab_{self.INDEX}"
self._container = container
self._close_tab = close_tab # NOTE: Close method in tab_mixin
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets()
self.set_tab_label()
self.show_all()
def _setup_styling(self):
self.set_orientation(0)
self.set_hexpand(False)
def _setup_signals(self):
...
def _subscribe_to_events(self):
...
def _load_widgets(self):
label = Gtk.Label()
close = Gtk.Button()
icon = Gtk.Image(stock=Gtk.STOCK_CLOSE)
# NOTE: Setup with settings and from file
label.set_xalign(0.0)
label.set_margin_left(25)
label.set_margin_right(25)
label.set_hexpand(True)
close.set_always_show_image(True)
close.set_hexpand(False)
close.set_image( Gtk.Image.new_from_icon_name("gtk-close", 4) )
close.connect("released", self._close_tab, *(self._container,))
self.add(label)
self.add(close)
def set_tab_label(self, label = "untitled"):
self.get_children()[0].set_label(label)

View File

@ -19,11 +19,11 @@ function main() {
# NOTE: Remove if you want to pass file(s) besides directories...
if [ ! -d "${path}" ]; then
echo "<change_me>: Path given not a directory..."
echo "Coherence: Path given not a directory..."
exit 1
fi
cd "/opt/"
python /opt/<change_me>.zip "$@"
python /opt/coherence.zip "$@"
}
main "$@";
main "$@";

View File

@ -1,11 +0,0 @@
[Desktop Entry]
Name=<change_me>
GenericName=<change_me>
Comment=<change_me>
Exec=/bin/<change_me> %F
Icon=/usr/share/<change_me>/icons/<change_me>.png
Type=Application
StartupNotify=true
Categories=System;FileTools;Utility;Core;GTK;FileManager;
MimeType=
Terminal=false

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Coherence
GenericName=Coherence is like a OneNote sibling thatlets you store notes, images, links, etc.
Comment=Coherence
Exec=/bin/coherence %F
Icon=/usr/share/Coherence/icons/coherence.png
Type=Application
StartupNotify=true
Categories=System;FileTools;Utility;Core;GTK;FileManager;
MimeType=
Terminal=false

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 858 B

View File

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 850 B

View File

Before

Width:  |  Height:  |  Size: 702 B

After

Width:  |  Height:  |  Size: 702 B

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 925 B

View File

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 882 B

View File

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 707 B

View File

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 798 B

View File

Before

Width:  |  Height:  |  Size: 989 B

After

Width:  |  Height:  |  Size: 989 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB