mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Merge branch 'main' into editor-3830
This commit is contained in:
commit
014247b70f
3 changed files with 29 additions and 9 deletions
|
@ -982,9 +982,34 @@ def show_in_folder(path: str) -> None:
|
||||||
"""
|
"""
|
||||||
call(osascript_to_args(script))
|
call(osascript_to_args(script))
|
||||||
else:
|
else:
|
||||||
# Just open the file in any other platform
|
# For linux, there are multiple file managers. Let's test if one of the
|
||||||
with no_bundled_libs():
|
# most common file managers is found and use it in case it is installed.
|
||||||
QDesktopServices.openUrl(QUrl.fromLocalFile(path))
|
# If none of this list are installed, use a fallback. The fallback
|
||||||
|
# might open the image in a web browser, image viewer or others,
|
||||||
|
# depending on the users defaults.
|
||||||
|
file_managers = [
|
||||||
|
"nautilus", # GNOME
|
||||||
|
"dolphin", # KDE
|
||||||
|
"pcmanfm", # LXDE
|
||||||
|
"thunar", # XFCE
|
||||||
|
"nemo", # Cinnamon
|
||||||
|
"caja", # MATE
|
||||||
|
]
|
||||||
|
|
||||||
|
available_file_manager = None
|
||||||
|
|
||||||
|
# Test if a file manager is installed and use it, fallback otherwise
|
||||||
|
for file_manager in file_managers:
|
||||||
|
if shutil.which(file_manager):
|
||||||
|
available_file_manager = file_manager
|
||||||
|
break
|
||||||
|
|
||||||
|
if available_file_manager:
|
||||||
|
subprocess.run([available_file_manager, path], check=False)
|
||||||
|
else:
|
||||||
|
# Just open the file in any other platform
|
||||||
|
with no_bundled_libs():
|
||||||
|
QDesktopServices.openUrl(QUrl.fromLocalFile(path))
|
||||||
|
|
||||||
|
|
||||||
def _show_in_folder_win32(path: str) -> None:
|
def _show_in_folder_win32(path: str) -> None:
|
||||||
|
|
|
@ -34,5 +34,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.collapse-label {
|
.collapse-label {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -6,9 +6,3 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<span class="label-name">
|
<span class="label-name">
|
||||||
<slot />
|
<slot />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
.label-name {
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in a new issue