summaryrefslogtreecommitdiff
path: root/raphodo/filebrowse.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-01-03 18:32:15 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-01-03 18:32:15 +0100
commitb71beaf0d22f182ab0b95b1b35da7e786585c4e7 (patch)
tree1e95d573c09bee1dec63d909cc59ef57222a7710 /raphodo/filebrowse.py
parentdeb736d38beac3863c04d4c0f285c28557fe07c6 (diff)
parent8351a36cbcbe8529ec1c0bb60d77bf65fb59fe12 (diff)
Update upstream source from tag 'upstream/0.9.7'
Update to upstream version '0.9.7' with Debian dir 9c39d3b734403d3ae14a7bfdb1f76e371acb4e78
Diffstat (limited to 'raphodo/filebrowse.py')
-rw-r--r--raphodo/filebrowse.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/raphodo/filebrowse.py b/raphodo/filebrowse.py
index 4508d7c..6f17b29 100644
--- a/raphodo/filebrowse.py
+++ b/raphodo/filebrowse.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 Damon Lynch <damonlynch@gmail.com>
+# Copyright (C) 2016-2017 Damon Lynch <damonlynch@gmail.com>
# This file is part of Rapid Photo Downloader.
#
@@ -21,7 +21,7 @@ Display file system folders and allow the user to select one
"""
__author__ = 'Damon Lynch'
-__copyright__ = "Copyright 2016, Damon Lynch"
+__copyright__ = "Copyright 2016-2017, Damon Lynch"
import os
import pathlib
@@ -32,14 +32,19 @@ import subprocess
from gettext import gettext as _
-from PyQt5.QtCore import (QDir, Qt, QModelIndex, QItemSelectionModel, QSortFilterProxyModel, QPoint)
-from PyQt5.QtWidgets import (QTreeView, QAbstractItemView, QFileSystemModel, QSizePolicy,
- QStyledItemDelegate, QStyleOptionViewItem, QMenu)
+from PyQt5.QtCore import (
+ QDir, Qt, QModelIndex, QItemSelectionModel, QSortFilterProxyModel, QPoint
+)
+from PyQt5.QtWidgets import (
+ QTreeView, QAbstractItemView, QFileSystemModel, QSizePolicy, QStyledItemDelegate,
+ QStyleOptionViewItem, QMenu
+)
from PyQt5.QtGui import QIcon
-from PyQt5.QtGui import (QPainter, QFont)
+from PyQt5.QtGui import QPainter, QFont
import raphodo.qrc_resources as qrc_resources
-from raphodo.constants import (minPanelWidth, minFileSystemViewHeight, Roles)
+from raphodo.constants import minPanelWidth, minFileSystemViewHeight, Roles
+from raphodo.storage import gvfs_gphoto2_path
class FileSystemModel(QFileSystemModel):
@@ -130,7 +135,7 @@ class FileSystemView(QTreeView):
"""
Call only after the model has been initialized
"""
- for i in (1,2,3):
+ for i in (1, 2, 3):
self.hideColumn(i)
def goToPath(self, path: str, scrollTo: bool=True) -> None:
@@ -205,10 +210,16 @@ class FileSystemFilter(QSortFilterProxyModel):
self.invalidateFilter()
def filterAcceptsRow(self, sourceRow: int, sourceParent: QModelIndex=None) -> bool:
+ index = self.sourceModel().index(sourceRow, 0, sourceParent) # type: QModelIndex
+ path = index.data(QFileSystemModel.FilePathRole) # type: str
+
+ if gvfs_gphoto2_path(path):
+ logging.debug("Rejecting browsing path %s", path)
+ return False
+
if not self.filtered_dir_names:
return True
- index = self.sourceModel().index(sourceRow, 0, sourceParent) # type: QModelIndex
file_name = index.data(QFileSystemModel.FileNameRole)
return file_name not in self.filtered_dir_names
@@ -217,6 +228,7 @@ class FileSystemDelegate(QStyledItemDelegate):
"""
Italicize provisional download folders that were not already created
"""
+
def __init__(self, parent=None):
super().__init__(parent)