BranchView with Thumbnails separated like digikam

Discuss and share scripts and script files...
Post Reply
bossi
Posts: 85
Joined: 30 Jul 2022 11:09

BranchView with Thumbnails separated like digikam

Post by bossi »

I just needed it

generates upper row , lower row and filler elements

Code: Select all

"_ : gen_fillers"{    // <--- select folders to generate seperators then execute
	$folders = sel_files();
	foreach $folder, $folders {
		$per_row = 8; // <--- set how much items are per row

		// create files row
		$sep_f_count = listfolder($folder, "*.separ", 32, );
		if $sep_f_count != $per_row-1 {
			$sep_f = quicksearch("*.separ /n",$folder ,"|" , );
			if $sep_f {
				delete 1,0, $sep_f;
			}
			$sep_f_counter = $per_row-1 ;
			while ( 0 < $sep_f_counter ){
				new($folder . "\$" . "_" .  $sep_f_counter . ".separ", "file",  ,  );
				$sep_f_counter -= 1;
			}
		}
		// create dir row
		$sep_d_count = listfolder($folder, "ᐱ_*", 32, );
		if $sep_d_count != $per_row {
			$sep_d = quicksearch("ᐱ_* /n",$folder ,"|" , );
			if $sep_d {
				delete 1,0, $sep_d;
			}
			$sep_d_counter = $per_row;
			while ( 0 < $sep_d_counter ){
				new($folder . "\ᐱ_" .  $sep_d_counter, "dir",  ,  );
				$sep_d_counter -= 1;
			}
		}
		//count only real files
		$files = listfolder($folder, "*", 4, );
		$total_files = 0;
		foreach $file,$files{
			if str_compare($file , "_____") == -1 AND str_compare($file , "Desktop.ini") == -1 AND str_compare($file , "Folder.ico") == -1{
				if str_compare($file , "ᐱ") == -1 AND str_compare($file , ".separ") == -1 AND str_compare($file , "ᐅ") == -1 {
					$total_files += 1;
				}
			}
		}
		// how many fillers needed ?
		$full_rows = floor($total_files / $per_row);
		$fillers_needed = $per_row - ($total_files - ($full_rows * 8 ));

		$fillers_exist_count = listfolder($folder, "ᐅ_*", 32, );

		if $fillers_needed != $fillers_exist_count{
			$fillers = quicksearch("ᐅ_* /n",$folder ,"|" , );
			if $fillers {
				delete 1,0, $fillers;
			}
			if $fillers_needed != $per_row {
				while ( 0 < $fillers_needed ){
					new($folder . "\ᐅ_$fillers_needed", "dir",  ,  );
					$fillers_needed -= 1;
				}
			}
		}
	}
}
toggles seperators on/off from ghost filter

Code: Select all

"_ : ghost_set_separ__"{       //< --- execute this via cat/toolbar button
	ghost_via_cat__(".separ", 0);
	ghost_via_cat__("ᐱ_", 0);
	ghost_via_cat__("ᐅ_", 0);
}
function ghost_via_cat__($str,$set_caption){  
	$ghost_active = ghost(); 
	$compare = strpos($ghost_active,$str);

	if $compare > -1 {		               //if is active already, toggle it off 
		$ghost_updated = replace($ghost_active,$str,"");
		$ghost_updated = replace($ghost_updated,"||","|");
	}	
	else{                                  // if is not active , append it  	
		$ghost_updated = trim($ghost_active . "|". $str);
		$ghost_updated = replace($ghost_updated,"||","|");
	}	
	ghost($ghost_updated,1); 
}
in custom icons assign a blank ico to :
*.separ
\ᐅ_*\
\ᐱ_*\

In Color Filters add & assign font & backgroud color :
L:dir: *ᐅ_*
L:dir: *ᐱ_*
L:.separ

upper and lower row are generated once , filler row regenerates when qty of files changes .
use 1 lvl branch view for this
Branch_View_D_wiki1_SCI_-_xy_pw.ini_tag.dat_26.30._2024-10-14_01-03-56.png
Branch_View_D_wiki1_SCI_-_xy_pw.ini_tag.dat_26.30._2024-10-14_01-03-56.png (1.34 MiB) Viewed 1978 times
Attachments
xy_pw.ini_tag.dat_26.30.0400__D_dbxy_thumbs__XYplo_2024-10-14_00-59-45.png
xy_pw.ini_tag.dat_26.30.0400__D_dbxy_thumbs__XYplo_2024-10-14_00-59-45.png (36.26 KiB) Viewed 1978 times
Win11-Pro , 3840x2160@100% , XY=x64 newest

jupe
Posts: 3290
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: BranchView with Thumbnails separated like digikam

Post by jupe »

I see the look you were going for based on the screenshot, nice, I can appreciate the effort you made to achieve that. I just had a quick look at your script though, and noticed you have used user functions sel_files/str_compare but not included them, so the script as it is posted won't work for anyone, as far as I can tell.

Also, not sure if you are aware or interested, but if you choose to display your items in a Virtual Folder instead, you can create dummy items in those without having to actually create files, I can mock up a quick demo script if you are interested, but all it basically takes is just inserting nonexistent items in the list fed to the Virtual Folder.

Post Reply