diff --git a/kibot/out_base.py b/kibot/out_base.py
index 0b2d678d..efa09a00 100644
--- a/kibot/out_base.py
+++ b/kibot/out_base.py
@@ -117,6 +117,10 @@ class BaseOutput(RegOutput):
return []
return self.options.get_targets(out_dir)
+ def get_navigate_targets(self, out_dir):
+ """ Returns a list of targets suitable for the navigate results """
+ return self.get_targets(out_dir), None
+
def get_dependencies(self):
""" Returns a list of files needed to create this output """
if self._sch_related:
diff --git a/kibot/out_kikit_present.py b/kibot/out_kikit_present.py
index be73ebb6..02a6732b 100644
--- a/kibot/out_kikit_present.py
+++ b/kibot/out_kikit_present.py
@@ -341,12 +341,14 @@ class KiKit_PresentOptions(BaseOptions):
except subprocess.CalledProcessError:
pass
- def get_targets(self, out_dir):
+ def _get_targets(self, out_dir, only_index=False):
self.ensure_tool('markdown2')
from .PcbDraw.present import readTemplate
# The web page
out_dir = self._parent.expand_dirname(out_dir)
res = [os.path.join(out_dir, 'index.html')]
+ if only_index:
+ return res
# The resources
template = readTemplate(self.template)
for r in self.resources:
@@ -356,6 +358,12 @@ class KiKit_PresentOptions(BaseOptions):
res.append(os.path.join(out_dir, 'boards'))
return res
+ def get_targets(self, out_dir):
+ return self._get_targets(out_dir)
+
+ def get_navigate_targets(self, out_dir):
+ return self._get_targets(out_dir, True)
+
def run(self, dir_name):
self.ensure_tool('markdown2')
from .PcbDraw.present import boardpage
@@ -400,6 +408,9 @@ class KiKit_Present(BaseOutput):
""" *[dict] Options for the `kikit_present` output """
self._category = 'PCB/docs'
+ def get_navigate_targets(self, out_dir):
+ return self.options.get_navigate_targets(out_dir), None
+
@staticmethod
def get_conf_examples(name, layers):
if not GS.check_tool(name, 'markdown2'):
diff --git a/kibot/out_kiri.py b/kibot/out_kiri.py
index 53a29897..351fa0b4 100644
--- a/kibot/out_kiri.py
+++ b/kibot/out_kiri.py
@@ -79,11 +79,13 @@ class KiRiOptions(AnyDiffOptions):
if self.max_commits < 0:
raise KiPlotConfigurationError(f"Wrong number of commits ({self.max_commits}) must be positive")
- def get_targets(self, out_dir):
+ def _get_targets(self, out_dir, only_index=False):
self.init_tools(out_dir)
hashes, sch_dirty, pcb_dirty, sch_files = self.collect_hashes()
if len(hashes) + (1 if sch_dirty or pcb_dirty else 0) < 2:
return []
+ if only_index:
+ return [os.path.join(self.cache_dir, 'index.html')]
files = [os.path.join(self.cache_dir, f) for f in ['blank.svg', 'commits', 'index.html', 'kiri-server', 'project']]
for h in hashes:
files.append(os.path.join(self.cache_dir, h[0][:7]))
@@ -91,6 +93,13 @@ class KiRiOptions(AnyDiffOptions):
files.append(os.path.join(self.cache_dir, HASH_LOCAL))
return files
+ def get_targets(self, out_dir):
+ return self._get_targets(out_dir)
+
+ def get_navigate_targets(self, out_dir):
+ """ Targets for the navigate results, just the index """
+ return self._get_targets(out_dir, True)
+
def create_layers_incl(self, layers):
self.incl_file = None
if isinstance(layers, type):
@@ -375,7 +384,7 @@ class KiRi(BaseOutput): # noqa: F821
if len(hashes) < 2:
return None
if GS.debug_level > 1:
- logger.debug(f'get_conf_examples found: {hashes}')
+ logger.debug(f'KiRi get_conf_examples found: {hashes}')
gb = {}
gb['name'] = 'basic_{}'.format(name)
gb['comment'] = 'Interactive diff between commits'
@@ -387,6 +396,10 @@ class KiRi(BaseOutput): # noqa: F821
outs.append(gb)
return outs
+ def get_navigate_targets(self, out_dir):
+ return (self.options.get_navigate_targets(out_dir),
+ [os.path.join(GS.get_resource_path('kiri'), 'images', 'icon.svg')])
+
def run(self, name):
self.options.layers = self.layers
super().run(name)
diff --git a/kibot/out_navigate_results.py b/kibot/out_navigate_results.py
index e39094ae..736a6f76 100644
--- a/kibot/out_navigate_results.py
+++ b/kibot/out_navigate_results.py
@@ -200,7 +200,7 @@ class Navigate_ResultsOptions(BaseOptions):
if img_w in self.copied_images:
# Already copied, just return its name
return self.copied_images[img_w]
- src = os.path.join(self.img_src_dir, img+'.svg')
+ src = os.path.join(self.img_src_dir, img+'.svg') if not img.endswith('.svg') else img
dst = os.path.join(self.out_dir, 'images', img_w)
id = img_w
if self.rsvg_command is not None and self.svg_to_png(src, dst+'.png', width):
@@ -293,12 +293,12 @@ class Navigate_ResultsOptions(BaseOptions):
os.remove(tmp_name)
return res, fname, os.path.relpath(fname, start=self.out_dir)
- def get_image_for_file(self, file, out_name, no_icon=False):
+ def get_image_for_file(self, file, out_name, no_icon=False, image=None):
ext = os.path.splitext(file)[1][1:].lower()
wide = False
# Copy the icon for this file extension
icon_name = 'folder' if os.path.isdir(file) else EXT_IMAGE.get(ext, 'unknown')
- img = self.copy(icon_name, MID_ICON)
+ img = self.copy(image or icon_name, MID_ICON)
# Full name for the file
file_full = file
# Just the file, to display it
@@ -387,10 +387,10 @@ class Navigate_ResultsOptions(BaseOptions):
f.write(' \n'.format(OUT_COLS, oname))
out_dir = get_output_dir(out.dir, out, dry=True)
f.write('{}