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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![version](https://img.shields.io/badge/Version-1.5.0-white.svg)
![version](https://img.shields.io/badge/Version-1.5.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 Expand Up @@ -26,7 +26,7 @@ To install, follow the instructions for your platform found here:
* Add integrations with professional applications
* Optimize everything
* Add support for tracking more than one executable per session
* Impliment a better way to filter out non-gui apps on macOS
* Add a better way to filter out non-GUI apps on macOS

#### Version 2 ('v2-change-to-pyqt6' branch):

Expand Down
2 changes: 1 addition & 1 deletion dev/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.5.0'
app_version='1.5.1'

mv dist/AppUsageGUI.app dist/AppUsageGUI/

Expand Down
4 changes: 2 additions & 2 deletions dev/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.5.0"
#define MyAppVersion "1.5.1"
#define MyAppPublisher "Adam Blair-Smith"
#define MyAppURL "https://github.com/Adam-Color/AppUsageGUI"
#define MyAppExeName "AppUsageGUI.exe"
#define MyInstallerName "AppUsageGUI_v1.5.0_WINDOWS_setup"
#define MyInstallerName "AppUsageGUI_v1.5.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.5.0"
__version__ = "1.5.1"
31 changes: 18 additions & 13 deletions src/core/logic/file_handler.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
"""Handler for all file io operations. Only handles one session at a time, which should
be set by other classes.
be set by other classes.
The file handler is responsible for saving and loading session data"""

import os
import pickle
import _pickle

from core.utils.file_utils import compute_hash, read_file, write_file, get_sessions_directory
from core.utils.file_utils import (
compute_hash,
read_file,
write_file,
get_sessions_directory,
)


class FileHandler:
def __init__(self, parent, logic_controller):
Expand All @@ -24,27 +30,27 @@ def __init__(self, parent, logic_controller):
def save_session_data(self, data):
"""Special function to save and hash session data"""
self.data = pickle.dumps(data)
file_path = os.path.join(self.directory, self.file_name + '.dat')
hash_path = os.path.join(self.directory, self.file_name + '.hash')
file_path = os.path.join(self.directory, self.file_name + ".dat")
hash_path = os.path.join(self.directory, self.file_name + ".hash")

# Save data to file
write_file(file_path, self.data)

# Compute and save hash
data_hash = compute_hash(self.data)
write_file(hash_path, data_hash.encode('utf-8'))
write_file(hash_path, data_hash.encode("utf-8"))

def load_session_data(self, filename):
"""Loads session data from file and checks hash"""
self.file_name = filename
file_path = os.path.join(self.directory, filename + '.dat')
hash_path = os.path.join(self.directory, filename + '.hash')
file_path = os.path.join(self.directory, filename + ".dat")
hash_path = os.path.join(self.directory, filename + ".hash")

if os.path.exists(file_path) and os.path.exists(hash_path):
try:
# Read data and hash
data = read_file(file_path)
stored_hash = read_file(hash_path).decode('utf-8')
stored_hash = read_file(hash_path).decode("utf-8")

# Compute hash of the loaded data
computed_hash = compute_hash(data)
Expand All @@ -63,8 +69,8 @@ def load_session_data(self, filename):

def delete_session(self, filename):
"""Delete data and hash files of a session"""
file_path = os.path.join(self.directory, filename + '.dat')
hash_path = os.path.join(self.directory, filename + '.hash')
file_path = os.path.join(self.directory, filename + ".dat")
hash_path = os.path.join(self.directory, filename + ".hash")

if os.path.exists(file_path):
os.remove(file_path)
Expand All @@ -77,11 +83,10 @@ def get_data(self):
return pickle.loads(self.data)
return self.data if isinstance(self.data, dict) else {}


def set_file_name(self, file_name):
if file_name is not None:
self.file_name = file_name

def get_file_name(self):
return self.file_name

Expand All @@ -91,7 +96,7 @@ def set_continuing_session(self, continuation=bool):
self.set_continuing_tracker(True)
self.controller.time_tracker.update_captures()

def set_continuing_tracker(self, value=bool):
def set_continuing_tracker(self, value):
self.continuing_tracker = value

def get_continuing_tracker(self):
Expand Down
4 changes: 1 addition & 3 deletions src/core/screens/splash_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def splash_screen(root):
splash_window.geometry("300x340")
splash_window.title("AppUsageGUI - Loading...")
splash_window.overrideredirect(True)
splash_window.attributes("-topmost", True)
center(splash_window)
splash_window.configure(bg="#2E2E2E")

Expand Down Expand Up @@ -178,8 +177,7 @@ def load_app():
elif download_url is not None:
webbrowser.open_new_tab(download_url)
webbrowser.open_new_tab("https://github.com/adam-color/AppUsageGUI/releases/latest")
tk.messagebox.showinfo("Update", "Please install the latest version after it downloads,\nautomatic updates are not yet available.\n\nThe application will now close.")
sys.exit(0)
tk.messagebox.showinfo("Update", "Please install the latest version after it downloads,\nautomatic updates are not yet available.\n\nPlease close AppUsageGUI after you download the new installer.")

update_progress(70)
win = GUIRoot(root)
Expand Down