Skip to content

Commit

Permalink
Backport fixes to 7.1 (#1421)
Browse files Browse the repository at this point in the history
* Fix Qt IconButton with a clickable area too small (#1383)

* Fix IconButton with a clickable area too small.

If we set the maximum size using the icon size, the clickable area
ends up being too small to click (tested on OSX with FileEditor,
RangeEditor, ListEditor). If we don't set the maximum size, the
button takes up too much space. This sizeHint logic is similar
to how QToolButton.sizeHint is implemented.

* Expand docstring for sizeHint

* Call ensurePolished as it was called in the original implementation

(cherry picked from commit 8912de3)

* Enable the scrollable trait of a Group in the Qt backend (#1406)

* Enable the scrollable trait of a Group in the Qt backend.

* Tests that should exercise each code path for scrollable groups.

* Be more specific about getting widgets to avoid cross-platform issues.

* Ensure UI gets disposed properly.

* Fixes and improvements to tests, code, based on PR review.

(cherry picked from commit b73c475)

* Change Dialog flag to Window to allow minimize/maximize buttons to be shown (#1409)

* Use Window flag instead to allow minimize and maximize buttons to be shown by more window managers.

Some window managers (e.g. Ubuntu 18, 20) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint
such that the window does not have minimize and maximize buttons on the window frame. Some window managers
(e.g. Fedora) do not do buttons but they do double clicking, and those functionalities can be ignored when
the window flag includes Dialog.

Some window managers (e.g. OSX, Ubuntu 16) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint
such that the minimize button is disabled, but the maximize button can still be used.

Some window managers (e.g. Windows, LXDE) would happily combine these flags as union, and allow minimize
and maximize buttons to be placed on a Dialog frame.

(cherry picked from commit 5a99887)

* Add GitHub Actions workflows targeting pip-installed dependencies (#1415)

* Add GitHub Actions workflow excluding EDM

* Shorten names

* Shortening name

* Add workflow for targeting Traits 6

* EXCLUDE_TESTS is no longer used

* Split minimal test to a separate workflow as it may be scheduled differently

* Remove job for wxPython + Ubuntu due to lack of allow-to-fail

* Update wheel before install

* Remove comment about prebuilt wheel being incompatible

The wheels for wxPython 4.1.0 did not work well on Python 3.8 and 3.9.
But the wheels for wxPython 4.1.1 work.

* Use Python 3.6 for per-PR run

* Final update to set on-schedule and on-pull-request

(cherry picked from commit e14ca3e)

* Reduce CI matrix on Appveyor (#1417)

* Reduce matrix on Appveyor as part of migration to GitHub Actions

* Add Windows to the workflow for null backend

(cherry picked from commit 38e5e33)

* Update changelog

* CLN : Use normal string, not f-string (#1393)

In this specific case, there was nothing that needed to be formatted in the string
so we can just use a normal string.

This was reported as a flake8 failure in the CI job
- https://travis-ci.org/github/enthought/traitsui/jobs/738921895

(cherry picked from commit c5438d5)

Co-authored-by: Corran Webster <[email protected]>
Co-authored-by: Poruri Sai Rahul <[email protected]>
  • Loading branch information
3 people committed Nov 30, 2020
1 parent 79e2da4 commit 7e9a54a
Show file tree
Hide file tree
Showing 19 changed files with 484 additions and 21 deletions.
29 changes: 29 additions & 0 deletions .github/actions/apt-get-qt-deps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Install Qt dependencies on Ubuntu

This action calls `apt-get` to install packages required for running Qt on Ubuntu.

## Inputs

There are no inputs.

## Outputs

There are no outputs.

## Example usage

```yml

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolkit: ['pyqt5']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Qt dependencies for Linux
uses: ./.github/actions/apt-get-qt-deps
if: startsWith(matrix.os, 'ubuntu')
```
19 changes: 19 additions & 0 deletions .github/actions/apt-get-qt-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This action installs dependencies for Qt on Ubuntu
# It does not install any Qt-Python wrapper.

name: 'Install Ubuntu packages for Qt'
description: 'This action should only be run on Ubuntu'
runs:
using: "composite"
steps:
- run: |
sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install libxkbcommon-x11-0
sudo apt-get install libxcb-icccm4
sudo apt-get install libxcb-image0
sudo apt-get install libxcb-keysyms1
sudo apt-get install libxcb-randr0
sudo apt-get install libxcb-render-util0
sudo apt-get install libxcb-xinerama0
shell: bash
42 changes: 42 additions & 0 deletions .github/workflows/bleeding-edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow installs dependencies from master

name: ETS from source

on:
schedule:
- cron: '0 0 * * 4'

jobs:
test:
env:
# Enforce selection of toolkit
ETS_TOOLKIT: qt
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolkit: ['pyside2']
python-version: [3.9]
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Qt dependencies for Linux
uses: ./.github/actions/apt-get-qt-deps
if: startsWith(matrix.os, 'ubuntu')
- name: Install local packages
run: python -m pip install .[${{ matrix.toolkit }},editors,test]
- name: Install source dependencies
run: |
python -m pip install --force-reinstall git+http://github.com/enthought/pyface.git#egg=pyface
python -m pip install --force-reinstall git+http://github.com/enthought/traits.git#egg=traits
- name: Sanity check dependencies
run: python -m pip list
- name: Run test suite
uses: GabrielBB/xvfb-action@v1
with:
run: python -m unittest discover -v traitsui
working-directory: ${{ runner.temp }}
40 changes: 40 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow runs integration tests (e.g. demo examples), which requires
# more dependencies


name: Integration tests

on:
schedule:
- cron: '0 0 * * 4'

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest]
toolkit: ['pyside2']
# Dependencies include chaco/enable, whose installation fails
# on Python 3.8 and 3.9
python-version: [3.6]
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Qt dependencies for Linux
uses: ./.github/actions/apt-get-qt-deps
if: startsWith(matrix.os, 'ubuntu')
- name: Install Python packages and dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install .[${{ matrix.toolkit }},test,editors]
python -m pip install .[examples]
- name: Run integration tests
uses: GabrielBB/xvfb-action@v1
with:
run: python -m unittest discover -v ${{ github.workspace }}/integrationtests
working-directory: ${{ runner.temp }}
28 changes: 28 additions & 0 deletions .github/workflows/minimal-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow targets stable released dependencies from PyPI with
# minimal dependencies.


name: Minimal setup

on: pull_request

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install Python packages
run: |
python -m pip install --upgrade pip wheel
python -m pip install .[test]
- name: Run test suite
run: python -m unittest discover -v traitsui
working-directory: ${{ runner.temp }}
28 changes: 28 additions & 0 deletions .github/workflows/style-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow run flake8 on the code base

name: Style check

on: pull_request

jobs:
style:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.6, 3.9]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and local packages
run: |
python -m pip install --upgrade pip
python -m pip install flake8
- name: Run style checks
run: |
python -m flake8
74 changes: 74 additions & 0 deletions .github/workflows/test-with-pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This workflow targets stable released dependencies from PyPI
# The matrix is conservative to avoid using too much public resources.

name: Test with PyPI

on: pull_request

jobs:
# Tests against Qt/Python packages from PyPI
pip-qt:
env:
# Enforce selection of toolkit
ETS_TOOLKIT: qt
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolkit: ['pyside2']
python-version: [3.6]
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Qt dependencies for Linux
uses: ./.github/actions/apt-get-qt-deps
if: startsWith(matrix.os, 'ubuntu')
- name: Update pip, setuptools and wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Install local packages
run: python -m pip install .[${{ matrix.toolkit }},editors,test]
- name: Run test suite
uses: GabrielBB/xvfb-action@v1
with:
run: python -m unittest discover -v traitsui
working-directory: ${{ runner.temp }}

# Tests against wxPython from PyPI
# On OSX:
# - wxPython complains about 'This program needs access to the screen'.
# On Ubuntu:
# - For wxPython 4.0, we need libsdl-image1.2
# - For wxPython 4.1, we need libsdl2-2.0-0
# - The Ubuntu build can be run but it fails and there are no equivalence
# of allow-failure on GitHub Actions.
pip-wx:
env:
# Enforce selection of toolkit
ETS_TOOLKIT: wx
strategy:
# Test failure is currently expected to fail on Ubuntu
fail-fast: false
matrix:
os: [windows-latest]
python-version: [3.6]
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Update pip, setuptools and wheel
run: python -m pip install --upgrade pip setuptools wheel
- name: Install local packages
run: python -m pip install .[wx,editors,test]
- name: Run test suite
uses: GabrielBB/xvfb-action@v1
with:
run: python -m unittest discover -v traitsui
working-directory: ${{ runner.temp }}
39 changes: 39 additions & 0 deletions .github/workflows/traits-6-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow is for running tests against Traits 6.0
# The entire workflow can be removed when Traits 6.0 support is dropped.

name: Test with Traits 6

on:
schedule:
- cron: '0 0 * * 4'

jobs:
trait-6:
env:
# Enforce selection of toolkit
ETS_TOOLKIT: qt
strategy:
matrix:
os: [ubuntu-latest]
toolkit: ['pyside2']
python-version: [3.6]
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Qt dependencies for Linux
uses: ./.github/actions/apt-get-qt-deps
if: startsWith(matrix.os, 'ubuntu')
- name: Install Traits 6
run: python -m pip install "traits<6.1"
- name: Install local packages
run: python -m pip install .[${{ matrix.toolkit }},editors,test]
- name: Run test suite
uses: GabrielBB/xvfb-action@v1
with:
run: python -m unittest discover -v traitsui
working-directory: ${{ runner.temp }}
14 changes: 14 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Traits UI Changelog
===================

Bugfix release 7.1.1
--------------------

This is a bugfix release that fixes a number of issues since the 7.1.0 release.
Thanks to Corran Webster and Kit Choi for the patches.

Fixes
~~~~~
- Fix ``scrollable`` trait of a Group not being implemented on Qt (#1406)
- Fix icon button's clickable area too small for FileEditor and RangeEditor on
Qt and OSX (#1383)
- Fix missing minimize and maximize buttons for dialogs opened on certain
Linux platforms (#1409)

Release 7.1.0
-------------

Expand Down
6 changes: 0 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ environment:
TOOLKIT: "pyqt"
- RUNTIME: '3.6'
TOOLKIT: "pyqt5"
- RUNTIME: '3.6'
TOOLKIT: "pyside2"
- RUNTIME: '3.6'
TOOLKIT: "wx"
- RUNTIME: '3.6'
TOOLKIT: "null"

matrix:
fast_finish: true
Expand Down
7 changes: 0 additions & 7 deletions etstool.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,6 @@ def test(runtime, toolkit, environment):
environ = environment_vars.get(toolkit, {}).copy()
environ['PYTHONUNBUFFERED'] = "1"

if toolkit == "wx":
environ["EXCLUDE_TESTS"] = "qt"
elif toolkit in {"pyqt", "pyqt5", "pyside", "pyside2"}:
environ["EXCLUDE_TESTS"] = "wx"
else:
environ["EXCLUDE_TESTS"] = "(wx|qt)"

parameters["integrationtests"] = os.path.abspath("integrationtests")
commands = [
"edm run -e {environment} -- python -W default -m coverage run -p -m unittest discover -v traitsui",
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
per-file-ignores = */api.py:F401
exclude =
# The following list should eventually be empty.
docs,
etstool.py,
examples/tutorials/traitsui_4.0,
integrationtests/styled_date_editor_test.py,
integrationtests/ui,
Expand Down
12 changes: 9 additions & 3 deletions traitsui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,25 @@ def load_tests(loader, standard_tests, pattern):
TestSuite representing all package tests that did not match specified
exclusion pattern.
"""
from os import environ
from os.path import dirname
from traitsui.tests._tools import filter_tests
from unittest import TestSuite
from traits.etsconfig.api import ETSConfig
from traitsui.tests._tools import filter_tests

# Make sure the right toolkit is up and running before importing tests
from traitsui.toolkit import toolkit
toolkit()

if ETSConfig.toolkit.startswith("qt"):
exclusion_pattern = "wx"
elif ETSConfig.toolkit == "wx":
exclusion_pattern = "qt"
else:
exclusion_pattern = "(wx|qt)"

this_dir = dirname(__file__)
package_tests = loader.discover(start_dir=this_dir, pattern=pattern)

exclusion_pattern = environ.get("EXCLUDE_TESTS", None)
if exclusion_pattern is None:
return package_tests

Expand Down
Loading

0 comments on commit 7e9a54a

Please sign in to comment.