Clean up codebase and improve file loading
- Moved plugins to proper sub groups (autopairs, code_minimap, colorize, commentzar, info_bar, markdown_preview, prettify_json, search_replace, tabs_bar, telescope, toggle_source_view, lsp_client) - Add filter_out_loaded_files to prevent opening already-loaded files - Add INDEPENDENT source view state - Fix cursor scroll position on buffer switch - Fix signal blocking during file load - Fix word boundary in completion provider - Refactor code events into single events module
This commit is contained in:
50
plugins/code/ui/code_minimap/code_minimap.py
Normal file
50
plugins/code/ui/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)
|
||||
Reference in New Issue
Block a user