Port from PyQt5 to PySide2

This commit is contained in:
Micah Lee 2020-10-13 22:28:21 -07:00
parent b42f92d714
commit cb0494d46f
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
33 changed files with 86 additions and 106 deletions

View File

@ -8,29 +8,6 @@
If you're using Linux, install `tor` and `obfs4proxy` from either the [official Debian repository](https://support.torproject.org/apt/tor-deb-repo/), or from your package manager.
Then download Qt 5.14.0 for Linux:
```sh
cd ~/Downloads
wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run
```
If you'd like to check to make sure you have the exact installer I have, here is the sha256 checksum:
```sh
sha256sum qt-opensource-linux-x64-5.14.0.run
4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e qt-opensource-linux-x64-5.14.0.run
```
Then make it executable and install Qt:
```sh
chmod +x qt-opensource-linux-x64-5.14.0.run
./qt-opensource-linux-x64-5.14.0.run
```
You have to create a Qt account and login to install Qt. Choose the default installation folder in your home directory. The only component you need is `Qt 5.14.0` > `Desktop gcc 64-bit`.
#### macOS
#### Windows

View File

@ -1,6 +1,6 @@
[tool.briefcase]
project_name = "OnionShare"
bundle = "org.onionshare.OnionShare"
bundle = "org.onionshare"
version = "2.3.dev1"
url = "https://onionshare.org"
license = "GPLv3"
@ -21,9 +21,8 @@ requires = [
"flask-socketio",
"psutil",
"pycryptodome",
"PyQt5==5.14",
"PyQt5-sip",
"PySocks",
"pyside2",
"qrcode",
"requests",
"stem",
@ -35,7 +34,12 @@ requires = []
[tool.briefcase.app.onionshare.linux]
requires = []
system_requires = ["tor", "obfs4proxy"]
system_requires = [
"tor",
"obfs4proxy",
"gcc",
"python3-dev",
]
[tool.briefcase.app.onionshare.windows]
requires = ["pywin32"]

View File

@ -1 +0,0 @@
from .__main__ import *

View File

@ -27,7 +27,7 @@ import signal
import json
import psutil
import getpass
from PyQt5 import QtCore, QtWidgets
from PySide2 import QtCore, QtWidgets
from onionshare_cli.common import Common

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.web import Web

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
import sys
import platform
import datetime
@ -41,7 +41,7 @@ class SettingsDialog(QtWidgets.QDialog):
Settings dialog.
"""
settings_saved = QtCore.pyqtSignal()
settings_saved = QtCore.Signal()
def __init__(self, common):
super(SettingsDialog, self).__init__()

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.common import AutoStopTimer
@ -36,14 +36,14 @@ class Mode(QtWidgets.QWidget):
The class that all modes inherit from
"""
start_server_finished = QtCore.pyqtSignal()
stop_server_finished = QtCore.pyqtSignal()
starting_server_step2 = QtCore.pyqtSignal()
starting_server_step3 = QtCore.pyqtSignal()
starting_server_error = QtCore.pyqtSignal(str)
starting_server_early = QtCore.pyqtSignal()
set_server_active = QtCore.pyqtSignal(bool)
change_persistent = QtCore.pyqtSignal(int, bool)
start_server_finished = QtCore.Signal()
stop_server_finished = QtCore.Signal()
starting_server_step2 = QtCore.Signal()
starting_server_step3 = QtCore.Signal()
starting_server_error = QtCore.Signal(str)
starting_server_early = QtCore.Signal()
set_server_active = QtCore.Signal(bool)
change_persistent = QtCore.Signal(int, bool)
def __init__(self, tab):
super(Mode, self).__init__()

View File

@ -22,7 +22,7 @@ import os
import random
import string
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onion import *
from onionshare_cli.common import Common
@ -39,8 +39,8 @@ class ChatMode(Mode):
Parts of the main window UI for sharing files.
"""
success = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(str)
success = QtCore.Signal()
error = QtCore.Signal(str)
def init(self):
"""

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from ... import strings
from ...widgets import Alert, AddFileDialog
@ -104,8 +104,8 @@ class FileList(QtWidgets.QListWidget):
The list of files and folders in the GUI.
"""
files_dropped = QtCore.pyqtSignal()
files_updated = QtCore.pyqtSignal()
files_dropped = QtCore.Signal()
files_updated = QtCore.Signal()
def __init__(self, common, background_image_filename, header_text, parent=None):
super(FileList, self).__init__(parent)

View File

@ -22,7 +22,7 @@ import time
import subprocess
import os
from datetime import datetime
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from ... import strings
from ...widgets import Alert

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets
from PySide2 import QtCore, QtWidgets
from ... import strings
@ -28,7 +28,7 @@ class ModeSettingsWidget(QtWidgets.QWidget):
All of the common settings for each mode are in this widget
"""
change_persistent = QtCore.pyqtSignal(int, bool)
change_persistent = QtCore.Signal(int, bool)
def __init__(self, common, tab, mode_settings):
super(ModeSettingsWidget, self).__init__()

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.web import Web

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onion import *
from onionshare_cli.common import Common
@ -427,7 +427,7 @@ class ShareMode(Mode):
class ZipProgressBar(QtWidgets.QProgressBar):
update_processed_size_signal = QtCore.pyqtSignal(int)
update_processed_size_signal = QtCore.Signal(int)
def __init__(self, common, total_files_size):
super(ZipProgressBar, self).__init__()

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore
from PySide2 import QtCore
class CompressThread(QtCore.QThread):
@ -26,8 +26,8 @@ class CompressThread(QtCore.QThread):
Compresses files to be shared
"""
success = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(str)
success = QtCore.Signal()
error = QtCore.Signal(str)
def __init__(self, mode):
super(CompressThread, self).__init__()

View File

@ -22,7 +22,7 @@ import os
import random
import string
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onion import *
from onionshare_cli.common import Common
@ -41,8 +41,8 @@ class WebsiteMode(Mode):
Parts of the main window UI for sharing files.
"""
success = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(str)
success = QtCore.Signal()
error = QtCore.Signal(str)
def init(self):
"""

View File

@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import platform
import textwrap
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtCore import Qt
from PySide2 import QtCore, QtWidgets, QtGui
from PySide2.QtCore import Qt
from .. import strings
from ..widgets import Alert
@ -34,13 +34,13 @@ class ServerStatus(QtWidgets.QWidget):
The server status chunk of the GUI.
"""
server_started = QtCore.pyqtSignal()
server_started_finished = QtCore.pyqtSignal()
server_stopped = QtCore.pyqtSignal()
server_canceled = QtCore.pyqtSignal()
button_clicked = QtCore.pyqtSignal()
url_copied = QtCore.pyqtSignal()
hidservauth_copied = QtCore.pyqtSignal()
server_started = QtCore.Signal()
server_started_finished = QtCore.Signal()
server_stopped = QtCore.Signal()
server_canceled = QtCore.Signal()
button_clicked = QtCore.Signal()
url_copied = QtCore.Signal()
hidservauth_copied = QtCore.Signal()
STATUS_STOPPED = 0
STATUS_WORKING = 1

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import queue
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onionshare import OnionShare
from onionshare_cli.web import Web
@ -80,9 +80,9 @@ class Tab(QtWidgets.QWidget):
A GUI tab, you know, sort of like in a web browser
"""
change_title = QtCore.pyqtSignal(int, str)
change_icon = QtCore.pyqtSignal(int, str)
change_persistent = QtCore.pyqtSignal(int, bool)
change_title = QtCore.Signal(int, str)
change_icon = QtCore.Signal(int, str)
change_persistent = QtCore.Signal(int, bool)
def __init__(
self,

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.mode_settings import ModeSettings
@ -33,7 +33,7 @@ class TabWidget(QtWidgets.QTabWidget):
A custom tab widget, that has a "+" button for adding new tabs
"""
bring_to_front = QtCore.pyqtSignal()
bring_to_front = QtCore.Signal()
def __init__(self, common, system_tray, status_bar):
super(TabWidget, self).__init__()
@ -259,7 +259,7 @@ class TabBar(QtWidgets.QTabBar):
A custom tab bar
"""
move_new_tab_button = QtCore.pyqtSignal()
move_new_tab_button = QtCore.Signal()
def __init__(self):
super(TabBar, self).__init__()

View File

@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
import json
import os
from PyQt5 import QtCore
from PySide2 import QtCore
from onionshare_cli.onion import (
TorTooOld,
@ -44,9 +44,9 @@ class OnionThread(QtCore.QThread):
Starts the onion service, and waits for it to finish
"""
success = QtCore.pyqtSignal()
success_early = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(str)
success = QtCore.Signal()
success_early = QtCore.Signal()
error = QtCore.Signal(str)
def __init__(self, mode):
super(OnionThread, self).__init__()
@ -114,8 +114,8 @@ class WebThread(QtCore.QThread):
Starts the web service
"""
success = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(str)
success = QtCore.Signal()
error = QtCore.Signal(str)
def __init__(self, mode):
super(WebThread, self).__init__()
@ -133,8 +133,8 @@ class AutoStartTimer(QtCore.QThread):
Waits for a prescribed time before allowing a share to start
"""
success = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(str)
success = QtCore.Signal()
error = QtCore.Signal(str)
def __init__(self, mode, canceled=False):
super(AutoStartTimer, self).__init__()
@ -180,8 +180,8 @@ class EventHandlerThread(QtCore.QThread):
{"type": "new_share_tab", "filenames": ["file1", "file2"]}
"""
new_tab = QtCore.pyqtSignal()
new_share_tab = QtCore.pyqtSignal(list)
new_tab = QtCore.Signal()
new_share_tab = QtCore.Signal(list)
def __init__(self, common):
super(EventHandlerThread, self).__init__()

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onion import *
@ -32,7 +32,7 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
Connecting to Tor dialog.
"""
open_settings = QtCore.pyqtSignal()
open_settings = QtCore.Signal()
def __init__(self, common, custom_settings=False):
super(TorConnectionDialog, self).__init__(None)
@ -123,10 +123,10 @@ class TorConnectionDialog(QtWidgets.QProgressDialog):
class TorConnectionThread(QtCore.QThread):
tor_status_update = QtCore.pyqtSignal(str, str)
connected_to_tor = QtCore.pyqtSignal()
canceled_connecting_to_tor = QtCore.pyqtSignal()
error_connecting_to_tor = QtCore.pyqtSignal(str)
tor_status_update = QtCore.Signal(str, str)
connected_to_tor = QtCore.Signal()
canceled_connecting_to_tor = QtCore.Signal()
error_connecting_to_tor = QtCore.Signal(str)
def __init__(self, common, settings, dialog):
super(TorConnectionThread, self).__init__()

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore
from PySide2 import QtCore
import datetime, time, socket, re, platform
import socks
from distutils.version import LooseVersion as Version
@ -57,10 +57,10 @@ class UpdateChecker(QtCore.QObject):
Only check at most once per day, unless force is True.
"""
update_available = QtCore.pyqtSignal(str, str, str)
update_not_available = QtCore.pyqtSignal()
update_error = QtCore.pyqtSignal()
update_invalid_version = QtCore.pyqtSignal(str)
update_available = QtCore.Signal(str, str, str)
update_not_available = QtCore.Signal()
update_error = QtCore.Signal()
update_invalid_version = QtCore.Signal(str)
def __init__(self, common, onion):
super(UpdateChecker, self).__init__()
@ -183,10 +183,10 @@ class UpdateChecker(QtCore.QObject):
class UpdateThread(QtCore.QThread):
update_available = QtCore.pyqtSignal(str, str, str)
update_not_available = QtCore.pyqtSignal()
update_error = QtCore.pyqtSignal()
update_invalid_version = QtCore.pyqtSignal(str)
update_available = QtCore.Signal(str, str, str)
update_not_available = QtCore.Signal()
update_error = QtCore.Signal()
update_invalid_version = QtCore.Signal(str)
def __init__(self, common, onion, force=False):
super(UpdateThread, self).__init__()

View File

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PyQt5 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets, QtGui
import qrcode
from . import strings

View File

@ -10,7 +10,7 @@ import tempfile
import secrets
import platform
from PyQt5 import QtCore, QtTest, QtWidgets
from PySide2 import QtCore, QtTest, QtWidgets
from onionshare_cli.common import Common
from onionshare_cli.settings import Settings

View File

@ -5,7 +5,7 @@ import shutil
import sys
from datetime import datetime, timedelta
from PyQt5 import QtCore, QtTest
from PySide2 import QtCore, QtTest
from .gui_base_test import GuiBaseTest

View File

@ -4,7 +4,7 @@ import requests
import tempfile
import zipfile
from PyQt5 import QtCore, QtTest
from PySide2 import QtCore, QtTest
from .gui_base_test import GuiBaseTest

View File

@ -1,7 +1,7 @@
import pytest
import os
from PyQt5 import QtCore, QtTest, QtWidgets
from PySide2 import QtCore, QtTest, QtWidgets
from .gui_base_test import GuiBaseTest

View File

@ -4,7 +4,7 @@ import requests
import shutil
from datetime import datetime, timedelta
from PyQt5 import QtCore, QtTest
from PySide2 import QtCore, QtTest
from .gui_base_test import GuiBaseTest