[hdf-compass] 63/295: Address a number of GUI issues on OS X
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun May 8 10:35:26 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository hdf-compass.
commit 6f548861d4c0277547f123720292eb15f394fa56
Author: Andrew Collette <andrew.collette at gmail.com>
Date: Sun Apr 26 11:09:59 2015 -0600
Address a number of GUI issues on OS X
---
compass_viewer/__init__.py | 4 ++--
compass_viewer/array/__init__.py | 4 ++--
compass_viewer/container/list.py | 9 ++++++---
compass_viewer/frame.py | 12 ++++++++++--
setup.py | 4 +++-
5 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/compass_viewer/__init__.py b/compass_viewer/__init__.py
index 6049e0f..6bb2e2b 100644
--- a/compass_viewer/__init__.py
+++ b/compass_viewer/__init__.py
@@ -110,7 +110,7 @@ def open_node(node, pos=None):
if pos is not None:
# The thing we get from GetPosition isn't really a tuple, so
# you have to manually cast entries to int or it silently fails.
- newpos =(int(pos[0])+80, int(pos[1])+80)
+ newpos =(int(pos[0])+40, int(pos[1])+40)
else:
newpos = None
@@ -166,7 +166,7 @@ def run():
app = CompassApp(False)
urls = sys.argv[1:]
-
+
for url in sys.argv[1:]:
if "://" not in url:
# assumed to be file path
diff --git a/compass_viewer/array/__init__.py b/compass_viewer/array/__init__.py
index 3827bae..f37af2c 100644
--- a/compass_viewer/array/__init__.py
+++ b/compass_viewer/array/__init__.py
@@ -42,9 +42,9 @@ class ArrayFrame(NodeFrame):
3. An ArrayGrid, which displays the data in a spreadsheet-like view.
"""
- def __init__(self, node, **kwds):
+ def __init__(self, node, pos=None):
""" Create a new array viewer, to display *node*. """
- NodeFrame.__init__(self, node, title=node.displayname, **kwds)
+ NodeFrame.__init__(self, node, size=(800,400), title=node.displayname, pos=pos)
self.node = node
diff --git a/compass_viewer/container/list.py b/compass_viewer/container/list.py
index 3784f6a..414cbfb 100644
--- a/compass_viewer/container/list.py
+++ b/compass_viewer/container/list.py
@@ -70,7 +70,8 @@ class ContainerList(wx.ListCtrl):
idx = evt.GetIndex()
newnode = self.node[idx]
- evt = CompassOpenEvent(newnode)
+ pos = wx.GetTopLevelParent(self).GetPosition()
+ evt = CompassOpenEvent(newnode, pos=pos)
wx.PostEvent(self, evt)
# ---------------------------------------------------------
@@ -132,7 +133,8 @@ class ContainerList(wx.ListCtrl):
Posts an event requesting that the node be opened as-is.
"""
- wx.PostEvent(self, CompassOpenEvent(self._menu_node))
+ pos = wx.GetTopLevelParent(self).GetPosition()
+ wx.PostEvent(self, CompassOpenEvent(self._menu_node), pos=pos)
def on_context_openwindow(self, evt):
@@ -161,7 +163,8 @@ class ContainerList(wx.ListCtrl):
node_new = h(node_being_opened.store, node_being_opened.key)
# Send off a request for it to be opened in the appropriate viewer
- wx.PostEvent(self, CompassOpenEvent(node_new))
+ pos = wx.GetTopLevelParent(self).GetPosition()
+ wx.PostEvent(self, CompassOpenEvent(node_new, pos=pos))
# End context menu support
diff --git a/compass_viewer/frame.py b/compass_viewer/frame.py
index 0eea6cd..d444d1d 100644
--- a/compass_viewer/frame.py
+++ b/compass_viewer/frame.py
@@ -192,6 +192,12 @@ class InitFrame(BaseFrame):
data = imagesupport.getbitmap('logo')
bmp = wx.StaticBitmap(self, wx.ID_ANY, data)
+ # The init frame isn't visible on Mac, so there shouldn't be an
+ # option to close it. "Quit" does the same thing.
+ if platform.MAC:
+ mb = self.GetMenuBar()
+ mu = mb.GetMenu(0)
+ mu.Enable(wx.ID_CLOSE, False)
self.Center()
@@ -371,14 +377,16 @@ class NodeFrame(BaseFrame):
id_ = evt.GetId()
# Present node
- node_being_opened = self.__node
+ node_being_opened = self.node
# The requested Node subclass to instantiate.
h = self._menu_handlers[id_]
+ print 'opening', node_being_opened.store, node_being_opened.key
# Brand new Node instance of the requested type
node_new = h(node_being_opened.store, node_being_opened.key)
# Send off a request for it to be opened in the appropriate viewer
# Post it directly to the App, or Container will intercept it!
- wx.PostEvent(wx.GetApp(), CompassOpenEvent(node_new))
+ pos = wx.GetTopLevelParent(self).GetPosition()
+ wx.PostEvent(wx.GetApp(), CompassOpenEvent(node_new, pos=pos))
diff --git a/setup.py b/setup.py
index 003a866..968b27b 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,9 @@ PLIST = { "CFBundleDocumentTypes": [ { "CFBundleTypeExtensions": ["hdf5","h5"]
"CFBundleDisplayName": "HDFCompass",
"CFBundleVersion": "0.5.0" }
-OPTIONS = { 'argv_emulation': True,
+# ARGV emulation interacts badly with wxPython on Mac... it "eats" events
+# when the program starts up and causes windows not to be displayed.
+OPTIONS = { 'argv_emulation': False,
'excludes': ['scipy', 'PyQt4', 'mpi4py'],
'matplotlib_backends': ['wxagg'],
'iconfile': 'compass.icns',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-compass.git
More information about the debian-science-commits
mailing list