Ordnerstruktur für Mesa und Astrometry aufräumen
This commit is contained in:
@@ -27,7 +27,9 @@ except ImportError:
|
||||
HAS_ASYNCSSH = False
|
||||
|
||||
|
||||
SSH_CREDENTIALS_JSON = "ssh_zugangsdaten.json"
|
||||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SSH_CREDENTIALS_JSON = os.path.join(SCRIPT_DIR, "ssh_zugangsdaten.json")
|
||||
PROFILE_DIR = os.path.join(SCRIPT_DIR, "profiles")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -219,6 +221,8 @@ class AstrometryGUI:
|
||||
self.v_port = tk.IntVar(value=22)
|
||||
self.v_user = tk.StringVar(value="eskimue")
|
||||
self.v_pass = tk.StringVar(value="Preside")
|
||||
self.v_profile_name = tk.StringVar()
|
||||
self._profile_names: list[str] = []
|
||||
self._load_startup_credentials()
|
||||
|
||||
self.v_local_file = tk.StringVar()
|
||||
@@ -281,11 +285,10 @@ class AstrometryGUI:
|
||||
self.results_files: dict[str, dict] = {}
|
||||
|
||||
def _load_startup_credentials(self):
|
||||
path = os.path.join(os.getcwd(), SSH_CREDENTIALS_JSON)
|
||||
if not os.path.isfile(path):
|
||||
if not os.path.isfile(SSH_CREDENTIALS_JSON):
|
||||
return
|
||||
try:
|
||||
self._load_credentials_from_file(path)
|
||||
self._load_credentials_from_file(SSH_CREDENTIALS_JSON)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -311,6 +314,7 @@ class AstrometryGUI:
|
||||
top = ttk.Frame(self.root, padding=4)
|
||||
top.pack(fill=tk.X)
|
||||
self._build_conn_bar(top)
|
||||
self._refresh_profile_list()
|
||||
|
||||
self.nb = ttk.Notebook(self.root)
|
||||
self.nb.pack(fill=tk.BOTH, expand=True, padx=6, pady=(0, 4))
|
||||
@@ -406,8 +410,23 @@ class AstrometryGUI:
|
||||
"Öffnet eine asynchrone SSH-Verbindung und prüft ob solve-field verfügbar ist."
|
||||
).grid(row=0, column=8, padx=4)
|
||||
|
||||
ttk.Label(lf, text="Profil:").grid(row=0, column=9, padx=(12, 2), sticky=tk.W)
|
||||
self.profile_combo = ttk.Combobox(
|
||||
lf,
|
||||
textvariable=self.v_profile_name,
|
||||
state="readonly",
|
||||
width=24,
|
||||
)
|
||||
self.profile_combo.grid(row=0, column=10, padx=(0, 4))
|
||||
self.profile_combo.bind("<<ComboboxSelected>>", self._on_profile_selected)
|
||||
tip(self.profile_combo, "Lädt ein gespeichertes Profil direkt aus dem profiles-Ordner.")
|
||||
|
||||
tip(ttk.Button(lf, text="Liste aktualisieren", command=self._refresh_profile_list),
|
||||
"Liest den profiles-Ordner neu ein und aktualisiert die Dropdown-Liste."
|
||||
).grid(row=0, column=11, padx=4)
|
||||
|
||||
self.conn_label = ttk.Label(lf, text="● nicht verbunden", foreground="gray")
|
||||
self.conn_label.grid(row=0, column=9, padx=6)
|
||||
self.conn_label.grid(row=0, column=12, padx=6)
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Tab: Input / Output
|
||||
@@ -1381,7 +1400,7 @@ class AstrometryGUI:
|
||||
def _collect_profile_data(self) -> dict:
|
||||
vars_data = {}
|
||||
for name, value in self.__dict__.items():
|
||||
if name.startswith("v_") and hasattr(value, "get"):
|
||||
if name.startswith("v_") and name != "v_profile_name" and hasattr(value, "get"):
|
||||
vars_data[name] = value.get()
|
||||
if "v_pass" in vars_data:
|
||||
vars_data["v_pass"] = ""
|
||||
@@ -1416,12 +1435,52 @@ class AstrometryGUI:
|
||||
|
||||
self._refresh_cmd()
|
||||
|
||||
def _list_profile_names(self) -> list[str]:
|
||||
if not os.path.isdir(PROFILE_DIR):
|
||||
return []
|
||||
return sorted(
|
||||
entry.name
|
||||
for entry in os.scandir(PROFILE_DIR)
|
||||
if entry.is_file() and entry.name.lower().endswith(".json")
|
||||
)
|
||||
|
||||
def _refresh_profile_list(self, selected_name: str | None = None):
|
||||
self._profile_names = self._list_profile_names()
|
||||
if hasattr(self, "profile_combo"):
|
||||
self.profile_combo["values"] = self._profile_names
|
||||
|
||||
if selected_name in self._profile_names:
|
||||
self.v_profile_name.set(selected_name)
|
||||
elif self.v_profile_name.get() not in self._profile_names:
|
||||
self.v_profile_name.set("")
|
||||
|
||||
def _load_profile_from_path(self, path: str):
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
self._apply_profile_data(data)
|
||||
|
||||
if os.path.dirname(os.path.abspath(path)) == os.path.abspath(PROFILE_DIR):
|
||||
self._refresh_profile_list(os.path.basename(path))
|
||||
else:
|
||||
self._refresh_profile_list()
|
||||
|
||||
self._log(f"[OK] Profil geladen: {path}\n", "ok")
|
||||
|
||||
def _on_profile_selected(self, _event=None):
|
||||
profile_name = self.v_profile_name.get().strip()
|
||||
if not profile_name:
|
||||
return
|
||||
path = os.path.join(PROFILE_DIR, profile_name)
|
||||
try:
|
||||
self._load_profile_from_path(path)
|
||||
except Exception as exc:
|
||||
messagebox.showerror("Profil laden", f"Laden fehlgeschlagen:\n{exc}")
|
||||
|
||||
def _save_profile(self):
|
||||
profile_dir = os.path.join(os.getcwd(), "profiles")
|
||||
os.makedirs(profile_dir, exist_ok=True)
|
||||
os.makedirs(PROFILE_DIR, exist_ok=True)
|
||||
path = filedialog.asksaveasfilename(
|
||||
title="Profil speichern",
|
||||
initialdir=profile_dir,
|
||||
initialdir=PROFILE_DIR,
|
||||
defaultextension=".json",
|
||||
filetypes=[("JSON-Dateien", "*.json"), ("Alle Dateien", "*.*")],
|
||||
)
|
||||
@@ -1431,31 +1490,28 @@ class AstrometryGUI:
|
||||
try:
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
self._refresh_profile_list(os.path.basename(path))
|
||||
self._log(f"[OK] Profil gespeichert: {path}\n", "ok")
|
||||
except Exception as exc:
|
||||
messagebox.showerror("Profil speichern", f"Speichern fehlgeschlagen:\n{exc}")
|
||||
|
||||
def _load_profile(self):
|
||||
profile_dir = os.path.join(os.getcwd(), "profiles")
|
||||
path = filedialog.askopenfilename(
|
||||
title="Profil laden",
|
||||
initialdir=profile_dir if os.path.isdir(profile_dir) else os.getcwd(),
|
||||
initialdir=PROFILE_DIR if os.path.isdir(PROFILE_DIR) else SCRIPT_DIR,
|
||||
filetypes=[("JSON-Dateien", "*.json"), ("Alle Dateien", "*.*")],
|
||||
)
|
||||
if not path:
|
||||
return
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
self._apply_profile_data(data)
|
||||
self._log(f"[OK] Profil geladen: {path}\n", "ok")
|
||||
self._load_profile_from_path(path)
|
||||
except Exception as exc:
|
||||
messagebox.showerror("Profil laden", f"Laden fehlgeschlagen:\n{exc}")
|
||||
|
||||
def _menu_load_credentials(self):
|
||||
path = filedialog.askopenfilename(
|
||||
title="Zugangsdaten laden",
|
||||
initialdir=os.getcwd(),
|
||||
initialdir=SCRIPT_DIR,
|
||||
filetypes=[("JSON-Dateien", "*.json"), ("Alle Dateien", "*.*")],
|
||||
)
|
||||
if not path:
|
||||
@@ -1,10 +1,6 @@
|
||||
{
|
||||
"format": 2,
|
||||
"variables": {
|
||||
"v_host": "10.42.44.25",
|
||||
"v_port": 22,
|
||||
"v_user": "eskimue",
|
||||
"v_pass": "",
|
||||
"v_local_file": "",
|
||||
"v_remote_dir": "/tmp/astrometry",
|
||||
"v_input_file": "",
|
||||
@@ -53,8 +49,6 @@
|
||||
"v_invert": true,
|
||||
"v_extra": ""
|
||||
},
|
||||
"secrets": {
|
||||
"v_pass_enc": "EQERAQYJAA=="
|
||||
},
|
||||
"secrets": {},
|
||||
"idx_text": ""
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -14,4 +14,4 @@ if errorlevel 1 (
|
||||
pip install paramiko
|
||||
)
|
||||
|
||||
python astrometry_gui.py
|
||||
python astrometry\astrometry_gui.py
|
||||
|
||||
+1
-1
@@ -14,4 +14,4 @@ if errorlevel 1 (
|
||||
pip install asyncssh
|
||||
)
|
||||
|
||||
python mesa_star_gui.py
|
||||
python mesa\mesa_star_gui.py
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
{
|
||||
"format": 2,
|
||||
"variables": {
|
||||
"v_host": "10.42.44.25",
|
||||
"v_port": 22,
|
||||
"v_user": "eskimue",
|
||||
"v_pass": "",
|
||||
"v_local_file": "C:/Users/ich/Cloud__Museum/Museumsentwicklung/Shop/Faksimile/2026/Heinlein Dieter/IMG_410328-1956_08_30-20000+2000-Te3-26-50.png",
|
||||
"v_remote_dir": "/tmp/astrometry",
|
||||
"v_input_file": "/tmp/astrometry/IMG_410328-1956_08_30-20000+2000-Te3-26-50.png",
|
||||
"v_out_prefix": "",
|
||||
"v_out_dir": "/tmp/astrometry",
|
||||
"v_new_fits": "/tmp/astrometry/IMG_410328-1956_08_30-20000+2000-Te3-26-50.fits",
|
||||
"v_wcs": "",
|
||||
"v_corr": "",
|
||||
"v_rdls": "",
|
||||
"v_axy": "",
|
||||
"v_solved": "",
|
||||
"v_match": "",
|
||||
"v_scale_units": "degwidth",
|
||||
"v_scale_low": "20",
|
||||
"v_scale_high": "30",
|
||||
"v_scale_est": "",
|
||||
"v_scale_err": "",
|
||||
"v_ra": "",
|
||||
"v_dec": "",
|
||||
"v_radius": "1.0",
|
||||
"v_depth": "",
|
||||
"v_cpulimit": "300",
|
||||
"v_plot_scale": "0.15",
|
||||
"v_plot_scale_auto": true,
|
||||
"v_plot_target_long_edge": "900",
|
||||
"v_downsample": "6",
|
||||
"v_tweak_order": "2",
|
||||
"v_odds_solve": "",
|
||||
"v_odds_reject": "",
|
||||
"v_odds_tune": "",
|
||||
"v_objs": "",
|
||||
"v_pixel_error": "",
|
||||
"v_parity": "both",
|
||||
"v_overwrite": true,
|
||||
"v_no_plots": false,
|
||||
"v_no_tweak": false,
|
||||
"v_resort": false,
|
||||
"v_verbose": false,
|
||||
"v_timestamp": true,
|
||||
"v_no_del_temp": false,
|
||||
"v_continue": false,
|
||||
"v_sextractor": false,
|
||||
"v_fits_image": false,
|
||||
"v_no_verify": false,
|
||||
"v_just_augment": false,
|
||||
"v_invert": true,
|
||||
"v_extra": ""
|
||||
},
|
||||
"secrets": {
|
||||
"v_pass_enc": "EQERAQYJAA=="
|
||||
},
|
||||
"idx_text": ""
|
||||
}
|
||||
Reference in New Issue
Block a user