prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Opacity slider label should be between 0 and 1
  ## 🐛 Bug
  
  Opacity slider label should be between 0 and 1 not 0 and 100. This will remove need for normalization on slider https://github.com/napari/napari/blob/aade148d8e5cb339bb2981ab4d1081ae5d2747e0/napari/_qt/layer_controls/qt_layer_controls_base.py#L79
  
  ![image](https://user-images.githubusercontent.com/6531703/125152865-96bcb380-e104-11eb-9a09-7a9784a3da0c.png)
  
  
  
  </issue>
  <code>
  [start of napari/_qt/layer_controls/qt_layer_controls_base.py]
  1 from qtpy.QtCore import Qt
  2 from qtpy.QtWidgets import QComboBox, QFrame, QGridLayout
  3 from superqt import QLabeledSlider as QSlider
  4 
  5 from ...layers.base._base_constants import BLENDING_TRANSLATIONS
  6 from ...utils.events import disconnect_events
  7 
  8 
  9 class QtLayerControls(QFrame):
  10     """Superclass for all the other LayerControl classes.
  11 
  12     This class is never directly instantiated anywhere.
  13 
  14     Parameters
  15     ----------
  16     layer : napari.layers.Layer
  17         An instance of a napari layer.
  18 
  19     Attributes
  20     ----------
  21     blendComboBox : qtpy.QtWidgets.QComboBox
  22         Drowpdown widget to select blending mode of layer.
  23     grid_layout : qtpy.QtWidgets.QGridLayout
  24         Layout of Qt widget controls for the layer.
  25     layer : napari.layers.Layer
  26         An instance of a napari layer.
  27     opacitySlider : qtpy.QtWidgets.QSlider
  28         Slider controlling opacity of the layer.
  29     """
  30 
  31     def __init__(self, layer):
  32         super().__init__()
  33 
  34         self.layer = layer
  35         self.layer.events.blending.connect(self._on_blending_change)
  36         self.layer.events.opacity.connect(self._on_opacity_change)
  37 
  38         self.setAttribute(Qt.WA_DeleteOnClose)
  39 
  40         self.setObjectName('layer')
  41         self.setMouseTracking(True)
  42 
  43         self.grid_layout = QGridLayout(self)
  44         self.grid_layout.setContentsMargins(0, 0, 0, 0)
  45         self.grid_layout.setSpacing(2)
  46         self.grid_layout.setColumnMinimumWidth(0, 86)
  47         self.grid_layout.setColumnStretch(1, 1)
  48         self.setLayout(self.grid_layout)
  49 
  50         sld = QSlider(Qt.Horizontal, parent=self)
  51         sld.setFocusPolicy(Qt.NoFocus)
  52         sld.setMinimum(0)
  53         sld.setMaximum(100)
  54         sld.setSingleStep(1)
  55         sld.valueChanged.connect(self.changeOpacity)
  56         self.opacitySlider = sld
  57         self._on_opacity_change()
  58 
  59         blend_comboBox = QComboBox(self)
  60         for index, (data, text) in enumerate(BLENDING_TRANSLATIONS.items()):
  61             data = data.value
  62             blend_comboBox.addItem(text, data)
  63             if data == self.layer.blending:
  64                 blend_comboBox.setCurrentIndex(index)
  65 
  66         blend_comboBox.activated[str].connect(self.changeBlending)
  67         self.blendComboBox = blend_comboBox
  68 
  69     def changeOpacity(self, value):
  70         """Change opacity value on the layer model.
  71 
  72         Parameters
  73         ----------
  74         value : float
  75             Opacity value for shapes.
  76             Input range 0 - 100 (transparent to fully opaque).
  77         """
  78         with self.layer.events.blocker(self._on_opacity_change):
  79             self.layer.opacity = value / 100
  80 
  81     def changeBlending(self, text):
  82         """Change blending mode on the layer model.
  83 
  84         Parameters
  85         ----------
  86         text : str
  87             Name of blending mode, eg: 'translucent', 'additive', 'opaque'.
  88         """
  89         self.layer.blending = self.blendComboBox.currentData()
  90 
  91     def _on_opacity_change(self, event=None):
  92         """Receive layer model opacity change event and update opacity slider.
  93 
  94         Parameters
  95         ----------
  96         event : napari.utils.event.Event, optional
  97             The napari event that triggered this method, by default None.
  98         """
  99         with self.layer.events.opacity.blocker():
  100             self.opacitySlider.setValue(int(self.layer.opacity * 100))
  101 
  102     def _on_blending_change(self, event=None):
  103         """Receive layer model blending mode change event and update slider.
  104 
  105         Parameters
  106         ----------
  107         event : napari.utils.event.Event, optional
  108             The napari event that triggered this method, by default None.
  109         """
  110         with self.layer.events.blending.blocker():
  111             self.blendComboBox.setCurrentIndex(
  112                 self.blendComboBox.findData(self.layer.blending)
  113             )
  114 
  115     def close(self):
  116         """Disconnect events when widget is closing."""
  117         disconnect_events(self.layer.events, self)
  118         for child in self.children():
  119             close_method = getattr(child, 'close', None)
  120             if close_method is not None:
  121                 close_method()
  122         super().close()
  123
  [end of napari/_qt/layer_controls/qt_layer_controls_base.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/napari/_qt/layer_controls/qt_layer_controls_base.py b/napari/_qt/layer_controls/qt_layer_controls_base.py
  --- a/napari/_qt/layer_controls/qt_layer_controls_base.py
  +++ b/napari/_qt/layer_controls/qt_layer_controls_base.py
  @@ -1,6 +1,6 @@
   from qtpy.QtCore import Qt
   from qtpy.QtWidgets import QComboBox, QFrame, QGridLayout
  -from superqt import QLabeledSlider as QSlider
  +from superqt import QLabeledDoubleSlider
   
   from ...layers.base._base_constants import BLENDING_TRANSLATIONS
   from ...utils.events import disconnect_events
  @@ -47,11 +47,11 @@
           self.grid_layout.setColumnStretch(1, 1)
           self.setLayout(self.grid_layout)
   
  -        sld = QSlider(Qt.Horizontal, parent=self)
  +        sld = QLabeledDoubleSlider(Qt.Horizontal, parent=self)
           sld.setFocusPolicy(Qt.NoFocus)
           sld.setMinimum(0)
  -        sld.setMaximum(100)
  -        sld.setSingleStep(1)
  +        sld.setMaximum(1)
  +        sld.setSingleStep(0.01)
           sld.valueChanged.connect(self.changeOpacity)
           self.opacitySlider = sld
           self._on_opacity_change()
  @@ -76,7 +76,7 @@
               Input range 0 - 100 (transparent to fully opaque).
           """
           with self.layer.events.blocker(self._on_opacity_change):
  -            self.layer.opacity = value / 100
  +            self.layer.opacity = value
   
       def changeBlending(self, text):
           """Change blending mode on the layer model.
  @@ -97,7 +97,7 @@
               The napari event that triggered this method, by default None.
           """
           with self.layer.events.opacity.blocker():
  -            self.opacitySlider.setValue(int(self.layer.opacity * 100))
  +            self.opacitySlider.setValue(self.layer.opacity)
   
       def _on_blending_change(self, event=None):
           """Receive layer model blending mode change event and update slider.
  
verification_info: {"golden_diff": "diff --git a/napari/_qt/layer_controls/qt_layer_controls_base.py b/napari/_qt/layer_controls/qt_layer_controls_base.py\n--- a/napari/_qt/layer_controls/qt_layer_controls_base.py\n+++ b/napari/_qt/layer_controls/qt_layer_controls_base.py\n@@ -1,6 +1,6 @@\n from qtpy.QtCore import Qt\n from qtpy.QtWidgets import QComboBox, QFrame, QGridLayout\n-from superqt import QLabeledSlider as QSlider\n+from superqt import QLabeledDoubleSlider\n \n from ...layers.base._base_constants import BLENDING_TRANSLATIONS\n from ...utils.events import disconnect_events\n@@ -47,11 +47,11 @@\n         self.grid_layout.setColumnStretch(1, 1)\n         self.setLayout(self.grid_layout)\n \n-        sld = QSlider(Qt.Horizontal, parent=self)\n+        sld = QLabeledDoubleSlider(Qt.Horizontal, parent=self)\n         sld.setFocusPolicy(Qt.NoFocus)\n         sld.setMinimum(0)\n-        sld.setMaximum(100)\n-        sld.setSingleStep(1)\n+        sld.setMaximum(1)\n+        sld.setSingleStep(0.01)\n         sld.valueChanged.connect(self.changeOpacity)\n         self.opacitySlider = sld\n         self._on_opacity_change()\n@@ -76,7 +76,7 @@\n             Input range 0 - 100 (transparent to fully opaque).\n         \"\"\"\n         with self.layer.events.blocker(self._on_opacity_change):\n-            self.layer.opacity = value / 100\n+            self.layer.opacity = value\n \n     def changeBlending(self, text):\n         \"\"\"Change blending mode on the layer model.\n@@ -97,7 +97,7 @@\n             The napari event that triggered this method, by default None.\n         \"\"\"\n         with self.layer.events.opacity.blocker():\n-            self.opacitySlider.setValue(int(self.layer.opacity * 100))\n+            self.opacitySlider.setValue(self.layer.opacity)\n \n     def _on_blending_change(self, event=None):\n         \"\"\"Receive layer model blending mode change event and update slider.\n", "issue": "Opacity slider label should be between 0 and 1\n## \ud83d\udc1b Bug\r\n\r\nOpacity slider label should be between 0 and 1 not 0 and 100. This will remove need for normalization on slider https://github.com/napari/napari/blob/aade148d8e5cb339bb2981ab4d1081ae5d2747e0/napari/_qt/layer_controls/qt_layer_controls_base.py#L79\r\n\r\n![image](https://user-images.githubusercontent.com/6531703/125152865-96bcb380-e104-11eb-9a09-7a9784a3da0c.png)\r\n\r\n\n", "before_files": [{"content": "from qtpy.QtCore import Qt\nfrom qtpy.QtWidgets import QComboBox, QFrame, QGridLayout\nfrom superqt import QLabeledSlider as QSlider\n\nfrom ...layers.base._base_constants import BLENDING_TRANSLATIONS\nfrom ...utils.events import disconnect_events\n\n\nclass QtLayerControls(QFrame):\n    \"\"\"Superclass for all the other LayerControl classes.\n\n    This class is never directly instantiated anywhere.\n\n    Parameters\n    ----------\n    layer : napari.layers.Layer\n        An instance of a napari layer.\n\n    Attributes\n    ----------\n    blendComboBox : qtpy.QtWidgets.QComboBox\n        Drowpdown widget to select blending mode of layer.\n    grid_layout : qtpy.QtWidgets.QGridLayout\n        Layout of Qt widget controls for the layer.\n    layer : napari.layers.Layer\n        An instance of a napari layer.\n    opacitySlider : qtpy.QtWidgets.QSlider\n        Slider controlling opacity of the layer.\n    \"\"\"\n\n    def __init__(self, layer):\n        super().__init__()\n\n        self.layer = layer\n        self.layer.events.blending.connect(self._on_blending_change)\n        self.layer.events.opacity.connect(self._on_opacity_change)\n\n        self.setAttribute(Qt.WA_DeleteOnClose)\n\n        self.setObjectName('layer')\n        self.setMouseTracking(True)\n\n        self.grid_layout = QGridLayout(self)\n        self.grid_layout.setContentsMargins(0, 0, 0, 0)\n        self.grid_layout.setSpacing(2)\n        self.grid_layout.setColumnMinimumWidth(0, 86)\n        self.grid_layout.setColumnStretch(1, 1)\n        self.setLayout(self.grid_layout)\n\n        sld = QSlider(Qt.Horizontal, parent=self)\n        sld.setFocusPolicy(Qt.NoFocus)\n        sld.setMinimum(0)\n        sld.setMaximum(100)\n        sld.setSingleStep(1)\n        sld.valueChanged.connect(self.changeOpacity)\n        self.opacitySlider = sld\n        self._on_opacity_change()\n\n        blend_comboBox = QComboBox(self)\n        for index, (data, text) in enumerate(BLENDING_TRANSLATIONS.items()):\n            data = data.value\n            blend_comboBox.addItem(text, data)\n            if data == self.layer.blending:\n                blend_comboBox.setCurrentIndex(index)\n\n        blend_comboBox.activated[str].connect(self.changeBlending)\n        self.blendComboBox = blend_comboBox\n\n    def changeOpacity(self, value):\n        \"\"\"Change opacity value on the layer model.\n\n        Parameters\n        ----------\n        value : float\n            Opacity value for shapes.\n            Input range 0 - 100 (transparent to fully opaque).\n        \"\"\"\n        with self.layer.events.blocker(self._on_opacity_change):\n            self.layer.opacity = value / 100\n\n    def changeBlending(self, text):\n        \"\"\"Change blending mode on the layer model.\n\n        Parameters\n        ----------\n        text : str\n            Name of blending mode, eg: 'translucent', 'additive', 'opaque'.\n        \"\"\"\n        self.layer.blending = self.blendComboBox.currentData()\n\n    def _on_opacity_change(self, event=None):\n        \"\"\"Receive layer model opacity change event and update opacity slider.\n\n        Parameters\n        ----------\n        event : napari.utils.event.Event, optional\n            The napari event that triggered this method, by default None.\n        \"\"\"\n        with self.layer.events.opacity.blocker():\n            self.opacitySlider.setValue(int(self.layer.opacity * 100))\n\n    def _on_blending_change(self, event=None):\n        \"\"\"Receive layer model blending mode change event and update slider.\n\n        Parameters\n        ----------\n        event : napari.utils.event.Event, optional\n            The napari event that triggered this method, by default None.\n        \"\"\"\n        with self.layer.events.blending.blocker():\n            self.blendComboBox.setCurrentIndex(\n                self.blendComboBox.findData(self.layer.blending)\n            )\n\n    def close(self):\n        \"\"\"Disconnect events when widget is closing.\"\"\"\n        disconnect_events(self.layer.events, self)\n        for child in self.children():\n            close_method = getattr(child, 'close', None)\n            if close_method is not None:\n                close_method()\n        super().close()\n", "path": "napari/_qt/layer_controls/qt_layer_controls_base.py"}]}