# -*- coding: utf-8 -*- ##--------------------------------------####### # Aide # ##--------------------------------------####### # WxGeometrie # Dynamic geometry, graph plotter, and more for french mathematic teachers. # Copyright (C) 2005-2013 Nicolas Pourcelot # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import ( QPushButton, QDialog, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QTextEdit, QTabWidget, ) from PyQt5.QtCore import Qt from .. import param from ..param import NOMPROG, LOGO ANNEE = param.date_version[0] from ..pylib.infos import informations_configuration from ..pylib import path2 from .app import app, white_palette class Informations(QDialog): def __init__(self, parent): QDialog.__init__(self, parent) self.setWindowTitle("Configuration systeme") self.setPalette(white_palette) panel = QWidget(self) panelSizer = QVBoxLayout() textes = informations_configuration().split("\n") for i, texte in enumerate(textes): if texte.startswith("+ "): textes[i] = "" + texte + "" t = QLabel("
".join(textes), panel) panelSizer.addWidget(t) btnOK = QPushButton("OK", panel) btnOK.clicked.connect(self.close) btnCopier = QPushButton("Copier", panel) btnCopier.clicked.connect(self.copier) sizer = QHBoxLayout() sizer.addWidget(btnOK) sizer.addStretch() sizer.addWidget(btnCopier) panelSizer.addLayout(sizer) panel.setLayout(panelSizer) topSizer = QHBoxLayout() topSizer.addWidget(panel) self.setLayout(topSizer) def copier(self): app.vers_presse_papier(informations_configuration()) class APropos(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) self.parent = parent sizer = QVBoxLayout() global LOGO LOGO = path2(LOGO) logo = QLabel(self) logo.setPixmap(QPixmap(LOGO)) sizer.addWidget(logo, 0, Qt.AlignCenter) date = "/".join(str(n) for n in reversed(param.date_version)) textes = ["%s version %s" % (NOMPROG, param.version)] textes.append("Version publiée le " + date + "") textes.append("") textes.append("« Le couteau suisse du prof de maths »") textes.append("") textes.append( " %s est un \ \ logiciel libre" % (path2("%/wxgeometrie/images/copyleft.png"), NOMPROG) ) textes.append( "Vous pouvez l'utiliser et le modifier selon les termes de la GNU Public License v2." ) textes.append( "Copyleft 2005-%s Nicolas Pourcelot (wxgeo@users.sourceforge.net)" % ANNEE ) textes.append("") label = QLabel("
".join(textes)) label.setAlignment(Qt.AlignCenter) label.setOpenExternalLinks(True) sizer.addWidget(label, 0, Qt.AlignCenter) self.setLayout(sizer) class Licence(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) self.parent = parent sizer = QVBoxLayout() texte = QTextEdit(self) with open(path2("%/wxgeometrie/doc/license.txt"), "r", encoding="utf8") as f: msg = f.read() texte.setPlainText(msg) texte.setMinimumHeight(500) texte.setReadOnly(True) texte.setLineWrapMode(QTextEdit.NoWrap) doc = texte.document() width = int(doc.idealWidth() + 4 * doc.documentMargin()) texte.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) texte.setMinimumWidth(width) sizer.addWidget(texte) self.setLayout(sizer) class Notes(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) self.parent = parent sizer = QVBoxLayout() texte = QTextEdit(self) with open(path2("%/wxgeometrie/doc/changelog.txt"), "r", encoding="utf8") as f: msg = f.read().replace("\n", "
") titre = ( "Changements apportés par la version courante (%s) :" % param.version ) msg = "
".join((titre, "", msg)) texte.setHtml(msg) texte.setMinimumHeight(500) texte.setMinimumWidth(300) texte.setReadOnly(True) doc = texte.document() width = int(doc.idealWidth() + 4 * doc.documentMargin()) texte.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) texte.setMinimumWidth(width) sizer.addWidget(texte) self.setLayout(sizer) class Credits(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) self.parent = parent sizer = QVBoxLayout() texte = ( """

Contributeurs :

Les personnes suivantes ont contribué au code de %(NOMPROG)s


Remerciements :

De nombreuses personnes ont aidé ce projet, par leurs retours d'expérience,
ou par leur aide à l'installation sur certaines plateformes.
Qu'elles en soient remerciées.

Remerciements tous particuliers à Jean-Pierre Garcia et à Georges Khaznadar.


Librairies utilisées :

Plus généralement, je remercie tous les acteurs de la communauté du logiciel libre,
tous ceux qui prennent la peine de partager leur savoir et leur travail.

Nous ne sommes jamais que « des nains juchés sur des épaules de géants » (Bernard de Chartres).

À Sophie, Clémence, Timothée, Olivier.

« Il y a des yeux qui reçoivent la lumière, et il y a des yeux qui la donnent. » (Paul Claudel)

""" % globals() ) label = QLabel(texte) label.setOpenExternalLinks(True) sizer.addWidget(label) sizer.addStretch() self.setLayout(sizer) class OngletsAbout(QTabWidget): def __init__(self, parent): QTabWidget.__init__(self, parent) self.addTab(APropos(parent), "À propos") self.addTab(Licence(parent), "Licence") self.addTab(Notes(parent), "Notes de version") self.addTab(Credits(parent), "Crédits") self.setTabPosition(QTabWidget.South) self.setStyleSheet( """ QTabBar::tab:selected { background: white; border: 1px solid #C4C4C3; border-top-color: white; /* same as the pane color */ border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 0px; border-top-right-radius: 0px; min-width: 8ex; padding: 7px; } QStackedWidget {background:white} QTabBar QToolButton { background:white; border: 1px solid #C4C4C3; border-top-color: white; /* same as the pane color */ border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 0px; border-top-right-radius: 0px; } """ ) class About(QDialog): def __init__(self, parent): QDialog.__init__(self, parent) self.setWindowTitle("A propos de " + NOMPROG) self.setPalette(white_palette) ##self.setWindowFlags(Qt.Dialog|Qt.FramelessWindowHint|Qt.X11BypassWindowManagerHint) sizer = QVBoxLayout() sizer.addWidget(OngletsAbout(self)) self.setLayout(sizer) ##class WhiteScrolledMessageDialog(QDialog): ##def __init__(self, parent, title='', msg = '', width=None): ##QDialog.__init__(self, parent) ##self.setWindowTitle(title) ##self.setPalette(white_palette) ## ##sizer = QVBoxLayout() ##self.setLayout(sizer) ## ##texte = QTextEdit(self) ##texte.setPlainText(msg) ##texte.setMinimumHeight(500) ##texte.setReadOnly(True) ##if width is None: ##texte.setLineWrapMode(QTextEdit.NoWrap) ##doc = texte.document() ##width = doc.idealWidth() + 4*doc.documentMargin() ##texte.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) ##texte.setMinimumWidth(width) ##sizer.addWidget(texte) ## ##boutons = QHBoxLayout() ##boutons.addStretch() ##ok = QPushButton('OK', clicked=self.close) ##boutons.addWidget(ok) ##boutons.addStretch() ##sizer.addLayout(boutons)