Changeset View
Changeset View
Standalone View
Standalone View
find-modules/module_generation/PyKF5/KWindowSystem.py
- This file was added.
1 | # | ||||
---|---|---|---|---|---|
2 | # Copyright 2017 by Shaheed Haque (srhaque@theiet.org) | ||||
3 | # | ||||
4 | # This program is free software; you can redistribute it and/or modify | ||||
5 | # it under the terms of the GNU General Public License as published by | ||||
6 | # the Free Software Foundation; either version 2 of the License, or | ||||
7 | # (at your option) any later version. | ||||
8 | # | ||||
9 | # This program is distributed in the hope that it will be useful, | ||||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | # GNU General Public License for more details. | ||||
13 | # | ||||
14 | # You should have received a copy of the GNU General Public License | ||||
15 | # along with this program; if not, write to the Free Software | ||||
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||||
17 | # 02110-1301 USA. | ||||
18 | # | ||||
19 | """ | ||||
20 | SIP binding customisation for PyKF5.KWindowSystem. This modules describes: | ||||
21 | | ||||
22 | * Supplementary SIP file generator rules. | ||||
23 | """ | ||||
24 | import rule_helpers | ||||
25 | | ||||
26 | | ||||
27 | def function_get_array(container, function, sip, rule): | ||||
28 | rule_helpers.initialise_cxx_decl(sip) | ||||
29 | sip["fn_result"] = "SIP_PYLIST" | ||||
30 | sip["code"] += """%MethodCode | ||||
31 | // TBD | ||||
32 | %End | ||||
33 | """ | ||||
34 | | ||||
35 | | ||||
36 | def module_fix_mapped_types(filename, sip, rule): | ||||
37 | # | ||||
38 | # SIP cannot handle duplicate %MappedTypes. | ||||
39 | # | ||||
40 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<int>") | ||||
41 | rule_helpers.module_add_classes(filename, sip, rule, "_XEvent", "xcb_generic_event_t", "xcb_key_press_event_t", | ||||
42 | "xcb_connection_t", "_XDisplay", "xcb_window_t") | ||||
43 | | ||||
44 | | ||||
45 | def module_fix_mapped_types_private(filename, sip, rule): | ||||
46 | # | ||||
47 | # SIP cannot handle duplicate %MappedTypes. | ||||
48 | # | ||||
49 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSize>", "QList<unsigned long long>") | ||||
50 | rule_helpers.module_add_classes(filename, sip, rule, "_XEvent", "xcb_generic_event_t", "xcb_key_press_event_t", | ||||
51 | "xcb_connection_t", "_XDisplay", "xcb_window_t") | ||||
52 | | ||||
53 | | ||||
54 | def container_rules(): | ||||
55 | return [ | ||||
56 | ["kwindowinfo_p.h", "KWindowInfoPrivate", ".*", ".*", ".*", rule_helpers.container_discard_QSharedData_base], | ||||
57 | ["kwindowinfo.h", "KWindowInfo", ".*", ".*", ".*", rule_helpers.container_fake_derived_class], | ||||
58 | ] | ||||
59 | | ||||
60 | | ||||
61 | def function_rules(): | ||||
62 | return [ | ||||
63 | ["KStartupInfo", "KStartupInfo", ".*", ".*", "bool.*", rule_helpers.function_discard], | ||||
64 | ["NETRootInfo", "(clientList(|Stacking))|virtualRoots", ".*", ".*", ".*", function_get_array], | ||||
65 | ["NETWinInfo", "iconSizes", ".*", ".*", ".*", function_get_array], | ||||
66 | # | ||||
67 | # SIP unsupported signal argument type. | ||||
68 | # | ||||
69 | ["KWindowSystem", "windowChanged", ".*", ".*", ".*", rule_helpers.function_discard], | ||||
70 | ] | ||||
71 | | ||||
72 | | ||||
73 | def modulecode(): | ||||
74 | return { | ||||
75 | "KWindowSystem/KWindowSystemmod.sip": { | ||||
76 | "code": module_fix_mapped_types, | ||||
77 | }, | ||||
78 | "KWindowSystem/private/privatemod.sip": { | ||||
79 | "code": module_fix_mapped_types_private, | ||||
80 | }, | ||||
81 | } |