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

[WIP] Qt6 Conversion #1601

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ jobs:
- name: Setup pip options
run: setup_pip_options

- name: Install system dependencies
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev libegl-dev

- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/dist.txt -r reqs/dist_extra_gui_qt.txt -r reqs/test.txt
- name: Build UI
Expand Down Expand Up @@ -667,7 +670,7 @@ jobs:

- name: List cache contents
run: list_cache

outputs:
version: ${{ steps.set_version.outputs.version }}
# }}}
Expand Down Expand Up @@ -710,7 +713,7 @@ jobs:
run: setup_pip_options

- name: Install system dependencies
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev libegl-dev

- name: Setup Python environment
run: setup_python_env -c reqs/constraints.txt -r reqs/build.txt -r reqs/setup.txt
Expand Down Expand Up @@ -958,4 +961,4 @@ jobs:
run: publish_github_release
# }}}

# vim: foldmethod=marker foldlevel=0
# vim: foldmethod=marker foldlevel=0
6 changes: 3 additions & 3 deletions .github/workflows/ci/workflow_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ jobs:
run: setup_osx_python '<@ j.python @>'

<% endif %>
<% if j.type == 'build' and j.os == 'Linux' %>
<% if j.type in ['build', 'test_gui_qt'] and j.os == 'Linux' %>
- name: Install system dependencies
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev
run: apt_get_install libdbus-1-dev libdbus-glib-1-dev libudev-dev libusb-1.0-0-dev libegl-dev

<% endif %>
- name: Setup Python environment
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
- name: List cache contents
run: list_cache
<% if j.type == 'test_packaging' %>

outputs:
version: ${{ steps.set_version.outputs.version }}
<% endif %>
Expand Down
7 changes: 1 addition & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,5 @@ include test/*.py
include test/gui_qt/*.py
include tox.ini
include windows/*
# Exclude: CI/Git/GitHub specific files,
# as well as generated Python files (UI).
exclude .gitignore
exclude plover/gui_qt/*_rc.py

exclude plover/gui_qt/*_ui.py
exclude plover/gui_qt/.gitignore
prune .github
33 changes: 15 additions & 18 deletions linux/appimage/blacklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
# Plover.
:usr/lib/python${pyversion}/site-packages/plover
gui_qt/*.ui
gui_qt/resources
messages/**/*.po
messages/plover.pot

# PyQt5.
# PyQt6.
:usr/bin
pylupdate5
pyrcc5
pyuic5
:usr/lib/python${pyversion}/site-packages/PyQt5
pylupdate6
pyuic6
:usr/lib/python${pyversion}/site-packages/PyQt6
**/*Designer*
**/*[Hh]elp*
**/*[Qq]ml*
Expand All @@ -49,19 +47,18 @@
**/*[Ww]ayland*
**/*[Ww]eb[Ee]ngine*
bindings
Qt5/plugins/egldeviceintegrations
Qt5/plugins/geoservices
Qt5/plugins/platforms/libqeglfs.so
Qt5/plugins/platforms/libqlinuxfb.so
Qt5/plugins/platforms/libqminimal.so
Qt5/plugins/platforms/libqminimalegl.so
Qt5/plugins/platforms/libqoffscreen.so
Qt5/plugins/platforms/libqvnc.so
Qt5/plugins/platforms/libqwebgl.so
Qt5/plugins/sceneparsers
Qt5/plugins/webview
Qt6/plugins/egldeviceintegrations
Qt6/plugins/geoservices
Qt6/plugins/platforms/libqeglfs.so
Qt6/plugins/platforms/libqlinuxfb.so
Qt6/plugins/platforms/libqminimal.so
Qt6/plugins/platforms/libqminimalegl.so
Qt6/plugins/platforms/libqoffscreen.so
Qt6/plugins/platforms/libqvnc.so
Qt6/plugins/platforms/libqwebgl.so
Qt6/plugins/sceneparsers
Qt6/plugins/webview
pylupdate*
pyrcc*
uic

# vim: ft=config
1 change: 1 addition & 0 deletions news.d/api/1601.break.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update UI to PyQt6 from PyQt5
48 changes: 23 additions & 25 deletions osx/app_resources/dist_blacklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
turtle*
**/*.exe
*/test*
# PyQt5.
:lib/python$python_base_version/site-packages/PyQt5
# PyQt6.
:lib/python$python_base_version/site-packages/PyQt6
**/*AxContainer*
**/*Bluetooth*
**/*CLucene*
Expand All @@ -35,34 +35,32 @@
**/*Serial*
**/*Sql*
**/*Test*
Qt5/plugins/audio
Qt5/plugins/bearer
Qt5/plugins/generic
Qt5/plugins/geoservices
Qt5/plugins/mediaservice
Qt5/plugins/playlistformats
Qt5/plugins/position
Qt5/plugins/printsupport
Qt5/plugins/sceneparsers
Qt5/plugins/sensor*
Qt5/plugins/sqldrivers
Qt5/qml
Qt5/resources
Qt5/translations/qt_help_*
Qt5/translations/qtconnectivity_*
Qt5/translations/qtdeclarative_*
Qt5/translations/qtlocation_*
Qt5/translations/qtmultimedia_*
Qt5/translations/qtquick*
Qt5/translations/qtserialport_*
Qt5/translations/qtwebsockets_*
Qt6/plugins/audio
Qt6/plugins/bearer
Qt6/plugins/generic
Qt6/plugins/geoservices
Qt6/plugins/mediaservice
Qt6/plugins/playlistformats
Qt6/plugins/position
Qt6/plugins/printsupport
Qt6/plugins/sceneparsers
Qt6/plugins/sensor*
Qt6/plugins/sqldrivers
Qt6/qml
Qt6/resources
Qt6/translations/qt_help_*
Qt6/translations/qtconnectivity_*
Qt6/translations/qtdeclarative_*
Qt6/translations/qtlocation_*
Qt6/translations/qtmultimedia_*
Qt6/translations/qtquick*
Qt6/translations/qtserialport_*
Qt6/translations/qtwebsockets_*
pylupdate*
pyrcc*
uic
# Plover.
:lib/python$python_base_version/site-packages/plover
gui_qt/*.ui
gui_qt/resources
messages/**/*.po
messages/plover.pot

Expand Down
2 changes: 1 addition & 1 deletion plover/gui_qt/about_dialog.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import re

from PyQt5.QtWidgets import QDialog
from PyQt6.QtWidgets import QDialog

import plover

Expand Down
4 changes: 2 additions & 2 deletions plover/gui_qt/add_translation_dialog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from PyQt5.QtWidgets import QDialogButtonBox
from PyQt6.QtWidgets import QDialogButtonBox

from plover import _

Expand Down Expand Up @@ -29,7 +29,7 @@ def __init__(self, engine, dictionary_path=None):
self.finished.connect(self.save_state)

def on_mapping_valid(self, valid):
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(valid)
self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(valid)

def on_config_changed(self, config_update):
if 'translation_frame_opacity' in config_update:
Expand Down
8 changes: 4 additions & 4 deletions plover/gui_qt/add_translation_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from html import escape as html_escape
from os.path import split as os_path_split

from PyQt5.QtCore import QEvent, pyqtSignal
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt6.QtCore import QEvent, pyqtSignal
from PyQt6.QtWidgets import QApplication, QWidget

from plover import _
from plover.misc import shorten_path
Expand Down Expand Up @@ -104,12 +104,12 @@ def select_dictionary(self, dictionary_path):
self._update_items()

def eventFilter(self, watched, event):
if event.type() == QEvent.FocusIn:
if event.type() == QEvent.Type.FocusIn:
if watched == self.strokes:
self._focus_strokes()
elif watched == self.translation:
self._focus_translation()
elif event.type() == QEvent.FocusOut:
elif event.type() == QEvent.Type.FocusOut:
if watched in (self.strokes, self.translation):
self._unfocus()
return False
Expand Down
8 changes: 4 additions & 4 deletions plover/gui_qt/config_serial_widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
</connection>
<connection>
<sender>baudrate</sender>
<signal>activated(QString)</signal>
<signal>textActivated(QString)</signal>
<receiver>SerialWidget</receiver>
<slot>on_baudrate_changed(QString)</slot>
<hints>
Expand All @@ -357,7 +357,7 @@
</connection>
<connection>
<sender>bytesize</sender>
<signal>activated(QString)</signal>
<signal>textActivated(QString)</signal>
<receiver>SerialWidget</receiver>
<slot>on_bytesize_changed(QString)</slot>
<hints>
Expand All @@ -373,7 +373,7 @@
</connection>
<connection>
<sender>parity</sender>
<signal>activated(QString)</signal>
<signal>textActivated(QString)</signal>
<receiver>SerialWidget</receiver>
<slot>on_parity_changed(QString)</slot>
<hints>
Expand Down Expand Up @@ -405,7 +405,7 @@
</connection>
<connection>
<sender>stopbits</sender>
<signal>activated(QString)</signal>
<signal>textActivated(QString)</signal>
<receiver>SerialWidget</receiver>
<slot>on_stopbits_changed(QString)</slot>
<hints>
Expand Down
28 changes: 14 additions & 14 deletions plover/gui_qt/config_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from copy import copy
from functools import partial

from PyQt5.QtCore import (
from PyQt6.QtCore import (
Qt,
QVariant,
pyqtSignal,
)
from PyQt5.QtWidgets import (
from PyQt6.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
Expand Down Expand Up @@ -123,9 +123,9 @@ class TableOption(QTableWidget):
def __init__(self):
super().__init__()
self.horizontalHeader().setStretchLastSection(True)
self.setSelectionMode(self.SingleSelection)
self.setSelectionMode(self.SelectionMode.SingleSelection)
self.setTabKeyNavigation(False)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.verticalHeader().hide()
self.currentItemChanged.connect(self._on_current_item_changed)

Expand Down Expand Up @@ -191,7 +191,7 @@ def setValue(self, value):
row += 1
self.insertRow(row)
item = QTableWidgetItem(key)
item.setFlags(item.flags() & ~Qt.ItemIsEditable)
item.setFlags(item.flags() & ~Qt.ItemFlag.ItemIsEditable)
self.setItem(row, 0, item)
item = QTableWidgetItem(action)
self.setItem(row, 1, item)
Expand All @@ -203,8 +203,8 @@ def setValue(self, value):
def _on_cell_changed(self, row, column):
if self._updating:
return
key = self.item(row, 0).data(Qt.DisplayRole)
action = self.item(row, 1).data(Qt.DisplayRole)
key = self.item(row, 0).data(Qt.ItemDataRole.DisplayRole)
action = self.item(row, 1).data(Qt.ItemDataRole.DisplayRole)
bindings = self._value.get_bindings()
if action:
bindings[key] = action
Expand Down Expand Up @@ -257,11 +257,11 @@ def setValue(self, value):
row += 1
self.insertRow(row)
item = QTableWidgetItem(self._choices[choice])
item.setFlags(item.flags() & ~Qt.ItemIsEditable)
item.setFlags(item.flags() & ~Qt.ItemFlag.ItemIsEditable)
self.setItem(row, 0, item)
item = QTableWidgetItem()
item.setFlags((item.flags() & ~Qt.ItemIsEditable) | Qt.ItemIsUserCheckable)
item.setCheckState(Qt.Checked if choice in value else Qt.Unchecked)
item.setFlags((item.flags() & ~Qt.ItemFlag.ItemIsEditable) | Qt.ItemFlag.ItemIsUserCheckable)
item.setCheckState(Qt.CheckState.Checked if choice in value else Qt.CheckState.Unchecked)
self.setItem(row, 1, item)
self.resizeColumnsToContents()
self.setMinimumSize(self.viewportSizeHint())
Expand All @@ -271,7 +271,7 @@ def _on_cell_changed(self, row, column):
if self._updating:
return
assert column == 1
choice = self._reversed_choices[self.item(row, 0).data(Qt.DisplayRole)]
choice = self._reversed_choices[self.item(row, 0).data(Qt.ItemDataRole.DisplayRole)]
if self.item(row, 1).checkState():
self._value.add(choice)
else:
Expand Down Expand Up @@ -437,8 +437,8 @@ def __init__(self, engine):
(option_by_name[option_name], update_fn)
for option_name, update_fn in option.dependents
]
self.buttons.button(QDialogButtonBox.Ok).clicked.connect(self.on_apply)
self.buttons.button(QDialogButtonBox.Apply).clicked.connect(self.on_apply)
self.buttons.button(QDialogButtonBox.StandardButton.Ok).clicked.connect(self.on_apply)
self.buttons.button(QDialogButtonBox.StandardButton.Apply).clicked.connect(self.on_apply)
self.tabs.currentWidget().setFocus()
self.restore_state()
self.finished.connect(self.save_state)
Expand Down Expand Up @@ -491,7 +491,7 @@ def _create_option_widget(self, option):

def keyPressEvent(self, event):
# Disable Enter/Return key to trigger "OK".
if event.key() in (Qt.Key_Enter, Qt.Key_Return):
if event.key() in (Qt.Key.Key_Enter, Qt.Key.Key_Return):
return
super().keyPressEvent(event)

Expand Down
Loading
Loading