def __init__( self, parent = None ): super(XKeyValueDialog, self).__init__(parent) # create the interface self._keyEdit = XLineEdit(self) self._keyEdit.setMaximumWidth(80) self._keyEdit.setHint( 'set key' ) self._valueEdit = XLineEdit(self) self._valueEdit.setHint( 'set value' ) hbox = QHBoxLayout() hbox.addWidget(self._keyEdit) hbox.addWidget(self._valueEdit) opts = QDialogButtonBox.Ok | QDialogButtonBox.Cancel buttons = QDialogButtonBox( opts, Qt.Horizontal, self ) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(buttons) # update the look and size self.setLayout(vbox) self.setWindowTitle('Edit Pair') self.setMinimumWidth(350) self.adjustSize() self.setFixedHeight(self.height()) # create connections buttons.accepted.connect( self.accept ) buttons.rejected.connect( self.reject )
def __init__(self, parent, uifile=''): uifile = '' super(XSchemeConfigWidget, self).__init__(parent, uifile) # define the font widgets self._applicationFont = QFontComboBox(self) self._applicationFont.setProperty('dataName', wrapVariant('font')) self._applicationFont.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) self._applicationFontSize = QSpinBox(self) self._applicationFontSize.setProperty('dataName', wrapVariant('fontSize')) self._colorButton = XColorButton(self) hbox = QHBoxLayout() hbox.addWidget(QLabel('Font:', self)) hbox.addWidget(self._applicationFont) hbox.addWidget(QLabel('Size:', self)) hbox.addWidget(self._applicationFontSize) hbox.addWidget(QLabel('Quick Color:', self)) hbox.addWidget(self._colorButton) # define the color tree self._colorTree = XColorTreeWidget(self) self._colorTree.setProperty('dataName', wrapVariant('colorSet')) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(self._colorTree) self.setLayout(vbox) # create connections self._colorButton.colorChanged.connect(self._colorTree.setQuickColor)
def __init__( self, parent, uifile = '' ): uifile = '' super(XSchemeConfigWidget, self).__init__(parent, uifile) # define the font widgets self._applicationFont = QFontComboBox(self) self._applicationFont.setProperty('dataName', wrapVariant('font')) self._applicationFont.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred ) self._applicationFontSize = QSpinBox(self) self._applicationFontSize.setProperty('dataName', wrapVariant('fontSize')) self._colorButton = XColorButton(self) hbox = QHBoxLayout() hbox.addWidget(QLabel('Font:', self)) hbox.addWidget(self._applicationFont) hbox.addWidget(QLabel('Size:', self)) hbox.addWidget(self._applicationFontSize) hbox.addWidget(QLabel('Quick Color:', self)) hbox.addWidget(self._colorButton) # define the color tree self._colorTree = XColorTreeWidget(self) self._colorTree.setProperty('dataName', wrapVariant('colorSet')) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(self._colorTree) self.setLayout(vbox) # create connections self._colorButton.colorChanged.connect( self._colorTree.setQuickColor )
def __init__(self, parent=None, buttons=None): super(XPopupWidget, self).__init__(parent) # define custom properties self._anchor = XPopupWidget.Anchor.TopCenter self._autoCalculateAnchor = False self._autoCloseOnAccept = True self._autoCloseOnReject = True self._autoCloseOnFocusOut = False self._autoDefault = True self._first = True self._animated = False self._currentMode = None self._positionLinkedTo = [] self._possibleAnchors = XPopupWidget.Anchor.all() # define controls self._result = 0 self._resizable = True self._popupPadding = 10 self._titleBarVisible = True self._buttonBoxVisible = True self._dialogButton = QToolButton(self) self._closeButton = QToolButton(self) self._scrollArea = QScrollArea(self) self._sizeGrip = QSizeGrip(self) self._sizeGrip.setFixedWidth(12) self._sizeGrip.setFixedHeight(12) self._leftSizeGrip = QSizeGrip(self) self._leftSizeGrip.setFixedWidth(12) self._leftSizeGrip.setFixedHeight(12) if buttons is None: buttons = QDialogButtonBox.NoButton self._buttonBox = QDialogButtonBox(buttons, Qt.Horizontal, self) self._buttonBox.setContentsMargins(3, 0, 3, 9) self._scrollArea.setWidgetResizable(True) self._scrollArea.setFrameShape(QScrollArea.NoFrame) self._scrollArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) palette = self.palette() self._scrollArea.setPalette(palette) self._dialogButton.setToolTip('Popout to Dialog') self._closeButton.setToolTip('Close Popup') for btn in (self._dialogButton, self._closeButton): btn.setAutoRaise(True) btn.setIconSize(QSize(14, 14)) btn.setMaximumSize(16, 16) # setup the icons icon = QIcon(projexui.resources.find('img/dialog.png')) self._dialogButton.setIcon(icon) icon = QIcon(projexui.resources.find('img/close.png')) self._closeButton.setIcon(icon) # define the ui hlayout = QHBoxLayout() hlayout.setSpacing(0) hlayout.addStretch(1) hlayout.addWidget(self._dialogButton) hlayout.addWidget(self._closeButton) hlayout.setContentsMargins(0, 0, 0, 0) hlayout2 = QHBoxLayout() hlayout2.addWidget(self._buttonBox) hlayout2.setContentsMargins(0, 0, 3, 0) vlayout = QVBoxLayout() vlayout.addLayout(hlayout) vlayout.addWidget(self._scrollArea) vlayout.addLayout(hlayout2) vlayout.setContentsMargins(3, 2, 3, 2) vlayout.setSpacing(0) self.setLayout(vlayout) self.setPositionLinkedTo(parent) # set default properties self.setAutoFillBackground(True) self.setBackgroundRole(QPalette.Window) self.setWindowTitle('Popup') self.setFocusPolicy(Qt.StrongFocus) self.setCurrentMode(XPopupWidget.Mode.Popup) # create connections self._dialogButton.clicked.connect(self.setDialogMode) self._closeButton.clicked.connect(self.reject) self._buttonBox.accepted.connect(self.accept) self._buttonBox.rejected.connect(self.reject) self._buttonBox.clicked.connect(self.handleButtonClick)