From 7c48f318d8aa032b0cf102c11cf3328e82dc3d20 Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Mon, 31 Dec 2018 14:59:37 -0500 Subject: [PATCH 01/15] Upgraded to work with QtPy and PySide2 --- CHANGELOG.rst | 2 +- README.md | 4 ++-- ci/install.sh | 4 +++- docs/source/conf.py | 2 +- docs/source/install.rst | 6 +++--- environment.yml | 3 ++- runsharp/full_gui.py | 21 +++++++++++++++++---- sharppy/gui.py | 14 +++++++------- sharppy/tests/test_gui.py | 2 +- sharppy/viz/SPCWindow.py | 5 +++-- sharppy/viz/advection.py | 4 ++-- sharppy/viz/analogues.py | 6 +++--- sharppy/viz/barbs.py | 2 +- sharppy/viz/draggable.py | 4 ++-- sharppy/viz/ensemble.py | 6 +++--- sharppy/viz/fire.py | 4 ++-- sharppy/viz/generic.py | 10 +++++----- sharppy/viz/hodo.py | 15 ++++++++------- sharppy/viz/kinematics.py | 4 ++-- sharppy/viz/map.py | 13 +++++++------ sharppy/viz/preferences.py | 5 +++-- sharppy/viz/ship.py | 4 ++-- sharppy/viz/skew.py | 13 +++++++------ sharppy/viz/slinky.py | 4 ++-- sharppy/viz/speed.py | 4 ++-- sharppy/viz/srwinds.py | 4 ++-- sharppy/viz/stp.py | 4 ++-- sharppy/viz/stpef.py | 4 ++-- sharppy/viz/thermo.py | 28 ++++++++++++++-------------- sharppy/viz/thetae.py | 8 ++++---- sharppy/viz/vrot.py | 4 ++-- sharppy/viz/watch.py | 4 ++-- sharppy/viz/winter.py | 4 ++-- utils/async.py | 4 ++-- utils/async_threads.py | 4 ++-- utils/config.py | 4 ++-- utils/progress.py | 5 +++-- 37 files changed, 130 insertions(+), 108 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b41ad73b..cc79eead 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -88,7 +88,7 @@ BUG FIXES * Additional error handling for partial profiles. * Various model forecast points relocated to their proper places. * Error handling for opening the program without an Internet connection. -* Removed PySide dependency and unused imports for those using SHARPpy routines in scripts. +* Removed qtpy dependency and unused imports for those using SHARPpy routines in scripts. SHARPpy v1.2.0 "El Reno" Release -------------------------------- diff --git a/README.md b/README.md index 0085ad3b..0804420d 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ The Anaconda Python Distribution can be downloaded here: https://www.anaconda.co __Required Python Packages/Libraries:__ * NumPy -* PySide +* qtpy -Since SHARPpy requires the PySide and Numpy packages, you will need to install them. If you choose to use the Anaconda distribution, Numpy comes installed by default. PySide can be installed through the Anaconda package manager that comes with the Anaconda distribution by opening up your command line program (Terminal in Mac OS X/Linux and Command Prompt in Windows) and typing: +Since SHARPpy requires the qtpy and Numpy packages, you will need to install them. If you choose to use the Anaconda distribution, Numpy comes installed by default. qtpy can be installed through the Anaconda package manager that comes with the Anaconda distribution by opening up your command line program (Terminal in Mac OS X/Linux and Command Prompt in Windows) and typing: conda install -c conda-forge pyside=1.2.4 diff --git a/ci/install.sh b/ci/install.sh index 44f14446..8ab12e07 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -23,10 +23,12 @@ conda update -q conda conda install -n -q root _license conda info -a conda config --add channels conda-forge -conda create -q -n test-environment python=$PYTHON_VERSION nose pyside pyinstaller conda-build anaconda-client numpy=$NUMPY_VERSION +conda create -q -n test-environment python=$PYTHON_VERSION nose pyinstaller conda-build anaconda-client numpy=$NUMPY_VERSION source activate test-environment pip install --upgrade pip +pip install PySide2 +conda install -q qtpy conda install -c conda-forge -q pytest-cov if [[ "$COVERALLS" == "YES" ]]; then conda install -c conda-forge -q coveralls diff --git a/docs/source/conf.py b/docs/source/conf.py index 2d118131..d2331f68 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -52,7 +52,7 @@ 'gallery_dirs': 'auto_examples', } -#autodoc_mock_imports = ["numpy", "PySide"] +#autodoc_mock_imports = ["numpy", "qtpy"] napoleon_google_docstring = False napolean_numpy_docstring = True diff --git a/docs/source/install.rst b/docs/source/install.rst index 5dc4e87a..ca842606 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -84,13 +84,13 @@ install the required packages manually. These instructions assume that you have *Required Python Packages/Libraries:* * NumPy -* PySide +* qtpy -Since SHARPpy requires the PySide and Numpy packages, you will need to install them. If you choose to use the Anaconda distribution, Numpy comes installed by default. PySide can be installed through the Anaconda package manager that comes with the Anaconda distribution by opening up your command line program (Terminal in macOS/Linux and Command Prompt in Windows) and typing: +Since SHARPpy requires the qtpy and Numpy packages, you will need to install them. If you choose to use the Anaconda distribution, Numpy comes installed by default. qtpy can be installed through the Anaconda package manager that comes with the Anaconda distribution by opening up your command line program (Terminal in macOS/Linux and Command Prompt in Windows) and typing: .. prompt:: bash - conda install -c conda-forge pyside=1.2.4 + pip install PySide2 After installing all the required Python packages for SHARPpy, you now can install the SHARPpy package to your computer. You'll need to download it to your computer first and open up a command line prompt. You can download it as a ZIP file (link on the right) or clone the Git respository (you will need the git program) into a directory on your computer by typing this into your command line: diff --git a/environment.yml b/environment.yml index ba51b0c5..45f7df7e 100644 --- a/environment.yml +++ b/environment.yml @@ -10,7 +10,8 @@ dependencies: - sphinx-gallery - sphinx-rtd-theme - pytest + - qtpy - pip: - sphinx-prompt - pydocstyle - + - PySide2 diff --git a/runsharp/full_gui.py b/runsharp/full_gui.py index 881744e2..89bd56c8 100644 --- a/runsharp/full_gui.py +++ b/runsharp/full_gui.py @@ -1,3 +1,10 @@ +from qtpy.QtGui import * +from qtpy.QtCore import * +from qtpy.QtWidgets import * +QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) +QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) +#QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) +#QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) from sharppy.viz.map import MapWidget import argparse import traceback @@ -6,8 +13,7 @@ import cProfile from functools import wraps, partial import datetime as date -from PySide.QtGui import * -from PySide.QtCore import * + from utils.progress import progress from utils.async_threads import AsyncThreads from datasources import data_source @@ -23,7 +29,7 @@ import warnings import utils.frozenutils as frozenutils import logging -import PySide +import qtpy import platform HOME_DIR = os.path.join(os.path.expanduser("~"), ".sharppy") @@ -67,7 +73,7 @@ logging.info('Started logging output for SHARPpy') logging.info('SHARPpy version: ' + str(__version__)) logging.info('numpy version: ' + str(np.__version__)) -logging.info('PySide version: ' + str(PySide.__version__)) +logging.info('qtpy version: ' + str(qtpy.__version__)) logging.info("Python version: " + str(platform.python_version())) # from sharppy._version import __version__#, __version_name__ @@ -1013,6 +1019,10 @@ def createWindow(file_names, collect=False, close=True): # Create an application app = QApplication([]) + app.setAttribute(Qt.AA_EnableHighDpiScaling) + app.setAttribute(Qt.AA_UseHighDpiPixmaps) +# + #app.setStyle("fusion") win = createWindow(args.file_names, collect=args.collect, close=args.close) if args.file_names != [] and args.close: @@ -1022,4 +1032,7 @@ def createWindow(file_names, collect=False, close=True): if __name__ == '__main__': + QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) +# main() diff --git a/sharppy/gui.py b/sharppy/gui.py index 59782bde..51fe9257 100644 --- a/sharppy/gui.py +++ b/sharppy/gui.py @@ -1,6 +1,6 @@ import sys import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets from sharppy.viz import plotSkewT, plotHodo, plotText, plotAnalogues from sharppy.viz import plotThetae, plotWinds, plotSpeed, plotKinematics from sharppy.viz import plotSlinky, plotWatch, plotAdvection, plotSTP @@ -18,7 +18,7 @@ title += 'in Python' mainWindow.setWindowTitle(title) mainWindow.setStyleSheet("QMainWindow {background-color: rgb(0, 0, 0);}") -centralWidget = QtGui.QFrame() +centralWidget = QtWidgets.QFrame() mainWindow.setCentralWidget(centralWidget) grid = QtGui.QGridLayout() grid.setHorizontalSpacing(0) @@ -35,11 +35,11 @@ grid.addWidget(sound, 0, 0, 3, 1) # Handle the Upper Right -urparent = QtGui.QFrame() +urparent = QtWidgets.QFrame() urparent_grid = QtGui.QGridLayout() urparent_grid.setContentsMargins(0, 0, 0, 0) urparent.setLayout(urparent_grid) -ur = QtGui.QFrame() +ur = QtWidgets.QFrame() ur.setStyleSheet("QFrame {" " background-color: rgb(0, 0, 0);" " border-width: 0px;" @@ -83,7 +83,7 @@ grid.addWidget(urparent, 0, 1, 3, 1) # Handle the Text Areas -text = QtGui.QFrame() +text = QtWidgets.QFrame() text.setStyleSheet("QWidget {" " background-color: rgb(0, 0, 0);" " border-width: 2px;" @@ -94,8 +94,8 @@ grid3.setContentsMargins(0, 0, 0, 0) text.setLayout(grid3) convective = plotText(prof) -#convective = QtGui.QFrame() -#kinematic = QtGui.QFrame() +#convective = QtWidgets.QFrame() +#kinematic = QtWidgets.QFrame() kinematic = plotKinematics(prof) SARS = plotAnalogues(prof) stp = plotSTP(prof) diff --git a/sharppy/tests/test_gui.py b/sharppy/tests/test_gui.py index 0113daa6..6b94a17d 100644 --- a/sharppy/tests/test_gui.py +++ b/sharppy/tests/test_gui.py @@ -1,4 +1,4 @@ -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.viz as viz import sharppy.viz.preferences as preferences from sharppy.io.spc_decoder import SPCDecoder diff --git a/sharppy/viz/SPCWindow.py b/sharppy/viz/SPCWindow.py index a7435e5d..c4bdf910 100644 --- a/sharppy/viz/SPCWindow.py +++ b/sharppy/viz/SPCWindow.py @@ -5,8 +5,9 @@ from sharppy.viz import plotThetae, plotWinds, plotSpeed, plotKinematics #, plotGeneric from sharppy.viz import plotSlinky, plotWatch, plotAdvection, plotSTP, plotWinter from sharppy.viz import plotSHIP, plotSTPEF, plotFire, plotVROT -from PySide.QtCore import * -from PySide.QtGui import * +from qtpy.QtCore import * +from qtpy.QtGui import * +from qtpy.QtWidgets import * import sharppy.sharptab.profile as profile import sharppy.sharptab as tab import sharppy.io as io diff --git a/sharppy/viz/advection.py b/sharppy/viz/advection.py index df5d8787..8dfc3d9d 100644 --- a/sharppy/viz/advection.py +++ b/sharppy/viz/advection.py @@ -1,11 +1,11 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * import platform __all__ = ['backgroundAdvection', 'plotAdvection'] -class backgroundAdvection(QtGui.QFrame): +class backgroundAdvection(QtWidgets.QFrame): ''' Draw the background frame and lines for the Theta-E plot frame ''' diff --git a/sharppy/viz/analogues.py b/sharppy/viz/analogues.py index 0c759c79..d37e26fa 100644 --- a/sharppy/viz/analogues.py +++ b/sharppy/viz/analogues.py @@ -1,6 +1,6 @@ import numpy as np import os -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * import sharppy.databases.sars as sars @@ -13,7 +13,7 @@ __all__ = ['backgroundAnalogues', 'plotAnalogues'] -class backgroundAnalogues(QtGui.QFrame): +class backgroundAnalogues(QtWidgets.QFrame): ''' Handles drawing the background frame for the SARS window. @@ -21,7 +21,7 @@ class backgroundAnalogues(QtGui.QFrame): def __init__(self): ''' Calls the initUI function to initialize the background frame. Inherits from the - QtGui.QFrame Object. + QtWidgets.QFrame Object. ''' super(backgroundAnalogues, self).__init__() self.initUI() diff --git a/sharppy/viz/barbs.py b/sharppy/viz/barbs.py index 99a754a3..5d7ff83c 100644 --- a/sharppy/viz/barbs.py +++ b/sharppy/viz/barbs.py @@ -1,5 +1,5 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * diff --git a/sharppy/viz/draggable.py b/sharppy/viz/draggable.py index 41fabd68..01a05aea 100644 --- a/sharppy/viz/draggable.py +++ b/sharppy/viz/draggable.py @@ -1,8 +1,8 @@ import numpy as np -from PySide.QtGui import * -from PySide.QtCore import * +from qtpy.QtGui import * +from qtpy.QtCore import * class Draggable(object): """ diff --git a/sharppy/viz/ensemble.py b/sharppy/viz/ensemble.py index a3eb1c07..d6b146aa 100644 --- a/sharppy/viz/ensemble.py +++ b/sharppy/viz/ensemble.py @@ -1,6 +1,6 @@ import numpy as np import os -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab.params as params import sharppy.sharptab.winds as winds import sharppy.sharptab.interp as interp @@ -12,7 +12,7 @@ __all__ = ['backgroundENS', 'plotENS'] -class backgroundENS(QtGui.QFrame): +class backgroundENS(QtWidgets.QFrame): ''' Draw the background frame and lines for the Theta-E plot frame ''' @@ -323,7 +323,7 @@ def draw_ensemble_point(self, qp, prof): return -class DrawTest(QtGui.QMainWindow): +class DrawTest(QtWidgets.QMainWindow): def __init__(self, parent=None): super(DrawTest, self).__init__(parent) # x = np.asarray([1,2,3,4]) diff --git a/sharppy/viz/fire.py b/sharppy/viz/fire.py index a4e27dd5..9db598e4 100644 --- a/sharppy/viz/fire.py +++ b/sharppy/viz/fire.py @@ -1,5 +1,5 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * import platform @@ -9,7 +9,7 @@ __all__ = ['backgroundFire', 'plotFire'] -class backgroundFire(QtGui.QFrame): +class backgroundFire(QtWidgets.QFrame): ''' Handles drawing the background frame. ''' diff --git a/sharppy/viz/generic.py b/sharppy/viz/generic.py index 4601525e..9c0e95c8 100644 --- a/sharppy/viz/generic.py +++ b/sharppy/viz/generic.py @@ -5,12 +5,12 @@ import numpy as np from sharppy.sharptab.constants import * import sharppy.sharptab as tab -from PySide import QtGui, QtCore -from PySide.QtGui import * -from PySide.QtCore import * -from PySide.QtOpenGL import * +from qtpy import QtGui, QtCore, QtWidgets +from qtpy.QtGui import * +from qtpy.QtCore import * +from qtpy.QtOpenGL import * -class backgroundGeneric(QtGui.QFrame): +class backgroundGeneric(QtWidgets.QFrame): """ A generic class for drawing the background of a widget. """ diff --git a/sharppy/viz/hodo.py b/sharppy/viz/hodo.py index 6040b692..32ba079e 100644 --- a/sharppy/viz/hodo.py +++ b/sharppy/viz/hodo.py @@ -1,19 +1,20 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.viz.draggable import Draggable from sharppy.sharptab.profile import Profile, create_profile from sharppy.sharptab.constants import * -from PySide.QtGui import * -from PySide.QtCore import * +from qtpy.QtGui import * +from qtpy.QtCore import * +from qtpy.QtWidgets import * __all__ = ['backgroundHodo', 'plotHodo'] -class backgroundHodo(QtGui.QFrame): +class backgroundHodo(QFrame): ''' Handles the plotting of the backgroun frame onto - a QPixmap. Inherits from the QtGui.QFrame object. + a QPixmap. Inherits from the QtWidgets.QFrame object. Unlike most plotting classes in SHARPPy, this class will not call the function to draw the background. This is so that the background can be redrawn when @@ -387,7 +388,7 @@ def __init__(self, **kwargs): self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.showCursorMenu) self.popupmenu=QMenu("Cursor Type:") - ag = QtGui.QActionGroup(self, exclusive=True) + ag = QtWidgets.QActionGroup(self, exclusive=True) self.readout_hght = -999. self.readout_visible = False @@ -408,7 +409,7 @@ def __init__(self, **kwargs): self.popupmenu.addAction(a) self.popupmenu.addSeparator() - ag2 = QtGui.QActionGroup(self, exclusive=True) + ag2 = QtWidgets.QActionGroup(self, exclusive=True) norm = QAction(self) norm.setText("Normal") diff --git a/sharppy/viz/kinematics.py b/sharppy/viz/kinematics.py index 75034e94..ce515e82 100644 --- a/sharppy/viz/kinematics.py +++ b/sharppy/viz/kinematics.py @@ -1,6 +1,6 @@ import logging import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.viz.barbs import drawBarb from sharppy.sharptab.constants import * @@ -11,7 +11,7 @@ __all__ = ['backgroundKinematics', 'plotKinematics'] -class backgroundKinematics(QtGui.QFrame): +class backgroundKinematics(QtWidgets.QFrame): ''' Handles drawing the background frame. ''' diff --git a/sharppy/viz/map.py b/sharppy/viz/map.py index 5686c795..0f6d786f 100644 --- a/sharppy/viz/map.py +++ b/sharppy/viz/map.py @@ -1,7 +1,8 @@ import numpy as np import sharppy -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets +from qtpy.QtWidgets import * from datetime import datetime import sys, os import re @@ -269,7 +270,7 @@ def getBoundary(self, name): paths.append(path) return paths -class MapWidget(QtGui.QWidget): +class MapWidget(QWidget): clicked = QtCore.Signal(dict) def __init__(self, data_source, init_time, async_object, **kwargs): @@ -313,27 +314,27 @@ def __init__(self, data_source, init_time, async_object, **kwargs): self.setMinimumSize(self.width(), self.height()) self.clicked_stn = None - self.stn_readout = QtGui.QLabel(parent=self) + self.stn_readout = QtWidgets.QLabel(parent=self) self.stn_readout.setStyleSheet("QLabel { background-color:#000000; border-width: 0px; font-size: 16px; color: #FFFFFF; }") self.stn_readout.setText("") self.stn_readout.show() self.stn_readout.move(self.width(), self.height()) - self.load_readout = QtGui.QLabel(parent=self) + self.load_readout = QtWidgets.QLabel(parent=self) self.load_readout.setStyleSheet("QLabel { background-color:#000000; border-width: 0px; font-size: 18px; color: #FFFFFF; }") self.load_readout.setText("Loading ...") self.load_readout.setFixedWidth(100) self.load_readout.show() self.load_readout.move(self.width(), self.height()) - self.latlon_readout = QtGui.QLabel(parent=self) + self.latlon_readout = QtWidgets.QLabel(parent=self) self.latlon_readout.setStyleSheet("QLabel { background-color:#000000; border-width: 0px; font-size: 18px; color: #FFFFFF; }") self.latlon_readout.setText("") self.latlon_readout.setFixedWidth(150) self.latlon_readout.show() self.latlon_readout.move(10, 10) - self.no_internet = QtGui.QLabel(parent=self) + self.no_internet = QtWidgets.QLabel(parent=self) self.no_internet.setStyleSheet("QLabel { background-color:#000000; border-width: 0px; font-size: 32px; color: #FFFFFF; }") self.no_internet.setText("No Internet Connection") self.no_internet.show() diff --git a/sharppy/viz/preferences.py b/sharppy/viz/preferences.py index 1cbf40d1..f6680647 100644 --- a/sharppy/viz/preferences.py +++ b/sharppy/viz/preferences.py @@ -1,6 +1,7 @@ -from PySide.QtCore import * -from PySide.QtGui import * +from qtpy.QtCore import * +from qtpy.QtGui import * +from qtpy.QtWidgets import * from collections import OrderedDict import numpy as np diff --git a/sharppy/viz/ship.py b/sharppy/viz/ship.py index f58795d5..de194619 100644 --- a/sharppy/viz/ship.py +++ b/sharppy/viz/ship.py @@ -1,6 +1,6 @@ import numpy as np import os -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab import sharppy.databases.inset_data as inset_data from sharppy.sharptab.constants import * @@ -11,7 +11,7 @@ __all__ = ['backgroundSHIP', 'plotSHIP'] -class backgroundSHIP(QtGui.QFrame): +class backgroundSHIP(QtWidgets.QFrame): ''' Draw the background frame and lines for the Theta-E plot frame ''' diff --git a/sharppy/viz/skew.py b/sharppy/viz/skew.py index af79876a..e7fcb98b 100644 --- a/sharppy/viz/skew.py +++ b/sharppy/viz/skew.py @@ -4,10 +4,11 @@ from sharppy.sharptab.profile import Profile, create_profile from sharppy.viz.draggable import Draggable from sharppy.viz.barbs import drawBarb -from PySide import QtGui, QtCore -from PySide.QtGui import * -from PySide.QtCore import * -from PySide.QtOpenGL import * +from qtpy import QtGui, QtCore, QtWidgets +from qtpy.QtGui import * +from qtpy.QtCore import * +from qtpy.QtWidgets import * +from qtpy.QtOpenGL import * from utils.utils import total_seconds import logging @@ -15,7 +16,7 @@ __all__ = ['backgroundSkewT', 'plotSkewT'] -class backgroundSkewT(QtGui.QWidget): +class backgroundSkewT(QWidget): def __init__(self, plot_omega=False): super(backgroundSkewT, self).__init__() self.plot_omega = plot_omega @@ -466,7 +467,7 @@ def __init__(self, **kwargs): self.parcelmenu.addAction(pcl4) self.parcelmenu.setEnabled(False) self.popupmenu=QMenu("Cursor Type:") - ag = QtGui.QActionGroup(self, exclusive=True) + ag = QtWidgets.QActionGroup(self, exclusive=True) nocurs = QAction(self) nocurs.setText("No Cursor") diff --git a/sharppy/viz/slinky.py b/sharppy/viz/slinky.py index a5778ce8..f2a712cb 100644 --- a/sharppy/viz/slinky.py +++ b/sharppy/viz/slinky.py @@ -1,5 +1,5 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * import platform @@ -9,7 +9,7 @@ ## Written by Greg Blumberg - CIMMS ## wblumberg@ou.edu -class backgroundSlinky(QtGui.QFrame): +class backgroundSlinky(QtWidgets.QFrame): ''' Draw the background frame and lines for the Storm Slinky. Draws onto a QPixmap. diff --git a/sharppy/viz/speed.py b/sharppy/viz/speed.py index 19147507..d90e5aa5 100644 --- a/sharppy/viz/speed.py +++ b/sharppy/viz/speed.py @@ -1,5 +1,5 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * @@ -8,7 +8,7 @@ __all__ = ['backgroundSpeed', 'plotSpeed'] -class backgroundSpeed(QtGui.QFrame): +class backgroundSpeed(QtWidgets.QFrame): ''' Handles drawing the plot background. ''' diff --git a/sharppy/viz/srwinds.py b/sharppy/viz/srwinds.py index 41c4d298..6c7fe014 100644 --- a/sharppy/viz/srwinds.py +++ b/sharppy/viz/srwinds.py @@ -1,5 +1,5 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab import sharppy.sharptab.utils as utils from sharppy.sharptab.constants import * @@ -9,7 +9,7 @@ __all__ = ['backgroundWinds', 'plotWinds'] -class backgroundWinds(QtGui.QFrame): +class backgroundWinds(QtWidgets.QFrame): ''' Handles the plotting of the frame boarders and ticks. Draws the frame onto a QPixmap. diff --git a/sharppy/viz/stp.py b/sharppy/viz/stp.py index 254e30a4..477adcdd 100644 --- a/sharppy/viz/stp.py +++ b/sharppy/viz/stp.py @@ -1,6 +1,6 @@ import numpy as np import os -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab import sharppy.databases.inset_data as inset_data from sharppy.sharptab.constants import * @@ -11,7 +11,7 @@ __all__ = ['backgroundSTP', 'plotSTP'] -class backgroundSTP(QtGui.QFrame): +class backgroundSTP(QtWidgets.QFrame): ''' Draw the background frame and lines for the STP plot frame ''' diff --git a/sharppy/viz/stpef.py b/sharppy/viz/stpef.py index fbf3ce59..121df565 100644 --- a/sharppy/viz/stpef.py +++ b/sharppy/viz/stpef.py @@ -1,6 +1,6 @@ import numpy as np import os -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab import sharppy.databases.inset_data as inset_data from sharppy.sharptab.constants import * @@ -10,7 +10,7 @@ __all__ = ['backgroundSTPEF', 'plotSTPEF'] -class backgroundSTPEF(QtGui.QFrame): +class backgroundSTPEF(QtWidgets.QFrame): ''' Draw the background frame and lines for the Theta-E plot frame ''' diff --git a/sharppy/viz/thermo.py b/sharppy/viz/thermo.py index a8192b7b..dcbe656a 100644 --- a/sharppy/viz/thermo.py +++ b/sharppy/viz/thermo.py @@ -1,7 +1,7 @@ import numpy as np -from PySide import QtGui, QtCore -from PySide.QtCore import * -from PySide.QtGui import * +from qtpy import QtGui, QtCore, QtWidgets +from qtpy.QtCore import * +from qtpy.QtGui import * import sharppy.sharptab as tab from sharppy.sharptab.constants import * import datetime @@ -12,10 +12,10 @@ __all__ = ['backgroundText', 'plotText'] -class backgroundText(QtGui.QFrame): +class backgroundText(QtWidgets.QFrame): ''' Handles drawing the background frame onto a QPixmap. - Inherits a QtGui.QFrame Object. + Inherits a QtWidgets.QFrame Object. ''' def __init__(self, **kwargs): super(backgroundText, self).__init__() @@ -701,9 +701,9 @@ def mousePressEvent(self, e): self.parentWidget().setFocus() break -class SelectParcels(QWidget): +class SelectParcels(QtWidgets.QWidget): def __init__(self, parcel_types, parent): - QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) self.thermo = parent self.parcel_types = parcel_types self.max_pcls = 4 @@ -712,42 +712,42 @@ def __init__(self, parcel_types, parent): def initUI(self): - self.sb = QtGui.QCheckBox('Surface-Based Parcel', self) + self.sb = QtWidgets.QCheckBox('Surface-Based Parcel', self) self.sb.move(20, 20) if "SFC" in self.parcel_types: self.sb.toggle() self.pcl_count += 1 self.sb.stateChanged.connect(self.changeParcel) - self.ml = QtGui.QCheckBox('100 mb Mixed Layer Parcel', self) + self.ml = QtWidgets.QCheckBox('100 mb Mixed Layer Parcel', self) self.ml.move(20, 40) if "ML" in self.parcel_types: self.ml.toggle() self.pcl_count += 1 self.ml.stateChanged.connect(self.changeParcel) - self.fcst = QtGui.QCheckBox('Forecast Surface Parcel', self) + self.fcst = QtWidgets.QCheckBox('Forecast Surface Parcel', self) self.fcst.move(20, 60) if "FCST" in self.parcel_types: self.fcst.toggle() self.pcl_count += 1 self.fcst.stateChanged.connect(self.changeParcel) - self.mu = QtGui.QCheckBox('Most Unstable Parcel', self) + self.mu = QtWidgets.QCheckBox('Most Unstable Parcel', self) self.mu.move(20, 80) if "MU" in self.parcel_types: self.mu.toggle() self.pcl_count += 1 self.mu.stateChanged.connect(self.changeParcel) - self.eff = QtGui.QCheckBox('Effective Inflow Layer Parcel', self) + self.eff = QtWidgets.QCheckBox('Effective Inflow Layer Parcel', self) self.eff.move(20, 100) if "EFF" in self.parcel_types: self.eff.toggle() self.pcl_count += 1 self.eff.stateChanged.connect(self.changeParcel) - self.usr = QtGui.QCheckBox('User Defined Parcel', self) + self.usr = QtWidgets.QCheckBox('User Defined Parcel', self) self.usr.move(20, 120) if "USER" in self.parcel_types: self.usr.toggle() @@ -757,7 +757,7 @@ def initUI(self): self.setGeometry(300, 300, 250, 180) self.setWindowTitle('Show Parcels') - self.ok = QtGui.QPushButton('Ok', self) + self.ok = QtWidgets.QPushButton('Ok', self) self.ok.move(20,150) self.ok.clicked.connect(self.okPushed) diff --git a/sharppy/viz/thetae.py b/sharppy/viz/thetae.py index af7d9d1c..b7fc7e60 100644 --- a/sharppy/viz/thetae.py +++ b/sharppy/viz/thetae.py @@ -1,6 +1,6 @@ import numpy as np -from PySide import QtGui, QtCore -from PySide.QtOpenGL import * +from qtpy import QtGui, QtCore, QtWidgets +from qtpy.QtOpenGL import * import sharppy.sharptab as tab import sharppy.sharptab.utils as utils from sharppy.sharptab.constants import * @@ -11,12 +11,12 @@ __all__ = ['backgroundThetae', 'plotThetae'] -class backgroundThetae(QtGui.QFrame): +class backgroundThetae(QtWidgets.QFrame): ''' Draw the background frame and lines for the Theta-E plot. Draws the background on a QPixmap. - Inherits a QtGui.QFrame Object + Inherits a QtWidgets.QFrame Object ''' def __init__(self): super(backgroundThetae, self).__init__() diff --git a/sharppy/viz/vrot.py b/sharppy/viz/vrot.py index 4cf67693..93b3ae60 100644 --- a/sharppy/viz/vrot.py +++ b/sharppy/viz/vrot.py @@ -1,6 +1,6 @@ import numpy as np import os -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab import sharppy.sharptab.utils as utils import sharppy.databases.inset_data as inset_data @@ -11,7 +11,7 @@ __all__ = ['backgroundVROT', 'plotVROT'] -class backgroundVROT(QtGui.QFrame): +class backgroundVROT(QtWidgets.QFrame): ''' Draw the background frame and lines for the Theta-E plot frame ''' diff --git a/sharppy/viz/watch.py b/sharppy/viz/watch.py index caf88e1a..75431210 100644 --- a/sharppy/viz/watch.py +++ b/sharppy/viz/watch.py @@ -1,5 +1,5 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * @@ -9,7 +9,7 @@ __all__ = ['backgroundWatch', 'plotWatch'] -class backgroundWatch(QtGui.QFrame): +class backgroundWatch(QtWidgets.QFrame): ''' Draw the background frame and lines for the watch plot frame ''' diff --git a/sharppy/viz/winter.py b/sharppy/viz/winter.py index bb56b34c..7504da86 100644 --- a/sharppy/viz/winter.py +++ b/sharppy/viz/winter.py @@ -1,5 +1,5 @@ import numpy as np -from PySide import QtGui, QtCore +from qtpy import QtGui, QtCore, QtWidgets import sharppy.sharptab as tab from sharppy.sharptab.constants import * import platform @@ -9,7 +9,7 @@ __all__ = ['backgroundWinter', 'plotWinter'] -class backgroundWinter(QtGui.QFrame): +class backgroundWinter(QtWidgets.QFrame): ''' Handles drawing the background frame. ''' diff --git a/utils/async.py b/utils/async.py index cd57dc53..1f5a297b 100644 --- a/utils/async.py +++ b/utils/async.py @@ -1,5 +1,5 @@ -from PySide.QtCore import * -from PySide.QtGui import * +from qtpy.QtCore import * +from qtpy.QtGui import * try: import Queue diff --git a/utils/async_threads.py b/utils/async_threads.py index fed8eb1f..9cd2900e 100644 --- a/utils/async_threads.py +++ b/utils/async_threads.py @@ -1,5 +1,5 @@ -from PySide.QtCore import * -from PySide.QtGui import * +from qtpy.QtCore import * +from qtpy.QtGui import * try: import Queue diff --git a/utils/config.py b/utils/config.py index a32a9fee..838d7500 100644 --- a/utils/config.py +++ b/utils/config.py @@ -1,6 +1,6 @@ -from PySide.QtGui import * -from PySide.QtCore import * +from qtpy.QtGui import * +from qtpy.QtCore import * try: import ConfigParser diff --git a/utils/progress.py b/utils/progress.py index c4d41eb8..b949e795 100644 --- a/utils/progress.py +++ b/utils/progress.py @@ -1,6 +1,7 @@ -from PySide.QtCore import * -from PySide.QtGui import * +from qtpy.QtCore import * +from qtpy.QtGui import * +from qtpy.QtWidgets import * class progress(QObject): _progress = Signal(int, int) From 1c9b5d112bc712e9ebf9de4e506a6e1bfbb43e89 Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Mon, 31 Dec 2018 15:08:23 -0500 Subject: [PATCH 02/15] Updated test_gui to work with PySide2 --- sharppy/tests/test_gui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sharppy/tests/test_gui.py b/sharppy/tests/test_gui.py index 6b94a17d..33b11fd0 100644 --- a/sharppy/tests/test_gui.py +++ b/sharppy/tests/test_gui.py @@ -16,8 +16,9 @@ dec = SPCDecoder('examples/data/14061619.OAX') prof_coll = dec.getProfiles() prof = prof_coll.getCurrentProfs()[''] -app = QtGui.QApplication([]) +app = QtWidgets.QApplication([]) + #@pytest.mark.skipif(True, reason="DISPLAY not set") @pytest.mark.skipif("DISPLAY_AVAIL" in os.environ and os.environ["DISPLAY_AVAIL"] == 'NO', reason="DISPLAY not set") def test_insets(): From b84c6e08a7881f044e0249d8f9a7052422e91944 Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Wed, 11 Sep 2019 22:30:52 -0400 Subject: [PATCH 03/15] Changed install to include a note about binaries --- .appveyor.yml | 4 ++-- docs/source/install.rst | 2 ++ runsharp/full_gui.py | 5 ++++- sharppy/io/spc_decoder.py | 3 +++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index ef8ba3a9..0e181038 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -48,7 +48,7 @@ after_test: # - "move dist\\SHARPpy.exe dist\\SHARPpy%ARCH%.exe" artifacts: - - path: "dist\\SHARPpy64.exe" + - path: "runsharp\\dist\\SHARPpy64.exe" name: binary - path: "*.png" @@ -62,7 +62,7 @@ deploy: release: $(appveyor_repo_tag_name) auth_token: secure: DB6sQwYCM7Dhhy+mjPkMd6kclvw0Sc2wglTJxcTBQue63dtIQRNa1dz/aqJG7Ygc - artifact: "dist\\SHARPpy64.exe" + artifact: "runsharp\\dist\\SHARPpy64.exe" draft: true prerelease: true on: diff --git a/docs/source/install.rst b/docs/source/install.rst index 05883c8d..0e0a345f 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -24,6 +24,8 @@ https://github.com/sharppy/SHARPpy/releases/ Installing a pre-compiled binary *should* be as simple as downloading the .zip file and extracting it to the location of your choice. The zip files are named for the operating system and number of bits. Most recently-built computers (probably post-2010 or so) should have 64-bit operating systems installed. If your computer is older and you're unsure whether it has a 32- or 64-bit operating system, you can check on Windows 7 by clicking Start, right-clicking on Computer, and selecting Properties. All recent versions of OS X (10.6 and newer) should be 64-bit. +.. note:: The pre-compile binaries are sometimes difficult to keep up to date, so for more recent versions of SHARPpy, you may want to look into the next section, which is about installing the program via package managers. + Installing using package managers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/runsharp/full_gui.py b/runsharp/full_gui.py index 0dec7a1a..dcf17810 100644 --- a/runsharp/full_gui.py +++ b/runsharp/full_gui.py @@ -859,6 +859,9 @@ def __initUI(self): self.show() self.raise_() + import time + time.sleep(3) + QPixmap.grabWidget(self).save('./screenshot.png', 'png') def createMenuBar(self): """ @@ -1191,8 +1194,8 @@ def main(): win.close() else: main_win = Main() + #app.exec_() sys.exit(app.exec_()) - if __name__ == '__main__': main() diff --git a/sharppy/io/spc_decoder.py b/sharppy/io/spc_decoder.py index fc30ab02..79249f9e 100644 --- a/sharppy/io/spc_decoder.py +++ b/sharppy/io/spc_decoder.py @@ -83,3 +83,6 @@ def _parse(self): prof_coll.setMeta('base_time', time) return prof_coll +#if __name__ == '__main__': +# import sys +# SPCDecoder(sys.argv[1]) From 888b2bf08d6316d60bb257f557444b92b73806f7 Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Wed, 11 Sep 2019 22:42:10 -0400 Subject: [PATCH 04/15] Submit tests to azure --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f469e2cf..acf60d77 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -68,7 +68,7 @@ steps: sleep 3 # give xvfb some time to start xdpyinfo | grep dimensions # Check display dimensions python ci/screen.py # Check display dimensions as seen by PySide - #pytest -v --junitxml=junit/test-results.xml + pytest -v --junitxml=junit/test-results.xml #mv examples/data/14061619.png examples/data/14061619_linux.png displayName: "Installing code and running tests (Linux)" condition: eq( variables['Agent.OS'], 'Linux') @@ -86,7 +86,7 @@ steps: system_profiler SPDisplaysDataType | grep Resolution # Check display dimensions using OS tools python ci/screen.py # Check display dimensions as seen by PySide pip install -e . - #sudo pytest -v --junitxml=junit/test-results.xml + sudo pytest -v --junitxml=junit/test-results.xml #sudo mv examples/data/14061619.png examples/data/14061619_mac.png cd runsharp pyinstaller SHARPpy-osx.spec --noconsole --onefile --log-level DEBUG @@ -109,7 +109,7 @@ steps: python ci/screen.py #SET PYTHONPATH=%PYTHONPATH%;%CD% pip install -e . - #pytest -v --junitxml=junit/test-results.xml + pytest -v --junitxml=junit/test-results.xml #move examples\\data\\14061619.png examples\\data\\14061619_win.png cd runsharp pyinstaller SHARPpy-win7-64.spec --log-level DEBUG From d59336a039c83040a00c63740ee3ba8efabe4393 Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Thu, 12 Sep 2019 11:10:01 -0400 Subject: [PATCH 05/15] environment.yml works to create SHARPpy dev environ --- environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment.yml b/environment.yml index 0e87b5fb..e5c1901e 100644 --- a/environment.yml +++ b/environment.yml @@ -16,6 +16,7 @@ dependencies: - python-dateutil - pyinstaller - setuptools + - pip - pip: - sphinx-prompt - pydocstyle From e761bce4c196df64a4ee4e2910ea8a6991748cb5 Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Thu, 12 Sep 2019 11:10:27 -0400 Subject: [PATCH 06/15] Removed pyside1 dependency from setup.py --- setup.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 0ca46dbe..87a2681b 100644 --- a/setup.py +++ b/setup.py @@ -34,11 +34,11 @@ # Because pip doesn't recognize it when PySide is installed by conda from conda-forge # Try to import PySide. If it fails, add the PySide to the install_requires # Because of this, the conda meta.yaml will require PySide to build SHARPpy -try: - import PySide - print("Success importing PySide") -except: - install_requires.append("PySide==1.2.*") +#try: +# import PySide +# print("Success importing PySide") +#except: +# install_requires.append("PySide==1.2.*") entry_pts = {"console_scripts": ['sharppy = runsharp.full_gui:main'] } # Create some directory variables to shorten the lines. From 61a09b399c25f51eaa67de175d5af6bba398fc4b Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Thu, 12 Sep 2019 11:10:45 -0400 Subject: [PATCH 07/15] Tried making title font larger --- sharppy/viz/skew.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharppy/viz/skew.py b/sharppy/viz/skew.py index 88c450d0..8ecbdc3e 100644 --- a/sharppy/viz/skew.py +++ b/sharppy/viz/skew.py @@ -53,7 +53,7 @@ def initUI(self): else: fsize = 7 fsizet = 14 - self.title_font = QtGui.QFont('Helvetica', fsizet + (self.hgt * 0.003)) + self.title_font = QtGui.QFont('Helvetica', fsizet + (self.hgt * 0.006)) self.title_metrics = QtGui.QFontMetrics( self.title_font ) #self.title_font.setBold(True) self.title_height = self.title_metrics.xHeight() + 5 + (self.hgt * 0.003) From b2bcb276570a2308556bdf5b4ce8a8a348faa84e Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Thu, 12 Sep 2019 11:11:22 -0400 Subject: [PATCH 08/15] Fixed some of the full_gui syntax issues with Pyside2 --- runsharp/full_gui.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runsharp/full_gui.py b/runsharp/full_gui.py index e7409fa7..c2156d6a 100644 --- a/runsharp/full_gui.py +++ b/runsharp/full_gui.py @@ -1,6 +1,7 @@ from qtpy.QtGui import * from qtpy.QtCore import * from qtpy.QtWidgets import * +import qtpy QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) #QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True) @@ -86,7 +87,7 @@ logging.info('numpy version: ' + str(np.__version__)) logging.info('qtpy version: ' + str(qtpy.__version__)) logging.info("Python version: " + str(platform.python_version())) -logging.info("Qt version: " + str(PySide.QtCore.__version__)) +logging.info("Qt version: " + str(qtpy.QtCore.__version__)) # from sharppy._version import __version__#, __version_name__ @@ -103,10 +104,9 @@ def versioning_info(include_sharppy=False): txt = "" if include_sharppy is True: txt += "SHARPpy version: " + str(__version__) + '\n' - txt += "PySide version: " + str(PySide.__version__) + '\n' txt += "Numpy version: " + str(np.__version__) + '\n' txt += "Python version: " + str(platform.python_version()) + '\n' - txt += "Qt version: " + str(PySide.QtCore.__version__) + txt += "PySide/Qt version: " + str(qtpy.QtCore.__version__) return txt class crasher(object): @@ -1179,12 +1179,12 @@ def main(): #app.setAttribute(Qt.AA_UseHighDpiPixmaps) # #app.setStyle("fusion") - win = createWindow(args.file_names, collect=args.collect, close=args.close) if QApplication.instance() is None: app = QApplication([]) else: app = QApplication.instance() + #win = createWindow(args.file_names, collect=args.collect, close=False) # Check to see if there's a newer version of SHARPpy on Github Releases latest = check_latest() From 696c3a9ac44ecde45988f29d64b861b6ff1a025f Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Thu, 12 Sep 2019 11:11:48 -0400 Subject: [PATCH 09/15] Tested azure-pipelines --- azure-pipelines.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index acf60d77..d9d53175 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,19 +8,19 @@ strategy: linux-1280x1024: # Ubuntu 16.04 - imageName: 'ubuntu-16.04' + imageName: 'ubuntu-latest' screen_w: 1280 screen_h: 1024 screen_d: 16 mac-defaultres: # macOS 10.13 - imageName: 'macos-10.13' + imageName: 'macos-latest' # screen_w: 1280 # screen_h: 1024 # screen_d: 16 windows-1280x1024: # Windows Docker Container not Visual Studio 2017 on Windows Server 2016 - imageName: 'vs2015-win2012r2' ##'vs2017-win2016' + imageName: 'windows-latest' #'vs2017-win2016' # 'vs2015-win2012r2' screen_w: 1280 screen_h: 1024 screen_d: 16 @@ -35,7 +35,9 @@ steps: displayName: Add conda to PATH condition: eq( variables['Agent.OS'], 'Linux') -- bash: echo "##vso[task.prependpath]$CONDA/bin" +- bash: | + echo "##vso[task.prependpath]$CONDA/bin" + sudo chown -R $USER $CONDA displayName: Add conda to PATH condition: eq( variables['Agent.OS'], 'Darwin') From 23e6fbcb1f21c251799851d7f82582b9e87b6e8b Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Thu, 12 Sep 2019 11:34:28 -0400 Subject: [PATCH 10/15] Hopefully fixed continuous integration stuff --- .appveyor.yml | 9 ++------- .travis.yml | 4 ---- azure-pipelines.yml | 5 ++--- ci/screen.py | 4 ++-- sharppy/tests/test_gui.py | 6 +++--- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0e181038..0350441b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,9 +1,5 @@ environment: matrix: - - PYTHON_VERSION: 2.7 - MINICONDA: C:\Miniconda - ARCH: "64" - NUMPY_VERSION: "1.15.*" - PYTHON_VERSION: 3.6 MINICONDA: C:\Miniconda3 ARCH: "64" @@ -16,11 +12,10 @@ install: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a - - "conda create -q -n test-environment python=%PYTHON_VERSION%" + - conda env create -f environment.yml # Install dependencies - - activate test-environment - - "conda install -q -c conda-forge pyside pyinstaller pytest requests python-dateutil numpy=%NUMPY_VERSION%" + - activate devel # Add to path the current folder - "SET PYTHONPATH=%PYTHONPATH%;%CD%" diff --git a/.travis.yml b/.travis.yml index b74ec3bc..295549a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,10 +16,6 @@ matrix: language: generic env: - PYTHON_VERSION="3.6" DISPLAY_AVAIL="NO" BUILD_BINARY="YES" NUMPY_VERSION=1.15 - - os: linux - language: generic - env: - - PYTHON_VERSION="2.7" NUMPY_VERSION=1.15 - os: linux language: generic env: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d9d53175..21ca8409 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -90,11 +90,10 @@ steps: pip install -e . sudo pytest -v --junitxml=junit/test-results.xml #sudo mv examples/data/14061619.png examples/data/14061619_mac.png - cd runsharp - pyinstaller SHARPpy-osx.spec --noconsole --onefile --log-level DEBUG + pyinstaller runsharp/SHARPpy-osx.spec --noconsole --onefile --log-level DEBUG #sudo chmod 777 dist/SHARPpy.app + cd runsharp ls -lh dist - cd .. displayName: "Installing code and running tests (macOS)" condition: eq( variables['Agent.OS'], 'Darwin') diff --git a/ci/screen.py b/ci/screen.py index 66421de5..eee7f02c 100644 --- a/ci/screen.py +++ b/ci/screen.py @@ -1,10 +1,10 @@ -from PySide import QtGui +from qtpy.QtWidgets import * import sys # A short utility to use PySide to detect the screen resolution # (for use in testing the SHARPpy GUI) -app = QtGui.QApplication(sys.argv) +app = QApplication(sys.argv) screen_rect = app.desktop().screenGeometry() width, height = screen_rect.width(), screen_rect.height() print("Screen Resolution:", str(width) + 'x' + str(height)) diff --git a/sharppy/tests/test_gui.py b/sharppy/tests/test_gui.py index d29103c0..56cc2f06 100644 --- a/sharppy/tests/test_gui.py +++ b/sharppy/tests/test_gui.py @@ -17,10 +17,10 @@ prof_coll = dec.getProfiles() prof = prof_coll.getCurrentProfs()[''] -if QtGui.QApplication.instance() is None: - app = QtGui.QApplication([]) +if QtWidgets.QApplication.instance() is None: + app = QtWidgets.QApplication([]) else: - app = QtGui.QApplication.instance() + app = QtWidgets.QApplication.instance() #@pytest.mark.skipif(True, reason="DISPLAY not set") @pytest.mark.skipif("DISPLAY_AVAIL" in os.environ and os.environ["DISPLAY_AVAIL"] == 'NO', reason="DISPLAY not set") From d34ea0279e06baec07d634c241a40e42050c4ca1 Mon Sep 17 00:00:00 2001 From: Greg Blumberg Date: Thu, 12 Sep 2019 11:43:12 -0400 Subject: [PATCH 11/15] Fixing Travis CI install script to support PySide2 --- ci/install.sh | 9 +++------ environment.yml | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ci/install.sh b/ci/install.sh index faa4a218..93ae890c 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -23,13 +23,10 @@ conda update -q conda conda install -n -q root _license conda info -a conda config --add channels conda-forge -conda create -q -n test-environment python=$PYTHON_VERSION nose pyinstaller conda-build anaconda-client numpy=$NUMPY_VERSION -source activate test-environment +conda env create -f environment.yml +source activate devel +conda install -c conda-forge -q pytest-cov conda-build anaconda-client -pip install --upgrade pip -conda install -q qtpy -conda install -q conda-forge pyside2 -conda install -c conda-forge -q pytest-cov if [[ "$COVERALLS" == "YES" ]]; then echo "Installing coveralls ..." conda install -c conda-forge -q coveralls diff --git a/environment.yml b/environment.yml index e5c1901e..a4b2d02d 100644 --- a/environment.yml +++ b/environment.yml @@ -1,7 +1,7 @@ name: devel channels: - - conda-forge/label/testing - conda-forge + - conda-forge/label/testing - anaconda dependencies: - python=3 From 4585a098fc78635dade74e9f930ed7cc519e632c Mon Sep 17 00:00:00 2001 From: wblumberg Date: Thu, 12 Sep 2019 14:02:15 -0400 Subject: [PATCH 12/15] Turned off display on Travis CI --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 295549a3..a5fe8fc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: - os: linux language: generic env: - - PYTHON_VERSION="3.6" BUILD_CONDA="YES" NUMPY_VERSION=1.15 + - PYTHON_VERSION="3.6" BUILD_CONDA="YES" NUMPY_VERSION=1.15 DISPLAY_AVAIL="NO" - os: osx language: generic env: @@ -19,7 +19,7 @@ matrix: - os: linux language: generic env: - - PYTHON_VERSION="3.6" BUILD_DOCS="YES" NUMPY_VERSION=1.15 COVERALLS="YES" + - PYTHON_VERSION="3.6" BUILD_DOCS="YES" NUMPY_VERSION=1.15 COVERALLS="YES" DISPLAY_AVAIL="NO" before_install: - source ci/install.sh install: From f340292d1e12cd68e22dbcd8fccb6a74feae5453 Mon Sep 17 00:00:00 2001 From: wblumberg Date: Thu, 12 Sep 2019 14:46:47 -0400 Subject: [PATCH 13/15] Removed sphinx-gallery because Qt was conflicting with PySide2 --- .travis.yml | 4 ++-- ci/build_docs.sh | 2 ++ environment.yml | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a5fe8fc1..7522f156 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: - os: linux language: generic env: - - PYTHON_VERSION="3.6" BUILD_CONDA="YES" NUMPY_VERSION=1.15 DISPLAY_AVAIL="NO" + - PYTHON_VERSION="3.6" BUILD_CONDA="YES" NUMPY_VERSION=1.15 DISPLAY_AVAIL="YES" - os: osx language: generic env: @@ -19,7 +19,7 @@ matrix: - os: linux language: generic env: - - PYTHON_VERSION="3.6" BUILD_DOCS="YES" NUMPY_VERSION=1.15 COVERALLS="YES" DISPLAY_AVAIL="NO" + - PYTHON_VERSION="3.6" BUILD_DOCS="YES" NUMPY_VERSION=1.15 COVERALLS="YES" DISPLAY_AVAIL="YES" before_install: - source ci/install.sh install: diff --git a/ci/build_docs.sh b/ci/build_docs.sh index 672185b0..9226679f 100644 --- a/ci/build_docs.sh +++ b/ci/build_docs.sh @@ -8,6 +8,8 @@ cd "$TRAVIS_BUILD_DIR" conda install -q -c anaconda sphinx sphinx_rtd_theme conda install -q -c conda-forge sphinx-gallery pip install sphinx-prompt +conda deactivate +conda activate devel echo "Adding the SSH key ..." cd ci/ diff --git a/environment.yml b/environment.yml index a4b2d02d..f35c000c 100644 --- a/environment.yml +++ b/environment.yml @@ -6,12 +6,13 @@ channels: dependencies: - python=3 - numpy=1.15.* - - pyside2 + - pyside2=5.13.* - sphinx - pytest - qtpy - - sphinx-gallery - sphinx_rtd_theme + #- sphinx-gallery + #Sphinx-Gallery removed because it requires matplotlib/pyqt and conflicts with pyside2's Qt version - requests - python-dateutil - pyinstaller From 7bc3147e72ee82e171ec7252442b9494be06454f Mon Sep 17 00:00:00 2001 From: wblumberg Date: Thu, 12 Sep 2019 14:57:01 -0400 Subject: [PATCH 14/15] Updated conda recipe to include PySide 2 --- conda-recipe/meta.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index f1ec4a97..fe81bc05 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -23,13 +23,13 @@ build: requirements: build: - setuptools - - python >=3.4 - - pyside + - python>=3.4 + - pyside2=5.13.* - pip run: - - python >=3.4 + - python>=3.4 - numpy={{ os.environ.get('NUMPY_VERSION', '1.15') }} - - pyside + - pyside2=5.13.* - requests - python-dateutil From dbcc7e93e8f40c34b7969bbf4718670585c9cbeb Mon Sep 17 00:00:00 2001 From: wblumberg Date: Thu, 12 Sep 2019 15:11:46 -0400 Subject: [PATCH 15/15] Updated azure-pipelines to fix macOS binary artifact and output screenshots --- azure-pipelines.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 21ca8409..e66029dc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -71,7 +71,7 @@ steps: xdpyinfo | grep dimensions # Check display dimensions python ci/screen.py # Check display dimensions as seen by PySide pytest -v --junitxml=junit/test-results.xml - #mv examples/data/14061619.png examples/data/14061619_linux.png + mv examples/data/14061619.png examples/data/14061619_linux.png displayName: "Installing code and running tests (Linux)" condition: eq( variables['Agent.OS'], 'Linux') @@ -89,11 +89,11 @@ steps: python ci/screen.py # Check display dimensions as seen by PySide pip install -e . sudo pytest -v --junitxml=junit/test-results.xml - #sudo mv examples/data/14061619.png examples/data/14061619_mac.png + sudo mv examples/data/14061619.png examples/data/14061619_mac.png pyinstaller runsharp/SHARPpy-osx.spec --noconsole --onefile --log-level DEBUG #sudo chmod 777 dist/SHARPpy.app - cd runsharp - ls -lh dist + #cd runsharp + #ls -lh dist displayName: "Installing code and running tests (macOS)" condition: eq( variables['Agent.OS'], 'Darwin') @@ -111,7 +111,7 @@ steps: #SET PYTHONPATH=%PYTHONPATH%;%CD% pip install -e . pytest -v --junitxml=junit/test-results.xml - #move examples\\data\\14061619.png examples\\data\\14061619_win.png + move examples\\data\\14061619.png examples\\data\\14061619_win.png cd runsharp pyinstaller SHARPpy-win7-64.spec --log-level DEBUG cd .. @@ -137,7 +137,7 @@ steps: # Zipping MacOS .app - task: ArchiveFiles@2 inputs: - rootFolderOrFile: runsharp/dist/SHARPpy.app + rootFolderOrFile: dist/SHARPpy.app archiveType: zip archiveFile: '$(Build.ArtifactStagingDirectory)/SHARPpy-osx-64.zip' displayName: "Zipping macOS .app"