prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Show logo during startup
  ## 🚀 Feature
  Right now napari takes a long time to launch the viewer. People can get discouraged as they wait, unsure if napari is loading, or if their data is loading, or if it is just hanging. Showing the napari logo, possibly with / without some text during that time might make it feel better.
  
  </issue>
  <code>
  [start of napari/_qt/event_loop.py]
  1 import sys
  2 from contextlib import contextmanager
  3 
  4 from qtpy.QtWidgets import QApplication
  5 
  6 
  7 @contextmanager
  8 def gui_qt():
  9     """Start a Qt event loop in which to run the application.
  10 
  11     Notes
  12     -----
  13     This context manager is not needed if running napari within an interactive
  14     IPython session. In this case, use the ``%gui qt`` magic command, or start
  15     IPython with the Qt GUI event loop enabled by default by using
  16     ``ipython --gui=qt``.
  17     """
  18     app = QApplication.instance() or QApplication(sys.argv)
  19     yield
  20     app.exec_()
  21
  [end of napari/_qt/event_loop.py]
  [start of napari/__main__.py]
  1 """
  2 napari command line viewer.
  3 """
  4 import argparse
  5 import sys
  6 
  7 import numpy as np
  8 
  9 from .util import io
  10 from . import Viewer, gui_qt
  11 
  12 
  13 def main():
  14     parser = argparse.ArgumentParser(usage=__doc__)
  15     parser.add_argument('images', nargs='*', help='Images to view.')
  16     parser.add_argument(
  17         '--layers',
  18         action='store_true',
  19         help='Treat multiple input images as layers.',
  20     )
  21     parser.add_argument(
  22         '-r',
  23         '--rgb',
  24         help='Treat images as RGB.',
  25         action='store_true',
  26         default=None,
  27     )
  28     parser.add_argument(
  29         '-g',
  30         '--grayscale',
  31         dest='rgb',
  32         action='store_false',
  33         help='interpret all dimensions in the image as spatial',
  34     )
  35     parser.add_argument(
  36         '-D',
  37         '--use-dask',
  38         action='store_true',
  39         help='Use dask to read in images. This conserves memory. This option '
  40         'does nothing if a single image is given.',
  41         default=None,
  42     )
  43     parser.add_argument(
  44         '-N',
  45         '--use-numpy',
  46         action='store_false',
  47         dest='use_dask',
  48         help='Use NumPy to read in images. This can be more performant than '
  49         'dask if all the images fit in RAM. This option does nothing if '
  50         'only a single image is given.',
  51     )
  52     args = parser.parse_args()
  53     with gui_qt():
  54         v = Viewer()
  55         if len(args.images) > 0:
  56             images = io.magic_imread(
  57                 args.images, use_dask=args.use_dask, stack=not args.layers
  58             )
  59             if args.layers:
  60                 for layer in images:
  61                     if layer.dtype in (
  62                         np.int32,
  63                         np.uint32,
  64                         np.int64,
  65                         np.uint64,
  66                     ):
  67                         v.add_labels(layer)
  68                     else:
  69                         v.add_image(layer, rgb=args.rgb)
  70             else:
  71                 v.add_image(images, rgb=args.rgb)
  72 
  73 
  74 if __name__ == '__main__':
  75     sys.exit(main())
  76
  [end of napari/__main__.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/__main__.py b/napari/__main__.py
  --- a/napari/__main__.py
  +++ b/napari/__main__.py
  @@ -50,7 +50,7 @@
           'only a single image is given.',
       )
       args = parser.parse_args()
  -    with gui_qt():
  +    with gui_qt(startup_logo=True):
           v = Viewer()
           if len(args.images) > 0:
               images = io.magic_imread(
  diff --git a/napari/_qt/event_loop.py b/napari/_qt/event_loop.py
  --- a/napari/_qt/event_loop.py
  +++ b/napari/_qt/event_loop.py
  @@ -1,13 +1,20 @@
   import sys
   from contextlib import contextmanager
  +from os.path import dirname, join
   
  -from qtpy.QtWidgets import QApplication
  +from qtpy.QtGui import QPixmap
  +from qtpy.QtWidgets import QApplication, QSplashScreen
   
   
   @contextmanager
  -def gui_qt():
  +def gui_qt(*, startup_logo=False):
       """Start a Qt event loop in which to run the application.
   
  +    Parameters
  +    ----------
  +    startup_logo : bool
  +        Show a splash screen with the napari logo during startup.
  +
       Notes
       -----
       This context manager is not needed if running napari within an interactive
  @@ -16,5 +23,11 @@
       ``ipython --gui=qt``.
       """
       app = QApplication.instance() or QApplication(sys.argv)
  +    if startup_logo:
  +        logopath = join(dirname(__file__), '..', 'resources', 'logo.png')
  +        splash_widget = QSplashScreen(QPixmap(logopath).scaled(400, 400))
  +        splash_widget.show()
       yield
  +    if startup_logo:
  +        splash_widget.close()
       app.exec_()
  
verification_info: {"golden_diff": "diff --git a/napari/__main__.py b/napari/__main__.py\n--- a/napari/__main__.py\n+++ b/napari/__main__.py\n@@ -50,7 +50,7 @@\n         'only a single image is given.',\n     )\n     args = parser.parse_args()\n-    with gui_qt():\n+    with gui_qt(startup_logo=True):\n         v = Viewer()\n         if len(args.images) > 0:\n             images = io.magic_imread(\ndiff --git a/napari/_qt/event_loop.py b/napari/_qt/event_loop.py\n--- a/napari/_qt/event_loop.py\n+++ b/napari/_qt/event_loop.py\n@@ -1,13 +1,20 @@\n import sys\n from contextlib import contextmanager\n+from os.path import dirname, join\n \n-from qtpy.QtWidgets import QApplication\n+from qtpy.QtGui import QPixmap\n+from qtpy.QtWidgets import QApplication, QSplashScreen\n \n \n @contextmanager\n-def gui_qt():\n+def gui_qt(*, startup_logo=False):\n     \"\"\"Start a Qt event loop in which to run the application.\n \n+    Parameters\n+    ----------\n+    startup_logo : bool\n+        Show a splash screen with the napari logo during startup.\n+\n     Notes\n     -----\n     This context manager is not needed if running napari within an interactive\n@@ -16,5 +23,11 @@\n     ``ipython --gui=qt``.\n     \"\"\"\n     app = QApplication.instance() or QApplication(sys.argv)\n+    if startup_logo:\n+        logopath = join(dirname(__file__), '..', 'resources', 'logo.png')\n+        splash_widget = QSplashScreen(QPixmap(logopath).scaled(400, 400))\n+        splash_widget.show()\n     yield\n+    if startup_logo:\n+        splash_widget.close()\n     app.exec_()\n", "issue": "Show logo during startup\n## \ud83d\ude80 Feature\r\nRight now napari takes a long time to launch the viewer. People can get discouraged as they wait, unsure if napari is loading, or if their data is loading, or if it is just hanging. Showing the napari logo, possibly with / without some text during that time might make it feel better.\n", "before_files": [{"content": "import sys\nfrom contextlib import contextmanager\n\nfrom qtpy.QtWidgets import QApplication\n\n\n@contextmanager\ndef gui_qt():\n    \"\"\"Start a Qt event loop in which to run the application.\n\n    Notes\n    -----\n    This context manager is not needed if running napari within an interactive\n    IPython session. In this case, use the ``%gui qt`` magic command, or start\n    IPython with the Qt GUI event loop enabled by default by using\n    ``ipython --gui=qt``.\n    \"\"\"\n    app = QApplication.instance() or QApplication(sys.argv)\n    yield\n    app.exec_()\n", "path": "napari/_qt/event_loop.py"}, {"content": "\"\"\"\nnapari command line viewer.\n\"\"\"\nimport argparse\nimport sys\n\nimport numpy as np\n\nfrom .util import io\nfrom . import Viewer, gui_qt\n\n\ndef main():\n    parser = argparse.ArgumentParser(usage=__doc__)\n    parser.add_argument('images', nargs='*', help='Images to view.')\n    parser.add_argument(\n        '--layers',\n        action='store_true',\n        help='Treat multiple input images as layers.',\n    )\n    parser.add_argument(\n        '-r',\n        '--rgb',\n        help='Treat images as RGB.',\n        action='store_true',\n        default=None,\n    )\n    parser.add_argument(\n        '-g',\n        '--grayscale',\n        dest='rgb',\n        action='store_false',\n        help='interpret all dimensions in the image as spatial',\n    )\n    parser.add_argument(\n        '-D',\n        '--use-dask',\n        action='store_true',\n        help='Use dask to read in images. This conserves memory. This option '\n        'does nothing if a single image is given.',\n        default=None,\n    )\n    parser.add_argument(\n        '-N',\n        '--use-numpy',\n        action='store_false',\n        dest='use_dask',\n        help='Use NumPy to read in images. This can be more performant than '\n        'dask if all the images fit in RAM. This option does nothing if '\n        'only a single image is given.',\n    )\n    args = parser.parse_args()\n    with gui_qt():\n        v = Viewer()\n        if len(args.images) > 0:\n            images = io.magic_imread(\n                args.images, use_dask=args.use_dask, stack=not args.layers\n            )\n            if args.layers:\n                for layer in images:\n                    if layer.dtype in (\n                        np.int32,\n                        np.uint32,\n                        np.int64,\n                        np.uint64,\n                    ):\n                        v.add_labels(layer)\n                    else:\n                        v.add_image(layer, rgb=args.rgb)\n            else:\n                v.add_image(images, rgb=args.rgb)\n\n\nif __name__ == '__main__':\n    sys.exit(main())\n", "path": "napari/__main__.py"}]}