diff --git a/ScaledScrollBar.py b/ScaledScrollBar.py index 26d854d..46d7f9a 100644 --- a/ScaledScrollBar.py +++ b/ScaledScrollBar.py @@ -1,7 +1,7 @@ import math -from PyQt6.QtWidgets import QScrollBar -from PyQt6.QtCore import pyqtSignal +from PySide6.QtWidgets import QScrollBar +from PySide6.QtCore import Signal import logging log = logging.getLogger("scaledScrollBar") @@ -10,7 +10,7 @@ log = logging.getLogger("scaledScrollBar") class ScaledScrollBar(QScrollBar): is_huge = False - valueChanged = pyqtSignal(str) + scaledValueChanged = Signal(str) """Signal emitted when the scroll bar value changes. **Note**: The value is a string and must be parsed into an int. QT's signal api only supports 32bit integers. Ints larger @@ -49,6 +49,6 @@ class ScaledScrollBar(QScrollBar): if self.is_huge: real_value = (value / self.maximum()) * self.real_maximum # print("scaled value changed: %d -> %d (%f)" % (value, real_value, value / self.maximum())) - self.valueChanged.emit(str(int(real_value))) + self.scaledValueChanged.emit(str(int(real_value))) else: - self.valueChanged.emit(str(int(value))) + self.scaledValueChanged.emit(str(int(value))) diff --git a/aboutdialog.py b/aboutdialog.py index 06e9bd0..4d89825 100644 --- a/aboutdialog.py +++ b/aboutdialog.py @@ -1,8 +1,9 @@ import textwrap -from PyQt6.QtCore import Qt -from PyQt6.QtGui import QFont, QPixmap -from PyQt6.QtWidgets import * +import PySide6 +from PySide6.QtCore import Qt +from PySide6.QtGui import QFont, QPixmap +from PySide6.QtWidgets import * import constants from label import Label @@ -33,7 +34,7 @@ class AboutDialog(QDialog): hbox = QHBoxLayout(heading) hbox.addWidget(app_icon) hbox.addWidget(VBox(heading_app_name, version)) - hbox.addSpacerItem(QSpacerItem(1, 1, hPolicy=QSizePolicy.Policy.Expanding)) + hbox.addSpacerItem(QSpacerItem(1, 1, hData=QSizePolicy.Policy.Expanding)) heading.layout = hbox self.layout.addWidget(heading) @@ -54,20 +55,24 @@ class AboutDialog(QDialog): result.layout = QVBoxLayout(result) label = Label(self.tr(textwrap.dedent(""" Log file viewer
- (c) 2021 Open Text Corporation
- License: GPL"""))) + (c) 2022 Open Text Corporation
+ License: LGPL v3"""))) result.layout.addWidget(label) return result def _license(self) -> QWidget: + dependencies = """ + """.format(pyside=PySide6.__version__, qt=PySide6.QtCore.__version__) + label = self.tr(textwrap.dedent(dependencies)) + result = QWidget() result.layout = QVBoxLayout(result) - result.layout.addWidget(Label(self.tr(textwrap.dedent(""" - """)))) + result.layout.addWidget(Label(label)) return result def _version(self): @@ -75,3 +80,4 @@ class AboutDialog(QDialog): line = f.readline() version = line.strip() return version + diff --git a/bigtext.py b/bigtext.py index ce06b64..031dc6c 100644 --- a/bigtext.py +++ b/bigtext.py @@ -4,12 +4,12 @@ import math import os import time from typing import Callable, List -from PyQt6 import QtGui +from PySide6 import QtGui -from PyQt6.QtCore import * -from PyQt6.QtGui import * -from PyQt6.QtGui import QMouseEvent -from PyQt6.QtWidgets import * +from PySide6.QtCore import * +from PySide6.QtGui import * +from PySide6.QtGui import QMouseEvent +from PySide6.QtWidgets import * import constants from ScaledScrollBar import ScaledScrollBar @@ -19,7 +19,7 @@ from highlighted_range import HighlightedRange from highlightingdialog import HighlightingDialog from line import Line from logFileModel import LogFileModel - +from raven.pluginregistry import PluginRegistry from ravenui import RavenUI from settings import Settings @@ -86,7 +86,7 @@ class BigText(QWidget): self.v_scroll_bar = ScaledScrollBar() # self.v_scroll_bar.setPageStep(1) - self.v_scroll_bar.valueChanged.connect(self.big_text.v_scroll_event) + self.v_scroll_bar.scaledValueChanged.connect(self.big_text.v_scroll_event) self.grid.addWidget(self.big_text, 0, 0) self.grid.addWidget(self.h_scroll_bar, 1, 0) @@ -271,11 +271,13 @@ class InnerBigText(QWidget): self._left_offset = self._left_offset + 2 self.update() + @Slot() def h_scroll_event(self, left_offset: int): self._left_offset = left_offset # print("left_offset: %d" % left_offset) self.update() + @Slot() def v_scroll_event(self, byte_offset: str): self._byte_offset = int(byte_offset) self.update() @@ -354,13 +356,13 @@ class InnerBigText(QWidget): dialog = QFileDialog(self) (selected_file, _filter) = dialog.getSaveFileName( caption=self.tr("Save File"), - directory=os.path.dirname(self.model.get_file()) + dir=os.path.dirname(self.model.get_file()) ) if selected_file: self.model.write_range(start, end, selected_file) open_tab = self.model.settings.session.getboolean("general", "open_tab_on_save_as_file") if open_tab: - RavenUI.window.open_file(selected_file) + PluginRegistry.execute("open_file", selected_file) def _select_all(self): self.selection_highlight.start_byte = 0 diff --git a/colorbutton.py b/colorbutton.py index a74210b..2c0be16 100644 --- a/colorbutton.py +++ b/colorbutton.py @@ -1,12 +1,12 @@ import re -from PyQt6.QtGui import QColor, QPixmap, QIcon -from PyQt6.QtWidgets import QWidget, QHBoxLayout, QPushButton, QColorDialog, QSizePolicy, QComboBox +from PySide6.QtGui import QColor, QPixmap, QIcon +from PySide6.QtWidgets import QWidget, QHBoxLayout, QPushButton, QColorDialog, QSizePolicy, QComboBox class ColorButton(QWidget): - def __init__(self, color: str): - super(QWidget, self).__init__() + def __init__(self, color: str, parent=None): + super(ColorButton, self).__init__(parent) self.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)) self.layout = QHBoxLayout(self) diff --git a/cutesettings.py b/cutesettings.py index b695d96..3cbb7ee 100644 --- a/cutesettings.py +++ b/cutesettings.py @@ -1,4 +1,4 @@ -from PyQt6.QtCore import QSettings +from PySide6.QtCore import QSettings class CuteSettings: diff --git a/filterwidget.py b/filterwidget.py index fd04845..5a5b506 100644 --- a/filterwidget.py +++ b/filterwidget.py @@ -4,8 +4,8 @@ import tempfile import threading from typing import Optional, Callable -from PyQt6.QtCore import QRunnable, QThreadPool -from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QCheckBox, QPushButton +from PySide6.QtCore import QRunnable, QThreadPool +from PySide6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QCheckBox, QPushButton from bigtext import BigText from logFileModel import LogFileModel diff --git a/fulltabwidget.py b/fulltabwidget.py index 139165b..9a6e4fe 100644 --- a/fulltabwidget.py +++ b/fulltabwidget.py @@ -1,5 +1,5 @@ -from PyQt6.QtWidgets import * -from PyQt6.QtCore import * +from PySide6.QtWidgets import * +from PySide6.QtCore import * from bigtext import BigText from filterviewsyncer import FilterViewSyncer diff --git a/hbox.py b/hbox.py index 17e91e6..71a4ea1 100644 --- a/hbox.py +++ b/hbox.py @@ -1,4 +1,4 @@ -from PyQt6.QtWidgets import QWidget, QHBoxLayout +from PySide6.QtWidgets import QWidget, QHBoxLayout class HBox(QWidget): diff --git a/highlight_regex.py b/highlight_regex.py index 566d908..034b114 100644 --- a/highlight_regex.py +++ b/highlight_regex.py @@ -3,7 +3,7 @@ from typing import Optional from highlight import Highlight from highlighted_range import HighlightedRange from line import Line -from PyQt6.QtGui import * +from PySide6.QtGui import QBrush, QColor from typing import List import re diff --git a/highlight_selection.py b/highlight_selection.py index 9f0b6d5..fa8ad98 100644 --- a/highlight_selection.py +++ b/highlight_selection.py @@ -3,8 +3,8 @@ from typing import Optional, List from highlight import Highlight from highlighted_range import HighlightedRange from line import Line -from PyQt6.QtCore import * -from PyQt6.QtGui import * +from PySide6.QtCore import Qt +from PySide6.QtGui import QBrush, QColor from settings import Settings diff --git a/highlighted_range.py b/highlighted_range.py index 9f2933b..096bb86 100644 --- a/highlighted_range.py +++ b/highlighted_range.py @@ -1,5 +1,5 @@ -from PyQt6.QtCore import * -from PyQt6.QtGui import * +from PySide6.QtCore import Qt +from PySide6.QtGui import QBrush, QPen class HighlightedRange: diff --git a/highlightingdialog.py b/highlightingdialog.py index d5e983f..ab983fb 100644 --- a/highlightingdialog.py +++ b/highlightingdialog.py @@ -1,5 +1,5 @@ -from PyQt6.QtGui import QIcon -from PyQt6.QtWidgets import QDialog, QLineEdit, QLabel, QGridLayout, QCheckBox, QListWidget, QListWidgetItem, \ +from PySide6.QtGui import QIcon +from PySide6.QtWidgets import QDialog, QLineEdit, QLabel, QGridLayout, QCheckBox, QListWidget, QListWidgetItem, \ QPushButton, QDialogButtonBox, QMessageBox, QSizePolicy from colorbutton import ColorButton diff --git a/label.py b/label.py index 7cd7722..eb52eb0 100644 --- a/label.py +++ b/label.py @@ -1,5 +1,5 @@ -from PyQt6.QtWidgets import QLabel -from PyQt6.QtCore import Qt +from PySide6.QtWidgets import QLabel +from PySide6.QtCore import Qt class Label(QLabel): @@ -7,4 +7,5 @@ class Label(QLabel): super(Label, self).__init__(text) self.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction) self.setTextInteractionFlags(Qt.TextInteractionFlag.LinksAccessibleByMouse) + self.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse) self.setOpenExternalLinks(True) diff --git a/line.py b/line.py index 1720ec6..390fefc 100644 --- a/line.py +++ b/line.py @@ -1,5 +1,4 @@ import unicodedata -from typing import Dict import constants diff --git a/logFileModel.py b/logFileModel.py index 1c0d739..cc8fb12 100644 --- a/logFileModel.py +++ b/logFileModel.py @@ -1,9 +1,7 @@ import math import re from typing import List, Optional - -from PyQt6.QtCore import pyqtSignal - +from PySide6.QtCore import Signal from highlight_regex import HighlightRegex from highlighting import Highlighting from line import Line @@ -14,7 +12,7 @@ from settings import Settings class LogFileModel: _query_highlight: Optional[HighlightRegex] = None - file_size_changed = pyqtSignal(str) + file_size_changed = Signal() """Fires when the file size changed. **Note:** uses strings, because int in Qt signal are limited to 32bit.""" diff --git a/main.py b/main.py index 675f41c..947aa10 100644 --- a/main.py +++ b/main.py @@ -2,17 +2,16 @@ import logging import signal import ctypes -from PyQt6 import QtCore -from PyQt6.QtWidgets import * -from PyQt6.QtCore import * -from PyQt6.QtGui import * +from PySide6 import QtCore +from PySide6.QtWidgets import QApplication +from PySide6.QtCore import QTimer +from PySide6.QtGui import QIcon import sys import constants from raven.pluginregistry import PluginRegistry from ravenui import RavenUI - logging.basicConfig(level=logging.INFO) log = logging.getLogger("main") diff --git a/pylupdate.py b/pylupdate.py deleted file mode 100644 index ffe8b6b..0000000 --- a/pylupdate.py +++ /dev/null @@ -1,9 +0,0 @@ -import glob -import os - -from PyQt6.lupdate import lupdate - -if __name__ == "__main__": - python_files = glob.glob(r"*.py") - print(python_files) - lupdate(python_files, ["messages_de.ts"]) \ No newline at end of file diff --git a/raven/mainwindow.py b/raven/mainwindow.py index afa69b8..389e114 100644 --- a/raven/mainwindow.py +++ b/raven/mainwindow.py @@ -1,9 +1,10 @@ import logging from typing import List -from PyQt6.QtWidgets import * -from PyQt6.QtGui import * -from PyQt6.QtCore import Qt +from PySide6.QtWidgets import * +from PySide6.QtGui import * +from PySide6.QtCore import Qt + import urlutils from cutesettings import CuteSettings from raven.pluginregistry import PluginRegistry diff --git a/raven/pluginregistry.py b/raven/pluginregistry.py index 9b4f958..9c98277 100644 --- a/raven/pluginregistry.py +++ b/raven/pluginregistry.py @@ -1,9 +1,6 @@ from types import ModuleType from typing import Dict, Optional from inspect import isclass -from pkgutil import iter_modules -from pathlib import Path -from os.path import dirname from importlib import import_module from inspect import signature from raven.pluginbase import PluginBase diff --git a/raven/plugins/logfileplugin.py b/raven/plugins/logfileplugin.py index 9f7a87d..eb6a05e 100644 --- a/raven/plugins/logfileplugin.py +++ b/raven/plugins/logfileplugin.py @@ -1,7 +1,7 @@ import os.path from typing import Callable, Optional -from PyQt6.QtWidgets import QMessageBox +from PySide6.QtWidgets import QMessageBox from fulltabwidget import FullTabWidget from logFileModel import LogFileModel diff --git a/raven/plugins/notes/noteswidget.py b/raven/plugins/notes/noteswidget.py index 791cae2..be38bc7 100644 --- a/raven/plugins/notes/noteswidget.py +++ b/raven/plugins/notes/noteswidget.py @@ -1,5 +1,5 @@ from raven.plugins.ravenlog.Tab import Tab -from PyQt6.QtWidgets import * +from PySide6.QtWidgets import QTextEdit, QVBoxLayout class NotesWidget(Tab): diff --git a/raven/plugins/notesplugin.py b/raven/plugins/notesplugin.py index cc2dfb2..b916521 100644 --- a/raven/plugins/notesplugin.py +++ b/raven/plugins/notesplugin.py @@ -1,6 +1,6 @@ from typing import Callable -from PyQt6.QtCore import Qt +from PySide6.QtCore import Qt from raven.pluginbase import PluginBase from raven.pluginregistry import PluginRegistry diff --git a/raven/plugins/openfileplugin.py b/raven/plugins/openfileplugin.py index 6551726..96faf3d 100644 --- a/raven/plugins/openfileplugin.py +++ b/raven/plugins/openfileplugin.py @@ -1,8 +1,7 @@ import os from typing import Callable from pathlib import Path -from PyQt6.QtGui import QAction, QIcon -from PyQt6.QtWidgets import QMenu, QFileDialog +from PySide6.QtWidgets import QFileDialog from raven.pluginbase import PluginBase from raven.pluginregistry import PluginRegistry @@ -47,8 +46,9 @@ class OpenFilePlugin(PluginBase): dialog = QFileDialog() (selected_file, _filter) = dialog.getOpenFileName( caption=self.tr("Open File"), - directory=directory + dir=directory ) + # directory=directory if selected_file: self.open_file(selected_file) @@ -71,7 +71,7 @@ class OpenFilePlugin(PluginBase): files = self._get_recent_files() for file in files: action = RAction(os.path.basename(file)) - action.set_action(lambda x, f=file: self.open_file(f)) + action.set_action(lambda _="", f=file: self.open_file(f)) self._menu_recent_files.add_action(action) def _remember_recent_file(self, file: str): diff --git a/raven/plugins/ravenlog/Tab.py b/raven/plugins/ravenlog/Tab.py index c0bb39d..b47759b 100644 --- a/raven/plugins/ravenlog/Tab.py +++ b/raven/plugins/ravenlog/Tab.py @@ -1,6 +1,6 @@ from abc import abstractmethod -from PyQt6.QtWidgets import QWidget +from PySide6.QtWidgets import QWidget class Tab(QWidget): diff --git a/raven/plugins/ravenlogplugin.py b/raven/plugins/ravenlogplugin.py index 3d3b5d8..38ec6db 100644 --- a/raven/plugins/ravenlogplugin.py +++ b/raven/plugins/ravenlogplugin.py @@ -1,8 +1,8 @@ import sys from typing import Optional -from PyQt6.QtCore import Qt -from PyQt6.QtWidgets import QDockWidget, QLabel +from PySide6.QtCore import Qt +from PySide6.QtWidgets import QDockWidget import constants from aboutdialog import AboutDialog diff --git a/requirements.txt b/requirements.txt index 8b3c6bb..0456c25 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ -PyQt6==6.2.2 -PyQt6-Qt6==6.2.2 -PyQt6-sip==13.2.0 +PySide6==6.2.2.1 six==1.16.0 urllib3==1.26.8 watchdog==2.1.6 diff --git a/scribble.py b/scribble.py index 2b3959f..cfe81f7 100644 --- a/scribble.py +++ b/scribble.py @@ -1,37 +1,10 @@ # extract icons from dll on windows # https://mail.python.org/pipermail/python-win32/2009-April/009078.html -import re -import time -from highlighted_range import HighlightedRange -from line import Line +import PySide6.QtCore -result = [] +# Prints PySide6 version +print(PySide6.__version__) -byte_offset = 123 -text = "2021-09-21 08:40:38,187 [catalina-exec-37] INFO c.r.c.s.l.SearchAdapter - Fetched 0 fields, 1 folders, 0 content requests for 1 documents; took 763ms (including 0ms to fetch field names). [project=axcelerate.lds_5m_review2, session=37891bc0-a67e-4c43-90c0-c20da567f491, user=r-162] [kttsjx2h.48z.9ls] 2021-09-21 08:47:16,529 [BravaJobHandler-12] INFO c.r.b.c.f.i.DoneNotifierRunnable - CORE job for 'complete document request with output format xdl (source n.pdf)' complete. Notifying Brava server about completion for numId=LDS_001:00095883.. Extracting and moving XDL and SVG/Thumbs took 31ms (from remote stream from 172.28.60.208:51048,com.recommind.rmi.ssl.SslRmiExporter$CheckedSslRmiClientSocketFactory). Notifying with URL https://localhost:8889/BravaServer/done/xc_E4E99FE32A313D2FBA8D29F846C0EF439E8AE2BE159164D04B2AFD862F714BED_ (context switch time 0ms) [project=axcelerate.lds_5m_review2, session=500380b9-94c5-4740-b30a-81e9f6cd071d, user=r-377] [kttsjx2h.8ys.kai]" - -start = time.time() -line = Line(byte_offset=byte_offset, byte_end=byte_offset + len(text.encode("utf8")), line=text) -regex = re.compile(r"\w", flags=re.IGNORECASE) -match_iter = re.finditer(regex, line.line()) -for match in match_iter: - start_char = match.start(0) - end_char = match.end(0) - - start_column = line.char_to_column(start_char) - end_column = line.char_to_column(end_char) - - result.append(HighlightedRange(start_column, end_column - start_column, highlight_full_line=True, brush=None, - brush_full_line=None)) - -end = time.time() -print("duration: %.3f" % ((end - start) * 1000)) - -result = [] -start = time.time() -for i in range(0, 10000): - result.append(i) - -end = time.time() -print("duration: %.3f" % ((end - start) * 1000)) +# Prints the Qt version used to compile PySide6 +print(PySide6.QtCore.__version__) diff --git a/tabs.py b/tabs.py index 87da764..18beeea 100644 --- a/tabs.py +++ b/tabs.py @@ -1,9 +1,6 @@ -import os -from typing import Mapping, Optional +from typing import Optional -from PyQt6.QtWidgets import * -from PyQt6.QtCore import * -from PyQt6.QtGui import * +from PySide6.QtWidgets import QWidget, QTabWidget, QVBoxLayout from bigtext import BigText from fulltabwidget import FullTabWidget diff --git a/testlogfilemodel.py b/testlogfilemodel.py index 54a98e3..4612dad 100644 --- a/testlogfilemodel.py +++ b/testlogfilemodel.py @@ -4,7 +4,6 @@ from configparser import ConfigParser from os.path import join from logFileModel import LogFileModel -from line import Line from settings import Settings diff --git a/vbox.py b/vbox.py index 7a733de..69c94b1 100644 --- a/vbox.py +++ b/vbox.py @@ -1,4 +1,4 @@ -from PyQt6.QtWidgets import QWidget, QVBoxLayout +from PySide6.QtWidgets import QWidget, QVBoxLayout class VBox(QWidget):