(self, mode, sources, destination, duplicate=False)
mode is int: 1 (move), 2 (copy), 3 (delete)
mode is int: 1 (move), 2 (copy), 3 (delete)
mode is int : 1 ( move ) 2 ( copy ) 3 ( delete )
def caller(self, mode, sources, destination, duplicate=False):
        '''mode is int: 1 (move), 2 (copy), 3 (delete)'''
        import ctypes
        if ST3: from Default.send2trash.plat_win import SHFILEOPSTRUCTW
        else:   from send2trash.plat_win import SHFILEOPSTRUCTW

        if duplicate:   fFlags = 8
        elif mode == 3: fFlags = 64  # send to recycle bin
        else:           fFlags = 0

        SHFileOperationW = ctypes.windll.shell32.SHFileOperationW
        SHFileOperationW.argtypes = [ctypes.POINTER(SHFILEOPSTRUCTW)]
        pFrom = u'\x00'.join(sources) + u'\x00'
        pTo   = (u'%s\x00' % destination) if destination else None
        wf = ctypes.WINFUNCTYPE(ctypes.wintypes.HWND)
        get_hwnd = wf(ctypes.windll.user32.GetForegroundWindow)
        args  = SHFILEOPSTRUCTW(
                                hwnd   = get_hwnd(),
                                wFunc  = ctypes.wintypes.UINT(mode),
                                pFrom  = ctypes.wintypes.LPCWSTR(pFrom),
                                pTo    = ctypes.wintypes.LPCWSTR(pTo),
                                fFlags = fFlags,
                                fAnyOperationsAborted = ctypes.wintypes.BOOL())
        out = SHFileOperationW(ctypes.byref(args))

        sublime.set_timeout(lambda: emit_event(u'watch_view', self.view.id(), plugin=u'FileBrowserWFS'), 1)
        if not out and destination:  # 0 == success
            sublime.set_timeout(lambda: self.view.run_command('dired_clear_copy_cut_list'), 1)
        else:  # probably user cancel op., or sth went wrong; keep settings
            sublime.set_timeout(lambda: self.view.run_command('dired_refresh'), 1)
def caller ( self , mode , sources , destination , duplicate = False ) : import ctypes if ST3 : from Default . send2trash . plat_win import SHFILEOPSTRUCTW else : from send2trash . plat_win import SHFILEOPSTRUCTW if duplicate : fFlags = 8 elif mode == 3 : fFlags = 64 # send to recycle bin else : fFlags = 0 SHFileOperationW = ctypes . windll . shell32 . SHFileOperationW SHFileOperationW . argtypes = [ ctypes . POINTER ( SHFILEOPSTRUCTW ) ] pFrom = u'\x00' . join ( sources ) + u'\x00' pTo = ( u'%s\x00' % destination ) if destination else None wf = ctypes . WINFUNCTYPE ( ctypes . wintypes . HWND ) get_hwnd = wf ( ctypes . windll . user32 . GetForegroundWindow ) args = SHFILEOPSTRUCTW ( hwnd = get_hwnd ( ) , wFunc = ctypes . wintypes . UINT ( mode ) , pFrom = ctypes . wintypes . LPCWSTR ( pFrom ) , pTo = ctypes . wintypes . LPCWSTR ( pTo ) , fFlags = fFlags , fAnyOperationsAborted = ctypes . wintypes . BOOL ( ) ) out = SHFileOperationW ( ctypes . byref ( args ) ) sublime . set_timeout ( lambda : emit_event ( u'watch_view' , self . view . id ( ) , plugin = u'FileBrowserWFS' ) , 1 ) if not out and destination : # 0 == success sublime . set_timeout ( lambda : self . view . run_command ( 'dired_clear_copy_cut_list' ) , 1 ) else : # probably user cancel op., or sth went wrong; keep settings sublime . set_timeout ( lambda : self . view . run_command ( 'dired_refresh' ) , 1 )