Use a larger size hint for main widget.
[maegirls] / trunk / src / win.py
index dd1521c..2837fd6 100755 (executable)
@@ -43,10 +43,18 @@ class ConfigDialog(QDialog):
        self.editName=QLineEdit(self)
        self.editCycle=QSpinBox(self)
        self.editCurrent=QSpinBox(self)
+       self.editMenstr=QSpinBox(self)
+       self.editOvday=QSpinBox(self)
+
        self.editCycle.setRange(10,50)
        self.editCurrent.setRange(1,50)
+       self.editMenstr.setRange(3,7)
+       self.editOvday.setRange(-30,+30)
+
        self.editCurrent.setWrapping(True)
        self.editCycle.setSuffix(self.tr(" days"))
+       self.editMenstr.setSuffix(self.tr(' days'))
+       self.editOvday.setSuffix(self.tr(' days'))
 
        self.editCycle.valueChanged.connect(self.slotEditCycleChanged)
 
@@ -56,6 +64,8 @@ class ConfigDialog(QDialog):
        l1.addRow(self.tr("Name:"), self.editName)
        l1.addRow(self.tr("Cycle length:"), self.editCycle)
        l1.addRow(self.tr("Current day in cycle:"), self.editCurrent)
+       l1.addRow(self.tr("Duration of menstruation:"), self.editMenstr)
+       l1.addRow(self.tr("Ovulation day:"), self.editOvday)
 
        self.l0.addLayout(l1)
 
@@ -79,6 +89,8 @@ class ConfigDialog(QDialog):
        self.name=str(self.editName.text())
        self.cycle=self.editCycle.value()
        self.current=self.editCurrent.value()-1
+       self.menstr=self.editMenstr.value()
+       self.ovday=self.editOvday.value()
 
        self.accept()
 
@@ -91,6 +103,8 @@ class ConfigDialog(QDialog):
        self.editName.setText(dt['name'])
        self.editCycle.setValue(dt['cycle'])
        self.editCurrent.setValue(dt['day0']+1)
+       self.editMenstr.setValue(dt['menstr'])
+       self.editOvday.setValue(dt['ovday'])
 
 class MyMsgDialog(QDialog):
     """
@@ -200,27 +214,37 @@ class HelpDialog(MyMsgDialog):
 
        txt=self.tr("""
 <p> MaeGirls shows information about women's cycle using some generic
-guidelines:  It assumes that 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.
+guidelines:  By default it assumes that 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> Using the configure menu you can change the duration of the cycle,
+the duration of the menstruation and the day the ovulation happens. When
+specifying the ovulation you can use negative numbers to indicate the number
+of days before the end of the period, or positive numbers to indicate the
+number of days after the beginning of the period. Default value for ovulation
+is -14.
+
+<p> MaeGirls supports tracking of multiple women. While there have been a lot
+of negative comments for this option, I find it useful even for women.
+Please don't complain or give negative feedback for an option that you're not
+forced to use.
 
 <p style="color: orange;">
-WARNING!!! This is not always correct. There are FAR TOO MANY exceptions
-to the above rules!!! You MUST consult a doctor in order to get accurate
-predictions!!!
+WARNING!!! The prediction is not always correct. There are FAR TOO MANY
+exceptions to the above rules!!! You MUST consult a doctor in order to get
+accurate predictions!!! Use the program at your own risk!!!
 
 <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, assumed to last 5 days.
+happens. Default: 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), 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 supports the "monitoring" of the cycle of multiple girls/women.
        """)
 
        self.setWindowTitle(self.tr("Help"))
@@ -378,7 +402,8 @@ class MaeGirls(QMainWindow):
     def setGirl(self, name):
        cfg=config.loadGirl(name)
        self.girl=name
-       self.algo.setReference(cfg['day0'], cfg['cycle'])
+       #self.algo.setReference(cfg['day0'], cfg['cycle'])
+       self.algo.setReference(cfg['day0'], cfg)
        self.update()
        self.updateTitle()
 
@@ -389,7 +414,9 @@ class MaeGirls(QMainWindow):
        dt={
            'name':     self.girl,
            'cycle':    self.algo.cycleLength(),
-           'day0':     self.algo.currentDayInCycle()
+           'day0':     self.algo.currentDayInCycle(),
+           'menstr':   self.algo.menstruationDuration(),
+           'ovday':    self.algo.ovulationDay()
            }
 
        self.dlgConfig.initValues(dt)
@@ -405,6 +432,8 @@ class MaeGirls(QMainWindow):
            dt={
                'cycle':        self.dlgConfig.cycle,
                'day0':         day0,
+               'ovday':        self.dlgConfig.ovday,
+               'menstr':       self.dlgConfig.menstr,
                }
 
            config.storeGirl(name, dt)