Skip to content

Commit

Permalink
Added Reset Button in plugin settings
Browse files Browse the repository at this point in the history
Plugin settings now has a Reset button that resets the state of the plugin together with a short explanation and warning what the button does.
  • Loading branch information
Balvald committed Aug 23, 2022
1 parent 7c19114 commit a1e164c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions load.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

import logging
from pickle import FALSE
import tkinter as tk
from typing import Optional

Expand Down Expand Up @@ -59,8 +58,7 @@ def setup_preferences(self, parent: nb.Notebook, cmdr: str, is_beta: bool) -> Op
current_row = 0
frame = nb.Frame(parent)

# TODO create useful preferences for the plugin: i.e. tick boxes to show or hide certain info like current system and body and a Reset state button.
# and remove the debug fields, where the user could just put anything in.
# TODO create useful preferences for the plugin: i.e. tick boxes to show or hide certain info like current system and body

if debug:
# setup debug fields for the scanner.
Expand All @@ -80,6 +78,13 @@ def setup_preferences(self, parent: nb.Notebook, cmdr: str, is_beta: bool) -> Op
nb.Entry(frame, textvariable=self.AST_current_scan_progress).grid(row=current_row, column=1)
current_row += 1

nb.Label(frame, text='To reset the state of the plugin press the button Below').grid(row=current_row)
current_row += 1
nb.Label(frame, text='Info that is reset can not be restored.').grid(row=current_row)
current_row += 2
nb.Button(frame, text="RESET", command= self.reset).grid(row=current_row)
current_row += 1

return frame

def on_preferences_closed(self, cmdr: str, is_beta: bool) -> None:
Expand Down Expand Up @@ -143,6 +148,13 @@ def setup_main_ui(self, parent: tk.Frame) -> tk.Frame:
tk.Label(frame, text="Last Exobioligy Scan:").grid(row=current_row)
tk.Label(frame, textvariable=self.AST_state).grid(row=current_row, column=1)
return frame

def reset(self):
self.AST_current_scan_progress.set("0/3")
self.AST_last_scan_system.set("None")
self.AST_last_scan_body.set("None")
self.AST_last_scan_plant.set("None")
self.AST_state.set("None")

def journal_entry(cmdr, is_beta, system, station, entry, state):
"""
Expand Down Expand Up @@ -171,7 +183,7 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
elif entry["ScanType"] == "Analyse":
plugin.AST_current_scan_progress.set("3/3")
else:
plugin.AST_current_scan_progress.set("Excuse me what the fuck") #Somethings horibly wrong if we end up here
plugin.AST_current_scan_progress.set("Excuse me what the fuck") #Somethings horribly wrong if we end up here

if entry["event"] in ["Location", "Embark", "Disembark", "Touchdown", "Liftoff", "FSDJump"]:
flag = True
Expand Down

0 comments on commit a1e164c

Please sign in to comment.