Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/293 show file links #294

Merged
merged 2 commits into from
May 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
This is an overview of major changes. Refer to the git repository for a full log change.

Version 0.1.29
-------------
- Fixed #293 - Link to files fails with ugly error message on Windows

Version 0.1.28
-------------
- Fixed #291 - Alter travis to use Anaconda / Miniconda
Expand Down
2 changes: 1 addition & 1 deletion inselect/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Segmentation, validation and annotation of images of museum specimens
"""
__version__ = '0.1.28'
__version__ = '0.1.29'
# distutils/version.py and win32/lib/win32verstamp.py have different
# restrictions on the format of version numbers - both must be met.
# Three numbers separated by dots is a safe format.
15 changes: 5 additions & 10 deletions inselect/gui/info_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import subprocess
import sys

from PySide.QtCore import Qt, QProcessEnvironment
from PySide.QtCore import Qt
from PySide.QtGui import QWidget, QFormLayout, QLabel, QGroupBox, QVBoxLayout

from inselect.lib.utils import format_dt_display
Expand All @@ -17,16 +17,11 @@ def reveal_path(path):
"""Shows path in Finder (on Mac) or in Explorer (on Windows)
"""
# http://stackoverflow.com/a/3546503
path = path.resolve()
if sys.platform.startswith("win"):
explorer = QProcessEnvironment.systemEnvironment().searchInPath("explorer.exe")
if not explorer:
raise ValueError('Explorer could not be located')
else:
if not path.is_dir():
arg = u"/select,{0}".format(path)
else:
arg = unicode(path)
subprocess.check_call([explorer, arg])
res = subprocess.call(["explorer.exe", u"/select,{0}".format(path)])
if 1 != res:
raise ValueError('Unexpected exit code [{0}]'.format(res))
elif 'Darwin' == platform.system():
reveal = u'tell application "Finder" to reveal POSIX file "{0}"'
activate = u'tell application "Finder" to activate "{0}"'
Expand Down