Skip to content

fix "Breaks with gedit 3.36.1" #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Gedit Source Code Browser
=========================

![No Longer Maintained](https://img.shields.io/badge/maintained-no-red.svg)
![Currently Maintained](https://img.shields.io/badge/maintained-yes-brightgreen.svg)

A source code class and function browser plugin for Gedit 3.
A source code class and function browser plugin for Gedit 40.

This plugin will add a new tab to the side pane in the Gedit text editor which
shows symbols (functions, classes, variables, etc.) for the active document.
Expand All @@ -17,7 +17,7 @@ for a list of the 41 programming languages supported by this plugin.
Requirements
------------

This plugins is for Gedit 3 and is **not compatible with Gedit 2.x**.
This plugins is for Gedit 40.

The Gedit Source Code Browser plugin uses
[Exuberant Ctags](http://ctags.sourceforge.net/) to parse symbols
Expand All @@ -36,7 +36,7 @@ Installation
1. Download this repository by clicking the Downloads button at the top of the
github page or issue the following command in a terminal:

git clone git://github.com/MicahCarrick/gedit-source-code-browser.git
git clone git://github.com/Supreeeme/gedit-source-code-browser.git

2. Copy the file `sourcecodebrowser.plugin` and the folder `sourcecodebrowser` to
`~/.local/share/gedit/plugins/`.
Expand Down
Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion sourcecodebrowser.plugin
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Plugin]
Loader=python
Loader=python3
Module=sourcecodebrowser
IAge=3
Name=Source Code Browser
Expand Down
4 changes: 2 additions & 2 deletions sourcecodebrowser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import plugin
from plugin import SourceCodeBrowserPlugin
from . import plugin
from .plugin import SourceCodeBrowserPlugin

12 changes: 9 additions & 3 deletions sourcecodebrowser/ctags.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ def _parse_text(self, text):
Parses ctags text which may have come from a TAG file or from raw output
from a ctags command.
"""
#print(str(text, 'utf-8'))
for line in text.splitlines():
name = None
file = None
ex_command = None
kind = None
for i, field in enumerate(line.split("\t")):
for i, f in enumerate(line.split(b'\t')):
# print(i, f)
field = str(f, 'utf-8')
if i == 0: tag = Tag(field)
elif i == 1: tag.file = field
elif i == 2: tag.ex_command = field
Expand Down Expand Up @@ -132,7 +135,7 @@ def get_tree(self):
if not p in node:
node[p] = {'tag':None, 'children':{}}
node = node[p]
print node
print(node)
node['tag'] = tag
else:
if not parent in self.tree:
Expand All @@ -146,4 +149,7 @@ def get_tree(self):
return tree
"""



if __name__ == "__main__":
the_parser = Parser()
the_parser.parse("ctags -nu --fields=fiKlmnsSzt -f - ctags.py", "ctags")
54 changes: 39 additions & 15 deletions sourcecodebrowser/data/configure_dialog.ui
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.2 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="configure_dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Source Code Browser</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
Expand All @@ -20,10 +24,10 @@
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-close</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
Expand All @@ -45,13 +49,32 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="use_bottom_panel">
<property name="label" translatable="yes">Use _bottom panel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_use_bottom_panel_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="show_line_numbers">
<property name="label" translatable="yes">Show _line numbers in tree</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
Expand All @@ -67,10 +90,10 @@
<child>
<object class="GtkCheckButton" id="load_remote_files">
<property name="label" translatable="yes">Load symbols from _remote files</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
Expand All @@ -86,10 +109,10 @@
<child>
<object class="GtkCheckButton" id="expand_rows">
<property name="label" translatable="yes">Start with rows _expanded</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
Expand All @@ -105,10 +128,10 @@
<child>
<object class="GtkCheckButton" id="sort_list">
<property name="label" translatable="yes">_Sort list alphabetically</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
Expand All @@ -124,13 +147,15 @@
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="can_focus">True</property>
<property name="xpad">5</property>
<property name="label" translatable="yes">ctags executable</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -139,18 +164,16 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="ctags_executable">
<object class="GtkFileChooserButton" id="ctags_executable">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="text" translatable="yes">ctags</property>
<property name="invisible_char_set">True</property>
<signal name="changed" handler="on_ctags_executable_changed" swapped="no"/>
<property name="hexpand">True</property>
<property name="title" translatable="yes"/>
<signal name="selection-changed" handler="on_ctags_executable_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">1</property>
</packing>
</child>
Expand All @@ -159,6 +182,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="pack_type">end</property>
<property name="position">4</property>
</packing>
</child>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="org.gnome.gedit.plugins.sourcecodebrowser" path="/org/gnome/gedit/plugins/sourcecodebrowser/">
<key type="b" name="use-bottom-panel">
<default>true</default>
<summary>Use bottom panel</summary>
<description>Use the bottom panel for the source tree.</description>
</key>
<key type="b" name="show-line-numbers">
<default>false</default>
<summary>Show Line Numbers</summary>
Expand Down
Loading