Mercurial > libervia-desktop-kivy
annotate cagou/core/patches.py @ 325:5868a5575e01
chat: cleaning + some improvments:
- code cleaning, removed some dead code
- some improvments on the way size is calculated, removed unnecessary sizing methods which
were linked to properties
- image have now a max size, this avoid gigantic image in the whole screen
- in SimpleXHTMLWidget, Label are now splitted when xhtml is set
- use a DelayedBoxLayout for messages, as they are really slow to be resized
- use of RecycleView has been investigated, but it is not currently usable as dynamic
contents are not propertly handled (see https://github.com/kivy/kivy/issues/6580 and
https://github.com/kivy/kivy/issues/6582). Furthermore, some tests with RecycleView on
Android don't give the expected speed boost, so BoxLayout still seems like the way to go
for the moment. To be re-investigated at a later point if necessary.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Dec 2019 13:25:31 +0100 |
parents | 772c170b47a9 |
children | 4d660b252487 |
rev | line source |
---|---|
280
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr//bin/env python2 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 # Copyright (C) 2016-2019 Jérôme Poisson (goffi@goffi.org) |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
312 | 20 import urllib.request, urllib.error, urllib.parse |
280
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 import ssl |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 def apply(): |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 # allow to disable certificate validation |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 ctx_no_verify = ssl.create_default_context() |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 ctx_no_verify.check_hostname = False |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 ctx_no_verify.verify_mode = ssl.CERT_NONE |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 |
312 | 30 class HTTPSHandler(urllib.request.HTTPSHandler): |
280
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 no_certificate_check = False |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 def __init__(self, *args, **kwargs): |
312 | 34 urllib.request._HTTPSHandler_ori.__init__(self, *args, **kwargs) |
280
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 if self.no_certificate_check: |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 self._context = ctx_no_verify |
b0461363bc65
core: certificate validation can be disabled:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 |
312 | 38 urllib.request._HTTPSHandler_ori = urllib.request.HTTPSHandler |
39 urllib.request.HTTPSHandler = HTTPSHandler | |
40 urllib.request.HTTPSHandler.no_certificate_check = True |