update main gui, add version
This commit is contained in:
parent
5a9473013d
commit
6d2ba2e8f9
@ -1,39 +1,5 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
block_cipher = None
|
||||
|
||||
a = Analysis(
|
||||
['radar_data_reader/__main__.py'],
|
||||
pathex=['.'],
|
||||
binaries=[],
|
||||
# Usa project_icon_filename nella sezione datas
|
||||
datas=[('radar_data_reader.ico', '.')],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False
|
||||
)
|
||||
a = Analysis(pathex=['radar_data_reader', '.'], binaries=[], datas=[('radar_data_reader.ico', '.')], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False, scripts=['radar_data_reader\\__main__.py'])
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='radar_data_reader',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True,
|
||||
# Usa project_icon_filename per l'opzione icon
|
||||
icon='radar_data_reader.ico'
|
||||
)
|
||||
exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='radar_data_reader', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True, icon='radar_data_reader.ico', exclude_binaries=True)
|
||||
coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, upx_exclude=[], name='radar_data_reader')
|
||||
|
||||
74
radar_data_reader/_version.py
Normal file
74
radar_data_reader/_version.py
Normal file
@ -0,0 +1,74 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated by PyInstaller GUI Wrapper. DO NOT EDIT MANUALLY.
|
||||
# Contains build-time information scraped from Git (if available)
|
||||
# and a helper function to format version strings.
|
||||
|
||||
import re
|
||||
|
||||
# --- Version Data (Generated) ---
|
||||
__version__ = "v.0.0.0.10-0-gd471569-dirty"
|
||||
GIT_COMMIT_HASH = "d4715690ab35c5ae15b593609182561a1f6fcdbd"
|
||||
GIT_BRANCH = "master"
|
||||
BUILD_TIMESTAMP = "2025-06-24T05:34:07.850332+00:00"
|
||||
IS_GIT_REPO = True
|
||||
|
||||
# --- Default Values (for comparison or fallback) ---
|
||||
DEFAULT_VERSION = "0.0.0+unknown"
|
||||
DEFAULT_COMMIT = "Unknown"
|
||||
DEFAULT_BRANCH = "Unknown"
|
||||
|
||||
# --- Helper Function ---
|
||||
def get_version_string(format_string=None):
|
||||
"""
|
||||
Returns a formatted string based on the build version information.
|
||||
|
||||
Args:
|
||||
format_string (str, optional): A format string using placeholders.
|
||||
Defaults to "{version} ({branch}/{commit_short})" if None.
|
||||
Placeholders:
|
||||
{{version}}: Full version string (e.g., 'v1.0.0-5-gabcdef-dirty')
|
||||
{{tag}}: Clean tag part if exists (e.g., 'v1.0.0'), else DEFAULT_VERSION.
|
||||
{{commit}}: Full Git commit hash.
|
||||
{{commit_short}}: Short Git commit hash (7 chars).
|
||||
{{branch}}: Git branch name.
|
||||
{{dirty}}: '-dirty' if the repo was dirty, empty otherwise.
|
||||
{{timestamp}}: Full build timestamp (ISO 8601 UTC).
|
||||
{{timestamp_short}}: Build date only (YYYY-MM-DD).
|
||||
{{is_git}}: 'Git' if IS_GIT_REPO is True, 'Unknown' otherwise.
|
||||
|
||||
Returns:
|
||||
str: The formatted version string, or an error message if formatting fails.
|
||||
"""
|
||||
if format_string is None:
|
||||
format_string = "{version} ({branch}/{commit_short})" # Default format
|
||||
|
||||
replacements = {}
|
||||
try:
|
||||
replacements['version'] = __version__ if __version__ else DEFAULT_VERSION
|
||||
replacements['commit'] = GIT_COMMIT_HASH if GIT_COMMIT_HASH else DEFAULT_COMMIT
|
||||
replacements['commit_short'] = GIT_COMMIT_HASH[:7] if GIT_COMMIT_HASH and len(GIT_COMMIT_HASH) >= 7 else DEFAULT_COMMIT
|
||||
replacements['branch'] = GIT_BRANCH if GIT_BRANCH else DEFAULT_BRANCH
|
||||
replacements['timestamp'] = BUILD_TIMESTAMP if BUILD_TIMESTAMP else "Unknown"
|
||||
replacements['timestamp_short'] = BUILD_TIMESTAMP.split('T')[0] if BUILD_TIMESTAMP and 'T' in BUILD_TIMESTAMP else "Unknown"
|
||||
replacements['is_git'] = "Git" if IS_GIT_REPO else "Unknown"
|
||||
replacements['dirty'] = "-dirty" if __version__ and __version__.endswith('-dirty') else ""
|
||||
|
||||
tag = DEFAULT_VERSION
|
||||
if __version__ and IS_GIT_REPO:
|
||||
match = re.match(r'^(v?([0-9]+(?:\.[0-9]+)*))', __version__)
|
||||
if match:
|
||||
tag = match.group(1)
|
||||
replacements['tag'] = tag
|
||||
|
||||
output_string = format_string
|
||||
for placeholder, value in replacements.items():
|
||||
pattern = re.compile(r'{{\s*' + re.escape(placeholder) + r'\s*}}')
|
||||
output_string = pattern.sub(str(value), output_string)
|
||||
|
||||
if re.search(r'{\s*\w+\s*}', output_string):
|
||||
pass # Or log a warning: print(f"Warning: Unreplaced placeholders found: {output_string}")
|
||||
|
||||
return output_string
|
||||
|
||||
except Exception as e:
|
||||
return f"[Formatting Error: {e}]"
|
||||
@ -16,6 +16,24 @@ from ..core.export_profiles import ExportProfile
|
||||
|
||||
log = logger.get_logger(__name__)
|
||||
|
||||
# --- Import Version Info FOR THE WRAPPER ITSELF ---
|
||||
try:
|
||||
# Use absolute import based on package name
|
||||
from radar_data_reader import _version as wrapper_version
|
||||
WRAPPER_APP_VERSION_STRING = f"{wrapper_version.__version__} ({wrapper_version.GIT_BRANCH}/{wrapper_version.GIT_COMMIT_HASH[:7]})"
|
||||
WRAPPER_BUILD_INFO = f"Wrapper Built: {wrapper_version.BUILD_TIMESTAMP}"
|
||||
except ImportError:
|
||||
# This might happen if you run the wrapper directly from source
|
||||
# without generating its _version.py first (if you use that approach for the wrapper itself)
|
||||
WRAPPER_APP_VERSION_STRING = "(Dev Wrapper)"
|
||||
WRAPPER_BUILD_INFO = "Wrapper build time unknown"
|
||||
|
||||
# --- Constants for Version Generation ---
|
||||
DEFAULT_VERSION = "0.0.0+unknown"
|
||||
DEFAULT_COMMIT = "Unknown"
|
||||
DEFAULT_BRANCH = "Unknown"
|
||||
# --- End Constants ---
|
||||
|
||||
|
||||
class MainWindow(tk.Frame):
|
||||
"""The main application window (View)."""
|
||||
@ -32,7 +50,7 @@ class MainWindow(tk.Frame):
|
||||
|
||||
self._init_vars()
|
||||
self.pack(fill=tk.BOTH, expand=True)
|
||||
self.master.title("Radar Data Reader & Processor")
|
||||
self.master.title(f"Radar Data Reader & Processor - {WRAPPER_APP_VERSION_STRING}")
|
||||
self.master.geometry("800x750")
|
||||
|
||||
self._create_widgets()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user