rearrange columns
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
GROSS_WEIGHT,GROSS_UNITS,GROSS_TIME,TARE_WEIGHT,TARE_UNITS,TARE_TIME,NET,NET_UNITS
|
GROSS_WT,TARE_WT,NET_WT,TARE_T,GROSS_T,GROSS_UNITS,TARE_UNITS,NET_UNITS
|
||||||
0,lb,09/17/2025 06:12 PM,3780,lb,09/17/2025 06:13 PM,-3780,lb
|
0,3780,-3780,09/17/2025 06:13 PM,09/17/2025 06:12 PM,lb,lb,lb
|
||||||
3780,lb,09/17/2025 10:18 PM,3640,lb,09/17/2025 10:19 PM,140,lb
|
3780,3640,140,09/17/2025 10:19 PM,09/17/2025 10:18 PM,lb,lb,lb
|
||||||
1640,lb,09/17/2025 10:19 PM,0,lb,09/17/2025 10:20 PM,1640,lb
|
1640,0,1640,09/17/2025 10:20 PM,09/17/2025 10:19 PM,lb,lb,lb
|
||||||
|
|||||||
|
@@ -1,4 +1,4 @@
|
|||||||
WEIGHT,UNITS,TIMESTAMP
|
WEIGHT,UNITS,TIME
|
||||||
0,lb,09/17/2025 06:12 PM
|
0,lb,09/17/2025 06:12 PM
|
||||||
3780,lb,09/17/2025 06:13 PM
|
3780,lb,09/17/2025 06:13 PM
|
||||||
3780,lb,09/17/2025 10:18 PM
|
3780,lb,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
@@ -62,7 +62,7 @@
|
|||||||
[],
|
[],
|
||||||
False,
|
False,
|
||||||
False,
|
False,
|
||||||
1758198359,
|
1758200623,
|
||||||
[('runw.exe',
|
[('runw.exe',
|
||||||
'C:\\Users\\Thad\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\runw.exe',
|
'C:\\Users\\Thad\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\runw.exe',
|
||||||
'EXECUTABLE')],
|
'EXECUTABLE')],
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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 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)
|
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)
|
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 '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 posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional), os (conditional, optional)
|
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 resource - imported by posix (top-level)
|
||||||
missing module named _posixsubprocess - imported by subprocess (conditional)
|
missing module named _posixsubprocess - imported by subprocess (conditional)
|
||||||
missing module named fcntl - imported by subprocess (optional)
|
missing module named fcntl - imported by subprocess (optional)
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ imports:
|
|||||||
• <a href="#sre_constants">sre_constants</a>
|
• <a href="#sre_constants">sre_constants</a>
|
||||||
• <a href="#sre_parse">sre_parse</a>
|
• <a href="#sre_parse">sre_parse</a>
|
||||||
• <a href="#stat">stat</a>
|
• <a href="#stat">stat</a>
|
||||||
|
• <a href="#subprocess">subprocess</a>
|
||||||
• <a href="#tkinter">tkinter</a>
|
• <a href="#tkinter">tkinter</a>
|
||||||
• <a href="#tkinter.filedialog">tkinter.filedialog</a>
|
• <a href="#tkinter.filedialog">tkinter.filedialog</a>
|
||||||
• <a href="#tkinter.messagebox">tkinter.messagebox</a>
|
• <a href="#tkinter.messagebox">tkinter.messagebox</a>
|
||||||
@@ -6857,7 +6858,8 @@ imports:
|
|||||||
</div>
|
</div>
|
||||||
<div class="import">
|
<div class="import">
|
||||||
imported by:
|
imported by:
|
||||||
<a href="#os">os</a>
|
<a href="#main.py">main.py</a>
|
||||||
|
• <a href="#os">os</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
BIN
dist/main/_internal/base_library.zip
vendored
BIN
dist/main/_internal/base_library.zip
vendored
Binary file not shown.
BIN
dist/main/main.exe
vendored
BIN
dist/main/main.exe
vendored
Binary file not shown.
29
main.py
29
main.py
@@ -2,6 +2,7 @@ import re
|
|||||||
import csv
|
import csv
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter import filedialog, messagebox
|
from tkinter import filedialog, messagebox
|
||||||
|
import subprocess
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@@ -46,21 +47,34 @@ def parse_logs(log_text):
|
|||||||
def write_csv1(pairs, filename):
|
def write_csv1(pairs, filename):
|
||||||
with open(filename, 'w', newline='') as f:
|
with open(filename, 'w', newline='') as f:
|
||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
writer.writerow(['WEIGHT', 'UNITS', 'TIMESTAMP'])
|
writer.writerow(['WEIGHT', 'UNITS', 'TIME'])
|
||||||
for weight, units, timestamp in pairs:
|
for weight, units, timestamp in pairs:
|
||||||
writer.writerow([weight, units, timestamp])
|
writer.writerow([weight, units, timestamp])
|
||||||
|
|
||||||
def write_csv2(pairs, filename):
|
def write_csv2(pairs, filename):
|
||||||
with open(filename, 'w', newline='') as f:
|
with open(filename, 'w', newline='') as f:
|
||||||
writer = csv.writer(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):
|
for j in range(0, len(pairs), 2):
|
||||||
if j + 1 < len(pairs):
|
if j + 1 < len(pairs):
|
||||||
gross_weight, gross_units, gross_time = pairs[j]
|
gross_weight, gross_units, gross_time = pairs[j]
|
||||||
tare_weight, tare_units, tare_time = pairs[j + 1]
|
tare_weight, tare_units, tare_time = pairs[j + 1]
|
||||||
net = gross_weight - tare_weight
|
net = gross_weight - tare_weight
|
||||||
# Use gross units for net (assuming consistent units within pairs)
|
# 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():
|
def select_input_file():
|
||||||
filename = filedialog.askopenfilename(filetypes=[("Text files", "*.txt"), ("All files", "*.*")])
|
filename = filedialog.askopenfilename(filetypes=[("Text files", "*.txt"), ("All files", "*.*")])
|
||||||
@@ -91,7 +105,7 @@ def process_files():
|
|||||||
|
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
root.title("Log to CSV Converter")
|
root.title("Log to CSV Converter")
|
||||||
root.geometry("500x120")
|
root.geometry("500x160")
|
||||||
|
|
||||||
input_file_var = tk.StringVar()
|
input_file_var = tk.StringVar()
|
||||||
|
|
||||||
@@ -100,9 +114,12 @@ input_frame = tk.Frame(root)
|
|||||||
input_frame.pack(pady=5, padx=10, fill='x')
|
input_frame.pack(pady=5, padx=10, fill='x')
|
||||||
tk.Label(input_frame, text="Select Input Log File:").pack(side='left')
|
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.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
|
# 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()
|
root.mainloop()
|
||||||
Reference in New Issue
Block a user