Added All tab plus minor bug fixes
Added an "All" tab allowing users to view images in all subdirectories in a single view. Modified behavior of opts.image_browser_with_subdirs to ignore "All" tab since users would reasonably expect an "All" tab to show all images regardless of what the option was set to. Fixed bug generating tabs_list when opts.image_browser_active_tabs option was present but no value was set resulting in no tabs being displayed. Added a check to verify the value is != "" and reset to default valuepull/186/head
parent
5aec351162
commit
04f87b271b
|
|
@ -96,10 +96,9 @@ def check_image_browser_active_tabs():
|
|||
shared.opts.save(shared.config_filename)
|
||||
|
||||
favorite_tab_name = "Favorites"
|
||||
default_output_path = "outputs"
|
||||
default_tab_options = ["All", "txt2img", "img2img", "txt2img-grids", "img2img-grids", "Extras", favorite_tab_name, "Others"]
|
||||
check_image_browser_active_tabs()
|
||||
tabs_list = [tab.strip() for tab in chain.from_iterable(csv.reader(StringIO(opts.image_browser_active_tabs))) if tab] if hasattr(opts, "image_browser_active_tabs") else default_tab_options
|
||||
tabs_list = [tab.strip() for tab in chain.from_iterable(csv.reader(StringIO(opts.image_browser_active_tabs))) if tab] if hasattr(opts, "image_browser_active_tabs") and opts.image_browser_active_tabs != "" else default_tab_options
|
||||
try:
|
||||
if opts.image_browser_enable_maint:
|
||||
tabs_list.append("Maintenance") # mandatory tab
|
||||
|
|
@ -107,7 +106,6 @@ except AttributeError:
|
|||
tabs_list.append("Maintenance") # mandatory tab
|
||||
|
||||
path_maps = {
|
||||
"All": opts.outdir_samples or default_output_path,
|
||||
"txt2img": opts.outdir_samples or opts.outdir_txt2img_samples,
|
||||
"img2img": opts.outdir_samples or opts.outdir_img2img_samples,
|
||||
"txt2img-grids": opts.outdir_grids or opts.outdir_txt2img_grids,
|
||||
|
|
@ -116,7 +114,6 @@ path_maps = {
|
|||
favorite_tab_name: opts.outdir_save
|
||||
}
|
||||
|
||||
|
||||
class ImageBrowserTab():
|
||||
|
||||
seen_base_tags = set()
|
||||
|
|
@ -450,7 +447,7 @@ def traverse_all_files(curr_path, image_list, tab_base_tag_box, img_path_depth)
|
|||
if os.path.splitext(fname)[1] in image_ext_list:
|
||||
image_list.append(f_info)
|
||||
elif stat.S_ISDIR(fstat.st_mode):
|
||||
if (opts.image_browser_with_subdirs and tab_base_tag_box != "image_browser_tab_others") or (tab_base_tag_box == "image_browser_tab_others" and img_path_depth != 0 and (current_depth < img_path_depth or img_path_depth < 0)):
|
||||
if (opts.image_browser_with_subdirs and tab_base_tag_box != "image_browser_tab_others") or (tab_base_tag_box == "image_browser_tab_all") or (tab_base_tag_box == "image_browser_tab_others" and img_path_depth != 0 and (current_depth < img_path_depth or img_path_depth < 0)):
|
||||
current_depth = current_depth + 1
|
||||
image_list = traverse_all_files(fname, image_list, tab_base_tag_box, img_path_depth)
|
||||
current_depth = current_depth - 1
|
||||
|
|
@ -739,7 +736,17 @@ def get_all_images(dir_name, sort_by, sort_order, keyword, tab_base_tag_box, img
|
|||
global current_depth
|
||||
logger.debug("get_all_images")
|
||||
current_depth = 0
|
||||
fileinfos = traverse_all_files(dir_name, [], tab_base_tag_box, img_path_depth)
|
||||
fileinfos = []
|
||||
if tab_base_tag_box == "image_browser_tab_all":
|
||||
for path in path_maps.values():
|
||||
list1 = fileinfos
|
||||
list2 = traverse_all_files(path, [], tab_base_tag_box, img_path_depth)
|
||||
tmp = dict(list1)
|
||||
tmp.update(dict(list2))
|
||||
fileinfos = list(tmp.items())
|
||||
else:
|
||||
fileinfos = traverse_all_files(dir_name, [], tab_base_tag_box, img_path_depth)
|
||||
|
||||
keyword = keyword.strip(" ")
|
||||
|
||||
if opts.image_browser_scan_exif:
|
||||
|
|
|
|||
Loading…
Reference in New Issue