Example #1
0
class XBasicCardWidget(XAbstractCardWidget):
    def __init__(self, parent):
        super(XBasicCardWidget, self).__init__(parent)

        # define the interface
        self._thumbnailButton = XIconButton(self)
        self._thumbnailButton.setIconSize(QSize(64, 64))

        self._titleLabel = QLabel(self)

        layout = QHBoxLayout()
        layout.addWidget(self._thumbnailButton)
        layout.addWidget(self._titleLabel)
        self.setLayout(layout)

    def setRecord(self, record):
        """
        Sets the record that is linked with this widget.
        
        :param      record | <orb.Table>
        """
        super(XBasicCardWidget, self).setRecord(record)

        browser = self.browserWidget()
        if (not browser):
            return

        factory = browser.factory()
        if (not factory):
            return

        self._thumbnailButton.setIcon(factory.thumbnail(record))
        self._titleLabel.setText(factory.thumbnailText(record))
Example #2
0
class XBasicCardWidget(XAbstractCardWidget):
    def __init__( self, parent ):
        super(XBasicCardWidget, self).__init__(parent)
        
        # define the interface
        self._thumbnailButton = XIconButton(self)
        self._thumbnailButton.setIconSize(QSize(64, 64))
        
        self._titleLabel      = QLabel(self)
        
        layout = QHBoxLayout()
        layout.addWidget(self._thumbnailButton)
        layout.addWidget(self._titleLabel)
        self.setLayout(layout)
    
    def setRecord( self, record ):
        """
        Sets the record that is linked with this widget.
        
        :param      record | <orb.Table>
        """
        super(XBasicCardWidget, self).setRecord(record)
        
        browser = self.browserWidget()
        if ( not browser ):
            return
        
        factory = browser.factory()
        if ( not factory ):
            return
        
        self._thumbnailButton.setIcon(factory.thumbnail(record))
        self._titleLabel.setText(factory.thumbnailText(record))
Example #3
0
    def __init__(self, parent):
        super(XBasicCardWidget, self).__init__(parent)

        # define the interface
        self._thumbnailButton = XIconButton(self)
        self._thumbnailButton.setIconSize(QSize(64, 64))

        self._titleLabel = QLabel(self)

        layout = QHBoxLayout()
        layout.addWidget(self._thumbnailButton)
        layout.addWidget(self._titleLabel)
        self.setLayout(layout)
Example #4
0
 def __init__( self, parent ):
     super(XBasicCardWidget, self).__init__(parent)
     
     # define the interface
     self._thumbnailButton = XIconButton(self)
     self._thumbnailButton.setIconSize(QSize(64, 64))
     
     self._titleLabel      = QLabel(self)
     
     layout = QHBoxLayout()
     layout.addWidget(self._thumbnailButton)
     layout.addWidget(self._titleLabel)
     self.setLayout(layout)
Example #5
0
    def __init__(self, scaffold, parent=None):
        super(XScaffoldPropertiesPage, self).__init__(parent)

        # setup the scaffolding options
        self._scaffold = scaffold

        self.setTitle('Properties')
        self.setSubTitle('Setup scaffold properties')

        if scaffold.uifile():
            projexui.loadUi(__file__, self, scaffold.uifile())
        else:
            layout = QtGui.QFormLayout()

            for prop in scaffold.properties():
                # define the text
                text = prop.label
                if prop.required:
                    text += '*'
                text += ':'

                # create a checkbox
                if prop.type == 'bool':
                    widget = QtGui.QCheckBox(self)
                    widget.setProperty('propertyName', wrapVariant(prop.name))
                    widget.setText(text.strip(':'))
                    layout.addRow(None, widget)

                # create a float
                elif prop.type == 'int':
                    lbl = QtGui.QLabel(text, self)
                    widget = QtGui.QSpinBox(self)
                    widget.setProperty('propertyName', wrapVariant(prop.name))
                    layout.addRow(lbl, widget)

                # create a double
                elif prop.type == 'float':
                    lbl = QtGui.QLabel(text, self)
                    widget = QtGui.QDoubleSpinBox(self)
                    widget.setProperty('propertyName', wrapVariant(prop.name))
                    layout.addRow(lbl, widget)

                # create a text edit
                elif prop.type == 'text':
                    lbl = QtGui.QLabel(text, self)
                    widget = XTextEdit(self)
                    widget.setProperty('propertyName', wrapVariant(prop.name))
                    layout.addRow(lbl, widget)

                # create a filepath
                elif prop.type == 'file':
                    lbl = QtGui.QLabel(text, self)
                    widget = XFilepathEdit(self)

                # create an icon
                elif prop.type == 'icon':
                    widget = XIconButton(self)
                    layout.addRow(lbl, widget)

                # create a line edit
                else:
                    lbl = QtGui.QLabel(text, self)

                    if prop.choices:
                        widget = XComboBox(self)
                        widget.setProperty('dataType', 'string')
                        widget.addItems([''] + prop.choices)
                    else:
                        widget = XLineEdit(self)

                        if prop.regex:
                            regexp = QtCore.QRegExp(prop.regex)
                            validator = QtGui.QRegExpValidator(regexp, widget)
                            widget.setValidator(validator)

                    widget.setProperty('propertyName', wrapVariant(prop.name))
                    layout.addRow(lbl, widget)

            self.setLayout(layout)

        for prop, widget in self.propertyWidgetMap().items():
            if prop.default is not None:
                try:
                    widget.setHint(prop.default)
                except AttributeError:
                    projexui.setWidgetValue(widget, prop.default)