Skip to content

Commit

Permalink
Added get_versions function
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp committed Mar 3, 2017
1 parent b41588f commit 474f4d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
22 changes: 19 additions & 3 deletions psyplot_gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@
logger = logging.getLogger(__name__)


def get_versions(requirements=True):
ret = {'version': __version__}
if requirements:
try:
import qtconsole
except:
logger.error('Could not load qtconsole!', exc_info=True)
else:
ret['qtconsole'] = qtconsole.__version__
try:
from psyplot_gui.compat.qtcompat import PYQT_VERSION, QT_VERSION
except:
logger.error('Could not load qt and pyqt!', exc_info=True)
else:
ret['qt'] = QT_VERSION
ret['pyqt'] = PYQT_VERSION
return ret


@docstrings.dedent
def start_app(fnames=[], name=[], dims=None, plot_method=None, backend=False,
output=None, project=None, engine=None, formatoptions=None,
Expand Down Expand Up @@ -166,9 +185,6 @@ def get_parser(create=True):
'Gui options',
'Options specific to the graphical user interface')

parser.update_arg('version', version="psyplot: %s\npsyplot_gui: %s" % (
psyplot.__version__, __version__))

parser.update_arg(
'backend', short='b', const=None, nargs='?', metavar='backend',
help="""
Expand Down
4 changes: 4 additions & 0 deletions psyplot_gui/compat/qtcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from PyQt4.QtWebKit import QWebView as QWebEngineView
from PyQt4.QtTest import QTest
from PyQt4 import QtGui
from PyQt4.Qt import PYQT_VERSION_STR as PYQT_VERSION
from PyQt4.Qt import QT_VERSION_STR as QT_VERSION
with_qt5 = False
QSignalSpy = None
else:
Expand All @@ -52,4 +54,6 @@
from PyQt5.QtWebKitWidgets import QWebView as QWebEngineView
from PyQt5.QtTest import QTest, QSignalSpy
from PyQt5 import QtGui
from PyQt5.Qt import PYQT_VERSION_STR as PYQT_VERSION
from PyQt5.Qt import QT_VERSION_STR as QT_VERSION
with_qt5 = True

0 comments on commit 474f4d7

Please sign in to comment.