From c9e226c8540fae1015824827b7e2254c9b15ce4c Mon Sep 17 00:00:00 2001 From: Sebastian Bauer <thurion@daily-nerds.de> Date: Wed, 7 Mar 2018 17:54:05 +0100 Subject: [PATCH] Add ignore to context menu --- load.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/load.py b/load.py index 6d792a9..933322d 100644 --- a/load.py +++ b/load.py @@ -62,6 +62,16 @@ this = sys.modules[__name__] # For holding module globals +class RseHyperlinkLabel(HyperlinkLabel): + + def __init__(self, master=None, **kw): + super(RseHyperlinkLabel, self).__init__(master, **kw) + self.menu.add_command(label=_("Ignore"), command = self.ignore) + + def ignore(self): + this.worker.ignore(self["text"]) + + class EliteSystem(object): def __init__(self, id, name, x, y, z, uncertainty = None, action = 0): self.id = id @@ -123,6 +133,15 @@ def __init__(self, queue, radius = DEFAULT_RADIUS): self.filter = set() # systems that have been completed + def ignore(self, systemName): + for system in self.systemList: + if system.name.lower() == systemName.lower(): + system.action = 0 + self.removeSystems() + self.showNewClosestSystem() + break; + + def adjustRadius(self, numberOfSystems): if numberOfSystems <= RADIUS_ADJUSTMENT_INCREASE: self.radius += 1 @@ -422,7 +441,7 @@ def plugin_app(parent): this.frame.bind_all("<<EDSM-RSE_BackgroundWorker>>", updateUI) this.frame.columnconfigure(1, weight=1) tk.Label(this.frame, text="Unconfirmed:").grid(row=0, column=0, sticky=tk.W) - this.unconfirmedSystem = HyperlinkLabel(frame, compound=tk.RIGHT, popup_copy = True) + this.unconfirmedSystem = RseHyperlinkLabel(frame, compound=tk.RIGHT, popup_copy = True) this.errorLabel = tk.Label(frame) tk.Label(this.frame, text="Distance:").grid(row=1, column=0, sticky=tk.W) this.distanceValue = tk.Label(this.frame)