summaryrefslogtreecommitdiff
path: root/raphodo/rapid.py
diff options
context:
space:
mode:
Diffstat (limited to 'raphodo/rapid.py')
-rwxr-xr-xraphodo/rapid.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/raphodo/rapid.py b/raphodo/rapid.py
index 6c1254a..683520b 100755
--- a/raphodo/rapid.py
+++ b/raphodo/rapid.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (C) 2011-2017 Damon Lynch <damonlynch@gmail.com>
+# Copyright (C) 2011-2018 Damon Lynch <damonlynch@gmail.com>
# This file is part of Rapid Photo Downloader.
#
@@ -29,7 +29,7 @@ Project line length: 100 characters (i.e. word wrap at 99)
"""
__author__ = 'Damon Lynch'
-__copyright__ = "Copyright 2011-2017, Damon Lynch"
+__copyright__ = "Copyright 2011-2018, Damon Lynch"
import sys
import logging
@@ -94,7 +94,7 @@ from raphodo.storage import (
has_one_or_more_folders, mountPaths, get_desktop_environment, get_desktop,
gvfs_controls_mounts, get_default_file_manager, validate_download_folder,
validate_source_folder, get_fdo_cache_thumb_base_directory, WatchDownloadDirs, get_media_dir,
- StorageSpace
+ StorageSpace, gvfs_gphoto2_path
)
from raphodo.interprocess import (
ScanArguments, CopyFilesArguments, RenameAndMoveFileData, BackupArguments,
@@ -640,6 +640,9 @@ class RapidWindow(QMainWindow):
"Version downgrade detected, from %s to %s",
__about__.__version__, previous_version
)
+ if pv < pkg_resources.parse_version('0.9.7b1'):
+ # Remove any duplicate subfolder generation or file renaming custom presets
+ self.prefs.filter_duplicate_generation_prefs()
def startThreadControlSockets(self) -> None:
"""
@@ -809,7 +812,7 @@ class RapidWindow(QMainWindow):
self.updateThumbnailModelAfterProximityChange
)
- self.file_manager = get_default_file_manager()
+ self.file_manager, self.file_manager_type = get_default_file_manager()
if self.file_manager:
logging.info("Default file manager: %s", self.file_manager)
else:
@@ -2574,7 +2577,7 @@ class RapidWindow(QMainWindow):
"""
Respond to This Computer Toggle Switch
- :param on: whether swich is on or off
+ :param on: whether switch is on or off
"""
if on:
@@ -2594,14 +2597,15 @@ class RapidWindow(QMainWindow):
"""
Respond to Devices Toggle Switch
- :param on: whether swich is on or off
+ :param on: whether switch is on or off
"""
self.prefs.device_autodetection = on
if not on:
for scan_id in list(self.devices.volumes_and_cameras):
self.removeDevice(scan_id=scan_id, adjust_temporal_proximity=False)
- if len(self.devices) == 0:
+ state = self.proximityStatePostDeviceRemoval()
+ if state == TemporalProximityState.empty:
self.temporalProximity.setState(TemporalProximityState.empty)
else:
self.generateTemporalProximityTableData("devices were removed as a download source")
@@ -2611,6 +2615,19 @@ class RapidWindow(QMainWindow):
QTimer.singleShot(100, self.devicesViewToggledOn)
self.adjustLeftPanelSliderHandles()
+ def proximityStatePostDeviceRemoval(self) -> TemporalProximityState:
+ """
+ :return: set correct proximity state after a device is removed
+ """
+
+ # ignore devices that are scanning - we don't care about them, because the scan
+ # could take a long time, especially with phones
+ if len(self.devices) - len(self.devices.scanning) > 0:
+ # Other already scanned devices are present
+ return TemporalProximityState.regenerate
+ else:
+ return TemporalProximityState.empty
+
@pyqtSlot()
def devicesViewToggledOn(self) -> None:
self.searchForCameras()
@@ -4446,13 +4463,6 @@ Do you want to proceed with the download?
Initiate Timeline generation if it's right to do so
"""
- if len(self.devices.scanning):
- logging.info(
- "Was tasked to generate Timeline because %s, but ignoring request "
- "because a scan is occurring", reason
- )
- return
-
if self.temporalProximity.state == TemporalProximityState.ctime_rebuild:
logging.info(
"Was tasked to generate Timeline because %s, but ignoring request "
@@ -5106,7 +5116,8 @@ Do you want to proceed with the download?
self.setDownloadCapabilities()
if adjust_temporal_proximity:
- if len(self.devices) == 0:
+ state = self.proximityStatePostDeviceRemoval()
+ if state == TemporalProximityState.empty:
self.temporalProximity.setState(TemporalProximityState.empty)
elif files_removed:
self.generateTemporalProximityTableData("a download source was removed")
@@ -6098,7 +6109,7 @@ def main():
sys.exit(1)
media_dir = get_media_dir()
- auto_detect = args.path.startswith(media_dir)
+ auto_detect = args.path.startswith(media_dir) or gvfs_gphoto2_path(args.path)
if auto_detect:
this_computer_source = False
this_computer_location = None