Beispiel #1
0
 def test_use_trash_is_false_on_non_posix(self):
     old_os_name = os.name
     try:
         os.name = 'not posix'
         self.assertFalse(use_trash())
     finally:
         os.name = old_os_name
Beispiel #2
0
 def test_use_trash_is_true_by_default_on_posix(self):
     old_os_name = os.name
     old_sys_platform = sys.platform
     try:
         os.name = 'posix'
         sys.platform = 'linux'
         self.assertTrue(use_trash())
     finally:
         os.name = old_os_name
         sys.platform = old_sys_platform
Beispiel #3
0
 def test_use_trash_is_false_on_darwin(self):
     old_os_name = os.name
     old_sys_platform = sys.platform
     try:
         os.name = 'posix'
         sys.platform = 'darwin'
         self.assertFalse(use_trash())
     finally:
         os.name = old_os_name
         sys.platform = old_sys_platform
Beispiel #4
0
 def test_use_trash_is_false_when_bypassed(self):
     old_os_name = os.name
     old_sys_platform = sys.platform
     try:
         config.set('settings', 'bypass_trash', "true")
         os.name = 'posix'
         sys.platform = 'linux'
         self.assertFalse(use_trash())
     finally:
         os.name = old_os_name
         sys.platform = old_sys_platform
Beispiel #5
0
 def test_use_trash_is_false_when_bypassed(self):
     old_os_name = os.name
     old_sys_platform = sys.platform
     try:
         config.set("settings", "bypass_trash", "true")
         os.name = "posix"
         sys.platform = "linux"
         self.assertFalse(use_trash())
     finally:
         os.name = old_os_name
         sys.platform = old_sys_platform
Beispiel #6
0
def trash_files(parent, paths):
    """Will try to move the files to the trash,
    or if not possible, delete them permanently.

    Will ask for confirmation in each case.
    """

    if not paths:
        return

    # depends on the platform if we can
    if trash.use_trash():
        _do_trash_files(parent, paths)
    else:
        _do_delete_files(parent, paths)
Beispiel #7
0
def trash_files(parent, paths):
    """Will try to move the files to the trash,
    or if not possible, delete them permanently.

    Will ask for confirmation in each case.
    """

    if not paths:
        return

    # depends on the platform if we can
    if trash.use_trash():
        _do_trash_files(parent, paths)
    else:
        _do_delete_files(parent, paths)
Beispiel #8
0
def trash_songs(parent, songs, librarian):
    """Will try to move the files associated with the songs to the trash,
    or if not possible, delete them permanently.

    Will ask for confirmation in each case.

    The deleted songs will be removed from the librarian.
    """

    if not songs:
        return

    # depends on the platform if we can
    if trash.use_trash():
        _do_trash_songs(parent, songs, librarian)
    else:
        _do_delete_songs(parent, songs, librarian)
Beispiel #9
0
def trash_songs(parent, songs, librarian):
    """Will try to move the files associated with the songs to the trash,
    or if not possible, delete them permanently.

    Will ask for confirmation in each case.

    The deleted songs will be removed from the librarian.
    """

    if not songs:
        return

    # depends on the platform if we can
    if trash.use_trash():
        _do_trash_songs(parent, songs, librarian)
    else:
        _do_delete_songs(parent, songs, librarian)
Beispiel #10
0
def TrashMenuItem():
    if trash.use_trash():
        return MenuItem(_("_Move to Trash"), Icons.USER_TRASH)
    else:
        return MenuItem(_("_Delete"), Icons.EDIT_DELETE)
Beispiel #11
0
def TrashMenuItem():
    if trash.use_trash():
        return MenuItem(_("_Move to Trash"), Icons.USER_TRASH)
    else:
        return MenuItem(_("_Delete"), Icons.EDIT_DELETE)
Beispiel #12
0
def TrashMenuItem():
    return (MenuItem(_("_Move to Trash"), "user-trash") if trash.use_trash()
            else Gtk.ImageMenuItem(Gtk.STOCK_DELETE, use_stock=True))
Beispiel #13
0
def TrashMenuItem():
    return (MenuItem(_("_Move to Trash"), "user-trash") if trash.use_trash()
            else Gtk.ImageMenuItem(Gtk.STOCK_DELETE, use_stock=True))