def edit_resource(self):
        """Handle edit resource requests.
        """
        self.mark_current_profile_as_pending()
        resource = None
        for item in self.resources_list.selectedItems()[:1]:
            resource = item.resource_full
            self.edit_item = item
        if not resource:
            return
        parameters_widget = [
            self.parameters_scrollarea.layout().itemAt(i) for i in
            range(self.parameters_scrollarea.layout().count())][0].widget()
        parameter_widgets = [
            parameters_widget.vertical_layout.itemAt(i).widget() for i in
            range(parameters_widget.vertical_layout.count())]
        parameter_widgets[0].set_text(resource['Resource name'])
        parameter_widgets[1].set_text(resource['Resource description'])
        parameter_widgets[2].set_text(resource['Unit'])
        parameter_widgets[3].set_text(resource['Units'])
        parameter_widgets[4].set_text(resource['Unit abbreviation'])
        parameter_widgets[5].set_value(float(resource['Default']))
        parameter_widgets[6].set_value(float(resource['Minimum allowed']))
        parameter_widgets[7].set_value(float(resource['Maximum allowed']))
        parameter_widgets[8].set_text(resource['Frequency'])
        parameter_widgets[9].set_text(resource['Readable sentence'])
        self.switch_context(self.resource_edit_page)
def edit_resource ( self ) : self . mark_current_profile_as_pending ( ) resource = None for item in self . resources_list . selectedItems ( ) [ : 1 ] : resource = item . resource_full self . edit_item = item if not resource : return parameters_widget = [ self . parameters_scrollarea . layout ( ) . itemAt ( i ) for i in range ( self . parameters_scrollarea . layout ( ) . count ( ) ) ] [ 0 ] . widget ( ) parameter_widgets = [ parameters_widget . vertical_layout . itemAt ( i ) . widget ( ) for i in range ( parameters_widget . vertical_layout . count ( ) ) ] parameter_widgets [ 0 ] . set_text ( resource [ 'Resource name' ] ) parameter_widgets [ 1 ] . set_text ( resource [ 'Resource description' ] ) parameter_widgets [ 2 ] . set_text ( resource [ 'Unit' ] ) parameter_widgets [ 3 ] . set_text ( resource [ 'Units' ] ) parameter_widgets [ 4 ] . set_text ( resource [ 'Unit abbreviation' ] ) parameter_widgets [ 5 ] . set_value ( float ( resource [ 'Default' ] ) ) parameter_widgets [ 6 ] . set_value ( float ( resource [ 'Minimum allowed' ] ) ) parameter_widgets [ 7 ] . set_value ( float ( resource [ 'Maximum allowed' ] ) ) parameter_widgets [ 8 ] . set_text ( resource [ 'Frequency' ] ) parameter_widgets [ 9 ] . set_text ( resource [ 'Readable sentence' ] ) self . switch_context ( self . resource_edit_page )
Handle edit resource requests.