code: def set_scale_alpha_from_selection(self):
          '''
          Set scale marker to alpha for selected layer.
          '''
          #  1. Look up selected layer.
          selection = self.treeview_layers.get_selection()
          list_store, selected_iter = selection.get_selected()
  
          # 2. Set adjustment to current alpha value for selected layer (if any).
          if selected_iter is None:
              # No layer was selected, so disable scale widget.
              self.adjustment_alpha.set_value(100)
              self.scale_alpha.set_sensitive(False)
              return
          else:
              surface_name, alpha = list_store[selected_iter]
              self.adjustment_alpha.set_value(alpha * 100)
              self.scale_alpha.set_sensitive(Truef set_scale_alpha_from_selection(self):
          '''
          Set scale marker to alpha for selected layer.
          '''
          #  1. Look up selected layer.
          selection = self.treeview_layers.get_selection()
          list_store, selected_iter = selection.get_selected()
  
          # 2. Set adjustment to current alpha value for selected layer (if any).
          if selected_iter is None:
              # No layer was selected, so disable scale widget.
              self.adjustment_alpha.set_value(100)
              self.scale_alpha.set_sensitive(False)
              return
          else:
              surface_name, alpha = list_store[selected_iter]
              self.adjustment_alpha.set_value(alpha * 100)
              self.scale_alpha.set_sensitive(True)
docs: Set scale marker to alpha for selected layer.