Skip to content

Commit

Permalink
pygtksourceview2 compatibility. fixes issue 4. Thanks pochu27!
Browse files Browse the repository at this point in the history
git-svn-id: http://infon.googlecode.com/svn/trunk@268 8171fb75-e542-0410-96e4-03d5dd800671
  • Loading branch information
dividuum committed Jul 10, 2009
1 parent 37f10db commit a8dec91
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
7 changes: 7 additions & 0 deletions contrib/infon-devel/debian/changelog
@@ -1,3 +1,10 @@
infon-devel (0~r218-1) unstable; urgency=low

* pygtksourceview is deprecated, use pygtksourceview2 instead
thanks to Emilio Pozuelo Monfort for the patch. (Closes: #532894)

-- Joachim Breitner <nomeata@debian.org> Fri, 12 Jun 2009 20:11:23 +0200

infon-devel (0~r144-1) unstable; urgency=low

* Initial Release
Expand Down
6 changes: 2 additions & 4 deletions contrib/infon-devel/debian/control
Expand Up @@ -5,13 +5,14 @@ Maintainer: Joachim Breitner <nomeata@debian.org>
Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6)
XS-Python-Version: all
Standards-Version: 3.7.2
Homepage: http://infon.dividuum.de/
XS-Vcs-Svn: http://infon.dividuum.de/svn/infon/trunk/contrib/infon-devel

Package: infon-devel
Architecture: all
Suggests: infon-server
Recommends: infon-viewer
Depends: ${python:Depends}, python-gnome2-desktop
Depends: ${python:Depends}, python-gtksourceview2
XB-Python-Version: ${python:Versions}
Description: Develop bots for the infon game
Infon is a game which simulates the live of simple bugs who eat,
Expand All @@ -24,6 +25,3 @@ Description: Develop bots for the infon game
This package contains a graphical lua editor with integration into
the infon server and allows easy uploading of the code. It also
marks the currently executed line of code.
.
Homepage: http://infon.dividuum.de/

28 changes: 13 additions & 15 deletions contrib/infon-devel/infon-devel.py
Expand Up @@ -23,7 +23,7 @@
pygtk.require('2.0')
import gtk
import gobject
import gtksourceview
import gtksourceview2

import os
import sys
Expand Down Expand Up @@ -249,7 +249,7 @@ def setup_menu(self):
('ShowNumbers', None, 'Show _Line Numbers', None, 'Toggle visibility of line numbers in the left margin',
lambda a, s: s.set_show_line_numbers(a.get_active())),
('ShowMarkers', None, 'Show _Markers', None, 'Toggle visibility of markers in the left margin',
lambda a, s: s.set_show_line_markers(a.get_active())),
lambda a, s: s.set_show_line_marks(a.get_active())),
('AutoIndent', None, 'Enable _Auto Indent', None, 'Toggle automatic auto indentation of text',
lambda a, s: s.set_auto_indent(a.get_active())),
#('InsertSpaces', None, 'Insert _Spaces Instead of Tabs', None, 'Whether to insert space characters when inserting tabulations',
Expand Down Expand Up @@ -320,7 +320,7 @@ def setup_menu(self):
action = actions.get_action('ShowNumbers')
action.set_active(self.bugview.get_show_line_numbers())
action = actions.get_action('ShowMarkers')
action.set_active(self.bugview.get_show_line_markers())
action.set_active(self.bugview.get_show_line_marks())
action = actions.get_action('AutoIndent')
action.set_active(self.bugview.get_auto_indent())
#action = actions.get_action('InsertSpaces')
Expand All @@ -333,31 +333,29 @@ def setup_menu(self):
self.ui.insert_action_group(actions,0)

def setup_bugview(self):
self.bugbuf = gtksourceview.SourceBuffer()
lm = gtksourceview.SourceLanguagesManager()
lang = lm.get_language_from_mime_type("text/x-lua")
self.bugbuf.set_highlight(True)
self.bugbuf = gtksourceview2.Buffer()
lm = gtksourceview2.LanguageManager()
lang = lm.guess_language(None, "text/x-lua")
self.bugbuf.set_highlight_syntax(True)
self.bugbuf.set_language(lang)

def set_bt_markers(blubb):
begin, end = self.bugbuf.get_bounds()
markers = self.bugbuf.get_markers_in_region(begin, end)
map(self.bugbuf.delete_marker, markers)
self.bugbuf.remove_source_marks(begin, end)

for creature, line in self.conn.bt:
if line:
pos = self.bugbuf.get_iter_at_line(line)
self.bugbuf.create_marker(None, "bt", pos)
self.bugbuf.create_source_mark(None, "bt", line)
self.conn.connect("new_bt",set_bt_markers)

self.bugview = gtksourceview.SourceView(self.bugbuf)
self.bugview.props.show_line_numbers = True
self.bugview.props.show_line_markers = True
self.bugview = gtksourceview2.View(self.bugbuf)
self.bugview.props.show_line_numbers = True
self.bugview.props.show_line_marks = True
self.bugview.props.auto_indent = True
#self.bugview.props.insert_spaces_instead_of_tabs = True

icon = gtk.gdk.pixbuf_new_from_file(PREFIX + 'marker.png')
self.bugview.set_marker_pixbuf("bt",icon)
self.bugview.set_mark_category_pixbuf("bt",icon)

def setup_connview(self):
self.connview = connview.ConnView()
Expand Down

0 comments on commit a8dec91

Please sign in to comment.