annotate src/cagou/__init__.py @ 38:9f45098289cc

widgets handler, core: hidden widgets can now be shown with swipes: - a couple of methods have been added to handle visible and hidden widgets - a new getOrClone method allow to recreate a widget if it already has a parent (can happen even if the widget is not shown, e.g. in a carousel) - handler now display hidden widgets of the same class as the displayed one when swiping. For instance, if a chat widget is displayed, and header input is used to show an other one, it's now possible to go back to the former by swiping. QuickWidget.onDelete method can be used to handle if a widget must be really deleted (return True) or just hidden (any other value). - handler use a subclass of Carousel for this new feature, with some adjustement so event can be passed to children without too much delay (and frustration). This may need to be adjusted again in the future. - handler.cagou_widget now give the main displayed widget in the handler - handler.changeWidget must be used when widget need to be changed (it's better to use host.switchWidget which will call it itself)
author Goffi <goffi@goffi.org>
date Sun, 28 Aug 2016 15:27:48 +0200
parents ba14b596b90e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
1 #!/usr//bin/env python2
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
2 # -*- coding: utf-8 -*-
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
3
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
4 # Cagou: desktop/mobile frontend for Salut à Toi XMPP client
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
5 # Copyright (C) 2016 Jérôme Poisson (goffi@goffi.org)
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
6
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
7 # This program is free software: you can redistribute it and/or modify
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
10 # (at your option) any later version.
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
11
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
12 # This program is distributed in the hope that it will be useful,
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
15 # GNU Affero General Public License for more details.
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
16
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
19
16
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
20
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
21 class Global(object):
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
22 @property
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
23 def host(self):
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
24 return self._host
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
25 G = Global()
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
26
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
27
15
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
28 from core import cagou_main
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
29
16
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
30
15
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
31 def run():
16
ba14b596b90e host can now be get as a global value:
Goffi <goffi@goffi.org>
parents: 15
diff changeset
32 host = G._host = cagou_main.Cagou()
15
56838ad5c84b files reorganisation, cagou is now launched with python2 cagou.py in src/
Goffi <goffi@goffi.org>
parents: 0
diff changeset
33 host.run()