def rebuild( self ):
        """
        Rebuilds the interface for this widget based on the current model.
        """
        self.setUpdatesEnabled(False)
        self.blockSignals(True)
        
        # clear out all the subwidgets for this widget
        for child in self.findChildren(QObject):
            child.setParent(None)
            child.deleteLater()
        
        # load up all the interface for this widget
        schema = self.schema()
        if ( schema ):
            self.setEnabled(True)
            
            uifile = self.uiFile()
            
            # load a user defined file
            if ( uifile ):
                projexui.loadUi('', self, uifile)
                
                for widget in self.findChildren(XOrbColumnEdit):
                    columnName = widget.columnName()
                    column     = schema.column(columnName)
                    
                    if ( column ):
                        widget.setColumn(column)
                    else:
                        logger.debug('%s is not a valid column of %s' % \
                                     (columnName, schema.name()))
            
            # dynamically load files
            else:
                layout = QFormLayout()
                layout.setContentsMargins(0, 0, 0, 0)
                columns = schema.columns()
                columns.sort(key = lambda x: x.displayName())
                
                record = self.record()
                
                for column in columns:
                    # ignore protected columns
                    if ( column.name().startswith('_') ):
                        continue
                    
                    label   = column.displayName()
                    coltype = column.columnType()
                    name    = column.name()
                    
                    # create the column edit widget
                    widget  = XOrbColumnEdit(self)
                    widget.setObjectName('ui_' + name)
                    widget.setColumnName(name)
                    widget.setColumnType(coltype)
                    widget.setColumn(column)
                    
                    layout.addRow(QLabel(label, self), widget)
                
                self.setLayout(layout)
                self.adjustSize()
                
                self.setWindowTitle('Edit %s' % schema.name())
        else:
            self.setEnabled(False)
        
        self.setUpdatesEnabled(True)
        self.blockSignals(False)
def rebuild ( self ) : self . setUpdatesEnabled ( False ) self . blockSignals ( True ) for child in self . findChildren ( QObject ) : child . setParent ( None ) child . deleteLater ( ) schema = self . schema ( ) if ( schema ) : self . setEnabled ( True ) uifile = self . uiFile ( ) if ( uifile ) : projexui . loadUi ( '' , self , uifile ) for widget in self . findChildren ( XOrbColumnEdit ) : columnName = widget . columnName ( ) column = schema . column ( columnName ) if ( column ) : widget . setColumn ( column ) else : logger . debug ( '%s is not a valid column of %s' % ( columnName , schema . name ( ) ) ) else : layout = QFormLayout ( ) layout . setContentsMargins ( 0 , 0 , 0 , 0 ) columns = schema . columns ( ) columns . sort ( key = lambda x : x . displayName ( ) ) record = self . record ( ) for column in columns : if ( column . name ( ) . startswith ( '_' ) ) : continue label = column . displayName ( ) coltype = column . columnType ( ) name = column . name ( ) widget = XOrbColumnEdit ( self ) widget . setObjectName ( 'ui_' + name ) widget . setColumnName ( name ) widget . setColumnType ( coltype ) widget . setColumn ( column ) layout . addRow ( QLabel ( label , self ) , widget ) self . setLayout ( layout ) self . adjustSize ( ) self . setWindowTitle ( 'Edit %s' % schema . name ( ) ) else : self . setEnabled ( False ) self . setUpdatesEnabled ( True ) self . blockSignals ( False )
Rebuilds the interface for this widget based on the current model.