def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Namer, self).__init__(self.windowMain) self.window = ToolSeq_Namer.qUiLoader.load( ToolSeq_Namer.userScriptDir + 'ToolSeq_Namer.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Namer.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.List_IdenticalNames.itemSelectionChanged.connect( self.Action_SelectList) self.window.Button_AppendToList.installEventFilter(self) self.window.Button_ExtractFromList.installEventFilter(self) self.window.Button_ClearList.installEventFilter(self) self.window.Button_RenameAutoInList.installEventFilter(self) self.window.show()
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Developer, self).__init__(self.windowMain) self.window = ToolSeq_Developer.qUiLoader.load( ToolSeq_Developer.userScriptDir + 'ToolSeq_Developer.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Developer.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Radio_Attributes.toggled.connect(self.Event_Attributes) self.window.Radio_CommandsMel.toggled.connect(self.Event_CommandsMel) self.window.Radio_CommandsPython.toggled.connect( self.Event_CommandsPython) self.window.Radio_VariablesMel.toggled.connect(self.Event_Variables) self.window.Line_Attributes.installEventFilter(self) self.window.Line_Search.installEventFilter(self) self.window.Button_Search.installEventFilter(self) self.window.Button_Act.installEventFilter(self) self.window.setEnabled(False) self.window.show() Thread(target=self.__init__later, args=()).start()
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance(long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_UV, self).__init__(self.windowMain) self.window = ToolSeq_UV.qUiLoader.load(ToolSeq_UV.userScriptDir + 'ToolSeq_UV.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_UV.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Widget_01.installEventFilter(self) self.window.Widget_012.installEventFilter(self) self.window.Text_Items.textChanged.connect(self.Event_Items) self.window.Combo_CutType.currentTextChanged.connect(self.Event_CutType) self.window.Button_Apply.installEventFilter(self) self.window.show() wMax1 = max(self.window.Check_Unfold.width(), self.window.Check_Optimize.width()) self.window.Check_Unfold.setFixedWidth(wMax1) self.window.Check_Optimize.setFixedWidth(wMax1) wMax2 = max(self.window.Label_TileSpace.width(), self.window.Label_ShellSpace.width()) self.window.Label_TileSpace.setFixedWidth(wMax2) self.window.Label_ShellSpace.setFixedWidth(wMax2)
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Unaverage, self).__init__(self.windowMain) self.window = ToolSeq_Unaverage.qUiLoader.load( ToolSeq_Unaverage.userScriptDir + 'ToolSeq_Unaverage.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Unaverage.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Widget_01.installEventFilter(self) self.window.Text_Items.textChanged.connect(self.Event_Items) self.window.Button_Apply.installEventFilter(self) self.window.show() wMax = max(self.window.Label_Amount.width(), self.window.Label_Blend.width(), self.window.Label_Iterations.width()) self.window.Label_Amount.setFixedWidth(wMax) self.window.Label_Blend.setFixedWidth(wMax) self.window.Label_Iterations.setFixedWidth(wMax)
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Displacement, self).__init__(self.windowMain) self.window = ToolSeq_Displacement.qUiLoader.load( ToolSeq_Displacement.userScriptDir + 'ToolSeq_Displacement.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Displacement.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Widget_Shape.installEventFilter(self) self.window.Button_ImagePath.installEventFilter(self) self.window.Button_Apply.installEventFilter(self) self.window.show() maya_cmds.loadPlugin('ToolSeq_Displacement.py', quiet=True)
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Uninstance, self).__init__(self.windowMain) self.window = ToolSeq_Uninstance.qUiLoader.load( ToolSeq_Uninstance.userScriptDir + 'ToolSeq_Uninstance.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Uninstance.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Widget_01.installEventFilter(self) self.window.Text_Transforms.textChanged.connect(self.Event_Transforms) self.window.Button_UninstanceHierarchy.installEventFilter(self) self.window.Widget_SourceShape.installEventFilter(self) self.window.Widget_TargetShape.installEventFilter(self) self.window.Button_AddInstancedShape.installEventFilter(self) self.window.Button_ReplaceInstancedShape.installEventFilter(self) self.window.show()
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Pivot, self).__init__(self.windowMain) self.window = ToolSeq_Pivot.qUiLoader.load( ToolSeq_Pivot.userScriptDir + 'ToolSeq_Pivot.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Pivot.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Widget_01.installEventFilter(self) self.window.Text_Transforms.textChanged.connect(self.Event_Transforms) self.window.Button_Minimum.installEventFilter(self) self.window.Button_Maximum.installEventFilter(self) self.window.Button_Center.installEventFilter(self) self.window.Button_CreateLocators.installEventFilter(self) self.window.Widget_Locator.installEventFilter(self) self.window.Button_MoveTransformsPivot.installEventFilter(self) self.window.Button_MatchTransformsPivot.installEventFilter(self) self.window.show()
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Cameras, self).__init__(self.windowMain) self.window = ToolSeq_Cameras.qUiLoader.load( ToolSeq_Cameras.userScriptDir + 'ToolSeq_Cameras.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Cameras.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Button_P.installEventFilter(self) self.window.Button_TB.installEventFilter(self) self.window.Button_FB.installEventFilter(self) self.window.Button_LR.installEventFilter(self) maya_cmds.undoInfo(stateWithoutFlush=False) try: self.Activity_CreateAll() except Exception as e: print >> stderr, str(e) maya_cmds.undoInfo(stateWithoutFlush=True) self.window.show()
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Freeze, self).__init__(self.windowMain) self.window = ToolSeq_Freeze.qUiLoader.load( ToolSeq_Freeze.userScriptDir + 'ToolSeq_Freeze.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Freeze.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Widget_01.installEventFilter(self) self.window.Text_Transforms.textChanged.connect(self.Event_Transforms) self.window.Button_ApplyTransformationMatrix.installEventFilter(self) self.window.Button_UnFreezeTranslate.installEventFilter(self) self.window.Button_UnFreezeScale.installEventFilter(self) self.window.show() maya_cmds.loadPlugin('ToolSeq_Freeze.py', quiet=True)
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Select, self).__init__(self.windowMain) self.window = ToolSeq_Select.qUiLoader.load( ToolSeq_Select.userScriptDir + 'ToolSeq_Select.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Select.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Button_LR_Standart.installEventFilter(self) self.window.Button_LR_Pattern.installEventFilter(self) self.window.Button_SelectSoft.installEventFilter(self) self.window.Button_SelectHard.installEventFilter(self) self.window.Button_SelectBorder.installEventFilter(self) self.window.Button_SelectAngle.installEventFilter(self) self.window.Button_Operate.installEventFilter(self) self.window.Button_Clear.installEventFilter(self) self.window.Button_Show.installEventFilter(self) self.window.show()
def __init__(self, parent=None): QStyledItemDelegate.__init__(self, parent) self.timestamp_delegate = TimestampDelegate() self.float_delegate = FloatDelegate(2) self.default = QStyledItemDelegate() self.delegates = {}
def __init__(self, view: QTreeWidget): """ Overwrite QTreeWidget Item Edit Behaviour :param QTreeWidget view: View we replace delegates in """ super(KnechtValueDelegate, self).__init__(view) self.view = view self.default_delegate = QStyledItemDelegate(view)
def __init__(self, view): """ Basic item delegate that returns the views default item delegate or depending on the item type column: an appropriate custom render setting item delegate. :param modules.itemview.treeview.KnechtTreeView view: View we replace delegates in """ super(KnechtValueDelegate, self).__init__(view) self.view = view self.default_delegate = QStyledItemDelegate(view) self.setting_delegate = None
def testIntDelegate(self): """PYSIDE-1250: When creating a QVariant, use int instead of long long for anything that fits into a int. Verify by checking that a spin box is created as item view editor for int.""" item = QStandardItem() item.setData(123123, Qt.EditRole) # <-- QVariant conversion here model = QStandardItemModel() model.appendRow(item) style_option = QStyleOptionViewItem() delegate = QStyledItemDelegate() editor = delegate.createEditor(None, style_option, model.index(0, 0)) self.assertEqual(type(editor), QSpinBox)
def testDelegates(self): widget = Widget() t = widget.treeView # When calling setItemDelegateForColumn using a separate variable # for the second argument (QAbstractItemDelegate), there was no problem # on keeping the reference to this object, since the variable was kept # alive (case A) # Contrary, when instantiating this argument on the function call # Using QStyledItemDelegate inside the call the reference of the # object was lost, causing a segfault. (case B) # Case A d = QStyledItemDelegate() # Using QStyledItemDelegate from a variable so we keep the reference alive # and we encounter no segfault. t.setItemDelegateForColumn(0, d) # This raised the Segmentation Fault too, because manually destroying # the object caused a missing refrence. del d # Getting the delegates a = t.itemDelegateForColumn(0) self.assertIsInstance(a, QStyledItemDelegate) # Case B t.setItemDelegateForColumn(1, QStyledItemDelegate()) # Getting the delegates b = t.itemDelegateForColumn(1) self.assertIsInstance(b, QStyledItemDelegate) # Test for Rows t.setItemDelegateForRow(0, QStyledItemDelegate()) self.assertIsInstance(t.itemDelegateForRow(0), QStyledItemDelegate) # Test for general delegate t.setItemDelegate(QStyledItemDelegate()) self.assertIsInstance(t.itemDelegate(), QStyledItemDelegate)
def __init__(self, parent, patient): QDialog.__init__(self) self.parent = parent self.patient = patient self.resize(480, 100) self.setWindowTitle("Stwórz predykcję") self.choose_method = QComboBox() self.choose_method.setItemDelegate(QStyledItemDelegate()) self.choose_method.addItem(self.base_esn_method) self.choose_method.addItem(self.deep_esn_method) self.choose_method.addItem(self.sub_reservoir_method) self.choose_method.addItem(self.abc_smc_method) spin_box = QDoubleSpinBox() spin_box.setRange(0.0, 1000.0) spin_box.setSingleStep(0.1) self.choose_prediction_length = spin_box self.predict_button = QPushButton("Stwórz predykcję") self.predict_button.clicked.connect(self.generatePrediction) self.add_future_treatment_button = QPushButton( "Dodaj podanie lekarstwa") self.add_future_treatment_button.clicked.connect( self.addFutureTreatment) self.form_layout = QFormLayout() self.form_layout.addRow("Wybierz metodę", self.choose_method) self.form_layout.addRow("Długość predykcji (dni)", self.choose_prediction_length) self.treatments = [] buttons_layout = QHBoxLayout() buttons_layout.addWidget(self.add_future_treatment_button) buttons_layout.addWidget(self.predict_button) layout = QVBoxLayout(self) layout.addLayout(self.form_layout) layout.addLayout(buttons_layout)
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance( long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Explode, self).__init__(self.windowMain) self.window = ToolSeq_Explode.qUiLoader.load( ToolSeq_Explode.userScriptDir + 'ToolSeq_Explode.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Explode.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) self.window.Widget_GroupLowCount.installEventFilter(self) self.window.Widget_GroupHigCount.installEventFilter(self) self.window.Text_GroupLow.textChanged.connect(self.Event_GroupLow) self.window.Text_GroupHig.textChanged.connect(self.Event_GroupHig) self.window.Button_Apply.installEventFilter(self) self.window.Button_Revert.installEventFilter(self) self.groupLow = [] self.groupHig = [] self.pivotLow = [] self.pivotHig = [] self.groupLowChi = [] self.groupHigChi = [] self.pivotLowChi = [] self.pivotHigChi = [] self.window.show()
def __init__(self): ptrs.append(self) self.windowMain = wrapInstance(long(OpenMayaUI_v1.MQtUtil.mainWindow()), QMainWindow) super(ToolSeq_Formula, self).__init__(self.windowMain) self.window = ToolSeq_Formula.qUiLoader.load(ToolSeq_Formula.userScriptDir + 'ToolSeq_Formula.ui', self) self.window.destroyed.connect(lambda: ptrs_remove(self)) self.window.setWindowFlags(self.window.windowFlags() & ~Qt.WindowMinMaxButtonsHint) self.window.setAttribute(Qt.WA_DeleteOnClose) for qComboBox in self.window.findChildren(QComboBox): qComboBox.setItemDelegate(QStyledItemDelegate(qComboBox)) with open(ToolSeq_Formula.userScriptDir + 'ToolSeq.qss', 'r') as fileStyleSheet: self.window.setStyleSheet(fileStyleSheet.read()) font = QFont('Consolas', 9) font.setStyleHint(QFont.Monospace) self.window.Text_PreFormula.setFont(font) self.window.Text_Formula.setFont(font) fontTab = QFontMetricsF(font).horizontalAdvance(' ') * 4 self.window.Text_PreFormula.setTabStopDistance(fontTab) self.window.Text_Formula.setTabStopDistance(fontTab) self.window.Text_PreFormula.setPlainText(ToolSeq_Formula.preFormulas[11]) self.window.Text_Formula.setPlainText(ToolSeq_Formula.formulas[11]) self.window.Widget_Shape.installEventFilter(self) self.window.Check_VariableN.toggled.connect(self.Event_VariableN) self.window.Button_Fill.installEventFilter(self) self.window.Button_Formulate.installEventFilter(self) self.window.show() wMax = max(self.window.Label_1.width(), self.window.Label_2.width()) self.window.Label_1.setFixedWidth(wMax) self.window.Label_2.setFixedWidth(wMax) maya_cmds.loadPlugin('ToolSeq_Formula.py', quiet=True)