diff options
author | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
---|---|---|
committer | Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr> | 2019-05-28 08:16:16 +0200 |
commit | a763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (patch) | |
tree | 45d462ed36a5522e9f3b9fde6c4ec4918c2ae8e3 /silx/gui/utils | |
parent | cebdc9244c019224846cb8d2668080fe386a6adc (diff) |
New upstream version 0.10.1+dfsg
Diffstat (limited to 'silx/gui/utils')
-rw-r--r-- | silx/gui/utils/concurrent.py | 4 | ||||
-rw-r--r-- | silx/gui/utils/projecturl.py | 77 | ||||
-rw-r--r-- | silx/gui/utils/test/test_async.py | 4 | ||||
-rw-r--r-- | silx/gui/utils/testutils.py | 10 |
4 files changed, 87 insertions, 8 deletions
diff --git a/silx/gui/utils/concurrent.py b/silx/gui/utils/concurrent.py index 48fff91..c27374f 100644 --- a/silx/gui/utils/concurrent.py +++ b/silx/gui/utils/concurrent.py @@ -25,12 +25,14 @@ """This module allows to run a function in Qt main thread from another thread """ +from __future__ import absolute_import + __authors__ = ["T. Vincent"] __license__ = "MIT" __date__ = "09/03/2018" -from silx.third_party.concurrent_futures import Future +from concurrent.futures import Future from .. import qt diff --git a/silx/gui/utils/projecturl.py b/silx/gui/utils/projecturl.py new file mode 100644 index 0000000..0832c2e --- /dev/null +++ b/silx/gui/utils/projecturl.py @@ -0,0 +1,77 @@ +# coding: utf-8 +# +# Project: Azimuthal integration +# https://github.com/silx-kit/silx +# +# Copyright (C) 2015-2019 European Synchrotron Radiation Facility, Grenoble, France +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +from __future__ import absolute_import, print_function, division + +"""Provide convenient URL for silx-kit projects.""" + +__author__ = "Valentin Valls" +__contact__ = "valentin.valls@ESRF.eu" +__license__ = "MIT" +__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" +__date__ = "15/01/2019" + + +from ... import _version as version + +BASE_DOC_URL = None +"""This could be patched by project packagers.""" + +_DEFAULT_BASE_DOC_URL = "http://www.silx.org/pub/doc/silx/{silx_doc_version}/{subpath}" +"""Identify the base URL of the project documentation. + +It supportes string replacement: + +- `{major}` the major version +- `{minor}` the minor version +- `{micro}` the micro version +- `{relev}` the status of the version (dev, final, rc). +- `{silx_doc_version}` is used to map the documentation stored at www.silx.org +- `{subpath}` is the subpart of the URL pointing to a specific page of the + documentation. It is mandatory. +""" + + +def getDocumentationUrl(subpath): + """Returns the URL to the documentation""" + + if version.RELEV == "final": + # Released verison will point to a specific documentation + silx_doc_version = "%d.%d.%d" % (version.MAJOR, version.MINOR, version.MICRO) + else: + # Dev versions will point to a single 'dev' documentation + silx_doc_version = "dev" + + keyworks = { + "silx_doc_version": silx_doc_version, + "major": version.MAJOR, + "minor": version.MINOR, + "micro": version.MICRO, + "relev": version.RELEV, + "subpath": subpath} + template = BASE_DOC_URL + if template is None: + template = _DEFAULT_BASE_DOC_URL + return template.format(**keyworks) diff --git a/silx/gui/utils/test/test_async.py b/silx/gui/utils/test/test_async.py index dabfb3c..dcfde1d 100644 --- a/silx/gui/utils/test/test_async.py +++ b/silx/gui/utils/test/test_async.py @@ -24,6 +24,8 @@ # ###########################################################################*/ """Test of async module.""" +from __future__ import absolute_import + __authors__ = ["T. Vincent"] __license__ = "MIT" __date__ = "09/03/2018" @@ -33,7 +35,7 @@ import threading import unittest -from silx.third_party.concurrent_futures import wait +from concurrent.futures import wait from silx.gui import qt from silx.gui.utils.testutils import TestCaseQt diff --git a/silx/gui/utils/testutils.py b/silx/gui/utils/testutils.py index 35085fc..6c54357 100644 --- a/silx/gui/utils/testutils.py +++ b/silx/gui/utils/testutils.py @@ -40,6 +40,8 @@ import os _logger = logging.getLogger(__name__) from silx.gui import qt +from silx.gui.qt import inspect as _inspect + if qt.BINDING == 'PySide': from PySide.QtTest import QTest @@ -139,11 +141,6 @@ class TestCaseQt(unittest.TestCase): # Makes sure a QApplication exists and do it once for all _qapp = qt.QApplication.instance() or qt.QApplication([]) - # Makes sure QDesktopWidget is init - # Otherwise it happens randomly during the tests - cls._desktopWidget = _qapp.desktop() - _qapp.processEvents() - @classmethod def tearDownClass(cls): sys.excepthook = cls._oldExceptionHook @@ -173,7 +170,8 @@ class TestCaseQt(unittest.TestCase): gc.collect() widgets = [widget for widget in self.qapp.allWidgets() - if widget not in self.__previousWidgets] + if (widget not in self.__previousWidgets and + _inspect.createdByPython(widget))] del self.__previousWidgets if qt.BINDING in ('PySide', 'PySide2'): |