-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_advanced.py
More file actions
40 lines (27 loc) · 1.12 KB
/
Copy pathexample_advanced.py
File metadata and controls
40 lines (27 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from gi.repository import GObject, Pluma, Peas
class ExamplePyWindowActivatable(GObject.Object, Peas.Activatable):
__gtype_name__ = "ExamplePyWindowActivatable"
object = GObject.Property(type=GObject.Object)
def __init__(self):
GObject.Object.__init__(self)
def do_activate(self):
self.window = self.object
print "Plugin created for", self.window
def do_deactivate(self):
print "Plugin stopped for", self.window
def do_update_state(self):
# Called whenever the window has been updated (active tab
# changed, etc.)
print "Plugin update for", self.window
class ExamplePyViewActivatable(GObject.Object, Gedit.ViewActivatable):
__gtype_name__ = "ExamplePyViewActivatable"
view = GObject.property(type=Gedit.View)
def __init__(self):
GObject.Object.__init__(self)
def do_activate(self):
print "Plugin created for", self.view
def do_deactivate(self):
print "Plugin stopped for", self.view
def do_update_state(self):
# Called whenever the view has been updated
print "Plugin update for", self.view