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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# -*- coding: utf-8 -*-
# extension-py.py.in
# This file is part of libpeas
#
# Copyright (C) 2011-2014 Garrett Regier
#
# libpeas is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# libpeas 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
import threading
from gi.repository import GObject, Introspection, Peas
__all__ = [ 'ExtensionPythonPlugin' ]
class ExtensionPythonPlugin(GObject.Object, Peas.Activatable,
Introspection.Base, Introspection.Callable,
Introspection.HasPrerequisite):
object = GObject.Property(type=GObject.Object)
update_count = GObject.Property(type=int, default=0, minimum=0)
def __init__(self):
self.__lock = threading.Lock()
def do_activate(self):
pass
def do_deactivate(self):
pass
def do_update_state(self):
with self.__lock:
self.update_count += 1
def do_get_plugin_info(self):
return self.plugin_info
def do_get_settings(self):
return self.plugin_info.get_settings(None)
def do_call_with_return(self):
return "Hello, World!"
def do_call_no_args(self):
pass
def do_call_single_arg(self):
return True
def do_call_multi_args(self, in_, inout):
return (inout, in_)
# ex:set ts=4 et sw=4 ai:
|