Skip to content

Gtk3 #10

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 29 commits into
base: master
Choose a base branch
from
Open

Gtk3 #10

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
42b4e4a
Ported to gi.repository.. still some glitch though
Jul 18, 2013
b617e87
gtk3 port still needs some testing
Jul 18, 2013
87e8f8d
Initialize pygobject on both Gtk3 and Gtk2
Jul 19, 2013
d34b59e
Plugin listing now working along with preference of console plugin
Jul 19, 2013
7f01516
super way of initializing
Jul 19, 2013
e3cefcf
Pygtk compatible codebase..not tested with pygtk
Jul 19, 2013
58e1909
Gtk3 and Gtk2 both compabilities undertaken
Jul 19, 2013
3da7333
README for gtk2 and gtk3
Jul 19, 2013
9d122d2
Pure gtk3 codebase and configurations/makefiles
Jul 19, 2013
ba77101
Donot know why keybinding was not enabled by default
Jul 20, 2013
2829929
Added keybinding
Jul 20, 2013
fcd83b4
Gtk2 and gtk3
Jul 20, 2013
3e8b0b8
GeanyPy Keybinding naming
Jul 20, 2013
218062e
Update console.py
Jul 30, 2013
e641dbd
Added parent to plugin manager as well as some cleanup
Jul 31, 2013
b79ca90
added flags
Jul 31, 2013
50626e2
Build compatible with pygtk as well as pygobject
Aug 1, 2013
34bdb6f
Color in colorbutton for console preference
Aug 1, 2013
4c29b78
Pure gtk3
Aug 4, 2013
247d34b
Gtk2 & gtk3 compatibilities
Aug 4, 2013
d0ba4db
merged logger
Oct 6, 2014
3428323
gtk3 configure and make
Oct 6, 2014
8dadf0c
Gtk2 and gtk3 compatabilities
Oct 6, 2014
ed481b1
IN newer gobject issue with PyGObject
Mar 11, 2015
a6b995b
IN newer gobject issue with PyGObject
Mar 11, 2015
767bba6
GLOG c file not header
Mar 11, 2015
5e5e59b
initialize glog
Mar 11, 2015
740cdd0
unload all plugins
Dec 7, 2015
f1476cb
Upstream changes
Jan 15, 2016
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
19 changes: 17 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,27 @@ To build GeanyPy you need the following dependencies:

* Python 2.6+ and development files (I don't think Python 3 will work).
* Geany 0.21+ and development files (from SVN)

** For Gtk2 **

* PyGTK 2.0 and development files

** For Gtk3 **

* GObject Introspection is needed [pygtk not needed.]

On Debian/Ubuntu, the (non-Geany) dependencies can be installed like this:

$ apt-get install python python-dev python-gtk2 python-gtk2-dev
$ sudo apt-get install python python-dev

** For Gtk2 **

$ sudo apt-get install python-gtk2 python-gtk2-dev

** For Gtk3 **

$ sudo apt-get install python-gi python-gi-dev

See Geany's documentation/website for information on compiling it from the
Subversion or Git repositories.

Expand All @@ -90,4 +105,4 @@ far. I imagine 2.7 series will also work fine.
Running on Windows
------------------

See `README.win32` for more information.
See `README.win32` for more information.
4 changes: 3 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LT_INIT([disable-static])
# Check for headers, libraries and packages
AC_CHECK_HEADERS([stdio.h string.h dlfcn.h])
PKG_CHECK_MODULES([GEANY], [geany >= 0.21])
PKG_CHECK_MODULES([PYGTK], [pygtk-2.0])
PKG_CHECK_MODULES([PYGOBJECT], [pygobject-3.0])
AX_PYTHON_DEVEL([>= '2.6'])
AX_PYTHON_LIBRARY(,[AC_MSG_ERROR([Cannot determine location of the Python DSO])])
AC_SUBST([PYTHON])
Expand All @@ -41,3 +41,5 @@ AC_CONFIG_FILES([
plugins/Makefile
])
AC_OUTPUT
m4_pattern_allow([AM_PROG_AR])
AM_PROG_AR
4 changes: 4 additions & 0 deletions geany/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import app
import bindings
import console
import dialogs
import document
Expand Down Expand Up @@ -67,5 +68,8 @@
# GObject to connect signal handlers on and which emits signals.
signals = SignalManager()

# Initialize the keybindings manager
bindings.init()

import plugin
from plugin import Plugin
20 changes: 14 additions & 6 deletions geany/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
# inside: GtkTextView is not a terminal.
# The use case is: you have a python program, you create this widget,
# and inspect your program interiors.
try:
from gi import pygtkcompat
except ImportError:
pygtkcompat = None

if pygtkcompat is not None:
pygtkcompat.enable()
pygtkcompat.enable_gtk(version='3.0')

import gtk
import gtk.gdk as gdk
Expand Down Expand Up @@ -160,7 +168,7 @@ def raw_input(self, ps=None):
self.thaw_undo()

self.__move_cursor_to(iter)
self.scroll_to_mark(self.cursor, 0.2)
self.scroll_to_mark(self.cursor, 0.2, use_align=False, xalign=0.5, yalign=0.5)

self.in_raw_input = True

Expand All @@ -177,7 +185,7 @@ def on_buf_mark_set(self, buffer, iter, mark):
if iter.compare(self.__get_start()) >= 0 and \
iter.compare(self.__get_end()) <= 0:
buffer.move_mark_by_name("cursor", iter)
self.scroll_to_mark(self.cursor, 0.2)
self.scroll_to_mark(self.cursor, 0.2, use_align=False, xalign=0.5, yalign=0.5)

def __insert(self, iter, text):
self.do_insert = True
Expand Down Expand Up @@ -286,7 +294,7 @@ def do_key_press_event(self, event, parent_type):
handled = False

if not handled:
return parent_type.do_key_press_event(self, event)
return parent_type.do_key_press_event(self, event.key if hasattr(event, "key") else event)
else:
return True

Expand All @@ -296,7 +304,7 @@ def __history(self, dir):
if not new_text is None:
self.__replace_line(new_text)
self.__move_cursor(0)
self.scroll_to_mark(self.cursor, 0.2)
self.scroll_to_mark(self.cursor, 0.2, use_align=False, xalign=0.5, yalign=0.5)

def __get_cursor(self):
return self.buffer.get_iter_at_mark(self.cursor)
Expand Down Expand Up @@ -343,7 +351,7 @@ def __delete_at_cursor(self, howmany):
self.__delete(iter, end)

def __get_width(self):
if not (self.flags() & gtk.REALIZED):
if not (self.get_realized()):
return 80
layout = pango.Layout(self.get_pango_context())
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Expand Down Expand Up @@ -386,7 +394,7 @@ def __print_completions(self, completions):
self.__insert(iter, "%s%s%s" % (self.ps, line_start, line_end))
iter.set_line_offset(len(self.ps) + len(line_start))
self.__move_cursor_to(iter)
self.scroll_to_mark(self.cursor, 0.2)
self.scroll_to_mark(self.cursor, 0.2, use_align=False, xalign=0.5, yalign=0.5)

def __complete(self):
text = self.__get_text(self.__get_start(), self.__get_cursor())
Expand Down
Loading