Skip to content

Commit

Permalink
commit message
Browse files Browse the repository at this point in the history
1.add QColorDialog-setCustomColor modifier
  • Loading branch information
astips committed Mar 27, 2019
1 parent 99eaee3 commit 880aaf6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions modifier/modifier_pyqt4.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from . import QtModifier
from PyQt4 import QtGui


qt_modifier = QtModifier()
Expand All @@ -27,3 +28,8 @@ def unwrapinstance(*args, **kwargs):
@qt_modifier.register('QtCore.QString.__str__')
def to_string(self):
return str(self.toUtf8)


@qt_modifier.register("QtWidgets.QColorDialog.set_custom_color")
def set_custom_color(self, index, color):
QtGui.QColorDialog.setCustomColor(index, color.rgb())
9 changes: 7 additions & 2 deletions modifier/modifier_pyqt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def unwrapinstance(*args, **kwargs):

@qt_modifier.register('QtWidgets.QTreeWidgetItem.setBackgroundColor')
def setBackgroundColor(self, p_int, QColor):
QtWidgets.QTreeWidgetItem.setBackgroundColor(self, p_int, QColor)
QtWidgets.QTreeWidgetItem.setBackground(self, p_int, QColor)


@qt_modifier.register('QtWidgets.QTreeWidgetItem.setTextColor')
Expand All @@ -37,7 +37,7 @@ def setTextColor(self, p_int, QColor):

@qt_modifier.register('QtWidgets.QTableWidgetItem.setBackgroundColor')
def setBackgroundColor(self, QColor):
QtWidgets.QTableWidgetItem.setBackgroundColor(self, QColor)
QtWidgets.QTableWidgetItem.setBackground(self, QColor)


@qt_modifier.register("QtWidgets.QTableWidgetItem.setTextColor")
Expand All @@ -58,3 +58,8 @@ def delta(self):
@qt_modifier.register("QtGui.QDrag.start")
def start(self, supportedActions=None):
QtGui.QDrag.exec_(self, supportedActions)


@qt_modifier.register("QtWidgets.QColorDialog.set_custom_color")
def set_custom_color(self, index, color):
QtWidgets.QColorDialog.setCustomColor(index, color)
5 changes: 5 additions & 0 deletions modifier/modifier_pyside.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def setTextColor(self, p_int, QColor):
QtGui.QTreeWidgetItem.setForeground(self, p_int, QColor)


@qt_modifier.register("QtWidgets.QColorDialog.set_custom_color")
def set_custom_color(self, index, color):
QtGui.QColorDialog.setCustomColor(index, color.rgb())


original_set_focus_policy = QtGui.QWidget.setFocusPolicy


Expand Down
5 changes: 5 additions & 0 deletions modifier/modifier_pyside2.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def setResizeMode(self, mode):
QtWidgets.QHeaderView.setSectionResizeMode(self, mode)


@qt_modifier.register("QtWidgets.QColorDialog.set_custom_color")
def set_custom_color(self, index, color):
QtWidgets.QColorDialog.setCustomColor(index, color)


original_set_focus_policy = QtWidgets.QWidget.setFocusPolicy


Expand Down

0 comments on commit 880aaf6

Please sign in to comment.