2012-05-30 16:10:56 +00:00
|
|
|
# Created On: 2012-05-30
|
2013-04-28 14:35:51 +00:00
|
|
|
# Copyright 2013 Hardcoded Software (http://www.hardcoded.net)
|
2012-05-30 16:10:56 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
|
|
|
# which should be included with this package. The terms are also available at
|
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
|
|
|
|
2013-07-14 15:58:49 +00:00
|
|
|
import os
|
|
|
|
|
2012-05-30 16:10:56 +00:00
|
|
|
from hscommon.gui.base import GUIObject
|
|
|
|
from hscommon.trans import tr
|
|
|
|
|
|
|
|
class DeletionOptions(GUIObject):
|
|
|
|
#--- View interface
|
|
|
|
# update_msg(msg: str)
|
|
|
|
# show()
|
|
|
|
#
|
|
|
|
|
|
|
|
def show(self, mark_count):
|
2012-08-01 16:36:23 +00:00
|
|
|
self.link_deleted = False
|
|
|
|
self.use_hardlinks = False
|
2012-05-30 16:10:56 +00:00
|
|
|
self.direct = False
|
|
|
|
msg = tr("You are sending {} file(s) to the Trash.").format(mark_count)
|
|
|
|
self.view.update_msg(msg)
|
|
|
|
return self.view.show()
|
|
|
|
|
2013-07-14 15:58:49 +00:00
|
|
|
def supports_links(self):
|
|
|
|
# When on a platform that doesn't implement it, calling os.symlink() (with the wrong number
|
|
|
|
# of arguments) raises NotImplementedError, which allows us to gracefully check for the
|
|
|
|
# feature.
|
|
|
|
try:
|
|
|
|
os.symlink()
|
|
|
|
except NotImplementedError:
|
2013-07-14 17:59:03 +00:00
|
|
|
# Windows XP, not supported
|
|
|
|
return False
|
|
|
|
except OSError:
|
|
|
|
# Vista+, symbolic link privilege not held
|
2013-07-14 15:58:49 +00:00
|
|
|
return False
|
|
|
|
except TypeError:
|
|
|
|
# wrong number of arguments
|
|
|
|
return True
|
|
|
|
|