Skip to content
Snippets Groups Projects
Commit 3795d12f authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Fixes to fsl platform module. Workaround wx GTK fit

parent c7612816
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,8 @@ import threading ...@@ -22,6 +22,8 @@ import threading
import wx import wx
from fsl.utils.platform import platform as fslplatform
class SimpleMessageDialog(wx.Dialog): class SimpleMessageDialog(wx.Dialog):
"""A simple, no-frills :class:`wx.Dialog` for displaying a message. The """A simple, no-frills :class:`wx.Dialog` for displaying a message. The
...@@ -637,16 +639,14 @@ class FSLDirDialog(wx.Dialog): ...@@ -637,16 +639,14 @@ class FSLDirDialog(wx.Dialog):
self.__icon.SetBitmap(bmp) self.__icon.SetBitmap(bmp)
self.__message.SetLabel( self.__message.SetLabel(
'The $FSLDIR environment variable ' 'The $FSLDIR environment variable is not set - {} '
'is not set - {} may not behave ' 'may not behave correctly.'.format(toolName))
'correctly.'.format(toolName))
self.__locate .SetLabel('Locate $FSLDIR') self.__locate .SetLabel('Locate $FSLDIR')
self.__skip .SetLabel('Skip') self.__skip .SetLabel('Skip')
self.__skip .Bind(wx.EVT_BUTTON, self.__onSkip) self.__skip .Bind(wx.EVT_BUTTON, self.__onSkip)
self.__locate.Bind(wx.EVT_BUTTON, self.__onLocate) self.__locate.Bind(wx.EVT_BUTTON, self.__onLocate)
self.__mainSizer = wx.BoxSizer(wx.HORIZONTAL) self.__mainSizer = wx.BoxSizer(wx.HORIZONTAL)
self.__contentSizer = wx.BoxSizer(wx.VERTICAL) self.__contentSizer = wx.BoxSizer(wx.VERTICAL)
self.__buttonSizer = wx.BoxSizer(wx.HORIZONTAL) self.__buttonSizer = wx.BoxSizer(wx.HORIZONTAL)
...@@ -671,8 +671,9 @@ class FSLDirDialog(wx.Dialog): ...@@ -671,8 +671,9 @@ class FSLDirDialog(wx.Dialog):
self.__message.Wrap(self.GetSize().GetWidth()) self.__message.Wrap(self.GetSize().GetWidth())
self.SetSizer(self.__mainSizer) self.SetSizer(self.__mainSizer)
self.Layout() self.__mainSizer.Layout()
self.Fit() self.__mainSizer.Fit(self)
self.CentreOnParent() self.CentreOnParent()
......
...@@ -70,7 +70,7 @@ class Platform(notifier.Notifier): ...@@ -70,7 +70,7 @@ class Platform(notifier.Notifier):
fsldir fsldir
haveGui haveGui
wxBuild wxPlatform
wxFlavour wxFlavour
glVersion glVersion
glRenderer glRenderer
...@@ -79,7 +79,14 @@ class Platform(notifier.Notifier): ...@@ -79,7 +79,14 @@ class Platform(notifier.Notifier):
def __init__(self): def __init__(self):
"""Create a ``Platform`` instance. """ """Create a ``Platform`` instance. """
# For things which 'from fsl.utils.platform import platform',
# these identifiers are available on the platform instance
self.WX_PYTHON = WX_PYTHON
self.WX_PHOENIX = WX_PHOENIX
self.WX_MAC_COCOA = WX_MAC_COCOA
self.WX_MAC_CARBON = WX_MAC_CARBON
self.WX_GTK = WX_GTK
self.__fsldir = os.environ.get('FSLDIR', None) self.__fsldir = os.environ.get('FSLDIR', None)
self.__haveGui = False self.__haveGui = False
...@@ -108,16 +115,16 @@ class Platform(notifier.Notifier): ...@@ -108,16 +115,16 @@ class Platform(notifier.Notifier):
if isPhoenix: self.__wxFlavour = WX_PHOENIX if isPhoenix: self.__wxFlavour = WX_PHOENIX
else: self.__wxFlavour = WX_PYTHON else: self.__wxFlavour = WX_PYTHON
if any(['cocoa' in p for p in pi]): build = WX_MAC_COCOA if any(['cocoa' in p for p in pi]): platform = WX_MAC_COCOA
elif any(['carbon' in p for p in pi]): build = WX_MAC_CARBON elif any(['carbon' in p for p in pi]): platform = WX_MAC_CARBON
elif any(['gtk' in p for p in pi]): build = WX_GTK elif any(['gtk' in p for p in pi]): platform = WX_GTK
else: build = None else: platform = None
self.__build = build self.__wxPlatform = platform
if self.__build is None: if self.__wxPlatform is None:
log.warning('Could not determine wx build from ' log.warning('Could not determine wx platform from '
'platform information: {}'.format(pi)) 'information: {}'.format(pi))
@property @property
...@@ -127,11 +134,11 @@ class Platform(notifier.Notifier): ...@@ -127,11 +134,11 @@ class Platform(notifier.Notifier):
@property @property
def wxBuild(self): def wxPlatform(self):
"""One of :data:`WX_MAC_COCOA`, :data:`WX_MAC_CARBON`, or """One of :data:`WX_MAC_COCOA`, :data:`WX_MAC_CARBON`, or
:data:`WX_GTK`, indicating the wx build. :data:`WX_GTK`, indicating the wx platform.
""" """
return self.__wxBuild return self.__wxPlatform
@property @property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment