Fixed link in about box.
[maegirls] / trunk / src / win.py
index 56a45be..2085258 100755 (executable)
@@ -27,6 +27,7 @@ from PyQt4.QtCore import *
 
 import sys
 import time
+import locale
 
 from graph import DaysGraph
 import config
@@ -135,20 +136,40 @@ class AboutDialog(MyMsgDialog):
        MyMsgDialog.__init__(self, *args, **kwargs)
 
        txt=self.tr("""
+<html><style>
+div.title {
+    text-decoration:   underline;
+}
+</style>
+<body>
 <p> A program to monitor the women's cycle.  Good for planning (or acting ;-).
 Inspired by "MyGirls" app which is (was?) available for Java ME capable phones.
 
 <p style="color: orange;">
-WARNING!!! This is not accurate nor correct! You cannot trust
-this program (or any other program) for accurate predictions!
-(after all, this is about women... how can one be sure :-).
-
+WARNING!!! This app is not guaranteed to be accurate or correct!  You cannot 
+trust this program, or any program, to give accurate predictions!
+The whole women-cycle-thing highly depends on a number of factors that
+only a doctor can tell.
+<p>
+<div class="title">Copyright</div>
 <p> Copyright &copy; 2010, Stefanos Harhalakis &lt;v13@v13.gr&gt;
 
 <p> Send comments and bug reports to the above address.
 
-<p> This program can be distributed under the terms of the GNU public
-license, version 3 or any later.
+<div class="title">License</div>
+<p> 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 3 of the License, or
+(at your option) any later version.
+<p> 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.
+<p> You should have received a copy of the GNU General Public License
+along with this program.  If not, see
+<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
+</body>
+</html>
        """)
 
        self.setWindowTitle(self.tr("About MaeGirls"))
@@ -179,24 +200,27 @@ class HelpDialog(MyMsgDialog):
 
        txt=self.tr("""
 <p> MaeGirls shows information about women's cycle using some generic
-guidelines.  It assumes that the ovulation happens 14 days before the start
+guidelines:  It assumes that the ovulation happens 14 days before the start
 of the next period and that the period cycle is constant. Also, it assumes
 that sperm can live for 4 days, while an egg can live for 2 days.
 
 <p style="color: orange;">
 WARNING!!! This is not always correct. There are FAR TOO MANY exceptions
-to the above rules!!!
+to the above rules!!! You MUST consult a doctor in order to get accurate
+predictions!!!
 
-<p> Assuming that you understand the risk of being wrong, you become
-entitled to read the graph as follows:
+<p> Assuming that you understand the risks of blindly trusting this program,
+you become entitled to read the graph as follows:
 <p> <span style="color: red">In red:</span> The days that menstruation
-happens.
-<p> <span style="color: green">In green:</span> The fertile days.
+happens, assumed to last 5 days.
+<p> <span style="color: green">In green:</span> The fertile days as described above.
 <p> <span style="color: blue">In blue:</span> The days of PMS
-(Premenstrual Syndrome).
+(Premenstrual Syndrome), assumed to last 7 days.
 
 <p> Navigation is easy: Use left-right finger movement to move the calendar
 view. Use up-down finger movement to zoom in/out.
+
+<p> This program allows for "monitoring" the cycle of multiple girls.
        """)
 
        self.setWindowTitle(self.tr("Help"))
@@ -339,7 +363,9 @@ class MaeGirls(QMainWindow):
        m.addAction(self.menuhelp)
        m.addAction(self.menuabout)
 
-       self.setWindowTitle("MaeGirls")
+    def updateTitle(self):
+       txt="MaeGirls - %s" % (self.girl, )
+       self.setWindowTitle(txt)
 
     def setAlgo(self, algo):
        self.dg.setAlgo(algo)
@@ -348,7 +374,8 @@ class MaeGirls(QMainWindow):
        cfg=config.loadGirl(name)
        self.girl=name
        self.algo.setReference(cfg['day0'], cfg['cycle'])
-       self.repaint()
+       self.update()
+       self.updateTitle()
 
     def menuConfig(self):
        if self.dlgConfig==None:
@@ -384,7 +411,7 @@ class MaeGirls(QMainWindow):
 
            self.setGirl(name)
 
-           self.repaint()
+           self.update()
 
     def menuGirls(self):
        if self.dlgGirls==None:
@@ -443,14 +470,22 @@ def init(algo):
     # Create the application
     app=QApplication(sys.argv)
 
+    # This returns the country and *NOT* the required locale
+    # This means that if you have'set language==en_GB and countr==Greece
+    # it will return el_GR.
+    # IOW: If you want english messages this will not work
+    #loc=QLocale.system().name()
+
+    loc=locale.setlocale(locale.LC_MESSAGES, '')
+
     # Load translations
     qttr=QTranslator()
-    qttr.load("qt_" + QLocale.system().name(),
+    qttr.load("qt_" + loc,
        QLibraryInfo.location(QLibraryInfo.TranslationsPath))
     app.installTranslator(qttr)
 
     maetr=QTranslator()
-    maetr.load("maegirls_" + QLocale.system().name(),
+    maetr.load("maegirls_" + loc,
        "/usr/share/maegirls/translations")
 
     # Install the translation