Visitar URL original
GUI: Fix redundant signal calls, streamline path selections by C-Achard · Pull Request #3395 · DeepLabCut/DeepLabCut · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use os.fspath instead of str
  • Loading branch information
deruyter92 authored and C-Achard committed Jul 16, 2026
commit 4c846926acd46e2449712658f997312a2c54b37b
5 changes: 3 additions & 2 deletions deeplabcut/gui/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#
from __future__ import annotations

import os
from os import PathLike
from pathlib import Path

Expand Down Expand Up @@ -79,7 +80,7 @@ def _dialog_directory(directory: PathInput | None) -> str:
"""Convert an optional path to a QFileDialog-compatible string."""
if directory is None or directory == "":
return ""
return str(Path(directory))
return os.fspath(directory)


def _get_open_file_name(
Expand Down Expand Up @@ -531,7 +532,7 @@ def _init_layout(self):

def _update_selected_conditions_display(self):
def _shorten_path(path: Path | str, max_length: int = 30) -> str:
path_str = str(path)
path_str = os.fspath(path)
if len(path_str) <= max_length:
return path_str
return "..." + path_str[-(max_length - 3) :]
Expand Down
Loading