From 2ae63628b62018414134c452521f75c00c5cac83 Mon Sep 17 00:00:00 2001 From: Ondrej Pesek Date: Sat, 7 Dec 2024 22:42:52 +0100 Subject: [PATCH] CQ: optimise if conditions in gmodeler.canvas (#4813) no need to run the same if condition twice when one of the interluding one could be inserted in --- gui/wxpython/gmodeler/canvas.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/wxpython/gmodeler/canvas.py b/gui/wxpython/gmodeler/canvas.py index 025b38c82cd..642f007e273 100644 --- a/gui/wxpython/gmodeler/canvas.py +++ b/gui/wxpython/gmodeler/canvas.py @@ -329,10 +329,10 @@ def OnRightClick(self, x, y, keys=0, attachment=0): self.frame.Bind(wx.EVT_MENU, self.OnEnable, id=self.popupID["enable"]) if isinstance(shape, (ModelAction, ModelComment)): popupMenu.AppendSeparator() - if isinstance(shape, ModelAction): - popupMenu.Append(self.popupID["label"], _("Set label")) - self.frame.Bind(wx.EVT_MENU, self.OnSetLabel, id=self.popupID["label"]) - if isinstance(shape, (ModelAction, ModelComment)): + if isinstance(shape, ModelAction): + popupMenu.Append(self.popupID["label"], _("Set label")) + self.frame.Bind(wx.EVT_MENU, self.OnSetLabel, id=self.popupID["label"]) + popupMenu.Append(self.popupID["comment"], _("Set comment")) self.frame.Bind(wx.EVT_MENU, self.OnSetComment, id=self.popupID["comment"])