From b41149112f81dae850785424aa905d8c63260d07 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Mon, 24 Aug 2015 13:53:26 +0100
Subject: [PATCH] TimeSeriesList/HistogramList/ControlPanels have tooltips

---
 fsl/fsleyes/controls/histogramcontrolpanel.py | 38 ++++++++++++-------
 fsl/fsleyes/controls/timeserieslistpanel.py   | 19 ++++++++--
 fsl/fsleyes/tooltips.py                       |  5 ++-
 3 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/fsl/fsleyes/controls/histogramcontrolpanel.py b/fsl/fsleyes/controls/histogramcontrolpanel.py
index d871f3678..5162da680 100644
--- a/fsl/fsleyes/controls/histogramcontrolpanel.py
+++ b/fsl/fsleyes/controls/histogramcontrolpanel.py
@@ -7,11 +7,12 @@
 
 import wx
 
-import                        props
-import pwidgets.widgetlist as widgetlist
+import                         props
+import pwidgets.widgetlist  as widgetlist
 
-import fsl.fsleyes.panel   as fslpanel
-import fsl.data.strings    as strings
+import fsl.fsleyes.panel    as fslpanel
+import fsl.fsleyes.tooltips as fsltooltips
+import fsl.data.strings     as strings
 
 
 class HistogramControlPanel(fslpanel.FSLEyesPanel):
@@ -45,6 +46,7 @@ class HistogramControlPanel(fslpanel.FSLEyesPanel):
             self.__widgets.AddWidget(
                 props.makeWidget(self.__widgets, hsPanel, prop),
                 displayName=strings.properties[hsPanel, prop],
+                tooltip=fsltooltips.properties[hsPanel, prop],
                 groupName='histSettings')
 
         self.__widgets.AddGroup(
@@ -54,6 +56,7 @@ class HistogramControlPanel(fslpanel.FSLEyesPanel):
         for prop in plotProps:
             self.__widgets.AddWidget(
                 props.makeWidget(self.__widgets, hsPanel, prop),
+                tooltip=fsltooltips.properties[hsPanel, prop],
                 displayName=strings.properties[hsPanel, prop],
                 groupName='plotSettings')
 
@@ -80,15 +83,18 @@ class HistogramControlPanel(fslpanel.FSLEyesPanel):
 
         self.__widgets.AddWidget(
             labels,
-            strings.labels[hsPanel, 'labels'],
+            displayName=strings.labels[hsPanel, 'labels'],
+            tooltip=fsltooltips.misc[  hsPanel, 'labels'],
             groupName='plotSettings')
         self.__widgets.AddWidget(
             xlims,
-            strings.labels[hsPanel, 'xlim'],
+            displayName=strings.labels[hsPanel, 'xlim'],
+            tooltip=fsltooltips.misc[  hsPanel, 'xlim'],
             groupName='plotSettings')
         self.__widgets.AddWidget(
             ylims,
-            strings.labels[hsPanel, 'ylim'],
+            displayName=strings.labels[hsPanel, 'ylim'],
+            tooltip=fsltooltips.misc[  hsPanel, 'ylim'],
             groupName='plotSettings')
 
         # We store a ref to the currently selected
@@ -180,22 +186,28 @@ class HistogramControlPanel(fslpanel.FSLEyesPanel):
 
         wlist.AddWidget(ignoreZeros,
                         groupName='currentSettings',
-                        displayName=strings.properties[hs, 'ignoreZeros'])
+                        displayName=strings.properties[hs, 'ignoreZeros'],
+                        tooltip=fsltooltips.properties[hs, 'ignoreZeros'])
         wlist.AddWidget(showOverlay,
                         groupName='currentSettings',
-                        displayName=strings.properties[hs, 'showOverlay'])
+                        displayName=strings.properties[hs, 'showOverlay'],
+                        tooltip=fsltooltips.properties[hs, 'showOverlay'])
         wlist.AddWidget(includeOutliers,
                         groupName='currentSettings',
-                        displayName=strings.properties[hs, 'includeOutliers']) 
+                        displayName=strings.properties[hs, 'includeOutliers'],
+                        tooltip=fsltooltips.properties[hs, 'includeOutliers']) 
         wlist.AddWidget(self.__nbins,
                         groupName='currentSettings',
-                        displayName=strings.properties[hs, 'nbins'])
+                        displayName=strings.properties[hs, 'nbins'],
+                        tooltip=fsltooltips.properties[hs, 'nbins'])
         wlist.AddWidget(volume,
                         groupName='currentSettings',
-                        displayName=strings.properties[hs, 'volume'])
+                        displayName=strings.properties[hs, 'volume'],
+                        tooltip=fsltooltips.properties[hs, 'volume'])
         wlist.AddWidget(dataRange,
                         groupName='currentSettings',
-                        displayName=strings.properties[hs, 'dataRange'])
+                        displayName=strings.properties[hs, 'dataRange'],
+                        tooltip=fsltooltips.properties[hs, 'dataRange'])
 
         if expanded:
             wlist.Expand('currentSettings')
diff --git a/fsl/fsleyes/controls/timeserieslistpanel.py b/fsl/fsleyes/controls/timeserieslistpanel.py
index 42d8afe89..28f45d558 100644
--- a/fsl/fsleyes/controls/timeserieslistpanel.py
+++ b/fsl/fsleyes/controls/timeserieslistpanel.py
@@ -13,7 +13,7 @@ import numpy as np
 import                           props
 import pwidgets.elistbox      as elistbox
 import fsl.fsleyes.panel      as fslpanel
-import fsl.utils.transform    as transform
+import fsl.fsleyes.tooltips   as fsltooltips
 import fsl.data.strings       as strings
 import fsl.fsleyes.colourmaps as fslcm
 
@@ -38,7 +38,16 @@ class TimeSeriesWidget(wx.Panel):
                                           'lineWidth')
         self.lineStyle = props.makeWidget(self,
                                           timeSeries,
-                                          'lineStyle') 
+                                          'lineStyle')
+
+        self.colour.SetToolTipString(
+            fsltooltips.properties[timeSeries, 'colour'])
+        self.alpha.SetToolTipString(
+            fsltooltips.properties[timeSeries, 'alpha'])
+        self.lineWidth.SetToolTipString(
+            fsltooltips.properties[timeSeries, 'lineWidth'])
+        self.lineStyle.SetToolTipString(
+            fsltooltips.properties[timeSeries, 'lineStyle'])
 
         self.sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.SetSizer(self.sizer)
@@ -151,7 +160,11 @@ class TimeSeriesListPanel(fslpanel.FSLEyesPanel):
 
         for ts in self.__tsPanel.dataSeries:
             widg = TimeSeriesWidget(self, ts)
-            self.__tsList.Append(ts.label, clientData=ts, extraWidget=widg)
+            self.__tsList.Append(
+                ts.label,
+                clientData=ts,
+                tooltip=fsltooltips.properties[ts, 'label'],
+                extraWidget=widg)
 
 
     def __locationChanged(self, *a):
diff --git a/fsl/fsleyes/tooltips.py b/fsl/fsleyes/tooltips.py
index fb21d4466..4c19f1866 100644
--- a/fsl/fsleyes/tooltips.py
+++ b/fsl/fsleyes/tooltips.py
@@ -372,6 +372,7 @@ actions = TypeDict({
 
 
 misc = TypeDict({
-
-
+    'HistogramPanel.labels' : 'X/Y axis labels.',
+    'HistogramPanel.xlim'   : 'X axis data limits.',
+    'HistogramPanel.ylim'   : 'Y axis data limits.'
 })
-- 
GitLab