diff -r 39e3db2b4936 -r eefe954f01e8 eric6/Debugger/VariablesViewer.py --- a/eric6/Debugger/VariablesViewer.py Sun Jul 05 11:11:24 2020 +0200 +++ b/eric6/Debugger/VariablesViewer.py Sun Oct 18 12:35:30 2020 +0200 @@ -7,11 +7,13 @@ Module implementing the variables viewer view based on QTreeView. """ +import ast +import re -import ast - -from PyQt5.QtCore import (Qt, QAbstractItemModel, QModelIndex, QRegExp, - QCoreApplication, QSortFilterProxyModel, pyqtSignal) +from PyQt5.QtCore import ( + Qt, QAbstractItemModel, QModelIndex, QCoreApplication, + QSortFilterProxyModel, pyqtSignal +) from PyQt5.QtGui import QBrush, QFontMetrics from PyQt5.QtWidgets import QTreeView, QAbstractItemView, QToolTip, QMenu @@ -41,7 +43,7 @@ } # Initialize regular expression for unprintable strings - rx_nonprintable = QRegExp(r"""(\\x\d\d)+""") + rx_nonprintable = re.compile(r"""(\\x\d\d)+""") noOfItemsStr = QCoreApplication.translate("VariablesViewer", "{0} items") unsized = QCoreApplication.translate("VariablesViewer", "unsized") @@ -194,7 +196,7 @@ self.hasChildren = True elif dtype in ['str', 'unicode']: - if VariableItem.rx_nonprintable.indexIn(dvalue) == -1: + if VariableItem.rx_nonprintable.search(dvalue) is None: try: dvalue = ast.literal_eval(dvalue) except Exception: # secok @@ -811,7 +813,8 @@ self.closedItems.remove(pathlist) self.getMore() else: - self.openItems.remove(pathlist) + if pathlist in self.openItems: + self.openItems.remove(pathlist) self.closedItems.append(pathlist) def __buildTreePath(self, parent): @@ -1195,7 +1198,7 @@ # now show the dialog from .VariableDetailDialog import VariableDetailDialog dlg = VariableDetailDialog(name, vtype, val) - dlg.exec_() + dlg.exec() def __configure(self): """