Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pyqt6 and python 3.10 #119

Merged
merged 4 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()


install_requires = ['qtpy (>=1.2.1)', 'numpy (>=1.4.1)', 'numexpr (>=2.0)',
install_requires = ['qtpy', 'pyqt6', 'numpy (>=1.4.1)', 'numexpr (>=2.0)',
'tables (>=3.0)', 'setuptools']
if 'CONDA_PREFIX' not in os.environ:
install_requires.append('PyQt5 (>=5.5.1)')
StFroese marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def config(self, launcher):
# Tear down code
cfg.writeValue('Logger/Paper', QtGui.QColor("#ffffff"))
cfg.writeValue('Logger/Text', QtGui.QColor("#000000"))
cfg.writeValue('Logger/Font', QtWidgets.qApp.font())
cfg.writeValue('Logger/Font', QtWidgets.QApplication.font())
cfg.writeValue('Workspace/Background',
QtGui.QBrush(QtGui.QColor("#ffffff")))
cfg.writeValue('Look/currentStyle', cfg.default_style)
Expand Down
6 changes: 3 additions & 3 deletions vitables/csv/export_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def export(self):
filepath, add_header = export_info

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
with open(filepath, 'ab') as out_handler:
if add_header:
from functools import reduce
Expand All @@ -280,7 +280,7 @@ def export(self):
# we must explicitly ensure we get an integer
nchunks = numpy.floor_divide(nrows, chunk_size)
for i in numpy.arange(0, nchunks + 1):
QtWidgets.qApp.processEvents()
QtWidgets.QApplication.processEvents()
cstart = chunk_size * i
if cstart >= nrows:
break
Expand All @@ -292,4 +292,4 @@ def export(self):
except OSError:
vitables.utils.formatExceptionInfo()
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
24 changes: 12 additions & 12 deletions vitables/csv/import_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ def csv2Table(self):

# Import the CSV content
try:
QtWidgets.qApp.processEvents()
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.processEvents()
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
input_handler = open(filepath, 'r+')
try:
(nrows, descr, has_header) = csvutils.tableInfo(input_handler)
Expand Down Expand Up @@ -306,7 +306,7 @@ def csv2Table(self):
except:
vitables.utils.formatExceptionInfo()
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
input_handler.close()

def csv2EArray(self):
Expand All @@ -322,8 +322,8 @@ def csv2EArray(self):

# Import the CSV content
try:
QtWidgets.qApp.processEvents()
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.processEvents()
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
chunk_size = 10000
input_handler = open(filepath, 'r+')
(nrows, atom, array_shape) = csvutils.earrayInfo(input_handler)
Expand Down Expand Up @@ -359,7 +359,7 @@ def csv2EArray(self):
except:
vitables.utils.formatExceptionInfo()
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
input_handler.close()

def csv2CArray(self):
Expand All @@ -375,8 +375,8 @@ def csv2CArray(self):

# Import the CSV content
try:
QtWidgets.qApp.processEvents()
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.processEvents()
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
chunk_size = 10000
input_handler = open(filepath, 'r+')
(atom, array_shape) = csvutils.carrayInfo(input_handler)
Expand Down Expand Up @@ -415,7 +415,7 @@ def csv2CArray(self):
except:
vitables.utils.formatExceptionInfo()
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
input_handler.close()

def csv2Array(self):
Expand All @@ -431,8 +431,8 @@ def csv2Array(self):

# Import the CSV content
try:
QtWidgets.qApp.processEvents()
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.processEvents()
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
# The dtypes are determined by the contents of each column
# Multidimensional columns will have string datatype
data = numpy.genfromtxt(filepath, delimiter=',', dtype=None)
Expand All @@ -458,4 +458,4 @@ def csv2Array(self):
vitables.utils.formatExceptionInfo()
finally:
del data
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
32 changes: 16 additions & 16 deletions vitables/h5db/dbstreemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def createDBDoc(self, filepath, is_tmp_db=False):
"""

try:
QtWidgets.qApp.setOverrideCursor(
QtWidgets.QApplication.setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor))
# Create the dbdoc
try:
Expand All @@ -311,7 +311,7 @@ def createDBDoc(self, filepath, is_tmp_db=False):
self.links_delta = frozenset([])
self.insertRows(0, 1)
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
return db_doc

def __createTempDB(self):
Expand Down Expand Up @@ -342,7 +342,7 @@ def deleteNode(self, index):
"""

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
node = self.nodeFromIndex(index)
# Deletes the node from the database
node.editor().delete(node.nodepath)
Expand All @@ -363,7 +363,7 @@ def deleteNode(self, index):
except KeyError:
pass
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()

def copy_node(self, index):
"""Mark a node from the tree of databases view as copied.
Expand All @@ -372,15 +372,15 @@ def copy_node(self, index):
"""

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
node = self.nodeFromIndex(index)
self.ccni = {'is_copied': True,
'nodename': node.name,
'filepath': node.filepath,
'nodepath': node.nodepath,
'target': getattr(node, 'target', None)}
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()

def cutNode(self, index):
"""Cut a `tables.Node`.
Expand All @@ -391,7 +391,7 @@ def cutNode(self, index):
"""

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
node = self.nodeFromIndex(index)
self.ccni = {'is_copied': False,
'nodename': node.name,
Expand All @@ -414,7 +414,7 @@ def cutNode(self, index):
current = self.index(position - 1, 0, parent)
self.vtgui.dbs_tree_view.selectNode(current)
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()

def pasteNode(self, index, childname, overwrite=False):
"""Paste a tables.Node.
Expand All @@ -429,7 +429,7 @@ def pasteNode(self, index, childname, overwrite=False):
"""

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
parent = self.nodeFromIndex(index)

# If the overwritten node (if any) exists in the tree of
Expand All @@ -454,7 +454,7 @@ def pasteNode(self, index, childname, overwrite=False):
# Select the pasted node
self.selectIndex(index, childname)
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()

def copiedNode(self):
"""The tables.Node currently copied/cut.
Expand All @@ -481,7 +481,7 @@ def create_group(self, index, childname, overwrite=False):
"""

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
parent = self.nodeFromIndex(index)
# If the overwritten node (if any) exists in the tree of
# databases view then delete it
Expand All @@ -498,7 +498,7 @@ def create_group(self, index, childname, overwrite=False):
# Select the pasted node
self.selectIndex(index, childname)
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()

def rename_node(self, index, new_name, overwrite=False):
"""Rename a node.
Expand All @@ -511,7 +511,7 @@ def rename_node(self, index, new_name, overwrite=False):
"""

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
node = self.nodeFromIndex(index)
initial_nodepath = node.nodepath
parent_index = self.parent(index)
Expand All @@ -534,7 +534,7 @@ def rename_node(self, index, new_name, overwrite=False):
except KeyError:
pass
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()

def updateDBTree(self, index, new_name, node):
"""
Expand Down Expand Up @@ -595,7 +595,7 @@ def move_node(self, src_filepath, childpath, parent_index, overwrite=False):
"""

try:
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
parent_node = self.nodeFromIndex(parent_index)
# full path of the destination database and new parent
dst_filepath = parent_node.filepath
Expand Down Expand Up @@ -624,7 +624,7 @@ def move_node(self, src_filepath, childpath, parent_index, overwrite=False):
movedname = editor.move(childpath, self.getDBDoc(dst_filepath),
parentpath, nodename)
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
return movedname

def validateNodename(self, src_filepath, childpath, dst_filepath,
Expand Down
10 changes: 5 additions & 5 deletions vitables/preferences/vtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ def __init__(self):
is UserScope.
"""

organization = QtWidgets.qApp.organizationName()
product = QtWidgets.qApp.applicationName()
version = QtWidgets.qApp.applicationVersion()
organization = QtWidgets.QApplication.organizationName()
product = QtWidgets.QApplication.applicationName()
version = QtWidgets.QApplication.applicationVersion()
if sys.platform.startswith('win'):
# organizationName() -> product
# applicationName() -> version
Expand Down Expand Up @@ -206,7 +206,7 @@ def loggerFont(self):
"""

key = 'Logger/Font'
default_value = QtWidgets.qApp.font()
default_value = QtWidgets.QApplication.font()
setting_value = self.value(key)
if isinstance(setting_value, QtGui.QFont):
return setting_value
Expand Down Expand Up @@ -570,7 +570,7 @@ def applyUserPreferences(self, config):
if key in config:
self.current_style = config[key]
# Default style is provided by the underlying window manager
QtWidgets.qApp.setStyle(self.current_style)
QtWidgets.QApplication.setStyle(self.current_style)

key = 'Plugins/Enabled'
if key in config:
Expand Down
4 changes: 2 additions & 2 deletions vitables/queries/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def queryWithIndex(self, src_dict):
# Selection is done in several steps. It saves a *huge*
# amount of memory when querying large tables
for i in numpy.arange(0, div+1):
QtWidgets.qApp.processEvents()
QtWidgets.QApplication.processEvents()
lstart = start + chunk_size*i
if lstart > stop:
lstart = stop
Expand Down Expand Up @@ -187,7 +187,7 @@ def queryWithNoIndex(self, src_dict):
# Selection is done in several steps. It saves a *huge*
# amount of memory when querying large tables
for i in numpy.arange(0, div+1):
QtWidgets.qApp.processEvents()
QtWidgets.QApplication.processEvents()
lstart = start + chunk_size*i
if lstart > stop:
lstart = stop
Expand Down
2 changes: 1 addition & 1 deletion vitables/queries/querydlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def __init__(self, info, ft_names, counter, initial_query, table):
#
# Create the dialog and customise the content of some widgets
#
super(QueryDlg, self).__init__(QtWidgets.qApp.activeWindow())
super(QueryDlg, self).__init__(QtWidgets.QApplication.activeWindow())
self.setupUi(self)

self.setWindowTitle(translate('QueryDlg', 'New query on table: {0}',
Expand Down
6 changes: 3 additions & 3 deletions vitables/queries/querymgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def newQuery(self):
new_query = query.Query(tmp_h5file, table_uid, table,
query_description)
new_query.query_completed.connect(self.addQueryResult)
QtWidgets.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
new_query.run()

def getQueryInfo(self, info, table):
Expand Down Expand Up @@ -231,7 +231,7 @@ def getQueryInfo(self, info, table):
finally:
query_description = dict(query_dlg.query_info)
del query_dlg
QtWidgets.qApp.processEvents()
QtWidgets.QApplication.processEvents()

if not query_description['condition']:
return None
Expand Down Expand Up @@ -298,7 +298,7 @@ def addQueryResult(self, completed, table_uid):
- `table_uid`: the UID of the table just queried
"""

QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()
if not completed:
log.error(translate('QueriesManager',
'Query on table {0} failed!',
Expand Down
2 changes: 1 addition & 1 deletion vitables/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def getVTApp():
"""

vtapp = None
for widget in QtWidgets.qApp.topLevelWidgets():
for widget in QtWidgets.QApplication.topLevelWidgets():
if widget.objectName() == 'VTGUI':
vtapp = widget.vtapp
break
Expand Down
4 changes: 2 additions & 2 deletions vitables/vtapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,12 @@ def fileSaveAs(self):

# Make a copy of the selected file
try:
QtWidgets.qApp.setOverrideCursor(
QtWidgets.QApplication.setOverrideCursor(
QtGui.QCursor(QtCore.Qt.WaitCursor))
dbdoc = self.gui.dbs_tree_model.getDBDoc(initial_filepath)
dbdoc.copy_file(filepath)
finally:
QtWidgets.qApp.restoreOverrideCursor()
QtWidgets.QApplication.restoreOverrideCursor()

# Close the copied file (which is not necessarely selected in
# the tree view because closing an overwritten file can change
Expand Down
4 changes: 1 addition & 3 deletions vitables/vtgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ def addComponents(self):

# The signal mapper used to keep the the Window menu updated
self.window_mapper = QtCore.QSignalMapper(self)
self.window_mapper.mapped[QtWidgets.QWidget].connect(
self.workspace.setActiveSubWindow)
self.workspace.installEventFilter(self)
self.dbs_tree_view.clicked.connect(self.selection_changed)

Expand Down Expand Up @@ -678,7 +676,7 @@ def closeEvent(self, event):

# Quit
event.accept()
QtWidgets.qApp.quit()
QtWidgets.QApplication.quit()

def makeCopy(self):
"""Copy text/leaf depending on which widget has focus.
Expand Down
2 changes: 1 addition & 1 deletion vitables/vtsplash.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def drawMessage(self, msg):
:Parameter msg: the message to be displayed
"""

QtWidgets.qApp.processEvents()
QtWidgets.QApplication.processEvents()
self.msg = msg
self.showMessage(self.msg)
time.sleep(0.500)
Expand Down
Loading