Skip to content

Commit e0fd638

Browse files
authored
Merge pull request #446 from tlecomte/pyqt6
feat(UI): migrate to PyQt6
2 parents 3f73c76 + d6a9126 commit e0fd638

88 files changed

Lines changed: 959 additions & 444 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/install-linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ sudo apt-get install -y fuse # AppImages require FUSE to run
1313

1414
# when PyInstaller collect libraries, it ignores libraries that are not found on the host.
1515
# Those missing libs prevent proper startup.
16-
# For example, PyQt5 bundles Qt5 libs that depend on libxcb-xinerama.so.0
16+
# For example, PyQt6 bundles Qt6 libs that depend on libxcb-xinerama.so.0
1717
# which would not be bundled unless explicitly installed.
1818
sudo apt-get install libxcb-xinerama0
1919
sudo apt-get install libxkbcommon-x11-0

INSTALL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Get the latest binary releases for Windows, macOS and Linux on the [Releases](ht
88

99
The following steps can be used to prepare a development environment for Friture on Ubuntu.
1010

11-
Prerequisite: a 64 bits Linux installation (PyQt5 wheels for Linux are only available for 64 bits).
11+
Prerequisite: a 64 bits Linux installation (PyQt6 wheels for Linux are only available for 64 bits).
1212

1313
This has been tested in a Virtualbox image for Ubuntu Trusty 16.04 LTS 64 bits from osboxes.org. The following custom settings have been set on the VM: increase video memory, enable 3d acceleration, enable audio input, install guest addition, add user to vboxsf (for file sharing with the host), keyboard layout setup.
1414

@@ -40,7 +40,7 @@ git fetch
4040
git checkout origin/<branchName>
4141
```
4242

43-
6. Create a virtual environment, install Friture dependencies (PyQt5, etc.), and build Cython extensions
43+
6. Create a virtual environment, install Friture dependencies (PyQt6, etc.), and build Cython extensions
4444
```
4545
uv sync
4646
```
@@ -92,8 +92,8 @@ See [pyproject.toml](pyproject.toml)
9292
If `settings.ui` or `resource.qrc` are changed, the corresponding python files need to be rebuilt:
9393

9494
```
95-
uv run pyuic5 ui/settings.ui --from-imports > friture/ui_settings.py
96-
uv run pyrcc5 resources/friture.qrc -o friture/friture_rc.py
95+
uv run pyuic6 ui/settings.ui -o friture/ui_settings.py
96+
uv run pyrcc6 resources/friture.qrc -o friture/friture_rc.py
9797
```
9898

9999
## Filters parameters

friture.spec

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,43 @@ from PyInstaller.utils.hooks import collect_data_files
88

99
block_cipher = None
1010

11-
# pyinstaller is conservative: it includes all Qt5 modules by default
11+
# pyinstaller is conservative: it includes all Qt6 modules by default
1212
# to reduce our frozen image size, we exclude unused modules
1313
excludes = [
14-
'PyQt5.QtHelp',
15-
'PyQt5.QtMultimedia',
16-
'PyQt5.QtScript',
17-
'PyQt5.QtScriptTools',
18-
'PyQt5.QtSql',
19-
'PyQt5.QtDesigner',
20-
'PyQt5.QtTest',
21-
'PyQt5.QtWebKit',
22-
'PyQt5.QtXMLPatterns',
23-
'PyQt5.QtCLucene',
24-
'PyQt5.QtBluetooth',
25-
'PyQt5.QtConcurrent',
26-
'PyQt5.QtMultimediaWidgets',
27-
'PyQt5.QtPositioning',
28-
'PyQt5.QtSensors',
29-
'PyQt5.QtSerialPort',
30-
'PyQt5.QtWebChannel',
31-
'PyQt5.QtWebEngine',
32-
'PyQt5.QtWebEngineCore',
33-
'PyQt5.QtWebEngineWidgets',
34-
'PyQt5.QtWebKitWidgets',
35-
'PyQt5.QtWebSockets']
14+
'PyQt6.QtHelp',
15+
'PyQt6.QtMultimedia',
16+
'PyQt6.QtSql',
17+
'PyQt6.QtDesigner',
18+
'PyQt6.QtTest',
19+
'PyQt6.QtPositioning',
20+
'PyQt6.QtSensors',
21+
'PyQt6.QtSerialPort',
22+
'PyQt6.QtWebChannel',
23+
'PyQt6.QtWebEngine',
24+
'PyQt6.QtWebEngineCore',
25+
'PyQt6.QtWebEngineWidgets',
26+
'PyQt6.QtWebSockets']
3627

3728
excluded_binaries = [
38-
'Qt5Bluetooth.dll',
39-
'Qt5DBus.dll',
40-
'Qt5Location.dll',
41-
'Qt5Nfc.dll',
42-
'Qt5Positioning.dll',
43-
'Qt5PositioningQuick.dll',
44-
'Qt5PrintSupport.dll',
45-
'Qt5RemoteObjects.dll',
46-
'Qt5WebSockets.dll',
47-
'Qt5WinExtras.dll',
48-
'Qt5Xml.dll',
49-
'Qt5XmlPatterns.dll',
29+
'Qt6Bluetooth.dll',
30+
'Qt6DBus.dll',
31+
'Qt6Location.dll',
32+
'Qt6Nfc.dll',
33+
'Qt6Positioning.dll',
34+
'Qt6PositioningQuick.dll',
35+
'Qt6PrintSupport.dll',
36+
'Qt6RemoteObjects.dll',
37+
'Qt6WebSockets.dll',
38+
'Qt6WinExtras.dll',
39+
'Qt6Xml.dll',
5040

5141
# # macos
5242
'QtHelp.framework',
5343
'QtMultimedia.framework',
54-
'QtScript.framework',
55-
'QtScriptTools.framework',
5644
'QtSql.framework',
5745
'QtDesigner.framework',
5846
'QtTest.framework',
59-
'QtWebKit.framework',
6047
'QtXMLPatterns.framework',
61-
'QtCLucene.framework',
6248
'QtBluetooth.framework',
6349
'QtConcurrent.framework',
6450
'QtMultimediaWidgets.framework',
@@ -69,15 +55,14 @@ excluded_binaries = [
6955
'QtWebEngine.framework',
7056
'QtWebEngineCore.framework',
7157
'QtWebEngineWidgets.framework',
72-
'QtWebKitWidgets.framework',
7358
'QtWebSockets.framework'
7459
]
7560

7661
pathex = []
7762
if platform.system() == "Windows":
78-
# workaround for PyInstaller that does not look where the new PyQt5 official wheels put the Qt dlls
63+
# workaround for PyInstaller that does not look where the new PyQt6 official wheels put the Qt dlls
7964
from PyInstaller.compat import getsitepackages
80-
pathex += [os.path.join(x, 'PyQt5', 'Qt', 'bin') for x in getsitepackages()]
65+
pathex += [os.path.join(x, 'PyQt6', 'Qt', 'bin') for x in getsitepackages()]
8166

8267
a = Analysis(['main.py'],
8368
pathex=pathex,
@@ -120,6 +105,6 @@ app = BUNDLE(coll,
120105
bundle_identifier="org.silentgain.friture",
121106
version=friture.__version__,
122107
info_plist={
123-
'NSMicrophoneUsageDescription': 'Friture reads from the audio inputs to show visualizations',
124-
'CFBundleVersion': friture.__version__
108+
'NSMicrophoneUsageDescription': 'Friture reads from the audio inputs to show visualizations',
109+
'CFBundleVersion': friture.__version__
125110
})

friture/ControlBar.qml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ RowLayout {
99

1010
SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active }
1111

12-
required property var viewModel
13-
1412
ComboBox {
1513
id: widgetSelector
1614
model: [
@@ -38,31 +36,31 @@ RowLayout {
3836
icon.source: "qrc:/images-src/dock-settings.svg"
3937
ToolTip.text: "Customize the audio widget"
4038
icon.color: systemPalette.windowText
41-
onClicked: viewModel.onSettingsClicked()
39+
onClicked: viewModel.triggerSettingsClicked()
4240
}
43-
41+
4442
ToolButton {
4543
id: movePreviousButton
4644
icon.source: "qrc:/images-src/dock-move-previous.svg"
4745
ToolTip.text: "Move widget to previous slot"
4846
icon.color: systemPalette.windowText
49-
onClicked: viewModel.onMovePreviousClicked()
47+
onClicked: viewModel.triggerMovePreviousClicked()
5048
}
51-
49+
5250
ToolButton {
5351
id: moveNextButton
5452
icon.source: "qrc:/images-src/dock-move-next.svg"
5553
ToolTip.text: "Move widget to next slot"
5654
icon.color: systemPalette.windowText
57-
onClicked: viewModel.onMoveNextClicked()
55+
onClicked: viewModel.triggerMoveNextClicked()
5856
}
59-
57+
6058
ToolButton {
6159
id: closeButton
6260
icon.source: "qrc:/images-src/dock-close.svg"
6361
ToolTip.text: "Close the audio widget"
6462
icon.color: systemPalette.windowText
65-
onClicked: viewModel.onCloseClicked()
63+
onClicked: viewModel.triggerCloseClicked()
6664
}
6765

6866
Item {

friture/DelayEstimator.qml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import QtQuick.Controls 2.15
33

44
Rectangle {
55
id: root
6-
required property var viewModel
7-
required property string fixedFont
86

97
SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active }
108
color: systemPalette.window

friture/FritureMainWindow.qml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ Rectangle { // eventually move to ApplicationWindow
99
// title: qsTr("Friture") // ApplicationWindow
1010
// icon.source: "qrc:/images-src/window-icon.svg" // ApplicationWindow
1111

12-
required property MainWindowViewModel main_window_view_model
13-
required property string fixedFont
12+
property string fixedFont
1413

1514
ColumnLayout { // remove once we use ApplicationWindow
1615
anchors.fill: parent
@@ -26,15 +25,19 @@ Rectangle { // eventually move to ApplicationWindow
2625
ToolButton {
2726
id: startButton
2827
checkable: true
29-
checked: mainWindow.main_window_view_model.toolbar_view_model.recording
28+
checked: main_window_view_model.toolbar_view_model.recording
3029
icon.source: startButton.checked ? "qrc:/images-src/stop.svg" : "qrc:/images-src/start.svg"
3130
text: startButton.checked ? qsTr("Stop") : qsTr("Start")
3231
ToolTip.text: qsTr("Start/Stop")
3332
icon.height: 32
3433
icon.width: 32
35-
//shortcut: "Space"
34+
Shortcut {
35+
context: Qt.ApplicationShortcut
36+
sequences: ["Space"]
37+
onActivated: startButton.clicked()
38+
}
3639
onClicked: {
37-
mainWindow.main_window_view_model.toolbar_view_model.recording_toggle()
40+
main_window_view_model.toolbar_view_model.recording_toggle()
3841
}
3942
}
4043
ToolButton {
@@ -45,7 +48,7 @@ Rectangle { // eventually move to ApplicationWindow
4548
icon.height: 32
4649
icon.width: 32
4750
onClicked: {
48-
mainWindow.main_window_view_model.toolbar_view_model.new_dock()
51+
main_window_view_model.toolbar_view_model.new_dock()
4952
}
5053
}
5154
ToolButton {
@@ -56,7 +59,7 @@ Rectangle { // eventually move to ApplicationWindow
5659
icon.height: 32
5760
icon.width: 32
5861
onClicked: {
59-
mainWindow.main_window_view_model.toolbar_view_model.settings()
62+
main_window_view_model.toolbar_view_model.settings()
6063
}
6164
}
6265
ToolButton {
@@ -66,7 +69,7 @@ Rectangle { // eventually move to ApplicationWindow
6669
icon.height: 32
6770
icon.width: 32
6871
onClicked: {
69-
mainWindow.main_window_view_model.toolbar_view_model.about()
72+
main_window_view_model.toolbar_view_model.about()
7073
}
7174
}
7275
}
@@ -77,7 +80,6 @@ Rectangle { // eventually move to ApplicationWindow
7780
Layout.fillWidth: true
7881
Layout.fillHeight: true
7982
fixedFont: mainWindow.fixedFont
80-
main_window_view_model: mainWindow.main_window_view_model
8183
}
8284
}
8385
}

friture/Generator.qml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import QtQuick 2.15
22
import QtQuick.Controls 2.15
33
import QtQuick.Layouts 1.15
4-
import QtQuick.Dialogs 1.3
54
import QtQml 2.15
65
import "./generators"
76

87
Rectangle {
98
id: generatorRoot
10-
required property var viewModel
11-
required property string fixedFont
129

1310
SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active }
1411
color: systemPalette.window
@@ -34,28 +31,33 @@ Rectangle {
3431
}
3532

3633
SineSettings {
37-
viewModel: generatorRoot.viewModel.sineGenerator
38-
visible: generatorRoot.viewModel.generatorIndex === 0
34+
Layout.fillWidth: true
35+
settingsViewModel: viewModel.sineGenerator
36+
visible: viewModel.generatorIndex === 0
3937
}
4038

4139
WhiteSettings {
42-
viewModel: generatorRoot.viewModel.whiteGenerator
43-
visible: generatorRoot.viewModel.generatorIndex === 1
40+
Layout.fillWidth: true
41+
settingsViewModel: viewModel.whiteGenerator
42+
visible: viewModel.generatorIndex === 1
4443
}
4544

4645
PinkSettings {
47-
viewModel: generatorRoot.viewModel.pinkGenerator
48-
visible: generatorRoot.viewModel.generatorIndex === 2
46+
Layout.fillWidth: true
47+
settingsViewModel: viewModel.pinkGenerator
48+
visible: viewModel.generatorIndex === 2
4949
}
5050

5151
SweepSettings {
52-
viewModel: generatorRoot.viewModel.sweepGenerator
53-
visible: generatorRoot.viewModel.generatorIndex === 3
52+
Layout.fillWidth: true
53+
settingsViewModel: viewModel.sweepGenerator
54+
visible: viewModel.generatorIndex === 3
5455
}
5556

5657
BurstSettings {
57-
viewModel: generatorRoot.viewModel.burstGenerator
58-
visible: generatorRoot.viewModel.generatorIndex === 4
58+
Layout.fillWidth: true
59+
settingsViewModel: viewModel.burstGenerator
60+
visible: viewModel.generatorIndex === 4
5961
}
6062
}
6163
}

friture/HistPlot.qml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import QtQuick.Shapes 1.15
55
import Friture 1.0
66

77
Plot {
8-
required property var viewModel
9-
required property string fixedFont
10-
118
scopedata: viewModel
129

1310
Repeater {

friture/ImagePlot.qml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import QtQuick.Shapes 1.15
55
import Friture 1.0
66

77
Plot {
8-
required property var viewModel
9-
required property string fixedFont
10-
118
scopedata: viewModel
129

1310
Repeater {

friture/MainWindow.qml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ Rectangle {
99
SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active }
1010
color: systemPalette.window
1111

12-
required property MainWindowViewModel main_window_view_model
13-
required property string fixedFont
12+
property string fixedFont
1413

1514
GridLayout {
1615
objectName: "main_row_layout"
1716
anchors.fill: parent
18-
rows: main_window.main_window_view_model.playback_control_enabled ? 2 : 1
17+
rows: main_window_view_model.playback_control_enabled ? 2 : 1
1918
columns: 2
2019
rowSpacing: 3
2120
columnSpacing: 3
2221

2322
Levels {
24-
level_view_model: main_window.main_window_view_model.level_view_model
23+
level_view_model: main_window_view_model.level_view_model
2524
Layout.row: 0
26-
Layout.rowSpan: main_window.main_window_view_model.playback_control_enabled ? 2 : 1
25+
Layout.rowSpan: main_window_view_model.playback_control_enabled ? 2 : 1
2726
Layout.column: 0
2827
Layout.fillHeight: true
2928
Layout.margins: 5
@@ -47,9 +46,9 @@ Rectangle {
4746
Layout.fillWidth: true
4847
Layout.margins: 5
4948

50-
viewModel: main_window.main_window_view_model.playback_control_view_model
49+
viewModel: main_window_view_model.playback_control_view_model
5150

52-
visible: main_window.main_window_view_model.playback_control_enabled
51+
visible: main_window_view_model.playback_control_enabled
5352
}
5453
}
5554
}

0 commit comments

Comments
 (0)