mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 06:37:17 +00:00
First Qt5 conversion commit
Replaced PyQt4 with PyQt5 and made all adjustments necessary to make dupeGuru start up.
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import Qt, QCoreApplication
|
||||
from PyQt4.QtGui import (QDialog, QDialogButtonBox, QPixmap, QSizePolicy, QHBoxLayout, QVBoxLayout,
|
||||
QLabel, QFont, QApplication)
|
||||
from PyQt5.QtCore import Qt, QCoreApplication
|
||||
from PyQt5.QtGui import QPixmap, QFont
|
||||
from PyQt5.QtWidgets import (QDialog, QDialogButtonBox, QSizePolicy, QHBoxLayout, QVBoxLayout,
|
||||
QLabel, QApplication)
|
||||
|
||||
from hscommon.trans import trget
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import SIGNAL, QTimer, QObject
|
||||
from PyQt5.QtCore import SIGNAL, QTimer, QObject
|
||||
|
||||
class Application(QObject):
|
||||
def __init__(self):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import Qt
|
||||
from PyQt5.QtCore import Qt
|
||||
|
||||
class Column:
|
||||
def __init__(self, attrname, defaultWidth, editor=None, alignment=Qt.AlignLeft, cantTruncate=False):
|
||||
|
||||
@@ -10,9 +10,10 @@ import traceback
|
||||
import sys
|
||||
import os
|
||||
|
||||
from PyQt4.QtCore import Qt, QUrl, QCoreApplication, QSize
|
||||
from PyQt4.QtGui import (QDialog, QDesktopServices, QVBoxLayout, QHBoxLayout, QLabel,
|
||||
QPlainTextEdit, QPushButton, QApplication)
|
||||
from PyQt5.QtCore import Qt, QUrl, QCoreApplication, QSize
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPlainTextEdit, QPushButton,
|
||||
QApplication)
|
||||
|
||||
from hscommon.trans import trget
|
||||
from .util import horizontalSpacer
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import Qt, QSettings, QRect, QPyNullVariant
|
||||
from PyQt5.QtCore import Qt, QSettings, QRect
|
||||
|
||||
from hscommon.trans import trget
|
||||
from hscommon.util import tryint
|
||||
@@ -52,8 +52,6 @@ def adjust_after_deserialization(v):
|
||||
return False
|
||||
else:
|
||||
return tryint(v, v)
|
||||
if isinstance(v, QPyNullVariant):
|
||||
return None
|
||||
return v
|
||||
|
||||
# About QRect conversion:
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import Qt, QTimer
|
||||
from PyQt4.QtGui import QProgressDialog
|
||||
from PyQt5.QtCore import Qt, QTimer
|
||||
from PyQt5.QtWidgets import QProgressDialog
|
||||
|
||||
class ProgressWindow(QProgressDialog):
|
||||
def __init__(self, parent, model):
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import pyqtSignal
|
||||
from PyQt4.QtGui import QWidget, QHBoxLayout, QRadioButton
|
||||
from PyQt5.QtCore import pyqtSignal
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QRadioButton
|
||||
|
||||
from .util import horizontalSpacer
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
from PyQt4.QtCore import pyqtSignal, QObject
|
||||
from PyQt4.QtGui import QAction
|
||||
from PyQt5.QtCore import pyqtSignal, QObject
|
||||
from PyQt5.QtWidgets import QAction
|
||||
|
||||
from hscommon.trans import trget
|
||||
from hscommon.util import dedupe
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtGui import QDialog
|
||||
from PyQt5.QtWidgets import QDialog
|
||||
|
||||
from .reg_submit_dialog import RegSubmitDialog
|
||||
from .reg_demo_dialog import RegDemoDialog
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
import sys
|
||||
|
||||
from PyQt4.QtCore import Qt, QCoreApplication
|
||||
from PyQt4.QtGui import (QDialog, QApplication, QVBoxLayout, QHBoxLayout, QLabel,
|
||||
QFont, QSpacerItem, QSizePolicy, QPushButton)
|
||||
from PyQt5.QtCore import Qt, QCoreApplication
|
||||
from PyQt5.QtWidgets import (QDialog, QApplication, QVBoxLayout, QHBoxLayout, QLabel, QSpacerItem,
|
||||
QSizePolicy, QPushButton)
|
||||
|
||||
from hscommon.plat import ISLINUX
|
||||
from hscommon.trans import trget
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
import sys
|
||||
|
||||
from PyQt4.QtCore import Qt, QCoreApplication
|
||||
from PyQt4.QtGui import (QDialog, QApplication, QVBoxLayout, QHBoxLayout, QLabel, QFormLayout,
|
||||
from PyQt5.QtCore import Qt, QCoreApplication
|
||||
from PyQt5.QtWidgets import (QDialog, QApplication, QVBoxLayout, QHBoxLayout, QLabel, QFormLayout,
|
||||
QLayout, QLineEdit, QPushButton, QSpacerItem, QSizePolicy)
|
||||
|
||||
from hscommon.trans import trget
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import pyqtSignal, Qt
|
||||
from PyQt4.QtGui import (QToolButton, QLineEdit, QIcon, QPixmap, QStyle, QStyleOptionFrameV2,
|
||||
QPainter, QPalette)
|
||||
from PyQt5.QtCore import pyqtSignal, Qt
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QPainter, QPalette
|
||||
from PyQt5.QtWidgets import QToolButton, QLineEdit, QStyle, QStyleOptionFrame
|
||||
|
||||
from hscommon.trans import trget
|
||||
|
||||
@@ -66,7 +66,7 @@ class SearchEdit(QLineEdit):
|
||||
def paintEvent(self, event):
|
||||
QLineEdit.paintEvent(self, event)
|
||||
if not bool(self.text()) and self.inactiveText and not self.hasFocus():
|
||||
panel = QStyleOptionFrameV2()
|
||||
panel = QStyleOptionFrame()
|
||||
self.initStyleOption(panel)
|
||||
textRect = self.style().subElementRect(QStyle.SE_LineEditContents, panel, self)
|
||||
leftMargin = 2
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import Qt, QAbstractListModel
|
||||
from PyQt4.QtGui import QItemSelection, QItemSelectionModel
|
||||
from PyQt5.QtCore import Qt, QAbstractListModel, QItemSelection, QItemSelectionModel
|
||||
|
||||
class SelectableList(QAbstractListModel):
|
||||
def __init__(self, model, view):
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from PyQt4.QtCore import Qt, QAbstractTableModel, QModelIndex
|
||||
from PyQt4.QtGui import QItemSelectionModel, QItemSelection
|
||||
from PyQt5.QtCore import Qt, QAbstractTableModel, QModelIndex, QItemSelectionModel, QItemSelection
|
||||
|
||||
from .column import Columns
|
||||
|
||||
@@ -135,7 +134,8 @@ class Table(QAbstractTableModel):
|
||||
|
||||
#--- model --> view
|
||||
def refresh(self):
|
||||
self.reset()
|
||||
self.beginResetModel()
|
||||
self.endResetModel()
|
||||
self._updateViewSelection()
|
||||
|
||||
def show_selected_row(self):
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4.QtCore import QAbstractItemModel, QModelIndex
|
||||
from PyQt5.QtCore import QAbstractItemModel, QModelIndex
|
||||
|
||||
class NodeContainer:
|
||||
def __init__(self):
|
||||
@@ -128,10 +128,11 @@ class TreeModel(QAbstractItemModel, NodeContainer):
|
||||
return self.createIndex(node.parent.row, 0, node.parent)
|
||||
|
||||
def reset(self):
|
||||
QAbstractItemModel.beginResetModel(self)
|
||||
self.invalidate()
|
||||
self._ref2node = {}
|
||||
self._dummyNodes = set()
|
||||
QAbstractItemModel.reset(self)
|
||||
QAbstractItemModel.endResetModel(self)
|
||||
|
||||
def rowCount(self, parent=QModelIndex()):
|
||||
node = parent.internalPointer() if parent.isValid() else self
|
||||
|
||||
@@ -14,8 +14,9 @@ import logging
|
||||
|
||||
from hscommon.util import first
|
||||
|
||||
from PyQt4.QtGui import (QDesktopWidget, QSpacerItem, QSizePolicy, QPixmap, QIcon, QAction,
|
||||
QHBoxLayout, QDesktopServices)
|
||||
from PyQt5.QtCore import QStandardPaths
|
||||
from PyQt5.QtGui import QPixmap, QIcon
|
||||
from PyQt5.QtWidgets import QDesktopWidget, QSpacerItem, QSizePolicy, QAction, QHBoxLayout
|
||||
|
||||
def moveToScreenCenter(widget):
|
||||
frame = widget.frameGeometry()
|
||||
@@ -75,7 +76,7 @@ def setAccelKeys(menu):
|
||||
action.setText(newtext)
|
||||
|
||||
def getAppData():
|
||||
return str(QDesktopServices.storageLocation(QDesktopServices.DataLocation))
|
||||
return QStandardPaths.standardLocations(QStandardPaths.DataLocation)[0]
|
||||
|
||||
class SysWrapper(io.IOBase):
|
||||
def write(self, s):
|
||||
|
||||
Reference in New Issue
Block a user