Skip to content

Commit

Permalink
Implement setting to switch on/off reporting by default. Closes #131.
Browse files Browse the repository at this point in the history
  • Loading branch information
aussig committed Aug 31, 2023
1 parent 1eb5741 commit b0c2301
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bgstally/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ def _get_new_faction_data(self, faction_name, faction_state):
"""
Get a new data structure for storing faction data
"""
return {'Faction': faction_name, 'FactionState': faction_state, 'Enabled': CheckStates.STATE_ON,
return {'Faction': faction_name, 'FactionState': faction_state, 'Enabled': self.bgstally.state.EnableSystemActivityByDefault.get(),
'MissionPoints': 0, 'MissionPointsSecondary': 0,
'TradeProfit': 0, 'TradePurchase': 0, 'BlackMarketProfit': 0, 'Bounties': 0, 'CartData': 0, 'ExoData': 0,
'TradeBuy': [{'items': 0, 'value': 0}, {'items': 0, 'value': 0}, {'items': 0, 'value': 0}, {'items': 0, 'value': 0}],
Expand Down
2 changes: 2 additions & 0 deletions bgstally/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def load(self):
self.DiscordPostStyle:tk.StringVar = tk.StringVar(value=config.get_str('XDiscordPostStyle', default=DiscordPostStyle.EMBED))
self.DiscordActivity:tk.StringVar = tk.StringVar(value=config.get_str('XDiscordActivity', default=DiscordActivity.BOTH))
self.EnableOverlay:tk.StringVar = tk.StringVar(value=config.get_str('XEnableOverlay', default=CheckStates.STATE_ON))
self.EnableSystemActivityByDefault:tk.StringVar = tk.StringVar(value=config.get_str('BGST_EnableSystemActivityByDefault', default=CheckStates.STATE_ON))

# Persistent values
self.current_system_id:str = config.get_str('XCurrentSystemID', default="")
Expand Down Expand Up @@ -75,6 +76,7 @@ def save(self):
config.set('XDiscordPostStyle', self.DiscordPostStyle.get())
config.set('XDiscordActivity', self.DiscordActivity.get())
config.set('XEnableOverlay', self.EnableOverlay.get())
config.set('BGST_EnableSystemActivityByDefault', self.EnableSystemActivityByDefault.get())

# Persistent values
config.set('XCurrentSystemID', self.current_system_id if self.current_system_id != None else "")
Expand Down
1 change: 1 addition & 0 deletions bgstally/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def get_prefs_frame(self, parent_frame: tk.Frame):
nb.Label(frame, text="Other Options").grid(row=current_row, column=0, padx=10, sticky=tk.W)
nb.Checkbutton(frame, text="Abbreviate Faction Names", variable=self.bgstally.state.AbbreviateFactionNames, onvalue=CheckStates.STATE_ON, offvalue=CheckStates.STATE_OFF).grid(row=current_row, column=1, padx=10, sticky=tk.W); current_row += 1
nb.Checkbutton(frame, text="Include Secondary INF", variable=self.bgstally.state.IncludeSecondaryInf, onvalue=CheckStates.STATE_ON, offvalue=CheckStates.STATE_OFF).grid(row=current_row, column=1, padx=10, sticky=tk.W); current_row += 1
nb.Checkbutton(frame, text="Enable Newly Visited System Activity By Default", variable=self.bgstally.state.EnableSystemActivityByDefault, onvalue=CheckStates.STATE_ON, offvalue=CheckStates.STATE_OFF).grid(row=current_row, column=1, padx=10, sticky=tk.W); current_row += 1
nb.Label(frame, text="BGS Webhook URL").grid(row=current_row, column=0, padx=10, sticky=tk.W)
EntryPlus(frame, textvariable=self.bgstally.state.DiscordBGSWebhook).grid(row=current_row, column=1, padx=10, pady=1, sticky=tk.EW); current_row += 1
nb.Label(frame, text="Thargoid War Webhook URL").grid(row=current_row, column=0, padx=10, sticky=tk.W)
Expand Down
1 change: 1 addition & 0 deletions bgstally/windows/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def _show(self, activity: Activity):
ttk.Label(DiscordOptionsFrame, text="Other Options").grid(row=current_row, column=0, padx=10, sticky=tk.W)
ttk.Checkbutton(DiscordOptionsFrame, text="Abbreviate Faction Names", variable=self.bgstally.state.AbbreviateFactionNames, onvalue=CheckStates.STATE_ON, offvalue=CheckStates.STATE_OFF, command=partial(self._option_change, DiscordText, activity)).grid(row=current_row, column=1, padx=10, sticky=tk.W); current_row += 1
ttk.Checkbutton(DiscordOptionsFrame, text="Include Secondary INF", variable=self.bgstally.state.IncludeSecondaryInf, onvalue=CheckStates.STATE_ON, offvalue=CheckStates.STATE_OFF, command=partial(self._option_change, DiscordText, activity)).grid(row=current_row, column=1, padx=10, sticky=tk.W); current_row += 1
ttk.Checkbutton(DiscordOptionsFrame, text="Enable Newly Visited System Activity By Default", variable=self.bgstally.state.EnableSystemActivityByDefault, onvalue=CheckStates.STATE_ON, offvalue=CheckStates.STATE_OFF).grid(row=current_row, column=1, padx=10, sticky=tk.W); current_row += 1

system_list = activity.get_ordered_systems()

Expand Down

0 comments on commit b0c2301

Please sign in to comment.