Restructure into src/ layout under pygui package

Move all application source under src/pygui/ and rewire imports,
build config, and QML module path to match.
- Relocate backend/, serialcomm/, and the ISC QML module into
  src/pygui/; convert main.py into pygui/__main__.py with a main()
  entry point (run via `python -m pygui` or the new `isc` script)
- Rewrite absolute imports: backend.* -> pygui.backend.*,
  serialcomm.* -> pygui.serialcomm.* (source + tests)
- Move app icons (isc.ico/icns) into packaging/
- Update README and ISC.qmlproject to the new paths
This commit is contained in:
jack
2026-06-03 11:41:45 -07:00
parent af170666e8
commit 9779baa468
34 changed files with 130 additions and 36 deletions
+51
View File
@@ -0,0 +1,51 @@
from datetime import datetime
# ===== CSV Metadata Model =====
class CSVFileMetadata:
# ===== Lifecycle =====
def __init__(self, wafer="", date="", chamber="", notes="", master_type="", filename="", columns=0):
self.wafer = wafer
self.date = date
self.chamber = chamber
self.notes = notes
self.master_type = master_type
self.filename = filename
self.columns = columns
# ===== Accessors =====
def get_wafer_type(self) -> str:
"""Return the first character of the wafer string, or empty if none"""
return self.wafer[0] if self.wafer else ""
def get_date(self) -> datetime:
"""Parsifes the date string. Returns current time if parsing fails"""
date_format = "%Y-%m-%d %H:%M:%S"
try:
return datetime.strptime(self.date, date_format)
except (ValueError, TypeError):
# If format is wrong or date is None, return current time
return datetime.now()
# ===== Formatting =====
@staticmethod
def format_date(dt: datetime) -> str:
"""Formats a datetime object into the standard ISO-like string."""
if not isinstance(dt, datetime):
return ""
return dt.strftime("%Y-%m-%d %H:%M:%S")
# ===== Serialization =====
def to_dict(self) -> dict:
return {
"wafer": self.wafer,
"date": self.string_date_format(), # Ensure we save as string
"chamber": self.chamber,
"notes": self.notes,
"masterType": self.master_type,
}
def string_date_format(self) -> str:
"""Helper to ensure the date is always a string for JSON."""
return self.format_date(self.get_date())