First Qt5 conversion commit

Replaced PyQt4 with PyQt5 and made all adjustments necessary to make
dupeGuru start up.
This commit is contained in:
Virgil Dupras 2013-10-20 15:15:09 -04:00
parent 33d9569427
commit a4256d3d2b
43 changed files with 113 additions and 106 deletions

View File

@ -18,7 +18,7 @@ echo "Installing pip requirements"
if [ "$(uname)" == "Darwin" ]; then
pip install -r requirements-osx.txt
else
python3 -c "import PyQt4" >/dev/null 2>&1 || { echo >&2 "PyQt 4.8+ required. Install it and try again. Aborting"; exit 1; }
python3 -c "import PyQt5" >/dev/null 2>&1 || { echo >&2 "PyQt 5.1+ required. Install it and try again. Aborting"; exit 1; }
pip install -r requirements.txt
fi

View File

@ -149,7 +149,7 @@ def build_qt(edition, dev, conf):
print("Building localizations")
build_localizations('qt', edition)
print("Building Qt stuff")
print_and_do("pyrcc4 -py3 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py')))
print_and_do("pyrcc5 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py')))
fix_qt_resource_file(op.join('qt', 'base', 'dg_rc.py'))
print("Creating the run.py file")
filereplace(op.join('qt', 'run_template.py'), 'run.py', edition=edition)
@ -191,7 +191,7 @@ def build_localizations(ui, edition):
shutil.copytree('locale', locale_dest, ignore=shutil.ignore_patterns('*.po', '*.pot'))
if ui == 'qt' and not ISLINUX:
print("Copying qt_*.qm files into the 'locale' folder")
from PyQt4.QtCore import QLibraryInfo
from PyQt5.QtCore import QLibraryInfo
trfolder = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
for lang in loc.get_langs('locale'):
qmname = 'qt_%s.qm' % lang

View File

@ -196,7 +196,7 @@ def copy_packages(packages_names, dest, create_links=False, extra_ignores=None):
shutil.copy(source_path, dest_path)
def copy_qt_plugins(folder_names, dest): # This is only for Windows
from PyQt4.QtCore import QLibraryInfo
from PyQt5.QtCore import QLibraryInfo
qt_plugin_dir = QLibraryInfo.location(QLibraryInfo.PluginsPath)
def ignore(path, names):
if path == qt_plugin_dir:
@ -444,7 +444,7 @@ def collect_stdlib_dependencies(script, dest_folder, extra_deps=None):
delete_files_with_pattern(op.join(dest_folder, 'distutils'), '*.exe')
def fix_qt_resource_file(path):
# pyrcc4 under Windows, if the locale is non-english, can produce a source file with a date
# pyrcc5 under Windows, if the locale is non-english, can produce a source file with a date
# containing accented characters. If it does, the encoding is wrong and it prevents the file
# from being correctly frozen by cx_freeze. To work around that, we open the file, strip all
# comments, and save.

View File

@ -46,8 +46,8 @@ try:
except ImportError:
try:
from PyQt4.QtCore import QUrl
from PyQt4.QtGui import QDesktopServices
from PyQt5.QtCore import QUrl, QStandardPaths
from PyQt5.QtGui import QDesktopServices
import os.path as op
def _open_path(path):
url = QUrl.fromLocalFile(str(path))
@ -58,10 +58,10 @@ except ImportError:
def _special_folder_path(special_folder):
if special_folder == SpecialFolder.Cache:
qtfolder = QDesktopServices.CacheLocation
qtfolder = QStandardPaths.CacheLocation
else:
qtfolder = QDesktopServices.DataLocation
return str(QDesktopServices.storageLocation(qtfolder))
qtfolder = QStandardPaths.DataLocation
return QStandardPaths.standardLocations(qtfolder)[0]
except ImportError:
raise Exception("Can't setup desktop functions!")

View File

@ -59,7 +59,7 @@ def get_locale_name(lang):
#--- Qt
def install_qt_trans(lang=None):
from PyQt4.QtCore import QCoreApplication, QTranslator, QLocale
from PyQt5.QtCore import QCoreApplication, QTranslator, QLocale
if not lang:
lang = str(QLocale.system().name())[:2]
localename = get_locale_name(lang)
@ -116,7 +116,7 @@ def install_gettext_trans_under_qt(base_folder, lang=None):
# So, we install the gettext locale, great, but we also should try to install qt_*.qm if
# available so that strings that are inside Qt itself over which I have no control are in the
# right language.
from PyQt4.QtCore import QCoreApplication, QTranslator, QLocale, QLibraryInfo
from PyQt5.QtCore import QCoreApplication, QTranslator, QLocale, QLibraryInfo
if not lang:
lang = str(QLocale.system().name())[:2]
localename = get_locale_name(lang)

View File

@ -9,8 +9,9 @@
import sys
import os.path as op
from PyQt4.QtCore import QTimer, QObject, QCoreApplication, QUrl, QProcess, SIGNAL, pyqtSignal
from PyQt4.QtGui import QDesktopServices, QFileDialog, QDialog, QMessageBox, QApplication
from PyQt5.QtCore import QTimer, QObject, QCoreApplication, QUrl, QProcess, pyqtSignal
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QApplication, QFileDialog, QDialog, QMessageBox
from hscommon.trans import trget
from hscommon.plat import ISLINUX
@ -74,7 +75,7 @@ class DupeGuru(QObject):
# In some circumstances, the nag is hidden by other window, which may make the user think
# that the application haven't launched.
QTimer.singleShot(0, self.finishedLaunching)
self.connect(QCoreApplication.instance(), SIGNAL('aboutToQuit()'), self.application_will_terminate)
QCoreApplication.instance().aboutToQuit.connect(self.application_will_terminate)
def _setupActions(self):
# Setup actions that are common to both the directory dialog and the results window.

View File

@ -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
from PyQt4.QtGui import QDialog, QVBoxLayout, QLabel, QCheckBox, QDialogButtonBox
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QLabel, QCheckBox, QDialogButtonBox
from hscommon.trans import trget
from qtlib.radio_box import RadioBox

View File

@ -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
from PyQt4.QtGui import QDialog
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog
from .details_table import DetailsModel
@ -42,5 +42,6 @@ class DetailsDialog(QDialog):
#--- model --> view
def refresh(self):
self.tableModel.reset()
self.tableModel.beginResetModel()
self.tableModel.endResetModel()

View File

@ -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, SIGNAL, QAbstractTableModel
from PyQt4.QtGui import QHeaderView, QTableView
from PyQt5.QtCore import Qt, QAbstractTableModel
from PyQt5.QtWidgets import QHeaderView, QTableView
from hscommon.trans import trget
@ -55,9 +55,9 @@ class DetailsTable(QTableView):
hheader.setHighlightSections(False)
hheader.setStretchLastSection(False)
hheader.resizeSection(0, 100)
hheader.setResizeMode(0, QHeaderView.Fixed)
hheader.setResizeMode(1, QHeaderView.Stretch)
hheader.setResizeMode(2, QHeaderView.Stretch)
hheader.setSectionResizeMode(0, QHeaderView.Fixed)
hheader.setSectionResizeMode(1, QHeaderView.Stretch)
hheader.setSectionResizeMode(2, QHeaderView.Stretch)
vheader = self.verticalHeader()
vheader.setVisible(False)
vheader.setDefaultSectionSize(18)

View File

@ -6,10 +6,11 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from PyQt4.QtCore import QRect
from PyQt4.QtGui import (QWidget, QFileDialog, QHeaderView, QVBoxLayout, QHBoxLayout, QTreeView,
QAbstractItemView, QSpacerItem, QSizePolicy, QPushButton, QApplication, QMainWindow, QMenuBar,
QMenu, QIcon, QPixmap, QLabel)
from PyQt5.QtCore import QRect
from PyQt5.QtWidgets import (QWidget, QFileDialog, QHeaderView, QVBoxLayout, QHBoxLayout, QTreeView,
QAbstractItemView, QSpacerItem, QSizePolicy, QPushButton, QMainWindow, QMenuBar, QMenu, QLabel,
QApplication)
from PyQt5.QtGui import QPixmap, QIcon
from hscommon.trans import trget
from qtlib.recent import Recent
@ -149,8 +150,8 @@ class DirectoriesDialog(QMainWindow):
def _setupColumns(self):
header = self.treeView.header()
header.setStretchLastSection(False)
header.setResizeMode(0, QHeaderView.Stretch)
header.setResizeMode(1, QHeaderView.Fixed)
header.setSectionResizeMode(0, QHeaderView.Stretch)
header.setSectionResizeMode(1, QHeaderView.Fixed)
header.resizeSection(1, 100)
def _updateAddButton(self):

View File

@ -8,9 +8,10 @@
import urllib.parse
from PyQt4.QtCore import pyqtSignal, Qt, QRect, QUrl, QModelIndex
from PyQt4.QtGui import (QComboBox, QStyledItemDelegate, QApplication, QBrush, QStyle,
QStyleOptionComboBox, QStyleOptionViewItemV4, QItemSelection)
from PyQt5.QtCore import pyqtSignal, Qt, QRect, QUrl, QModelIndex, QItemSelection
from PyQt5.QtWidgets import (QComboBox, QStyledItemDelegate, QStyle, QStyleOptionComboBox,
QStyleOptionViewItem, QApplication)
from PyQt5.QtGui import QBrush
from hscommon.trans import trget
from qtlib.tree_model import RefNode, TreeModel
@ -29,7 +30,7 @@ class DirectoriesDelegate(QStyledItemDelegate):
def paint(self, painter, option, index):
self.initStyleOption(option, index)
# No idea why, but this cast is required if we want to have access to the V4 valuess
option = QStyleOptionViewItemV4(option)
option = QStyleOptionViewItem(option)
if (index.column() == 1) and (option.state & QStyle.State_Selected):
cboption = QStyleOptionComboBox()
cboption.rect = option.rect

View File

@ -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
from PyQt4.QtGui import QDialog, QVBoxLayout, QPushButton, QTableView, QAbstractItemView
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QPushButton, QTableView, QAbstractItemView
from hscommon.trans import trget
from qtlib.util import horizontalWrap

View File

@ -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 QApplication
from PyQt5.QtWidgets import QApplication
from hscommon import trans
from qtlib.preferences import Preferences as PreferencesBase

View File

@ -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 SIGNAL, Qt, QSize
from PyQt4.QtGui import (QDialog, QDialogButtonBox, QVBoxLayout, QHBoxLayout, QLabel, QComboBox,
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtWidgets import (QDialog, QDialogButtonBox, QVBoxLayout, QHBoxLayout, QLabel, QComboBox,
QSlider, QSizePolicy, QSpacerItem, QCheckBox, QLineEdit, QMessageBox, QSpinBox)
from hscommon.plat import ISOSX, ISLINUX
@ -26,8 +26,8 @@ class PreferencesDialogBase(QDialog):
self.app = app
self._setupUi()
self.connect(self.filterHardnessSlider, SIGNAL("valueChanged(int)"), self.filterHardnessLabel.setNum)
self.connect(self.buttonBox, SIGNAL('clicked(QAbstractButton*)'), self.buttonClicked)
self.filterHardnessSlider.valueChanged['int'].connect(self.filterHardnessLabel.setNum)
self.buttonBox.clicked['QAbstractButton*'].connect(self.buttonClicked)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)

View File

@ -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, QMimeData, QByteArray
from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QComboBox, QListView,
from PyQt5.QtCore import Qt, QMimeData, QByteArray
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QComboBox, QListView,
QDialogButtonBox, QAbstractItemView, QLabel, QStyle, QSplitter, QWidget, QSizePolicy)
from hscommon.trans import trget

View File

@ -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
from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QSpacerItem, QSizePolicy,
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QSpacerItem, QSizePolicy,
QLabel, QTableView, QAbstractItemView, QApplication)
from hscommon.trans import trget

View File

@ -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 Qt, QUrl, QRect
from PyQt4.QtGui import (QMainWindow, QMenu, QLabel, QDesktopServices, QFileDialog, QMenuBar,
QWidget, QVBoxLayout, QAbstractItemView, QStatusBar, QDialog, QAction, QPushButton, QCheckBox)
from PyQt5.QtCore import Qt, QRect
from PyQt5.QtWidgets import (QMainWindow, QMenu, QLabel, QFileDialog, QMenuBar, QWidget,
QVBoxLayout, QAbstractItemView, QStatusBar, QDialog, QAction, QPushButton, QCheckBox)
from hscommon.trans import trget
from qtlib.util import moveToScreenCenter, horizontalWrap, createActions
@ -164,7 +164,7 @@ class ResultWindow(QMainWindow):
self.resize(630, 514)
self.centralwidget = QWidget(self)
self.verticalLayout = QVBoxLayout(self.centralwidget)
self.verticalLayout.setMargin(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(0)
self.actionsButton = QPushButton(tr("Actions"))
self.detailsButton = QPushButton(tr("Details"))
@ -183,7 +183,7 @@ class ResultWindow(QMainWindow):
self.resultsView.verticalHeader().setVisible(False)
h = self.resultsView.horizontalHeader()
h.setHighlightSections(False)
h.setMovable(True)
h.setSectionsMovable(True)
h.setStretchLastSection(False)
h.setDefaultAlignment(Qt.AlignLeft)
self.verticalLayout.addWidget(self.resultsView)

View File

@ -6,8 +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 Qt, pyqtSignal
from PyQt4.QtGui import QBrush, QFont, QFontMetrics, QTableView, QColor
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QBrush, QFont, QFontMetrics, QColor
from PyQt5.QtWidgets import QTableView
from qtlib.table import Table

View File

@ -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 QSize
from PyQt4.QtGui import QVBoxLayout, QAbstractItemView
from PyQt5.QtCore import QSize
from PyQt5.QtGui import QVBoxLayout, QAbstractItemView
from hscommon.trans import trget
from ..base.details_dialog import DetailsDialog as DetailsDialogBase

View File

@ -7,8 +7,8 @@
# http://www.hardcoded.net/licenses/bsd_license
import sys
from PyQt4.QtCore import QSize
from PyQt4.QtGui import (QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
from PyQt5.QtCore import QSize
from PyQt5.QtWidgets import (QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
QApplication)
from hscommon.trans import trget

View File

@ -8,7 +8,7 @@
import logging
from PyQt4.QtGui import QImage, QImageReader, QTransform
from PyQt5.QtGui import QImage, QImageReader, QTransform
from core_pe import __appname__
from core_pe.photo import Photo as PhotoBase

View File

@ -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, QSize
from PyQt4.QtGui import QVBoxLayout, QAbstractItemView, QHBoxLayout, QLabel, QSizePolicy, QPixmap
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QVBoxLayout, QAbstractItemView, QHBoxLayout, QLabel, QSizePolicy, QPixmap
from hscommon.trans import trget
from ..base.details_dialog import DetailsDialog as DetailsDialogBase

View File

@ -7,7 +7,7 @@
# http://www.hardcoded.net/licenses/bsd_license
import sys
from PyQt4.QtGui import QApplication
from PyQt5.QtWidgets import QApplication
from hscommon.trans import trget
from core.scanner import ScanType

View File

@ -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 QMessageBox, QAction
from PyQt5.QtGui import QMessageBox, QAction
from hscommon.trans import trget
from ..base.result_window import ResultWindow as ResultWindowBase

View File

@ -8,8 +8,9 @@
import sys
import os.path as op
from PyQt4.QtCore import QCoreApplication, QSettings
from PyQt4.QtGui import QApplication, QIcon, QPixmap
from PyQt5.QtCore import QCoreApplication, QSettings
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtWidgets import QApplication
from hscommon.plat import ISWINDOWS
from hscommon.trans import install_gettext_trans_under_qt

View File

@ -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 QSize
from PyQt4.QtGui import QVBoxLayout, QAbstractItemView
from PyQt5.QtCore import QSize
from PyQt5.QtWidgets import QVBoxLayout, QAbstractItemView
from hscommon.trans import trget
from ..base.details_dialog import DetailsDialog as DetailsDialogBase
@ -22,7 +22,7 @@ class DetailsDialog(DetailsDialogBase):
self.setMinimumSize(QSize(200, 0))
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setMargin(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.tableView = DetailsTable(self)
self.tableView.setAlternatingRowColors(True)
self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)

View File

@ -7,8 +7,8 @@
# http://www.hardcoded.net/licenses/bsd_license
import sys
from PyQt4.QtCore import QSize
from PyQt4.QtGui import (QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
from PyQt5.QtCore import QSize
from PyQt5.QtWidgets import (QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
QLineEdit, QApplication)
from hscommon.plat import ISWINDOWS, ISLINUX

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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:

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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):