a lot of progress
This commit is contained in:
+17
-9
@@ -6,6 +6,7 @@ import matplotlib.pylab as plt
|
||||
from matplotlib.widgets import Button
|
||||
|
||||
from image_preparing import fix_image_resolution
|
||||
import transition
|
||||
|
||||
|
||||
class ImageInterface:
|
||||
@@ -96,15 +97,22 @@ class ImageInterface:
|
||||
self.current_index = 0
|
||||
self._show_browser()
|
||||
def _open_shenanigans(self):
|
||||
image_paths = self.image_sets.get("source", [])
|
||||
selected_index = self.selected_indices.get("source")
|
||||
if selected_index is None:
|
||||
selected_index = self.current_index if self.current_category == "source" else 0
|
||||
selected_path = None
|
||||
if image_paths:
|
||||
safe_index = max(0, min(selected_index, len(image_paths) - 1))
|
||||
selected_path = image_paths[safe_index]
|
||||
fix_image_resolution(selected_path)
|
||||
src_paths = self.image_sets.get("source", [])
|
||||
goal_paths = self.image_sets.get("goal", [])
|
||||
if not src_paths or not goal_paths:
|
||||
return
|
||||
sel_src = self.selected_indices.get("source")
|
||||
sel_goal = self.selected_indices.get("goal")
|
||||
src_path = src_paths[sel_src] if sel_src is not None else src_paths[0]
|
||||
goal_path = goal_paths[sel_goal] if sel_goal is not None else goal_paths[0]
|
||||
try:
|
||||
import importlib
|
||||
importlib.reload(transition)
|
||||
except Exception:
|
||||
pass
|
||||
if not hasattr(transition, "transform_images"):
|
||||
return
|
||||
transition.transform_images(src_path, goal_path)
|
||||
def _selected_image_name(self, category):
|
||||
selected_index = self.selected_indices.get(category)
|
||||
image_paths = self.image_sets.get(category, [])
|
||||
|
||||
Reference in New Issue
Block a user