Changeset View
Changeset View
Standalone View
Standalone View
find-modules/module_generation/PyKF5/KGAPI.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.KGAPI. This modules describes: | ||||
21 | | ||||
22 | * Supplementary SIP file generator rules. | ||||
23 | """ | ||||
24 | import rule_helpers | ||||
25 | | ||||
26 | | ||||
27 | def fix_ktimezone_stuff(filename, sip, rule): | ||||
28 | rule_helpers.module_add_classes(filename, sip, rule, "KTimeZone", "KTimeZoneBackend", "KTimeZoneData", | ||||
29 | "KTimeZoneSource", "icalcomponent_impl", "_icaltimezone", | ||||
30 | "QNetworkAccessManager", "QNetworkRequest", | ||||
31 | "QNetworkReply", "KDateTime", "KDateTime::Spec", "QLatin1String", "VObject") | ||||
32 | rule_helpers.module_add_includes(filename, sip, rule, "<QtNetwork/QtNetwork>") | ||||
33 | | ||||
34 | | ||||
35 | def module_fix_mapped_types(filename, sip, rule): | ||||
36 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSharedPointer<T> >") | ||||
37 | fix_ktimezone_stuff(filename, sip, rule) | ||||
38 | rule_helpers.module_add_classes(filename, sip, rule, "KConfigGroup") | ||||
39 | rule_helpers.module_add_imports(filename, sip, rule, "KGAPI/KGAPI/Blogger/Bloggermod.sip", | ||||
40 | "KGAPI/KGAPI/Calendar/Calendarmod.sip", | ||||
41 | "KGAPI/KGAPI/Contacts/Contactsmod.sip", | ||||
42 | "KGAPI/KGAPI/Drive/Drivemod.sip", | ||||
43 | "KGAPI/KGAPI/Latitude/Latitudemod.sip", | ||||
44 | "KGAPI/KGAPI/Tasks/Tasksmod.sip") | ||||
45 | | ||||
46 | | ||||
47 | def module_fix_mapped_types_blogger(filename, sip, rule): | ||||
48 | # | ||||
49 | # SIP cannot handle duplicate %MappedTypes. | ||||
50 | # | ||||
51 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSharedPointer<KGAPI2::Object> >", "QList<QUrl>", | ||||
52 | "QSharedPointer<KGAPI2::Account>", "QSharedPointer<KGAPI2::Blogger::Comment>", | ||||
53 | "QSharedPointer<KGAPI2::Blogger::Page>", "QSharedPointer<KGAPI2::Blogger::Post>", | ||||
54 | "QList<QSharedPointer<KGAPI2::Blogger::Blog> >", | ||||
55 | "QSharedPointer<KGAPI2::Blogger::Blog>", "QSharedPointer<KGAPI2::Object>") | ||||
56 | rule_helpers.module_add_classes(filename, sip, rule, "KConfig", "_IO_FILE", "Kleo::DownloadJob", | ||||
57 | "Kleo::RefreshKeysJob", "QNetworkAccessManager", "QNetworkRequest", "QNetworkReply", | ||||
58 | "Akonadi::Protocol::Command", "KConfigGroup", "Akonadi::ServerManagerPrivate", | ||||
59 | "KCoreConfigSkeleton") | ||||
60 | rule_helpers.module_add_includes(filename, sip, rule, "<QtNetwork/QtNetwork>") | ||||
61 | | ||||
62 | | ||||
63 | def module_fix_mapped_types_calendar(filename, sip, rule): | ||||
64 | # | ||||
65 | # SIP cannot handle duplicate %MappedTypes. | ||||
66 | # | ||||
67 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSharedPointer<KGAPI2::Calendar> >", | ||||
68 | "QList<QSharedPointer<KGAPI2::Event> >", "QList<QSharedPointer<KGAPI2::Object> >", | ||||
69 | "QSharedPointer<KGAPI2::Account>", "QSharedPointer<KGAPI2::Calendar>", | ||||
70 | "QSharedPointer<KGAPI2::Event>", "QList<QSharedPointer<KGAPI2::Reminder> >", | ||||
71 | "QSharedPointer<KGAPI2::Reminder>") | ||||
72 | fix_ktimezone_stuff(filename, sip, rule) | ||||
73 | | ||||
74 | | ||||
75 | def module_fix_mapped_types_contacts(filename, sip, rule): | ||||
76 | # | ||||
77 | # SIP cannot handle duplicate %MappedTypes. | ||||
78 | # | ||||
79 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSharedPointer<KGAPI2::Contact> >", | ||||
80 | "QSharedPointer<KGAPI2::Account>", "QList<QSharedPointer<KGAPI2::Object> >", | ||||
81 | "QList<QSharedPointer<KGAPI2::ContactsGroup> >", | ||||
82 | "QSharedPointer<KGAPI2::Contact>", "QSharedPointer<KGAPI2::ContactsGroup>") | ||||
83 | rule_helpers.module_add_classes(filename, sip, rule, "KIO::Job") | ||||
84 | rule_helpers.module_add_imports(filename, sip, rule, "KIOCore/KIOCoremod.sip") | ||||
85 | | ||||
86 | | ||||
87 | def module_fix_mapped_types_drive(filename, sip, rule): | ||||
88 | # | ||||
89 | # SIP cannot handle duplicate %MappedTypes. | ||||
90 | # | ||||
91 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSharedPointer<KGAPI2::Drive::ChildReference> >", | ||||
92 | "QList<QSharedPointer<KGAPI2::Drive::File> >", | ||||
93 | "QList<QSharedPointer<KGAPI2::Drive::ParentReference> >", | ||||
94 | "QList<QSharedPointer<KGAPI2::Drive::Permission> >", | ||||
95 | "QList<QSharedPointer<KGAPI2::Drive::Revision> >", | ||||
96 | "QList<QSharedPointer<KGAPI2::Object> >", "QSharedPointer<KGAPI2::Account>", | ||||
97 | "QSharedPointer<KGAPI2::Drive::About>", | ||||
98 | "QSharedPointer<KGAPI2::Drive::ChildReference>", | ||||
99 | "QSharedPointer<KGAPI2::Drive::File>", | ||||
100 | "QSharedPointer<KGAPI2::Drive::ParentReference>", | ||||
101 | "QSharedPointer<KGAPI2::Drive::Permission>", | ||||
102 | "QSharedPointer<KGAPI2::Drive::Revision>", | ||||
103 | "QList<QSharedPointer<KGAPI2::Drive::App> >", | ||||
104 | "QList<QSharedPointer<KGAPI2::Drive::Change> >", | ||||
105 | "QList<QSharedPointer<KGAPI2::Drive::User> >", | ||||
106 | "QSharedPointer<KGAPI2::Drive::App>", | ||||
107 | "QSharedPointer<KGAPI2::Drive::Change>", | ||||
108 | "QSharedPointer<KGAPI2::Drive::User>") | ||||
109 | rule_helpers.module_add_classes(filename, sip, rule, "KIO::Job") | ||||
110 | rule_helpers.module_add_imports(filename, sip, rule, "KIOCore/KIOCoremod.sip") | ||||
111 | | ||||
112 | | ||||
113 | def module_fix_mapped_types_latitude(filename, sip, rule): | ||||
114 | # | ||||
115 | # SIP cannot handle duplicate %MappedTypes. | ||||
116 | # | ||||
117 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSharedPointer<KGAPI2::Object> >", | ||||
118 | "QSharedPointer<KGAPI2::Account>", "QSharedPointer<KGAPI2::Location>") | ||||
119 | rule_helpers.module_add_classes(filename, sip, rule, "KIO::Job") | ||||
120 | rule_helpers.module_add_imports(filename, sip, rule, "KIOCore/KIOCoremod.sip") | ||||
121 | | ||||
122 | | ||||
123 | def module_fix_mapped_types_maps(filename, sip, rule): | ||||
124 | # | ||||
125 | # SIP cannot handle duplicate %MappedTypes. | ||||
126 | # | ||||
127 | rule_helpers.modulecode_delete(filename, sip, rule, "QVector<KContacts::Address>") | ||||
128 | rule_helpers.module_add_classes(filename, sip, rule, "KIO::Job") | ||||
129 | rule_helpers.module_add_imports(filename, sip, rule, "KIOCore/KIOCoremod.sip") | ||||
130 | | ||||
131 | | ||||
132 | def module_fix_mapped_types_tasks(filename, sip, rule): | ||||
133 | # | ||||
134 | # SIP cannot handle duplicate %MappedTypes. | ||||
135 | # | ||||
136 | rule_helpers.modulecode_delete(filename, sip, rule, "QList<QSharedPointer<KGAPI2::Object> >", | ||||
137 | "QList<QSharedPointer<KGAPI2::Task> >", "QList<QSharedPointer<KGAPI2::TaskList> >", | ||||
138 | "QSharedPointer<KGAPI2::Account>", "QSharedPointer<KGAPI2::Task>", | ||||
139 | "QSharedPointer<KGAPI2::TaskList>") | ||||
140 | fix_ktimezone_stuff(filename, sip, rule) | ||||
141 | | ||||
142 | | ||||
143 | def container_rules(): | ||||
144 | return [ | ||||
145 | # | ||||
146 | # SIP does not seem to be able to handle these type specialization, but we can live without them? | ||||
147 | # | ||||
148 | ["KGAPI2", "Account|Object|Reminder", "", ".*", ".*", rule_helpers.container_make_unassignable], | ||||
149 | ] | ||||
150 | | ||||
151 | | ||||
152 | def modulecode(): | ||||
153 | return { | ||||
154 | "KGAPI/KGAPI/KGAPImod.sip": { | ||||
155 | "code": module_fix_mapped_types, | ||||
156 | }, | ||||
157 | "KGAPI/KGAPI/Blogger/Bloggermod.sip": { | ||||
158 | "code": module_fix_mapped_types_blogger, | ||||
159 | }, | ||||
160 | "KGAPI/KGAPI/Calendar/Calendarmod.sip": { | ||||
161 | "code": module_fix_mapped_types_calendar, | ||||
162 | }, | ||||
163 | "KGAPI/KGAPI/Contacts/Contactsmod.sip": { | ||||
164 | "code": module_fix_mapped_types_contacts, | ||||
165 | }, | ||||
166 | "KGAPI/KGAPI/Drive/Drivemod.sip": { | ||||
167 | "code": module_fix_mapped_types_drive, | ||||
168 | }, | ||||
169 | "KGAPI/KGAPI/Latitude/Latitudemod.sip": { | ||||
170 | "code": module_fix_mapped_types_latitude, | ||||
171 | }, | ||||
172 | "KGAPI/KGAPI/Maps/Mapsmod.sip": { | ||||
173 | "code": module_fix_mapped_types_maps, | ||||
174 | }, | ||||
175 | "KGAPI/KGAPI/Tasks/Tasksmod.sip": { | ||||
176 | "code": module_fix_mapped_types_tasks, | ||||
177 | }, | ||||
178 | } |