Merge deab6ba1bc6ef7afeec9485ee815d5b8390a01c7 into 12e7a9ba59e452a4fce9bad25e1b71e0ddf1cf94

This commit is contained in:
hefee 2025-02-10 12:47:26 +05:30 committed by GitHub
commit e2e79d1c27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 47 additions and 43 deletions

View File

@ -26,10 +26,10 @@ import signal
import json
import psutil
import getpass
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from PySide6.QtCore import Slot, Qt
from PySide6.QtGui import QPalette, QColor
from qtpy.QtCore import Slot, Qt
from qtpy.QtGui import QPalette, QColor
from onionshare_cli.common import Common
from onionshare_cli.settings import Settings

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import json
import os
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from onionshare_cli.censorship import (
CensorshipCircumvention,

View File

@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
from pkg_resources import resource_filename
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from . import strings
from onionshare_cli.onion import (
@ -624,9 +624,11 @@ class ToggleCheckbox(QtWidgets.QCheckBox):
x = (
rect.width() - rect.x() - self.w + 20
) # 20 is the padding between text and toggle
x = int(x)
y = (
self.height() / 2 - self.h / 2 + 16
) # 16 is the padding top for the checkbox
y = int(y)
self.toggleRect = QtCore.QRect(x, y, self.w, self.h)
painter.setBrush(QtGui.QColor(self.bg_color))
painter.drawRoundedRect(x, y, self.w, self.h, self.h / 2, self.h / 2)

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import time
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy 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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
import requests
import os
import base64

View File

@ -1,4 +1,4 @@
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from onionshare_cli.mode_settings import ModeSettings

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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
import platform
import datetime
from onionshare_cli.settings import Settings

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 PySide6 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
from onionshare_cli.common import AutoStopTimer

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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy 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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from ... import strings
from ...widgets import Alert, AddFileDialog

View File

@ -22,9 +22,11 @@ import time
import subprocess
import os
from datetime import datetime
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from urllib.parse import unquote
from ... import strings
from ...widgets import Alert
from ...gui_common import GuiCommon
@ -122,7 +124,7 @@ class ShareHistoryItem(HistoryItem):
self.progress_bar.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.progress_bar.setAlignment(QtCore.Qt.AlignHCenter)
self.progress_bar.setMinimum(0)
self.progress_bar.setMaximum(total_bytes / 1024)
self.progress_bar.setMaximum(total_bytes // 1024)
self.progress_bar.setValue(0)
self.progress_bar.setStyleSheet(
self.common.gui.css["downloads_uploads_progress_bar"]
@ -141,7 +143,7 @@ class ShareHistoryItem(HistoryItem):
def update(self, downloaded_bytes):
self.downloaded_bytes = downloaded_bytes
self.progress_bar.setValue(downloaded_bytes / 1024)
self.progress_bar.setValue(downloaded_bytes // 1024)
if (downloaded_bytes / 1024) == (self.progress_bar.total_bytes / 1024):
pb_fmt = strings._("gui_all_modes_progress_complete").format(
self.common.format_seconds(time.time() - self.started)
@ -393,8 +395,8 @@ class ReceiveHistoryItem(HistoryItem):
total_uploaded_bytes += data["progress"][filename]["uploaded_bytes"]
# Update the progress bar
self.progress_bar.setMaximum(self.content_length / 1024)
self.progress_bar.setValue(total_uploaded_bytes / 1024)
self.progress_bar.setMaximum(self.content_length // 1024)
self.progress_bar.setValue(total_uploaded_bytes // 1024)
elapsed = datetime.now() - self.started
if elapsed.seconds < 10:
@ -529,7 +531,7 @@ class IndividualFileHistoryItem(HistoryItem):
else:
self.total_bytes = data["filesize"]
self.progress_bar.setMinimum(0)
self.progress_bar.setMaximum(data["filesize"] / 1024)
self.progress_bar.setMaximum(data["filesize"] // 1024)
self.progress_bar.total_bytes = data["filesize"]
# Start at 0
@ -538,7 +540,7 @@ class IndividualFileHistoryItem(HistoryItem):
def update(self, downloaded_bytes):
self.downloaded_bytes = downloaded_bytes
self.progress_bar.setValue(downloaded_bytes / 1024)
self.progress_bar.setValue(downloaded_bytes // 1024)
if (downloaded_bytes / 1024) == (self.progress_bar.total_bytes / 1024):
self.status_code_label.setText("200")
self.status_code_label.setStyleSheet(

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 PySide6 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
from ... import strings

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy 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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from onionshare_cli.common import Common
from onionshare_cli.web import Web

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 PySide6 import QtCore
from qtpy import QtCore
class CompressThread(QtCore.QThread):

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from onionshare_cli.common import Common
from onionshare_cli.web import Web

View File

@ -18,8 +18,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import textwrap
from PySide6 import QtCore, QtWidgets, QtGui
from PySide6.QtCore import Qt
from qtpy import QtCore, QtWidgets, QtGui
from qtpy.QtCore import Qt
from .. import strings
from ..widgets import Alert

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import queue
from PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from onionshare_cli.onionshare import OnionShare
from onionshare_cli.web import Web
@ -69,11 +69,11 @@ class NewTabButton(QtWidgets.QPushButton):
self.title_label.setStyleSheet(self.common.gui.css["new_tab_title_text"])
if self.title_label.sizeHint().width() >= 250:
self.title_label.setGeometry(
(self.width() - 250) / 2, self.height() - 120, 250, 60
(self.width() - 250) // 2, self.height() - 120, 250, 60
)
else:
self.title_label.setGeometry(
(self.width() - 250) / 2, self.height() - 100, 250, 30
(self.width() - 250) // 2, self.height() - 100, 250, 30
)
self.title_label.show()
@ -82,7 +82,7 @@ class NewTabButton(QtWidgets.QPushButton):
self.text_label.setAlignment(QtCore.Qt.AlignCenter)
self.text_label.setStyleSheet(self.common.gui.css["new_tab_button_text"])
self.text_label.setGeometry(
(self.width() - 200) / 2, self.height() - 50, 200, 30
(self.width() - 200) // 2, self.height() - 50, 200, 30
)
self.text_label.show()

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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
from onionshare_cli.mode_settings import ModeSettings

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 PySide6 import QtCore
from qtpy import QtCore
from onionshare_cli.onion import (
TorErrorInvalidSetting,

View File

@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import time
from PySide6 import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets
from onionshare_cli.onion import (
BundledTorCanceled,

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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
import sys
import platform
import os

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 PySide6 import QtCore
from qtpy import QtCore
import datetime
import re
import socks

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 PySide6 import QtCore, QtWidgets, QtGui
from qtpy import QtCore, QtWidgets, QtGui
import qrcode
from . import strings

View File

@ -2,7 +2,7 @@ import sys
import os
from datetime import datetime, timedelta
from PySide6 import QtTest
from qtpy import QtTest
# Force tests to look for resources in the source code tree

View File

@ -7,7 +7,7 @@ import secrets
import platform
import sys
from PySide6 import QtCore, QtTest, QtWidgets
from qtpy import QtCore, QtTest, QtWidgets
from onionshare_cli.common import Common

View File

@ -1,6 +1,6 @@
import requests
from PySide6 import QtTest
from qtpy import QtTest
from .gui_base_test import GuiBaseTest

View File

@ -6,7 +6,7 @@ import shutil
import sys
from datetime import datetime, timedelta
from PySide6 import QtCore, QtTest
from qtpy import QtCore, QtTest
from .gui_base_test import GuiBaseTest

View File

@ -3,7 +3,7 @@ import requests
import tempfile
import zipfile
from PySide6 import QtCore, QtTest
from qtpy import QtCore, QtTest
from .gui_base_test import GuiBaseTest

View File

@ -1,6 +1,6 @@
import os
from PySide6 import QtCore, QtTest, QtWidgets
from qtpy import QtCore, QtTest, QtWidgets
from .gui_base_test import GuiBaseTest

View File

@ -1,6 +1,6 @@
import requests
from PySide6 import QtTest
from qtpy import QtTest
from .gui_base_test import GuiBaseTest