1 # Copyright (C) 2016-2023 CEA, EDF
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from . import _use_pyqt
22 from PyQt5.QtGui import *
24 # Make QVariant invisible in PyQt5 since they don't exist in
26 # __original_itemData = QComboBox.itemData
27 # def new_itemData(*args, **kargs):
28 # from PyQt5.QtCore import QVariant
29 # variant = __original_itemData(*args, **kargs)
30 # funcS = lambda : (str(variant.toString()), True)
31 # dico = {QVariant.Int: variant.toInt, QVariant.String: funcS,
32 # QVariant.Bool: variant.toBool, QVariant.Double: variant.toDouble}
33 # conv = dico.get(variant.type(), None)
35 # raise Exception("Unsupported variant type in pyqtside: '%s'!" % variant.typeName())
38 # QComboBox.itemData = new_itemData
40 from PySide.QtGui import *
42 __original_ofn = QFileDialog.getOpenFileName
43 __original_sfn = QFileDialog.getSaveFileName
45 # In PySide, getOpenFileName and co returns 2 values, and only one in PyQt ...
46 def newOfn(cls,*args, **kargs):
47 tup = __original_ofn(*args, **kargs)
50 def newSfn(cls,*args, **kargs):
51 tup = __original_sfn(*args, **kargs)
54 QFileDialog.getOpenFileName = classmethod(newOfn)
55 QFileDialog.getSaveFileName = classmethod(newSfn)