Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- OS Version [e.g. 22]
- AppUsageGUI Version [e.g. 1.4.0]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![version](https://img.shields.io/badge/Version-1.4.0-white.svg)
![version](https://img.shields.io/badge/Version-1.4.1-white.svg)
![license](https://img.shields.io/badge/License-GPL%20v3-blue.svg)
![python](https://img.shields.io/badge/Python-3.12-green.svg)

Expand Down
4 changes: 3 additions & 1 deletion docs/install_windows.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Windows Installation Steps:
* download the windows setup .exe [here](https://github.com/Adam-Color/AppUsageGUI/releases/latest) (under the "assets" section)
* double-click the setup .exe to open it
* click "More info"
* click "Run anyway"
* follow the instructions on screen
* if the installer asks to replace a file that is already there, click "yes"
* if the installer asks to replace a file that is already there, click "yes"
2 changes: 1 addition & 1 deletion docs/release_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To install, follow the instructions for your platform found here:

[Windows](install_windows.md) | [macOS](install_macos.md)
[Windows](https://github.com/Adam-Color/AppUsageGUI/blob/Develop/docs/install_windows.md) | [macOS](https://github.com/Adam-Color/AppUsageGUI/blob/Develop/docs/install_macos.md)

## What's Changed

Expand Down
2 changes: 1 addition & 1 deletion installers/macos_installer.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# This script is used to create the installer for the macOS version of the application
app_version='1.4.0'
app_version='1.4.1'

mv dist/AppUsageGUI.app dist/AppUsageGUI/

Expand Down
4 changes: 2 additions & 2 deletions installers/windows_installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "AppUsageGUI"
#define MyAppVersion "1.4.0"
#define MyAppVersion "1.4.1"
#define MyAppPublisher "Adam Blair-Smith"
#define MyAppURL "https://github.com/Adam-Color/AppUsageGUI"
#define MyAppExeName "AppUsageGUI.exe"
#define MyInstallerName "AppUsageGUI_v1.4.0_WINDOWS_setup"
#define MyInstallerName "AppUsageGUI_v1.4.1_WINDOWS_setup"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
Expand Down
2 changes: 1 addition & 1 deletion src/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.4.0"
__version__ = "1.4.1"
32 changes: 26 additions & 6 deletions src/core/logic/app_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
from core.utils.file_utils import read_file, write_file, apps_file, user_dir_exists

EXCLUDED_APP_PIDS = []
INCLUDED_APP_PIDS = []

if user_dir_exists() and os.path.exists(apps_file()):
EXCLUDED_APP_PIDS = read_file(apps_file())['excluded_app_pids']
INCLUDED_APP_PIDS = read_file(apps_file())['included_app_pids']

class AppTracker:
def __init__(self, parent, logic_controller):
Expand Down Expand Up @@ -96,20 +98,37 @@ def start(self):
def reset(self):
self.selected_app = None
self.update_thread = None

def start_filter_reset(self, refresh=False, update_pids=False):
self.temp_reset_thread = threading.Thread(target=self._reset_excluded_pids(refresh, update_pids), name="reset_filter")
self.temp_reset_thread.start()

def _reset_excluded_pids(self, refresh, update_pids):
global EXCLUDED_APP_PIDS
global INCLUDED_APP_PIDS
EXCLUDED_APP_PIDS = []
INCLUDED_APP_PIDS = []
if refresh:
self.app_names = self._fetch_app_names()
if update_pids:
self._update_excluded_apps()

def _update_excluded_apps(self):
seen_pids = set()
seen_pids = []
i = 0
for process in psutil.process_iter(['pid', 'status']):
try:
pid = process.info['pid']
if pid in seen_pids:
continue
#print(f"Checking process: (PID: {pid})") # Debugging line
seen_pids.add(pid)
if process.info['status'] == psutil.STATUS_RUNNING and pid not in EXCLUDED_APP_PIDS and not self._has_gui(pid):
i += 1
EXCLUDED_APP_PIDS.append(pid)
seen_pids.append(pid)
if process.info['status'] == psutil.STATUS_RUNNING and pid not in INCLUDED_APP_PIDS and pid not in EXCLUDED_APP_PIDS:
if self._has_gui(pid):
INCLUDED_APP_PIDS.append(pid)
else:
i += 1
EXCLUDED_APP_PIDS.append(pid)
if len(seen_pids) > (400 if os.name == 'nt' else 10000):
# Limit the number of seen processes to avoid long loading times
break
Expand All @@ -119,7 +138,8 @@ def _update_excluded_apps(self):

#print(f"\nExcluded app PIDs: {EXCLUDED_APP_PIDS}") # Debugging line
print(f"New exlusions: {i}")
data = {'excluded_app_pids': EXCLUDED_APP_PIDS}
data = {'excluded_app_pids': EXCLUDED_APP_PIDS,
'included_app_pids': INCLUDED_APP_PIDS}
write_file(apps_file(), data)

def _has_gui(self, process_id):
Expand Down
10 changes: 5 additions & 5 deletions src/core/screens/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ def __init__(self, parent, controller, logic_controller):
label.pack(side="top", fill="x", pady=10)

button1 = tk.Button(self, text="Start new session",
command=lambda: controller.show_frame("SelectAppWindow"), width=25)
command=lambda: self.controller.show_frame("SelectAppWindow"), width=25)
button1 = tk.Button(self, text="Start new session",
command=lambda: controller.show_frame("SelectAppWindow"), width=25)
command=lambda: self.controller.show_frame("SelectAppWindow"), width=25)
button1.pack(pady=3)

if label_text == "What would you like to do?":
button2 = tk.Button(self, text="Continue previous session",
command=lambda: controller.show_frame("SessionsWindow"), width=25)
command=lambda: [self.controller.show_frame("SessionsWindow"), self.logic.app_tracker.start_filter_reset(refresh=True)], width=25)
button2.pack(pady=3)

button3 = tk.Button(self, text="Configure custom rules",
command=lambda: controller.show_frame("TrackerSettingsWindow"),
command=lambda: self.controller.show_frame("TrackerSettingsWindow"),
width=25)
button3.pack(pady=3)

exit_button = tk.Button(self, text=" Exit ", command=lambda: controller.on_close())
exit_button = tk.Button(self, text=" Exit ", command=lambda: self.controller.on_close())
exit_button.pack(pady=10, side='bottom')
8 changes: 5 additions & 3 deletions src/core/screens/select_app_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, parent, controller, logic_controller):
search_entry.pack(pady=5)

# Button to refresh the list
refresh_button = tk.Button(self, text="Refresh List", command=self.refresh_apps)
refresh_button = tk.Button(self, text="Refresh List", command=lambda: self.refresh_apps(True))
refresh_button.pack(pady=10)

# Frame for listbox and scrollbar
Expand Down Expand Up @@ -65,10 +65,12 @@ def select_app(self):
messagebox.showerror("Error", "No application selected")

@threaded
def refresh_apps(self):
def refresh_apps(self, filter_reset=False):
"""Fetch all app names and display them in the listbox."""
try:
self.app_listbox.delete(0, tk.END)
#if filter_reset:
# self.logic.app_tracker.start_filter_reset(refresh=True, update_pids=True)
self.all_apps = self.app_tracker.get_app_names()

if not self.all_apps:
Expand All @@ -78,7 +80,7 @@ def refresh_apps(self):
self.app_listbox.insert(tk.END, app)
except RuntimeError as e:
if str(e) == "main thread is not in main loop":
self.refresh_apps() # Retry if the error is due to unsafe threading
self.refresh_apps(filter_reset) # Retry if the error is due to unsafe threading
else:
messagebox.showerror("Error", f"refresh_apps() encountered an error it did not expect: {str(traceback.format_exc())}")

Expand Down