def populate_function_table_1(self):
        """Populate the tblFunctions1 table with available functions."""
        hazards = deepcopy(hazard_all)
        exposures = exposure_all

        self.lblAvailableFunctions1.clear()
        self.tblFunctions1.clear()
        self.tblFunctions1.setColumnCount(len(hazards))
        self.tblFunctions1.setRowCount(len(exposures))
        for i in range(len(hazards)):
            hazard = hazards[i]
            item = QTableWidgetItem()
            item.setIcon(QIcon(get_image_path(hazard)))
            item.setText(hazard['name'].capitalize())
            item.setTextAlignment(Qt.AlignLeft)
            self.tblFunctions1.setHorizontalHeaderItem(i, item)
        for i in range(len(exposures)):
            exposure = exposures[i]
            item = QTableWidgetItem()
            item.setIcon(QIcon(get_image_path(exposure)))
            item.setText(exposure['name'].capitalize())
            self.tblFunctions1.setVerticalHeaderItem(i, item)
        developer_mode = setting('developer_mode', False, bool)
        for hazard in hazards:
            for exposure in exposures:
                item = QTableWidgetItem()
                if (exposure in hazard['disabled_exposures'] and not
                        developer_mode):
                    background_colour = unavailable_option_color
                    # Set it disable and un-selectable
                    item.setFlags(
                        item.flags() & ~
                        Qt.ItemIsEnabled & ~
                        Qt.ItemIsSelectable
                    )
                else:
                    background_colour = available_option_color
                item.setBackground(QBrush(background_colour))
                item.setFont(big_font)
                item.setTextAlignment(Qt.AlignCenter | Qt.AlignHCenter)
                item.setData(RoleHazard, hazard)
                item.setData(RoleExposure, exposure)
                self.tblFunctions1.setItem(
                    exposures.index(exposure), hazards.index(hazard), item)
        self.parent.pbnNext.setEnabled(False)
def populate_function_table_1 ( self ) : hazards = deepcopy ( hazard_all ) exposures = exposure_all self . lblAvailableFunctions1 . clear ( ) self . tblFunctions1 . clear ( ) self . tblFunctions1 . setColumnCount ( len ( hazards ) ) self . tblFunctions1 . setRowCount ( len ( exposures ) ) for i in range ( len ( hazards ) ) : hazard = hazards [ i ] item = QTableWidgetItem ( ) item . setIcon ( QIcon ( get_image_path ( hazard ) ) ) item . setText ( hazard [ 'name' ] . capitalize ( ) ) item . setTextAlignment ( Qt . AlignLeft ) self . tblFunctions1 . setHorizontalHeaderItem ( i , item ) for i in range ( len ( exposures ) ) : exposure = exposures [ i ] item = QTableWidgetItem ( ) item . setIcon ( QIcon ( get_image_path ( exposure ) ) ) item . setText ( exposure [ 'name' ] . capitalize ( ) ) self . tblFunctions1 . setVerticalHeaderItem ( i , item ) developer_mode = setting ( 'developer_mode' , False , bool ) for hazard in hazards : for exposure in exposures : item = QTableWidgetItem ( ) if ( exposure in hazard [ 'disabled_exposures' ] and not developer_mode ) : background_colour = unavailable_option_color item . setFlags ( item . flags ( ) & ~ Qt . ItemIsEnabled & ~ Qt . ItemIsSelectable ) else : background_colour = available_option_color item . setBackground ( QBrush ( background_colour ) ) item . setFont ( big_font ) item . setTextAlignment ( Qt . AlignCenter | Qt . AlignHCenter ) item . setData ( RoleHazard , hazard ) item . setData ( RoleExposure , exposure ) self . tblFunctions1 . setItem ( exposures . index ( exposure ) , hazards . index ( hazard ) , item ) self . parent . pbnNext . setEnabled ( False )
Populate the tblFunctions1 table with available functions.