| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
from PyQt5.QtGui import QPixmap |
| 27 |
from PyQt5.QtWidgets import ( |
| 28 |
QPushButton, |
| 29 |
QDialog, |
| 30 |
QWidget, |
| 31 |
QVBoxLayout, |
| 32 |
QHBoxLayout, |
| 33 |
QLabel, |
| 34 |
QTextEdit, |
| 35 |
QTabWidget, |
| 36 |
) |
| 37 |
from PyQt5.QtCore import Qt |
| 38 |
|
| 39 |
from .. import param |
| 40 |
from ..param import NOMPROG, LOGO |
| 41 |
|
| 42 |
ANNEE = param.date_version[0] |
| 43 |
from ..pylib.infos import informations_configuration |
| 44 |
from ..pylib import path2 |
| 45 |
from .app import app, white_palette |
| 46 |
|
| 47 |
|
| 48 |
class Informations(QDialog): |
| 49 |
def __init__(self, parent): |
| 50 |
QDialog.__init__(self, parent) |
| 51 |
self.setWindowTitle("Configuration systeme") |
| 52 |
self.setPalette(white_palette) |
| 53 |
|
| 54 |
panel = QWidget(self) |
| 55 |
|
| 56 |
panelSizer = QVBoxLayout() |
| 57 |
|
| 58 |
textes = informations_configuration().split("\n") |
| 59 |
|
| 60 |
for i, texte in enumerate(textes): |
| 61 |
if texte.startswith("+ "): |
| 62 |
textes[i] = "<i>" + texte + "</i>" |
| 63 |
t = QLabel("<br>".join(textes), panel) |
| 64 |
panelSizer.addWidget(t) |
| 65 |
|
| 66 |
btnOK = QPushButton("OK", panel) |
| 67 |
btnOK.clicked.connect(self.close) |
| 68 |
btnCopier = QPushButton("Copier", panel) |
| 69 |
btnCopier.clicked.connect(self.copier) |
| 70 |
|
| 71 |
sizer = QHBoxLayout() |
| 72 |
sizer.addWidget(btnOK) |
| 73 |
sizer.addStretch() |
| 74 |
sizer.addWidget(btnCopier) |
| 75 |
panelSizer.addLayout(sizer) |
| 76 |
|
| 77 |
panel.setLayout(panelSizer) |
| 78 |
|
| 79 |
topSizer = QHBoxLayout() |
| 80 |
topSizer.addWidget(panel) |
| 81 |
|
| 82 |
self.setLayout(topSizer) |
| 83 |
|
| 84 |
def copier(self): |
| 85 |
app.vers_presse_papier(informations_configuration()) |
| 86 |
|
| 87 |
|
| 88 |
class APropos(QWidget): |
| 89 |
def __init__(self, parent): |
| 90 |
QWidget.__init__(self, parent) |
| 91 |
self.parent = parent |
| 92 |
sizer = QVBoxLayout() |
| 93 |
global LOGO |
| 94 |
LOGO = path2(LOGO) |
| 95 |
logo = QLabel(self) |
| 96 |
logo.setPixmap(QPixmap(LOGO)) |
| 97 |
|
| 98 |
sizer.addWidget(logo, 0, Qt.AlignCenter) |
| 99 |
|
| 100 |
date = "/".join(str(n) for n in reversed(param.date_version)) |
| 101 |
textes = ["<b>%s version %s</b>" % (NOMPROG, param.version)] |
| 102 |
textes.append("<i>Version publiée le " + date + "</i>") |
| 103 |
textes.append("") |
| 104 |
textes.append("« Le couteau suisse du prof de maths »") |
| 105 |
textes.append("") |
| 106 |
textes.append( |
| 107 |
"<img src='%s'> <b>%s est un \ |
| 108 |
<a href='http://fr.wikipedia.org/wiki/Logiciel_libre'> \ |
| 109 |
logiciel libre</a></b>" |
| 110 |
% (path2("%/wxgeometrie/images/copyleft.png"), NOMPROG) |
| 111 |
) |
| 112 |
textes.append( |
| 113 |
"Vous pouvez l'utiliser et le modifier selon les termes de la GNU Public License v2." |
| 114 |
) |
| 115 |
textes.append( |
| 116 |
"<i>Copyleft 2005-%s Nicolas Pourcelot ([email protected])</i>" |
| 117 |
% ANNEE |
| 118 |
) |
| 119 |
textes.append("") |
| 120 |
label = QLabel("<br>".join(textes)) |
| 121 |
label.setAlignment(Qt.AlignCenter) |
| 122 |
label.setOpenExternalLinks(True) |
| 123 |
|
| 124 |
sizer.addWidget(label, 0, Qt.AlignCenter) |
| 125 |
self.setLayout(sizer) |
| 126 |
|
| 127 |
|
| 128 |
class Licence(QWidget): |
| 129 |
def __init__(self, parent): |
| 130 |
QWidget.__init__(self, parent) |
| 131 |
self.parent = parent |
| 132 |
|
| 133 |
sizer = QVBoxLayout() |
| 134 |
|
| 135 |
texte = QTextEdit(self) |
| 136 |
with open(path2("%/wxgeometrie/doc/license.txt"), "r", encoding="utf8") as f: |
| 137 |
msg = f.read() |
| 138 |
texte.setPlainText(msg) |
| 139 |
texte.setMinimumHeight(500) |
| 140 |
texte.setReadOnly(True) |
| 141 |
texte.setLineWrapMode(QTextEdit.NoWrap) |
| 142 |
doc = texte.document() |
| 143 |
width = int(doc.idealWidth() + 4 * doc.documentMargin()) |
| 144 |
texte.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) |
| 145 |
texte.setMinimumWidth(width) |
| 146 |
sizer.addWidget(texte) |
| 147 |
self.setLayout(sizer) |
| 148 |
|
| 149 |
|
| 150 |
class Notes(QWidget): |
| 151 |
def __init__(self, parent): |
| 152 |
QWidget.__init__(self, parent) |
| 153 |
self.parent = parent |
| 154 |
|
| 155 |
sizer = QVBoxLayout() |
| 156 |
|
| 157 |
texte = QTextEdit(self) |
| 158 |
with open(path2("%/wxgeometrie/doc/changelog.txt"), "r", encoding="utf8") as f: |
| 159 |
msg = f.read().replace("\n", "<br>") |
| 160 |
titre = ( |
| 161 |
"<b>Changements apportés par la version courante (%s) :</b>" % param.version |
| 162 |
) |
| 163 |
msg = "<br>".join((titre, "", msg)) |
| 164 |
texte.setHtml(msg) |
| 165 |
texte.setMinimumHeight(500) |
| 166 |
texte.setMinimumWidth(300) |
| 167 |
texte.setReadOnly(True) |
| 168 |
doc = texte.document() |
| 169 |
width = int(doc.idealWidth() + 4 * doc.documentMargin()) |
| 170 |
texte.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) |
| 171 |
texte.setMinimumWidth(width) |
| 172 |
sizer.addWidget(texte) |
| 173 |
self.setLayout(sizer) |
| 174 |
|
| 175 |
|
| 176 |
class Credits(QWidget): |
| 177 |
def __init__(self, parent): |
| 178 |
QWidget.__init__(self, parent) |
| 179 |
self.parent = parent |
| 180 |
|
| 181 |
sizer = QVBoxLayout() |
| 182 |
texte = ( |
| 183 |
"""<h3>Contributeurs :</h3> |
| 184 |
<p><i>Les personnes suivantes ont contribué au code de %(NOMPROG)s</i></p> |
| 185 |
<ul> |
| 186 |
<li><i>Boris Mauricette</i> : statistiques, interpolation (2011-2012)</li> |
| 187 |
<li><i>Christophe Gragnic</i> : gestion de la documentation (2012)</li> |
| 188 |
</ul> |
| 189 |
<br> |
| 190 |
<h3>Remerciements :</h3> |
| 191 |
<p> |
| 192 |
<a href="http://wxgeo.free.fr/doc/html/help.html#remerciements"> |
| 193 |
De nombreuses personnes</a> ont aidé ce projet, par leurs retours d'expérience,<br> |
| 194 |
ou par leur aide à l'installation sur certaines plateformes.<br> |
| 195 |
Qu'elles en soient remerciées.</p> |
| 196 |
<p> |
| 197 |
Remerciements tous particuliers à <i>Jean-Pierre Garcia</i> et à <i>Georges Khaznadar</i>.</p> |
| 198 |
<br> |
| 199 |
<h3>Librairies utilisées :</h3> |
| 200 |
<ul> |
| 201 |
<li>%(NOMPROG)s inclut désormais <a href='http://www.sympy.org'> SymPy</a> |
| 202 |
(Python library for symbolic mathematics)<br> |
| 203 |
© 2006-%(ANNEE)s <i>The Sympy Team</i></li> |
| 204 |
<li>%(NOMPROG)s est codé en <a href="http://www.python.org">Python</a></li> |
| 205 |
<li><a href="http://www.numpy.org">Numpy</a> est une bibliothèque de calcul numérique</li> |
| 206 |
<li><a href="http://www.matplotlib.org">Matplotlib</a> est une librairie graphique scientifique</li> |
| 207 |
<li><a href="http://www.riverbankcomputing.co.uk/software/pyqt">PyQt</a> |
| 208 |
est utilisé pour l'interface graphique</li> |
| 209 |
</ul> |
| 210 |
|
| 211 |
<p> |
| 212 |
Plus généralement, je remercie tous les acteurs de la communauté du logiciel libre,<br> |
| 213 |
tous ceux qui prennent la peine de partager leur savoir et leur travail.</p> |
| 214 |
<p>Nous ne sommes jamais que <i>« des nains juchés sur des épaules de géants » (Bernard de Chartres)</i>. |
| 215 |
<br> |
| 216 |
<p><i>À Sophie, Clémence, Timothée, Olivier.</i></p> |
| 217 |
<p><i>« Il y a des yeux qui reçoivent la lumière, et il y a des yeux qui la donnent. » (Paul Claudel)</i> |
| 218 |
</p> |
| 219 |
""" |
| 220 |
% globals() |
| 221 |
) |
| 222 |
label = QLabel(texte) |
| 223 |
label.setOpenExternalLinks(True) |
| 224 |
|
| 225 |
sizer.addWidget(label) |
| 226 |
sizer.addStretch() |
| 227 |
self.setLayout(sizer) |
| 228 |
|
| 229 |
|
| 230 |
class OngletsAbout(QTabWidget): |
| 231 |
def __init__(self, parent): |
| 232 |
QTabWidget.__init__(self, parent) |
| 233 |
self.addTab(APropos(parent), "À propos") |
| 234 |
self.addTab(Licence(parent), "Licence") |
| 235 |
self.addTab(Notes(parent), "Notes de version") |
| 236 |
self.addTab(Credits(parent), "Crédits") |
| 237 |
self.setTabPosition(QTabWidget.South) |
| 238 |
self.setStyleSheet( |
| 239 |
""" |
| 240 |
QTabBar::tab:selected { |
| 241 |
background: white; |
| 242 |
border: 1px solid #C4C4C3; |
| 243 |
border-top-color: white; /* same as the pane color */ |
| 244 |
border-bottom-left-radius: 4px; |
| 245 |
border-bottom-right-radius: 4px; |
| 246 |
border-top-left-radius: 0px; |
| 247 |
border-top-right-radius: 0px; |
| 248 |
min-width: 8ex; |
| 249 |
padding: 7px; |
| 250 |
} |
| 251 |
QStackedWidget {background:white} |
| 252 |
QTabBar QToolButton { |
| 253 |
background:white; |
| 254 |
border: 1px solid #C4C4C3; |
| 255 |
border-top-color: white; /* same as the pane color */ |
| 256 |
border-bottom-left-radius: 4px; |
| 257 |
border-bottom-right-radius: 4px; |
| 258 |
border-top-left-radius: 0px; |
| 259 |
border-top-right-radius: 0px; |
| 260 |
} |
| 261 |
""" |
| 262 |
) |
| 263 |
|
| 264 |
|
| 265 |
class About(QDialog): |
| 266 |
def __init__(self, parent): |
| 267 |
QDialog.__init__(self, parent) |
| 268 |
self.setWindowTitle("A propos de " + NOMPROG) |
| 269 |
self.setPalette(white_palette) |
| 270 |
|
| 271 |
sizer = QVBoxLayout() |
| 272 |
|
| 273 |
sizer.addWidget(OngletsAbout(self)) |
| 274 |
|
| 275 |
self.setLayout(sizer) |
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|