Permalink
Browse files

first commit

  • Loading branch information...
nagaozen committed Feb 28, 2011
0 parents commit b3309e495114ae94e07c5b12576d7f46ea503e15
Showing with 586 additions and 0 deletions.
  1. +9 −0 codebrowser.gedit-plugin
  2. +123 −0 codebrowser/__init__.py
  3. BIN codebrowser/__init__.pyc
  4. +82 −0 codebrowser/iconlib.py
  5. BIN codebrowser/iconlib.pyc
  6. +268 −0 codebrowser/parsers.py
  7. BIN codebrowser/parsers.pyc
  8. BIN codebrowser/pixmaps/class.png
  9. BIN codebrowser/pixmaps/class_priv.png
  10. BIN codebrowser/pixmaps/class_prot.png
  11. BIN codebrowser/pixmaps/const.png
  12. BIN codebrowser/pixmaps/const_priv.png
  13. BIN codebrowser/pixmaps/const_prot.png
  14. BIN codebrowser/pixmaps/default.png
  15. BIN codebrowser/pixmaps/enum.png
  16. BIN codebrowser/pixmaps/enum_priv.png
  17. BIN codebrowser/pixmaps/enum_prot.png
  18. BIN codebrowser/pixmaps/event.png
  19. BIN codebrowser/pixmaps/event_priv.png
  20. BIN codebrowser/pixmaps/event_prot.png
  21. BIN codebrowser/pixmaps/exception.png
  22. BIN codebrowser/pixmaps/exception_priv.png
  23. BIN codebrowser/pixmaps/exception_prot.png
  24. BIN codebrowser/pixmaps/field.png
  25. BIN codebrowser/pixmaps/field_priv.png
  26. BIN codebrowser/pixmaps/field_prot.png
  27. BIN codebrowser/pixmaps/interface.png
  28. BIN codebrowser/pixmaps/interface_priv.png
  29. BIN codebrowser/pixmaps/interface_prot.png
  30. BIN codebrowser/pixmaps/macro.png
  31. BIN codebrowser/pixmaps/macro_priv.png
  32. BIN codebrowser/pixmaps/macro_prot.png
  33. BIN codebrowser/pixmaps/method.png
  34. BIN codebrowser/pixmaps/method_priv.png
  35. BIN codebrowser/pixmaps/method_prot.png
  36. BIN codebrowser/pixmaps/namespace.png
  37. BIN codebrowser/pixmaps/namespace_priv.png
  38. BIN codebrowser/pixmaps/namespace_prot.png
  39. BIN codebrowser/pixmaps/object.png
  40. BIN codebrowser/pixmaps/object_priv.png
  41. BIN codebrowser/pixmaps/object_prot.png
  42. BIN codebrowser/pixmaps/patch.png
  43. BIN codebrowser/pixmaps/proc.png
  44. BIN codebrowser/pixmaps/proc_priv.png
  45. BIN codebrowser/pixmaps/proc_prot.png
  46. BIN codebrowser/pixmaps/prop.png
  47. BIN codebrowser/pixmaps/prop_priv.png
  48. BIN codebrowser/pixmaps/prop_prot.png
  49. BIN codebrowser/pixmaps/struct.png
  50. BIN codebrowser/pixmaps/struct_priv.png
  51. BIN codebrowser/pixmaps/struct_prot.png
  52. BIN codebrowser/pixmaps/typedef.png
  53. BIN codebrowser/pixmaps/typedef_priv.png
  54. BIN codebrowser/pixmaps/typedef_prot.png
  55. BIN codebrowser/pixmaps/union.png
  56. BIN codebrowser/pixmaps/union_priv.png
  57. BIN codebrowser/pixmaps/union_prot.png
  58. +104 −0 codebrowser/plugin.py
  59. BIN codebrowser/plugin.pyc
@@ -0,0 +1,9 @@
+[Gedit Plugin]
+Loader=python
+Module=codebrowser
+IAge=2
+Name=Evolved Code Browser
+Description=A code browser powered by etags.
+Authors=Fabio Zendhi Nagao <nagaozen@hotmail.com>\nhttp://zend.lojcomm.com.br/
+Copyright=Copyright © 2011 Fabio Zendhi Nagao
+Website=http://github.com/nagaozen/gedit-plugin-codebrowser/
@@ -0,0 +1,123 @@
+# -*- coding: utf-8 -*-
+
+# gEdit CodeBrowser plugin
+# Copyright (C) 2011 Fabio Zendhi Nagao
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gtk
+import gedit
+from plugin import CodeBrowser
+from parsers import *
+
+class CodeBrowserWindowHelper:
+
+ ICO = [
+ # width height ncolors chars_per_pixel
+ "16 16 16 1",
+ # colors
+ " c None",
+ "1 c #EEEEEC",# Tango Aluminium
+ "2 c #D3D7CF",
+ "3 c #BABDB6",
+ "4 c #888A85",
+ "5 c #555753",
+ "6 c #2E3436",
+ "a c #E9B96E",# Tango Chocolate
+ "b c #C17D11",
+ "c c #8F5902",
+ "d c #729FCF",# Tango Sky Blue
+ "e c #3465A4",
+ "f c #204A87",
+ "g c #AD7FA8",# Tango Plum
+ "h c #75507B",
+ "i c #5C3566",
+ # pixels
+ "aaa ",
+ "abc 123456666 ",
+ "ccc ",
+ " ",
+ " 3 ddd ",
+ " 3def 123456666",
+ " 3 fff ",
+ " ",
+ " 3 ggg ",
+ " 3ghi 1234566 ",
+ " 3 iii ",
+ " 3 ",
+ " 3 3 ddd ",
+ " 33def 123456",
+ " 3 fff ",
+ " ",
+ ]
+
+ def __init__(self, plugin, window):
+ self._window = window
+ self._plugin = plugin
+ self._panel = self._window.get_side_panel()
+
+ # Generate the side panel tab icon
+ drawable = gtk.gdk.get_default_root_window()
+ colormap = drawable.get_colormap()
+ pixmap, mask = gtk.gdk.pixmap_colormap_create_from_xpm_d(drawable, colormap, None, self.ICO)
+
+ image = gtk.Image()
+ image.set_from_pixmap(pixmap, mask)
+
+ # Create and assign widget to the panel
+ self._codebrowser = CodeBrowser(self._plugin, self._window)
+ self._panel.add_item(self._codebrowser, "Code Browser", image)
+
+ self.parser = CTagsParser()
+
+ def deactivate(self):
+ self._panel.remove_item(self._codebrowser)
+ self._codebrowser.deactivate()
+ self._codebrowser = None
+
+ self._panel = None
+ self._window = None
+ self._plugin = None
+
+ def update_ui(self):
+ doc = self._window.get_active_document()
+ if doc:
+ parser = self.parser
+ ts = parser.parse(doc)
+ self._codebrowser.set_model(ts, parser)
+ else:
+ self._codebrowser.set_model(None)
+
+
+class CodeBrowserPlugin(gedit.Plugin):
+
+ WINDOW_DATA_KEY = "CodeBrowserPluginWindowData"
+
+ def __init__(self):
+ gedit.Plugin.__init__(self)
+
+ def activate(self, window):
+ helper = CodeBrowserWindowHelper(self, window)
+ window.set_data(self.WINDOW_DATA_KEY, helper)
+
+ def deactivate(self, window):
+ window.get_data(self.WINDOW_DATA_KEY).deactivate()
+ window.set_data(self.WINDOW_DATA_KEY, None)
+
+ def update_ui(self, window):
+ window.get_data(self.WINDOW_DATA_KEY).update_ui()
+
+
+# ex:ts=4:et:
+
Binary file not shown.
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+
+# gEdit CodeBrowser plugin
+# Copyright (C) 2011 Fabio Zendhi Nagao
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import gtk
+import os
+
+pixbufs = {
+ "class": None,
+ "class_priv": None,
+ "class_prot": None,
+ "const": None,
+ "const_priv": None,
+ "const_prot": None,
+ "enum": None,
+ "enum_priv": None,
+ "enum_prot": None,
+ "event": None,
+ "event_priv": None,
+ "event_prot": None,
+ "exception": None,
+ "exception_priv": None,
+ "exception_prot": None,
+ "field": None,
+ "field_priv": None,
+ "field_prot": None,
+ "interface": None,
+ "interface_priv": None,
+ "interface_prot": None,
+ "macro": None,
+ "macro_priv": None,
+ "macro_prot": None,
+ "method": None,
+ "method_priv": None,
+ "method_prot": None,
+ "namespace": None,
+ "namespace_priv": None,
+ "namespace_prot": None,
+ "object": None,
+ "object_priv": None,
+ "object_prot": None,
+ "proc": None,
+ "proc_priv": None,
+ "proc_prot": None,
+ "prop": None,
+ "prop_priv": None,
+ "prop_prot": None,
+ "struct": None,
+ "struct_priv": None,
+ "struct_prot": None,
+ "typedef": None,
+ "typedef_priv": None,
+ "typedef_prot": None,
+ "union": None,
+ "union_priv": None,
+ "union_prot": None,
+
+ "default": None,
+ "patch": None
+}
+
+def populate(plugin):
+ for key in pixbufs:
+ filename = os.path.join( plugin.get_install_dir(), "codebrowser", "pixmaps", "%s.png" %key )
+ pixbufs[key] = gtk.gdk.pixbuf_new_from_file(filename)
+
+# ex:ts=4:et:
+
Binary file not shown.
Oops, something went wrong.

0 comments on commit b3309e4

Please sign in to comment.