rearrange columns

This commit is contained in:
Thaddeus Hughes
2025-09-18 08:03:59 -05:00
parent 659c956c95
commit bb5536614b
13 changed files with 5595 additions and 5576 deletions

View File

@@ -1,4 +1,4 @@
GROSS_WEIGHT,GROSS_UNITS,GROSS_TIME,TARE_WEIGHT,TARE_UNITS,TARE_TIME,NET,NET_UNITS
0,lb,09/17/2025 06:12 PM,3780,lb,09/17/2025 06:13 PM,-3780,lb
3780,lb,09/17/2025 10:18 PM,3640,lb,09/17/2025 10:19 PM,140,lb
1640,lb,09/17/2025 10:19 PM,0,lb,09/17/2025 10:20 PM,1640,lb
GROSS_WT,TARE_WT,NET_WT,TARE_T,GROSS_T,GROSS_UNITS,TARE_UNITS,NET_UNITS
0,3780,-3780,09/17/2025 06:13 PM,09/17/2025 06:12 PM,lb,lb,lb
3780,3640,140,09/17/2025 10:19 PM,09/17/2025 10:18 PM,lb,lb,lb
1640,0,1640,09/17/2025 10:20 PM,09/17/2025 10:19 PM,lb,lb,lb
1 GROSS_WEIGHT GROSS_WT TARE_WT GROSS_TIME NET_WT TARE_WEIGHT TARE_T GROSS_T TARE_TIME GROSS_UNITS NET TARE_UNITS NET_UNITS
2 0 0 3780 09/17/2025 06:12 PM -3780 3780 09/17/2025 06:13 PM 09/17/2025 06:12 PM 09/17/2025 06:13 PM lb -3780 lb lb
3 3780 3780 3640 09/17/2025 10:18 PM 140 3640 09/17/2025 10:19 PM 09/17/2025 10:18 PM 09/17/2025 10:19 PM lb 140 lb lb
4 1640 1640 0 09/17/2025 10:19 PM 1640 0 09/17/2025 10:20 PM 09/17/2025 10:19 PM 09/17/2025 10:20 PM lb 1640 lb lb

View File

@@ -1,4 +1,4 @@
WEIGHT,UNITS,TIMESTAMP
WEIGHT,UNITS,TIME
0,lb,09/17/2025 06:12 PM
3780,lb,09/17/2025 06:13 PM
3780,lb,09/17/2025 10:18 PM
1 WEIGHT UNITS TIMESTAMP TIME
2 0 lb 09/17/2025 06:12 PM 09/17/2025 06:12 PM
3 3780 lb 09/17/2025 06:13 PM 09/17/2025 06:13 PM
4 3780 lb 09/17/2025 10:18 PM 09/17/2025 10:18 PM

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -62,7 +62,7 @@
[],
False,
False,
1758198359,
1758200623,
[('runw.exe',
'C:\\Users\\Thad\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\runw.exe',
'EXECUTABLE')],

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -18,8 +18,8 @@ missing module named grp - imported by shutil (delayed, optional), tarfile (opti
missing module named pwd - imported by posixpath (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib._local (optional), subprocess (delayed, conditional, optional)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
missing module named 'collections.abc' - imported by tracemalloc (top-level), traceback (top-level), typing (top-level), inspect (top-level), logging (top-level), importlib.resources.readers (top-level), selectors (top-level)
missing module named posix - imported by posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional), os (conditional, optional)
missing module named 'collections.abc' - imported by traceback (top-level), typing (top-level), inspect (top-level), logging (top-level), importlib.resources.readers (top-level), selectors (top-level), tracemalloc (top-level)
missing module named posix - imported by os (conditional, optional), posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional)
missing module named resource - imported by posix (top-level)
missing module named _posixsubprocess - imported by subprocess (conditional)
missing module named fcntl - imported by subprocess (optional)

View File

@@ -172,6 +172,7 @@ imports:
&#8226; <a href="#sre_constants">sre_constants</a>
&#8226; <a href="#sre_parse">sre_parse</a>
&#8226; <a href="#stat">stat</a>
&#8226; <a href="#subprocess">subprocess</a>
&#8226; <a href="#tkinter">tkinter</a>
&#8226; <a href="#tkinter.filedialog">tkinter.filedialog</a>
&#8226; <a href="#tkinter.messagebox">tkinter.messagebox</a>
@@ -6857,7 +6858,8 @@ imports:
</div>
<div class="import">
imported by:
<a href="#os">os</a>
<a href="#main.py">main.py</a>
&#8226; <a href="#os">os</a>
</div>

Binary file not shown.

BIN
dist/main/main.exe vendored

Binary file not shown.

29
main.py
View File

@@ -2,6 +2,7 @@ import re
import csv
import tkinter as tk
from tkinter import filedialog, messagebox
import subprocess
import os
from datetime import datetime
@@ -46,21 +47,34 @@ def parse_logs(log_text):
def write_csv1(pairs, filename):
with open(filename, 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['WEIGHT', 'UNITS', 'TIMESTAMP'])
writer.writerow(['WEIGHT', 'UNITS', 'TIME'])
for weight, units, timestamp in pairs:
writer.writerow([weight, units, timestamp])
def write_csv2(pairs, filename):
with open(filename, 'w', newline='') as f:
writer = csv.writer(f)
writer.writerow(['GROSS_WEIGHT', 'GROSS_UNITS', 'GROSS_TIME', 'TARE_WEIGHT', 'TARE_UNITS', 'TARE_TIME', 'NET', 'NET_UNITS'])
writer.writerow(['GROSS_WT', 'TARE_WT', 'NET_WT', 'TARE_T', 'GROSS_T', 'GROSS_UNITS', 'TARE_UNITS', 'NET_UNITS'])
for j in range(0, len(pairs), 2):
if j + 1 < len(pairs):
gross_weight, gross_units, gross_time = pairs[j]
tare_weight, tare_units, tare_time = pairs[j + 1]
net = gross_weight - tare_weight
# Use gross units for net (assuming consistent units within pairs)
writer.writerow([gross_weight, gross_units, gross_time, tare_weight, tare_units, tare_time, net, gross_units])
writer.writerow([gross_weight, tare_weight, net, tare_time, gross_time, gross_units, tare_units, gross_units])
def run_update_script():
try:
# Run update.sh script
result = subprocess.run(['sh', 'C:\\Program Files\\rslugger-merger\\update.sh'], capture_output=True, text=True, cwd=os.getcwd())
if result.returncode == 0:
messagebox.showinfo("Success", f"update.sh executed successfully!\n\nOutput:\n{result.stdout}")
else:
messagebox.showerror("Error", f"update.sh failed with return code {result.returncode}\n\nError:\n{result.stderr}")
except FileNotFoundError:
messagebox.showerror("Error", "update.sh not found in current directory")
except Exception as e:
messagebox.showerror("Error", f"Failed to run update.sh: {str(e)}")
def select_input_file():
filename = filedialog.askopenfilename(filetypes=[("Text files", "*.txt"), ("All files", "*.*")])
@@ -91,7 +105,7 @@ def process_files():
root = tk.Tk()
root.title("Log to CSV Converter")
root.geometry("500x120")
root.geometry("500x160")
input_file_var = tk.StringVar()
@@ -100,9 +114,12 @@ input_frame = tk.Frame(root)
input_frame.pack(pady=5, padx=10, fill='x')
tk.Label(input_frame, text="Select Input Log File:").pack(side='left')
tk.Entry(input_frame, textvariable=input_file_var, width=40).pack(side='left', padx=5)
tk.Button(input_frame, text="Browse Input", command=select_input_file).pack(side='left')
tk.Button(input_frame, text="Browse Input", bg="#2196F3", command=select_input_file).pack(side='left')
# Convert button
tk.Button(root, text="CONVERT TO CSV", command=process_files, font=("Arial", 14), relief="raised", bg="#4CAF50", fg="white").pack(pady=20, padx=10, fill='x')
tk.Button(root, text="CONVERT TO CSV", command=process_files, font=("Arial", 14), relief="raised", bg="#4CAF50", fg="white").pack(pady=10, padx=10, fill='x')
# Update script button
tk.Button(root, text="Update this Application", command=run_update_script, font=("Arial", 12), relief="raised").pack(pady=5, padx=10, fill='x')
root.mainloop()