irrad_control/gui/widgets/daq_info_widget.py
def _setup_table(self, server):
        """Setup and return table widget(s) in order to display channel data of adc"""
        
        # Check how many tables are needed to display all channels
        total_tables = self._check_n_tables(server)

        # Determine which table has how many columns
        cols_per_table, remnant = divmod(self.n_channels[server], total_tables)
        cols_final = [cpt + 1 if (i + 1) <= remnant else cpt for i, cpt in enumerate([cols_per_table] * total_tables)]

        # Loop over tables and fill list
        tables = []
        for i in range(total_tables):
            table = QtWidgets.QTableWidget()
            table.showGrid()
            table.setRowCount(1)
            table.verticalHeader().setVisible(False)
            table.setColumnCount(cols_final[i])
            current_headers = self.channels[server][sum(cols_final[:i]): sum(cols_final[:i + 1])]
            table.setHorizontalHeaderLabels([h + ' / ' + self.unit[server] for h in current_headers])
            for j in range(table.columnCount()):
                table.horizontalHeaderItem(j).setToolTip('Channel of type %s' % self.ch_types[server][j])
                table.horizontalHeaderItem(j).setFont(self.table_header_font)
                table.setItem(0, j, QtWidgets.QTableWidgetItem(format(0, '.{}f'.format(self.n_digits[server]))))
                table.item(0, j).setTextAlignment(QtCore.Qt.AlignCenter)
                table.item(0, j).setFlags(QtCore.Qt.ItemIsEnabled)
                table.item(0, j).setFont(self.table_value_font)
                table.item(0, j).setToolTip("R/O scale I_FS: {}".format(_ro_scales[self.ro_scales[server][j]].encode('utf-8')))
                table.resizeColumnToContents(j)

            # Set minimum widths and stretch policies
            table.setMinimumWidth(sum([table.columnWidth(k) for k in range(table.columnCount())]))
            table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
            table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)

            tables.append(table)

        return tables
Setup and return table widget(s) in order to display channel data of adc
Setup and return table widget(s) in order to display channel data of adc
Setup and return table widget ( s ) in order to display channel data of adc
def _setup_table(self, server):
        total_tables = self._check_n_tables(server)
        cols_per_table, remnant = divmod(self.n_channels[server], total_tables)
        cols_final = [cpt + 1 if (i + 1) <= remnant else cpt for i, cpt in enumerate([cols_per_table] * total_tables)]
        tables = []
        for i in range(total_tables):
            table = QtWidgets.QTableWidget()
            table.showGrid()
            table.setRowCount(1)
            table.verticalHeader().setVisible(False)
            table.setColumnCount(cols_final[i])
            current_headers = self.channels[server][sum(cols_final[:i]): sum(cols_final[:i + 1])]
            table.setHorizontalHeaderLabels([h + ' / ' + self.unit[server] for h in current_headers])
            for j in range(table.columnCount()):
                table.horizontalHeaderItem(j).setToolTip('Channel of type %s' % self.ch_types[server][j])
                table.horizontalHeaderItem(j).setFont(self.table_header_font)
                table.setItem(0, j, QtWidgets.QTableWidgetItem(format(0, '.{}f'.format(self.n_digits[server]))))
                table.item(0, j).setTextAlignment(QtCore.Qt.AlignCenter)
                table.item(0, j).setFlags(QtCore.Qt.ItemIsEnabled)
                table.item(0, j).setFont(self.table_value_font)
                table.item(0, j).setToolTip("R/O scale I_FS: {}".format(_ro_scales[self.ro_scales[server][j]].encode('utf-8')))
                table.resizeColumnToContents(j)
            table.setMinimumWidth(sum([table.columnWidth(k) for k in range(table.columnCount())]))
            table.horizontalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
            table.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
            tables.append(table)
        return tables
def _setup_table ( self , server ) : total_tables = self . _check_n_tables ( server ) cols_per_table , remnant = divmod ( self . n_channels [ server ] , total_tables ) cols_final = [ cpt + 1 if ( i + 1 ) <= remnant else cpt for i , cpt in enumerate ( [ cols_per_table ] * total_tables ) ] tables = [ ] for i in range ( total_tables ) : table = QtWidgets . QTableWidget ( ) table . showGrid ( ) table . setRowCount ( 1 ) table . verticalHeader ( ) . setVisible ( False ) table . setColumnCount ( cols_final [ i ] ) current_headers = self . channels [ server ] [ sum ( cols_final [ : i ] ) : sum ( cols_final [ : i + 1 ] ) ] table . setHorizontalHeaderLabels ( [ h + ' / ' + self . unit [ server ] for h in current_headers ] ) for j in range ( table . columnCount ( ) ) : table . horizontalHeaderItem ( j ) . setToolTip ( 'Channel of type %s' % self . ch_types [ server ] [ j ] ) table . horizontalHeaderItem ( j ) . setFont ( self . table_header_font ) table . setItem ( 0 , j , QtWidgets . QTableWidgetItem ( format ( 0 , '.{}f' . format ( self . n_digits [ server ] ) ) ) ) table . item ( 0 , j ) . setTextAlignment ( QtCore . Qt . AlignCenter ) table . item ( 0 , j ) . setFlags ( QtCore . Qt . ItemIsEnabled ) table . item ( 0 , j ) . setFont ( self . table_value_font ) table . item ( 0 , j ) . setToolTip ( "R/O scale I_FS: {}" . format ( _ro_scales [ self . ro_scales [ server ] [ j ] ] . encode ( 'utf-8' ) ) ) table . resizeColumnToContents ( j ) table . setMinimumWidth ( sum ( [ table . columnWidth ( k ) for k in range ( table . columnCount ( ) ) ] ) ) table . horizontalHeader ( ) . setSectionResizeMode ( QtWidgets . QHeaderView . Stretch ) table . verticalHeader ( ) . setSectionResizeMode ( QtWidgets . QHeaderView . Stretch ) tables . append ( table ) return tables
Setup and return table widget(s) in order to display channel data of adc
Setup and return table widget ( s ) in order to display channel data of adc
"""Setup and return table widget(s) in order to display channel data of adc""" # Check how many tables are needed to display all channels # Determine which table has how many columns # Loop over tables and fill list # Set minimum widths and stretch policies
self
server