generated from itdominator/Python-With-Gtk-Template
Resolving info widget updating events
This commit is contained in:
parent
2b50afe14d
commit
6752cf47df
|
@ -96,7 +96,7 @@ class Plugin(PluginBase):
|
|||
self.delay_completion(source_view, context, callback)
|
||||
|
||||
def _do_completion(self, source_view, context, callback):
|
||||
filepath = source_view.get_current_filepath()
|
||||
filepath = source_view.get_current_file()
|
||||
|
||||
if not filepath: return
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class Plugin(MarkdownTemplateMixin, PluginBase):
|
|||
text = buffer.get_text(start_iter, end_iter, include_hidden_chars = False)
|
||||
html = markdown.markdown(text)
|
||||
|
||||
path = self._active_src_view.get_current_filepath().get_parent().get_path()
|
||||
path = self._active_src_view.get_current_file().get_parent().get_path()
|
||||
data = self.wrap_html_to_body(html)
|
||||
self._markdown_view.load_html(content = data, base_uri = f"file://{path}/")
|
||||
|
||||
|
|
|
@ -34,10 +34,15 @@ class ControllerData:
|
|||
ctx = old_notebook.get_style_context()
|
||||
ctx.remove_class("notebook-selected-focus")
|
||||
|
||||
|
||||
notebook = source_view.get_parent().get_parent()
|
||||
ctx = notebook.get_style_context()
|
||||
ctx.add_class("notebook-selected-focus")
|
||||
|
||||
file = source_view.get_current_file()
|
||||
if file:
|
||||
source_view.set_bottom_labels(file)
|
||||
else:
|
||||
event_system.emit("set_bottom_labels")
|
||||
|
||||
self.active_src_view = source_view
|
||||
|
||||
|
|
|
@ -65,11 +65,13 @@ class GeneralInfoWidget:
|
|||
|
||||
def set_bottom_labels(self, path = None, line_char = None, file_type = None, encoding_type = None):
|
||||
self._set_path_label(path)
|
||||
self._set_line_char_label()
|
||||
self._set_line_char_label(line_char)
|
||||
self._set_file_type_label(file_type)
|
||||
self._set_encoding_label()
|
||||
self._set_encoding_label(encoding_type)
|
||||
|
||||
def _set_path_label(self, gfile = ""):
|
||||
gfile = "" if not gfile else gfile
|
||||
|
||||
if isinstance(gfile, str):
|
||||
self.bottom_path_label.set_text( gfile )
|
||||
self.bottom_path_label.set_tooltip_text( gfile )
|
||||
|
@ -78,10 +80,18 @@ class GeneralInfoWidget:
|
|||
self.bottom_path_label.set_tooltip_text( gfile.get_path() )
|
||||
|
||||
def _set_line_char_label(self, line_char = "1:1"):
|
||||
line_char = "1:1" if not line_char else line_char
|
||||
|
||||
self.bottom_line_char_label.set_text(line_char)
|
||||
|
||||
def _set_file_type_label(self, file_type = "buffer"):
|
||||
file_type = "buffer" if not file_type else file_type
|
||||
|
||||
self.bottom_file_type_label.set_text(file_type)
|
||||
|
||||
def _set_encoding_label(self, encoding_type = "utf-8"):
|
||||
encoding_type = "utf-8" if not encoding_type else encoding_type
|
||||
|
||||
self.bottom_encoding_label.set_text(encoding_type)
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class EditorEventsMixin:
|
|||
|
||||
file_type = source_view.get_filetype()
|
||||
if not file_type == "buffer":
|
||||
uri = source_view.get_current_filepath().get_uri()
|
||||
uri = source_view.get_current_file().get_uri()
|
||||
event_system.emit("textDocument/didClose", (file_type, uri,))
|
||||
|
||||
page_num = notebook.page_num(container)
|
||||
|
|
|
@ -13,7 +13,7 @@ from .source_view_events import SourceViewEvents
|
|||
|
||||
|
||||
class SourceViewControllerMixin(KeyInputController, SourceViewEvents):
|
||||
def get_current_filepath(self):
|
||||
def get_current_file(self):
|
||||
return self._current_file
|
||||
|
||||
def get_filetype(self):
|
||||
|
@ -30,7 +30,7 @@ class SourceViewControllerMixin(KeyInputController, SourceViewEvents):
|
|||
iter = buffer.get_iter_at_mark( buffer.get_insert() )
|
||||
line = iter.get_line()
|
||||
offset = iter.get_line_offset()
|
||||
uri = self.get_current_filepath().get_uri()
|
||||
uri = self.get_current_file().get_uri()
|
||||
|
||||
event_system.emit("textDocument/definition", (self.get_filetype(), uri, line, offset,))
|
||||
|
||||
|
|
Loading…
Reference in New Issue