changeset 81:9922cde5ad6c

MainWindow: refactor to move ROM grid into a dockable window Lots of big changes here. I'm still experimenting with the layout. Also, I've decided to use the Adwaita symbolic icons, in light and dark versions. I'll be using the color.is_dark to decide which version of the icons to use.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Tue, 10 Sep 2019 13:21:22 -0400
parents cc5ffdcf7108
children c93a436e6dec
files colors.py img/darkside/widget-close.svg img/darkside/widget-undock.svg img/darkside/zoom-in.svg img/darkside/zoom-original.svg img/darkside/zoom-out.svg img/lightside/widget-close.svg img/lightside/widget-undock.svg img/lightside/zoom-in.svg img/lightside/zoom-original.svg img/lightside/zoom-out.svg tilerswift
diffstat 12 files changed, 412 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/colors.py
+++ b/colors.py
@@ -84,6 +84,10 @@
     return luminance < 0.5
 
 
+def widget_icon_path(widget):
+    return "darkside" if is_dark(widget.palette().color(QG.QPalette.Background)) else "lightside"
+
+
 def palette_to_qt(palette):
     return [
         QG.QColor(0, 0, 0, 0).rgba() if color_idx is None
new file mode 100644
--- /dev/null
+++ b/img/darkside/widget-close.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="32"
+   height="32"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="widget-close-light.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1217"
+     inkscape:window-height="737"
+     id="namedview7"
+     showgrid="true"
+     inkscape:zoom="13.632822"
+     inkscape:cx="17.746364"
+     inkscape:cy="1.4474508"
+     inkscape:window-x="-1"
+     inkscape:window-y="34"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2">
+    <inkscape:grid
+       type="xygrid"
+       id="grid2984"
+       empspacing="5"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata8">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs6" />
+  <path
+     d="M 25,25 7,7"
+     id="path2989"
+     style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cc" />
+  <path
+     sodipodi:nodetypes="cc"
+     inkscape:connector-curvature="0"
+     style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+     id="path2985"
+     d="M 25,7 7,25" />
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/darkside/widget-undock.svg
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="32"
+   height="32"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="widget-undock-light.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="640"
+     inkscape:window-height="480"
+     id="namedview5953"
+     showgrid="false"
+     inkscape:zoom="9.4204102"
+     inkscape:cx="16"
+     inkscape:cy="16"
+     inkscape:window-x="0"
+     inkscape:window-y="24"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="g3792" />
+  <metadata
+     id="metadata8">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs6" />
+  <g
+     transform="translate(-7.2158478,-11.926544)"
+     id="g3792"
+     style="stroke:#ffffff;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
+    <rect
+       width="15.999999"
+       height="15"
+       rx="0.2512264"
+       ry="0.0025005043"
+       x="12.215848"
+       y="24.291922"
+       id="rect3794"
+       style="color:#000000;fill:none;stroke:#ffffff;stroke-width:1.50000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <rect
+       width="16"
+       height="1.9999998"
+       rx="0.2512264"
+       ry="0.0025005043"
+       x="12.215848"
+       y="24.291922"
+       id="rect3796"
+       style="color:#000000;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.50000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <rect
+       width="16"
+       height="1.9999998"
+       rx="0.2512264"
+       ry="0.0025005043"
+       x="18.215847"
+       y="16.291922"
+       id="rect2988"
+       style="color:#000000;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.50000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+  </g>
+  <path
+     d="m 11,4.3653773 0,9.9999997"
+     id="path3800"
+     style="fill:none;stroke:#ffffff;stroke-width:1.50000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+  <path
+     d="m 21,19.365377 6,0 0,-14.9999997"
+     id="path3804"
+     style="fill:none;stroke:#ffffff;stroke-width:1.50000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/darkside/zoom-in.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="15.982" height="16">
+    <path d="M3.188 2C2.524 2 2 2.549 2 3.219v9.562C2 13.451 2.525 14 3.188 14h9.624c.663 0 1.188-.549 1.188-1.219V3.22C14 2.549 13.475 2 12.812 2zM7 5h2v2h2v2H9v2H7V9H5V7h2z" style="marker:none" color="#bebebe" overflow="visible" fill="#b8b8b8"/>
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/darkside/zoom-original.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="15.982" height="16">
+    <path d="M3.188 2C2.524 2 2 2.549 2 3.219v9.562C2 13.451 2.525 14 3.188 14h9.624c.663 0 1.188-.549 1.188-1.219V3.22C14 2.549 13.475 2 12.812 2zM7 5h2v6H7V7H6V6c.694 0 1-.348 1-1z" style="marker:none" color="#bebebe" overflow="visible" fill="#b8b8b8"/>
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/darkside/zoom-out.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="15.982" height="16">
+    <path d="M3.188 2C2.524 2 2 2.549 2 3.219v9.562C2 13.451 2.525 14 3.188 14h9.624c.663 0 1.188-.549 1.188-1.219V3.22C14 2.549 13.475 2 12.812 2zM5 7h6v2H5z" style="marker:none" color="#bebebe" overflow="visible" fill="#b8b8b8"/>
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/lightside/widget-close.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="32"
+   height="32"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="widget-close.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1217"
+     inkscape:window-height="737"
+     id="namedview7"
+     showgrid="true"
+     inkscape:zoom="13.632822"
+     inkscape:cx="17.746364"
+     inkscape:cy="17.927867"
+     inkscape:window-x="-1"
+     inkscape:window-y="34"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2">
+    <inkscape:grid
+       type="xygrid"
+       id="grid2984"
+       empspacing="5"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata8">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs6" />
+  <path
+     d="M 25,25 7,7"
+     id="path2989"
+     style="fill:none;stroke:#141414;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cc" />
+  <path
+     sodipodi:nodetypes="cc"
+     inkscape:connector-curvature="0"
+     style="fill:none;stroke:#141414;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+     id="path2985"
+     d="M 25,7 7,25" />
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/lightside/widget-undock.svg
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="32"
+   height="32"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="widget-undock.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1105"
+     inkscape:window-height="720"
+     id="namedview3783"
+     showgrid="true"
+     inkscape:zoom="16.421381"
+     inkscape:cx="24.012447"
+     inkscape:cy="16.356858"
+     inkscape:window-x="0"
+     inkscape:window-y="24"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="g3792">
+    <inkscape:grid
+       type="xygrid"
+       id="grid3785"
+       empspacing="5"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata8">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs6" />
+  <g
+     transform="translate(-7.2158478,-11.926544)"
+     id="g3792"
+     style="stroke:#141414;stroke-opacity:1;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none">
+    <rect
+       width="15.999999"
+       height="15"
+       rx="0.2512264"
+       ry="0.0025005043"
+       x="12.215848"
+       y="24.291922"
+       id="rect3794"
+       style="color:#000000;fill:none;stroke:#141414;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <rect
+       width="16"
+       height="1.9999998"
+       rx="0.2512264"
+       ry="0.0025005043"
+       x="12.215848"
+       y="24.291922"
+       id="rect3796"
+       style="color:#000000;fill:#141414;fill-opacity:1;stroke:#141414;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+    <rect
+       width="16"
+       height="1.9999998"
+       rx="0.2512264"
+       ry="0.0025005043"
+       x="18.215847"
+       y="16.291922"
+       id="rect2988"
+       style="color:#000000;fill:#141414;fill-opacity:1;stroke:#141414;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+  </g>
+  <path
+     d="m 11,4.3653773 0,9.9999997"
+     id="path3800"
+     style="fill:none;stroke:#141414;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="cc" />
+  <path
+     d="m 21,19.365377 6,0 0,-14.9999997"
+     id="path3804"
+     style="fill:none;stroke:#141414;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+     inkscape:connector-curvature="0"
+     sodipodi:nodetypes="ccc" />
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/lightside/zoom-in.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="15.982" height="16">
+    <path d="M3.188 2C2.524 2 2 2.549 2 3.219v9.562C2 13.451 2.525 14 3.188 14h9.624c.663 0 1.188-.549 1.188-1.219V3.22C14 2.549 13.475 2 12.812 2zM7 5h2v2h2v2H9v2H7V9H5V7h2z" style="marker:none" color="#bebebe" overflow="visible" fill="#474747"/>
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/lightside/zoom-original.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="15.982" height="16">
+    <path d="M3.188 2C2.524 2 2 2.549 2 3.219v9.562C2 13.451 2.525 14 3.188 14h9.624c.663 0 1.188-.549 1.188-1.219V3.22C14 2.549 13.475 2 12.812 2zM7 5h2v6H7V7H6V6c.694 0 1-.348 1-1z" style="marker:none" color="#bebebe" overflow="visible" fill="#474747"/>
+</svg>
new file mode 100644
--- /dev/null
+++ b/img/lightside/zoom-out.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="15.982" height="16">
+    <path d="M3.188 2C2.524 2 2 2.549 2 3.219v9.562C2 13.451 2.525 14 3.188 14h9.624c.663 0 1.188-.549 1.188-1.219V3.22C14 2.549 13.475 2 12.812 2zM5 7h6v2H5z" style="marker:none" color="#bebebe" overflow="visible" fill="#474747"/>
+</svg>
--- a/tilerswift
+++ b/tilerswift
@@ -281,7 +281,7 @@
     background-repeat: repeat-xy;
     """
 
-    def __init__(self, rom_canvas):
+    def __init__(self, rom_canvas=None):
         super().__init__(
             numcols=50,
             numrows=30,
@@ -369,6 +369,7 @@
             return
 
         self.setText(f"{colour_idx:0{2}X}")
+
         bgcolour = NES_PALETTE[colour_idx]
         qt_colour = QG.QColor(bgcolour)
 
@@ -399,6 +400,21 @@
     def __init__(self):
         super().__init__()
 
+        bar = self.menuBar()
+        file = bar.addMenu("&File")
+        open_action = file.addAction("&Open")
+        quit_action = file.addAction("&Quit")
+        open_action.triggered.connect(self.open_rom)
+        quit_action.triggered.connect(app.quit)
+
+        self.tile_picker = TilePicker()
+
+        scroll = QW.QScrollArea()
+        scroll.setWidget(self.tile_picker)
+
+        self.setCentralWidget(scroll)
+
+    def open_rom(self):
         filename = QW.QFileDialog.getOpenFileName(
             self,
             "Open ROM", "", "NES Files (*.nes)"
@@ -407,23 +423,8 @@
 
         self.grid_widget = ROMCanvas(rom)
 
-        self.tile_picker = TilePicker(self.grid_widget)
-
-        scroll1 = QW.QScrollArea()
-        scroll1.setWidget(self.grid_widget)
-
-        scroll2 = QW.QScrollArea()
-        scroll2.setWidget(self.tile_picker)
-
-        horz = QW.QHBoxLayout()
-        horz.addWidget(scroll1)
-        horz.addWidget(scroll2)
-
-        scrolls = QW.QWidget()
-        scrolls.setLayout(horz)
-
-        vert = QW.QVBoxLayout()
-        vert.addWidget(scrolls)
+        scroll = QW.QScrollArea()
+        scroll.setWidget(self.grid_widget)
 
         self.colour_picker = ColourPicker()
 
@@ -433,22 +434,40 @@
             button.pressed.connect(lambda idx=button_idx: self.pick_palette_colour(idx))
             self.palette.addWidget(button)
 
-        zoomInButton = QW.QPushButton("+")
-        zoomInButton.setFixedSize(QC.QSize(24, 24))
-        zoomInButton.pressed.connect(self.grid_widget.zoomIn)
-        self.palette.addWidget(zoomInButton)
+        for zoom in ["in", "out", "original"]:
+            zoomButton = QW.QPushButton("")
+            iconpath = widget_icon_path(zoomButton)
+            zoomButton.setIcon(QG.QIcon(f"img/{iconpath}/zoom-{zoom}.svg"))
+            zoomButton.setFixedSize(QC.QSize(48, 48))
+            zoomButton.setIconSize(QC.QSize(32, 32))
+            zoomButton.setToolTip(f"Zoom {zoom}")
+            zoomButton.pressed.connect(getattr(self.grid_widget, f"zoom{zoom.capitalize()}"))
+            self.palette.addWidget(zoomButton)
 
-        zoomOutButton = QW.QPushButton("-")
-        zoomOutButton.setFixedSize(QC.QSize(24, 24))
-        zoomOutButton.pressed.connect(self.grid_widget.zoomOut)
-        self.palette.addWidget(zoomOutButton)
+        left = QW.QVBoxLayout()
+        left.addWidget(scroll)
+        romWidget = QW.QWidget()
+        romWidget.setLayout(left)
+        paletteWidget = QW.QWidget()
+        paletteWidget.setLayout(self.palette)
+        left.addWidget(paletteWidget)
+
+        left_dock = QW.QDockWidget("ROM tiles", self)
+        left_dock.setWidget(romWidget)
 
-        vert.addLayout(self.palette)
+        iconpath = widget_icon_path(left_dock)
+        left_dock.setStyleSheet(
+           f"""
+            QDockWidget
+            {{
+              titlebar-close-icon: url(img/{iconpath}/widget-close.svg);
+              titlebar-normal-icon: url(img/{iconpath}/widget-undock.svg);
+            }}
+            """
+        )
 
-        main_widget = QW.QWidget()
-        main_widget.setLayout(vert)
-
-        self.setCentralWidget(main_widget)
+        self.addDockWidget(QC.Qt.LeftDockWidgetArea, left_dock)
+        self.tile_picker.rom_canvas = self.grid_widget
 
     def pick_palette_colour(self, palette_idx):
         if self.colour_picker.exec_():