Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
- name: Setup xvfb (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libglib2.0-0 libgl1-mesa-dev
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
# start xvfb in the background
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Install Python dependencies
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.16.12
0.17.0
- BREAKING CHANGE: migrate codebase from PyQt5 to PyQt6
- tests: allow to use different DCOR instance for testing
- tests: make tests independent of testing user
0.16.11
Expand Down
20 changes: 10 additions & 10 deletions dcoraid/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@
setup_logging("dclab")
setup_logging("requests", level=logging.INFO)

from PyQt5.QtWidgets import QApplication
from PyQt6.QtWidgets import QApplication

Check warning on line 13 in dcoraid/__main__.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/__main__.py#L13

Added line #L13 was not covered by tests

if platform.win32_ver()[0] == "7":
# Use software OpenGL on Windows 7, because sometimes the
# window content becomes plain white.
# Not sure whether this actually works.
from PyQt5.QtCore import Qt, QCoreApplication
from PyQt5.QtGui import QGuiApplication
from PyQt6.QtCore import Qt, QCoreApplication
from PyQt6.QtGui import QGuiApplication

Check warning on line 20 in dcoraid/__main__.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/__main__.py#L19-L20

Added lines #L19 - L20 were not covered by tests
QApplication.setAttribute(Qt.AA_UseSoftwareOpenGL)
QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL)
QGuiApplication.setAttribute(Qt.AA_UseSoftwareOpenGL)

app = QApplication(sys.argv)

if splash:
from PyQt5.QtWidgets import QSplashScreen
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import QEventLoop
from PyQt6.QtWidgets import QSplashScreen
from PyQt6.QtGui import QPixmap
from PyQt6.QtCore import QEventLoop

Check warning on line 30 in dcoraid/__main__.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/__main__.py#L28-L30

Added lines #L28 - L30 were not covered by tests
ref_splash = resources.files("dcoraid.img") / "splash.png"
with resources.as_file(ref_splash) as splash_path:
splash_pix = QPixmap(str(splash_path))
splash = QSplashScreen(splash_pix)
splash.setMask(splash_pix.mask())
splash.show()
app.processEvents(QEventLoop.AllEvents, 300)
app.processEvents(QEventLoop.ProcessEventsFlag.AllEvents, 300)

Check warning on line 37 in dcoraid/__main__.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/__main__.py#L37

Added line #L37 was not covered by tests

from PyQt5 import QtCore, QtGui
from PyQt6 import QtCore, QtGui

Check warning on line 39 in dcoraid/__main__.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/__main__.py#L39

Added line #L39 was not covered by tests
from .gui import DCORAid

# Set Application Icon
Expand All @@ -45,14 +45,14 @@
app.setWindowIcon(QtGui.QIcon(str(icon_path)))

# Use dots as decimal separators
QtCore.QLocale.setDefault(QtCore.QLocale(QtCore.QLocale.C))
QtCore.QLocale.setDefault(QtCore.QLocale(QtCore.QLocale.Language.C))

Check warning on line 48 in dcoraid/__main__.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/__main__.py#L48

Added line #L48 was not covered by tests

window = DCORAid()

if splash:
splash.finish(window)

sys.exit(app.exec_())
sys.exit(app.exec())

Check warning on line 55 in dcoraid/__main__.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/__main__.py#L55

Added line #L55 was not covered by tests


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion dcoraid/gui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil
import tempfile

from PyQt5 import QtCore
from PyQt6 import QtCore

from ..api import CKANAPI

Expand Down
6 changes: 3 additions & 3 deletions dcoraid/gui/browse_public/widget_browse_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from importlib import resources

from PyQt5 import uic, QtCore, QtWidgets
from PyQt6 import uic, QtCore, QtWidgets

from ...common import ConnectionTimeoutErrors
from ...dbmodel import APIInterrogator
Expand All @@ -29,7 +29,7 @@

@QtCore.pyqtSlot()
def on_public_search(self):
self.setCursor(QtCore.Qt.WaitCursor)
self.setCursor(QtCore.Qt.CursorShape.WaitCursor)

Check warning on line 32 in dcoraid/gui/browse_public/widget_browse_public.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/gui/browse_public/widget_browse_public.py#L32

Added line #L32 was not covered by tests
api = get_ckan_api(
public=not self.checkBox_public_include_private.isChecked())
try:
Expand All @@ -44,7 +44,7 @@
self,
f"Failed to connect to {api.server}",
tb.format_exc(limit=1))
self.setCursor(QtCore.Qt.ArrowCursor)
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)

Check warning on line 47 in dcoraid/gui/browse_public/widget_browse_public.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/gui/browse_public/widget_browse_public.py#L47

Added line #L47 was not covered by tests

@staticmethod
def find_main_window():
Expand Down
8 changes: 4 additions & 4 deletions dcoraid/gui/dbview/drag_table_widget.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import Qt
from PyQt6 import QtWidgets, QtCore, QtGui
from PyQt6.QtCore import Qt


class DragTableWidget(QtWidgets.QTableWidget):
Expand All @@ -9,7 +9,7 @@

urls = []
for item in self.selectedItems():
data = item.data(Qt.UserRole + 1)
data = item.data(Qt.ItemDataRole.UserRole + 1)

Check warning on line 12 in dcoraid/gui/dbview/drag_table_widget.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/gui/dbview/drag_table_widget.py#L12

Added line #L12 was not covered by tests
urls.append(QtCore.QUrl(data))

mime_data = QtCore.QMimeData()
Expand All @@ -20,4 +20,4 @@
drag.setHotSpot(e.pos() - self.rect().topLeft())

# This magic is somehow required to get drag working.
dropAction = drag.exec_(Qt.CopyAction) # noqa: F841
dropAction = drag.exec(Qt.CopyAction) # noqa: F841

Check warning on line 23 in dcoraid/gui/dbview/drag_table_widget.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/gui/dbview/drag_table_widget.py#L23

Added line #L23 was not covered by tests
14 changes: 8 additions & 6 deletions dcoraid/gui/dbview/filter_base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
from importlib import resources

from PyQt5 import QtCore, QtGui, QtWidgets, uic
from PyQt6 import QtCore, QtGui, QtWidgets, uic


class FilterBase(QtWidgets.QWidget):
Expand All @@ -22,7 +22,8 @@ def __init__(self, *args, **kwargs):

# resize first column
header = self.tableWidget.horizontalHeader()
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
header.setSectionResizeMode(0,
QtWidgets.QHeaderView.ResizeMode.Stretch)

# trigger user selection change signal
self.tableWidget.itemSelectionChanged.connect(self.on_entry_selected)
Expand All @@ -38,9 +39,10 @@ def __init__(self, *args, **kwargs):
self.tableWidget.setDragEnabled(False) # disable drag
self.tableWidget.setDragDropOverwriteMode(False) # don't overwrite
self.tableWidget.setDragDropMode(
QtWidgets.QAbstractItemView.NoDragDrop) # drag & drop disabled
# drag & drop disabled
QtWidgets.QAbstractItemView.DragDropMode.NoDragDrop)
self.tableWidget.setDefaultDropAction(
QtCore.Qt.IgnoreAction) # no drop by default
QtCore.Qt.DropAction.IgnoreAction) # no drop by default

def get_entry_actions(self, row, entry):
"""This is defined in the subclasses (Circle, Collection, etc)"""
Expand Down Expand Up @@ -87,8 +89,8 @@ def set_entry(self, row, entry):
horz_layout.setContentsMargins(2, 0, 2, 0)

spacer = QtWidgets.QSpacerItem(0, 0,
QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Minimum)
QtWidgets.QSizePolicy.Policy.Expanding,
QtWidgets.QSizePolicy.Policy.Minimum)
horz_layout.addItem(spacer)

for action in self.get_entry_actions(row, entry):
Expand Down
2 changes: 1 addition & 1 deletion dcoraid/gui/dbview/filter_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from importlib import resources

from PyQt5 import QtCore, QtWidgets, uic
from PyQt6 import QtCore, QtWidgets, uic

from ..tools import ShowWaitCursor
from ..api import get_ckan_api
Expand Down
12 changes: 6 additions & 6 deletions dcoraid/gui/dbview/filter_views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import partial
import webbrowser

from PyQt5 import QtCore, QtWidgets
from PyQt5.QtCore import Qt
from PyQt6 import QtCore, QtWidgets
from PyQt6.QtCore import Qt

from ..api import get_ckan_api
from ..tools import ShowWaitCursor
Expand Down Expand Up @@ -64,7 +64,7 @@ def download_collection(self, collection_name, condensed=False):
for res_dict in ds_dict.get("resources", []):
self.download_resource.emit(res_dict["id"], condensed)
QtWidgets.QApplication.processEvents(
QtCore.QEventLoop.AllEvents,
QtCore.QEventLoop.ProcessEventsFlag.AllEvents,
300)

def get_entry_actions(self, row, entry):
Expand Down Expand Up @@ -108,7 +108,7 @@ def download_dataset(self, dataset_id, condensed=False):
for res_dict in ds_dict.get("resources", []):
self.download_resource.emit(res_dict["id"], condensed)
QtWidgets.QApplication.processEvents(
QtCore.QEventLoop.AllEvents,
QtCore.QEventLoop.ProcessEventsFlag.AllEvents,
300)

def get_entry_actions(self, row, entry):
Expand Down Expand Up @@ -139,7 +139,7 @@ def __init__(self, *args, **kwargs):
self.checkBox.setChecked(True)
self.tableWidget.setDragEnabled(True)
self.tableWidget.setDragDropMode(
QtWidgets.QAbstractItemView.DragOnly)
QtWidgets.QAbstractItemView.DragDropMode.DragOnly)
self.label_info.setText("<i>Tip: You can drag and drop your selection "
"from the resources list to Shape-Out!</i>")

Expand Down Expand Up @@ -172,4 +172,4 @@ def set_entry_label(self, row, entry):
item = self.tableWidget.item(row, 0)
api = get_ckan_api()
dcor_url = f"{api.server}/api/3/action/dcserv?id={entry['id']}"
item.setData(Qt.UserRole + 1, dcor_url)
item.setData(Qt.ItemDataRole.UserRole + 1, dcor_url)
24 changes: 13 additions & 11 deletions dcoraid/gui/download/widget_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import subprocess
import webbrowser

from PyQt5 import uic, QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QStandardPaths
from PyQt6 import uic, QtCore, QtGui, QtWidgets
from PyQt6.QtCore import QStandardPaths

from ...download import DownloadQueue

Expand All @@ -37,7 +37,7 @@
#: path to persistent shelf to be able to resume uploads on startup
self.shelf_path = os_path.join(
QStandardPaths.writableLocation(
QStandardPaths.AppLocalDataLocation),
QStandardPaths.StandardLocation.AppLocalDataLocation),
"persistent_download_jobs")

#: DownloadQueue instance
Expand Down Expand Up @@ -85,7 +85,7 @@
@QtCore.pyqtSlot(str, bool)
def download_resource(self, resource_id, condensed=False):
fallback = QStandardPaths.writableLocation(
QStandardPaths.DownloadLocation)
QStandardPaths.StandardLocation.DownloadLocation)
dl_path = self.settings.value("downloads/default path", fallback)
self.widget_jobs.jobs.new_job(resource_id, dl_path, condensed)

Expand Down Expand Up @@ -182,14 +182,14 @@
job.traceback = traceback.format_exc()

QtWidgets.QApplication.processEvents(
QtCore.QEventLoop.AllEvents,
300)
QtCore.QEventLoop.ProcessEventsFlag.AllEvents, 300)

# spacing (did not work in __init__)
header = self.horizontalHeader()
header.setSectionResizeMode(
0, QtWidgets.QHeaderView.ResizeToContents)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
0, QtWidgets.QHeaderView.ResizeMode.ResizeToContents)
header.setSectionResizeMode(

Check warning on line 191 in dcoraid/gui/download/widget_download.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/gui/download/widget_download.py#L191

Added line #L191 was not covered by tests
1, QtWidgets.QHeaderView.ResizeMode.Stretch)

self._busy_updating_widgets = False

Expand Down Expand Up @@ -219,9 +219,11 @@
horz_layout = QtWidgets.QHBoxLayout(widact)
horz_layout.setContentsMargins(2, 0, 2, 0)

spacer = QtWidgets.QSpacerItem(0, 0,
QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Minimum)
spacer = QtWidgets.QSpacerItem(

Check warning on line 222 in dcoraid/gui/download/widget_download.py

View check run for this annotation

Codecov / codecov/patch

dcoraid/gui/download/widget_download.py#L222

Added line #L222 was not covered by tests
0, 0,
QtWidgets.QSizePolicy.Policy.Expanding,
QtWidgets.QSizePolicy.Policy.Minimum
)
horz_layout.addItem(spacer)
if job.state == "error":
actions = [
Expand Down
2 changes: 1 addition & 1 deletion dcoraid/gui/logs/widget_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import time
import traceback

from PyQt5 import uic, QtCore, QtWidgets
from PyQt6 import uic, QtCore, QtWidgets

from ..._version import version

Expand Down
Loading
Loading