Skip to content

Commit

Permalink
Configure reminder for once per year
Browse files Browse the repository at this point in the history
Issue #252
  • Loading branch information
damies13 committed Oct 27, 2024
1 parent cc4fef9 commit a1ad942
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions rfswarm_reporter/rfswarm_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7810,9 +7810,13 @@ def dispaly_donation_reminder(self):
base.config['GUI']['donation_reminder'] = "0"
base.saveini()

reminder = int(base.config['GUI']['donation_reminder'])
lastreminder = int(base.config['GUI']['donation_reminder'])
timenow = int(datetime.now().timestamp())
timesincereminder = timenow - lastreminder
yearseconds = 60 * 60 * 24 * 365

if reminder < 1:
# display donation reminder on first launch and then once per year
if timesincereminder > yearseconds:

titlemsg = "RFSwarm Reporter - Donation Reminder"

Expand Down Expand Up @@ -7877,14 +7881,14 @@ def dispaly_donation_reminder(self):
self.drWindow.bind('<Return>', self.close_donation_reminder)
self.drWindow.bind('<Key-Escape>', self.drWindow.destroy)

bdonate = ttk.Button(self.drWindow.fmeBBar, text="Donate", padding='1 1 1 1', command=self.close_donation_reminder)
bdonate = ttk.Button(self.drWindow.fmeBBar, text="Donate", padding='3 3 3 3', command=self.close_donation_reminder)
bdonate.grid(column=9, row=0, sticky="nsew")

blater = ttk.Button(self.drWindow.fmeBBar, text="Maybe Later", padding='1 1 1 1', command=self.drWindow.destroy)
blater = ttk.Button(self.drWindow.fmeBBar, text="Maybe Later", padding='3 3 3 3', command=self.drWindow.destroy)
blater.grid(column=8, row=0, sticky="nsew")

# base.config['GUI']['donation_reminder'] = str(int(datetime.now().timestamp()))
# base.saveini()
base.config['GUI']['donation_reminder'] = str(int(datetime.now().timestamp()))
base.saveini()

def close_donation_reminder(self, *args):
base.debugmsg(5, "args:", args)
Expand Down

0 comments on commit a1ad942

Please sign in to comment.