From 136121ca18da21d4016a02900405036aeaf5159f Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Thu, 12 Dec 2019 12:34:50 -0800 Subject: [PATCH 1/2] fixed issue saving wallpaper metadata when None --- coretk/coretk/coreclient.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coretk/coretk/coreclient.py b/coretk/coretk/coreclient.py index 57224a93..1cf99526 100644 --- a/coretk/coretk/coreclient.py +++ b/coretk/coretk/coreclient.py @@ -479,8 +479,11 @@ class CoreClient: def set_metadata(self): # create canvas data + wallpaper = None + if self.app.canvas.wallpaper_file: + wallpaper = Path(self.app.canvas.wallpaper_file).name canvas_config = { - "wallpaper": Path(self.app.canvas.wallpaper_file).name, + "wallpaper": wallpaper, "wallpaper-style": self.app.canvas.scale_option.get(), "gridlines": self.app.canvas.show_grid.get(), "fit_image": self.app.canvas.adjust_to_dim.get(), From f154733e2ec0d9fb7a68e0b2d9617733ce8c732c Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Thu, 12 Dec 2019 12:49:29 -0800 Subject: [PATCH 2/2] fixed toolbar updating with the smaller icons from picked nodes/annotations --- coretk/coretk/toolbar.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/coretk/coretk/toolbar.py b/coretk/coretk/toolbar.py index 72288b71..1a0cac0b 100644 --- a/coretk/coretk/toolbar.py +++ b/coretk/coretk/toolbar.py @@ -14,11 +14,11 @@ from coretk.nodeutils import NodeUtils from coretk.themes import Styles from coretk.tooltip import Tooltip -WIDTH = 32 +TOOLBAR_SIZE = 32 PICKER_SIZE = 24 -def icon(image_enum, width=WIDTH): +def icon(image_enum, width=TOOLBAR_SIZE): return Images.get(image_enum, width) @@ -146,17 +146,23 @@ class Toolbar(ttk.Frame): self.node_picker = ttk.Frame(self.master) # draw default nodes for node_draw in NodeUtils.NODES: + toolbar_image = icon(node_draw.image_enum) image = icon(node_draw.image_enum, PICKER_SIZE) - func = partial(self.update_button, self.node_button, image, node_draw) + func = partial( + self.update_button, self.node_button, toolbar_image, node_draw + ) self.create_picker_button(image, func, self.node_picker, node_draw.label) # draw custom nodes for name in sorted(self.app.core.custom_nodes): node_draw = self.app.core.custom_nodes[name] - image = Images.get_custom(node_draw.image_file, WIDTH) - func = partial(self.update_button, self.node_button, image, node_draw) + toolbar_image = Images.get_custom(node_draw.image_file, TOOLBAR_SIZE) + image = Images.get_custom(node_draw.image_file, PICKER_SIZE) + func = partial( + self.update_button, self.node_button, toolbar_image, node_draw + ) self.create_picker_button(image, func, self.node_picker, name) # draw edit node - image = icon(ImageEnum.EDITNODE) + image = icon(ImageEnum.EDITNODE, PICKER_SIZE) self.create_picker_button( image, self.click_edit_node, self.node_picker, "Custom" ) @@ -276,10 +282,13 @@ class Toolbar(ttk.Frame): self.hide_pickers() self.network_picker = ttk.Frame(self.master) for node_draw in NodeUtils.NETWORK_NODES: + toolbar_image = icon(node_draw.image_enum) image = icon(node_draw.image_enum, PICKER_SIZE) self.create_picker_button( image, - partial(self.update_button, self.network_button, image, node_draw), + partial( + self.update_button, self.network_button, toolbar_image, node_draw + ), self.network_picker, node_draw.label, ) @@ -318,10 +327,11 @@ class Toolbar(ttk.Frame): (ImageEnum.TEXT, ShapeType.TEXT), ] for image_enum, shape_type in nodes: + toolbar_image = icon(image_enum) image = icon(image_enum, PICKER_SIZE) self.create_picker_button( image, - partial(self.update_annotation, image, shape_type), + partial(self.update_annotation, toolbar_image, shape_type), self.annotation_picker, shape_type.value, )