-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_minimal__debug.py
More file actions
46 lines (38 loc) · 1.95 KB
/
Copy pathexample_minimal__debug.py
File metadata and controls
46 lines (38 loc) · 1.95 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
41
42
43
44
45
46
import sys
print('[DEBUG]', sys.version) # Python 2.7
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Pluma', '1.0')
gi.require_version('Peas', '1.0')
#from gi.repository import GObject, Gtk, Gedit # <-- Gedit
from gi.repository import GObject, Gtk, Pluma, Peas # <-- Pluma
#class ExamplePyPlugin(GObject.Object, Gedit.WindowActivatable): # <-- Gedit
class ExamplePyPlugin__Debug(GObject.Object, Peas.Activatable): # <-- Pluma
__gtype_name__ = "ExamplePyPlugin__Debug"
#window = GObject.property(type=Gedit.Window) # <-- Gedit
window = GObject.Property(type=GObject.Object) # <-- Pluma: ERROR - doesn't works, `self.window` will be `None`
object = GObject.Property(type=GObject.Object) # <-- Pluma: OK - but needs `self.window = self.object` in methods
def __init__(self):
GObject.Object.__init__(self)
#self.window = GObject.Property(type=GObject.Object) # ERROR
print('[DEBUG] __init__: window:', self.window) # <-- Pluma: None - it makes problem
print('[DEBUG] __init__: object:', self.object) # <-- Pluma: None - it makes problem
def do_activate(self):
print('[DEBUG] do_activate: window:', self.window) # <-- Pluma: None - it makes problem
print('[DEBUG] do_activate: object:', self.object) # <-- Pluma: OK
#self.window = self.object # <-- Pluma: OK
pass
def do_deactivate(self):
print('[DEBUG] do_deactivate: window:', self.window) # <-- Pluma: OK
print('[DEBUG] do_deactivate: object:', self.object) # <-- Pluma: OK
#self.window = self.object # <-- Pluma: OK
pass
def do_update_state(self):
print('[DEBUG] do_update_state: window:', self.window) # <-- Pluma: OK
print('[DEBUG] do_update_state: object:', self.object) # <-- Pluma: OK
#self.window = self.object # <-- Pluma: OK
pass
if __name__ == '__main__':
print('[DEBUG]: main')
plugin = ExamplePyPlugin()
plugin.do_activate()