Debian Codegraph @

wxgeometrie/geolib/pseudo_canvas.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 ##--------------------------------------#######
4 # Pseudo-canvas #
5 ##--------------------------------------#######
6 # WxGeometrie
7 # Dynamic geometry, graph plotter, and more for french mathematic teachers.
8 # Copyright (C) 2005-2013 Nicolas Pourcelot
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
24 from .. import param
25
26 class PseudoContexte(object):
27 "Contexte bidon ne faisant absolument rien."
28
29 def __enter__(self):
30 pass
31
32 def __exit__(self, type, value, traceback):
33 pass
34
35
36 class PseudoCanvas(object):
37 """Faux canvas utilisé par défaut par la feuille de travail.
38
39 Permet de faire appel à l'objet canvas et à ses méthodes sans générer d'erreur
40 lorsqu'il n'y a pas de canvas."""
41
42 def __getattr__(self, nom):
43 if param.debug:
44 print('Action %s non effectuee (pas de canevas).' %nom)
45 return (lambda *args, **kw: NotImplemented)
46 ##
47 ## def __setattr__(self, nom, valeur):
48 ## pass
49 ##
50 def geler_affichage(self, *args, **kw):
51 return PseudoContexte()
52
53 ## def detecter(self, *args, **kw):
54 ## pass
55 ##
56 ## def actualiser(self, *args, **kw):
57 ## pass
58
59 def __bool__(self):
60 return False
61
62 def __bool__(self):
63 return False
64
65 ## def redessiner_et_actualiser(self, *args, **kw):
66 ## pass
67
68 _pseudocanvas = PseudoCanvas()