7
7
Compatibility module to use the KDE Color Dialog instead of the Qt Color Dialog.
12
if os.getenv("e3nokde"):
15
from kdeui import KColorDialog
16
from qt import Qt, QColor
18
def getColor(initial = Qt.white, parent = None, name = None):
20
Public function to pop up a modal dialog to select a color.
22
@param initial initial color to select (QColor)
23
@param parent parent widget of the dialog (QWidget)
24
@param name name of the dialog (ignored)
25
@return the selected color or the invalid color, if the
26
canceled the dialog (QColor)
29
res = KColorDialog.getColor(col, parent)
30
if res == KColorDialog.Accepted:
35
16
except (ImportError, RuntimeError):
37
getColor = qt.QColorDialog.getColor
17
os.environ["e4nokde"] = "1"
19
from PyQt4.QtCore import Qt
20
from PyQt4.QtGui import QColorDialog, QColor
22
__qtGetColor = QColorDialog.getColor
24
################################################################################
26
def getColor(initial = QColor(Qt.white), parent = None):
28
Public function to pop up a modal dialog to select a color.
30
@param initial initial color to select (QColor)
31
@param parent parent widget of the dialog (QWidget)
32
@return the selected color or the invalid color, if the user
33
canceled the dialog (QColor)
35
if Preferences.getUI("UseKDEDialogs") and not os.getenv("e4nokde"):
36
return __kdeGetColor(initial, parent)
38
return __qtGetColor(initial, parent)