refactor: remove InfoBarWidget in favor of plugin-based one
- Replace direct InfoBarWidget with set_info_labels command that emits events to plugins - Replace mini view widget in favor of plugin-based one - Add widget registry exposure for code-container and editors-container - Fix DND mixin exec_with_args call (tuple args issue) - Add break statements in tabs_widget loops for efficiency - Add _update_transparency call to BaseContainer
This commit is contained in:
3
plugins/code/code_minimap/__init__.py
Normal file
3
plugins/code/code_minimap/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""
|
||||
Pligin Module
|
||||
"""
|
||||
3
plugins/code/code_minimap/__main__.py
Normal file
3
plugins/code/code_minimap/__main__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""
|
||||
Pligin Package
|
||||
"""
|
||||
50
plugins/code/code_minimap/code_minimap.py
Normal file
50
plugins/code/code_minimap/code_minimap.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
import gi
|
||||
gi.require_version('GtkSource', '4')
|
||||
from gi.repository.GtkSource import Map
|
||||
from gi.repository import Pango
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
class CodeMiniMap(Map):
|
||||
def __init__(self):
|
||||
super(CodeMiniMap, self).__init__()
|
||||
|
||||
self._setup_styling()
|
||||
self._setup_signals()
|
||||
self._subscribe_to_events()
|
||||
self._load_widgets()
|
||||
|
||||
self.show()
|
||||
|
||||
|
||||
def _setup_styling(self):
|
||||
ctx = self.get_style_context()
|
||||
ctx.add_class("mini-view")
|
||||
|
||||
self.set_hexpand(False)
|
||||
self._set_font_desc()
|
||||
|
||||
def _setup_signals(self):
|
||||
...
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
event_system.subscribe(f"set-mini-view", self.set_smini_view)
|
||||
|
||||
def _load_widgets(self):
|
||||
...
|
||||
|
||||
def _set_font_desc(self):
|
||||
default_font = 'Monospace 1'
|
||||
desc = Pango.FontDescription(default_font)
|
||||
|
||||
desc.set_size(Pango.SCALE) # Set size to 1pt
|
||||
desc.set_family('BuilderBlocks,' + desc.get_family())
|
||||
self.set_property('font-desc', desc)
|
||||
|
||||
def set_smini_view(self, source_view):
|
||||
self.set_view(source_view)
|
||||
7
plugins/code/code_minimap/manifest.json
Normal file
7
plugins/code/code_minimap/manifest.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "Code MiniMap",
|
||||
"author": "ITDominator",
|
||||
"version": "0.0.1",
|
||||
"support": "",
|
||||
"requests": {}
|
||||
}
|
||||
32
plugins/code/code_minimap/plugin.py
Normal file
32
plugins/code/code_minimap/plugin.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
from libs.event_factory import Event_Factory, Code_Event_Types
|
||||
|
||||
from plugins.plugin_types import PluginCode
|
||||
|
||||
from .code_minimap import CodeMiniMap
|
||||
|
||||
|
||||
|
||||
code_minimap = CodeMiniMap()
|
||||
|
||||
|
||||
|
||||
class Plugin(PluginCode):
|
||||
def __init__(self):
|
||||
super(Plugin, self).__init__()
|
||||
|
||||
|
||||
def _controller_message(self, event: Code_Event_Types.CodeEvent):
|
||||
if isinstance(event, Code_Event_Types.FocusedViewEvent):
|
||||
code_minimap.set_smini_view(event.view)
|
||||
|
||||
def load(self):
|
||||
editors_container = self.requests_ui_element("editors-container")
|
||||
editors_container.add( code_minimap )
|
||||
|
||||
def run(self):
|
||||
...
|
||||
Reference in New Issue
Block a user