dag: Use a QWidget instead of QDialog as the base class
[git-cola.git] / cola / qtcompat.py
blobd2cf716c19b1e81f9b57dca9e6e387873e9ee751
1 from PyQt4 import QtGui
2 from PyQt4 import QtCore
4 def install():
5 if not hasattr(QtGui.QHBoxLayout, 'setContentsMargins'):
6 QtGui.QHBoxLayout.setContentsMargins = lambda *args: True
8 if not hasattr(QtGui.QVBoxLayout, 'setContentsMargins'):
9 QtGui.QVBoxLayout.setContentsMargins = lambda *args: True
11 if not hasattr(QtGui.QKeySequence, 'Preferences'):
12 QtGui.QKeySequence.Preferences = 'Ctrl+O'
15 def add_search_path(prefix, path):
16 if hasattr(QtCore.QDir, 'addSearchPath'):
17 QtCore.QDir.addSearchPath(prefix, path)
19 def set_common_dock_options(window):
20 if not hasattr(window, 'setDockOptions'):
21 return
22 nested = QtGui.QMainWindow.AllowNestedDocks
23 tabbed = QtGui.QMainWindow.AllowTabbedDocks
24 animated = QtGui.QMainWindow.AnimatedDocks
25 window.setDockOptions(nested | tabbed | animated)