How to use the ltk.actions.add_action.AddAction function in ltk

To help you get started, we’ve selected a few ltk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Lingotek / filesystem-connector / tests / test_actions / test_clone.py View on Github external
def setUp(self):
        self.action = CloneAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.added_directories = []
        self.config_action = ConfigAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.dir_path1 = os.path.join(os.getcwd(), 'dir1')
        self.added_directories.append(self.dir_path1)
        create_directory(self.dir_path1)
        self.dir_path2 = os.path.join(os.getcwd(), 'dir2')
        self.added_directories.append(self.dir_path2)
        create_directory(self.dir_path2)
        self.dir_path3 = os.path.join(os.getcwd(), 'dir1','dir3')
        self.added_directories.append(self.dir_path3)
        create_directory(self.dir_path3)
        self.delete_directory(os.path.join(os.getcwd(), 'ja-JP'))
        self.delete_directory(os.path.join(os.getcwd(), 'es-MX'))
        self.delete_directory(os.path.join(os.getcwd(), 'downloads'))
github Lingotek / filesystem-connector / tests / test_actions / test_rm.py View on Github external
def setUp(self):
        create_config()
        self.action = RmAction(os.getcwd())
        self.clean_action = CleanAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.clean_action.clean_action(True, False, None)
        self.file_name = 'sample.txt'
        self.file_path = create_txt_file(self.file_name)
        self.add_action.add_action([self.file_name], overwrite=True)
        self.doc_id = self.action.doc_manager.get_doc_ids()[0]
        assert poll_doc(self.action, self.doc_id)
github Lingotek / filesystem-connector / tests / test_actions / test_list.py View on Github external
def setUp(self):
        self.action = ListAction(os.getcwd())
        self.clean_action = CleanAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.clean_action.clean_action(True, False, None)
        self.rm_action = RmAction(os.getcwd())
github Lingotek / filesystem-connector / tests / test_actions / test_status.py View on Github external
def setUp(self):
        create_config()
        self.action = StatusAction(os.getcwd())
        self.clean_action = CleanAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.clean_action.clean_action(True, False, None)
        self.file_name = 'sample.txt'
        self.file_path = create_txt_file(self.file_name)
        self.add_action.add_action([self.file_name], overwrite=True)
        self.doc_id = self.action.doc_manager.get_doc_ids()[0]
        assert poll_doc(self.action, self.doc_id)
        self.targets = ['ja-JP', 'de-DE']
github Lingotek / filesystem-connector / tests / test_actions / test_request.py View on Github external
def setUp(self):
        self.clean_action = CleanAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.clean_action.clean_action(True, False, None)
        self.files = ['sample.txt', 'sample1.txt', 'sample2.txt']
        self.first_doc = 'sample.txt'
        for fn in self.files:
            create_txt_file(fn)
        self.add_action.add_action(['sample*.txt'], overwrite=True)
        self.doc_ids = self.add_action.doc_manager.get_doc_ids()
        for doc_id in self.doc_ids:
            assert poll_doc(self.add_action, doc_id)
github Lingotek / filesystem-connector / tests / test_actions / test_mv.py View on Github external
def setUp(self):
        self.action = MoveAction(os.getcwd())
        self.rm_action = RmAction(os.getcwd())
        self.add_action = AddAction(os.getcwd())
        self.list_action = ListAction(os.getcwd())
        self.added_dirs = {#dictionary of directory names to directory paths
            'full': 'full',
            'empty': 'empty',
            'hassub': 'hassub',
            'issub': 'hassub'+os.sep+'issub'
        }
        create_directory(os.path.join(os.getcwd(), self.added_dirs['hassub']))
        create_directory(os.path.join(os.getcwd(), self.added_dirs['issub']))
        create_directory(os.path.join(os.getcwd(), self.added_dirs['full']))
        create_directory(os.path.join(os.getcwd(), self.added_dirs['empty']))
        self.added_files = {#dictionary of file names to file paths
            'fileA.txt': 'fileA.txt',
            'fileB.txt': os.path.join(self.added_dirs['full'], 'fileB.txt'),
            'fileC.txt': os.path.join(self.added_dirs['hassub'], 'fileC.txt'), #untracked
            'fileD.txt': os.path.join(self.added_dirs['issub'], 'fileD.txt')
github Lingotek / filesystem-connector / python2 / ltk / watch.py View on Github external
self.observers = []  # watchdog observers that will watch the files
        self.handler = WatchHandler()
        self.handler.on_modified = self._on_modified
        self.handler.on_created = self._on_created
        self.handler.on_moved = self._on_moved
        self.watch_queue = []  # not much slower than deque unless expecting 100+ items
        self.locale_delimiter = None
        self.ignore_ext = []  # file types to ignore as specified by the user
        self.detected_locales = {}  # dict to keep track of detected locales
        self.watch_folder = True
        self.timeout = timeout
        self.updated = {}
        self.git_auto = Git_Auto(path)
        self.polled_list = set([])
        self.force_poll = False
        self.add = add_action.AddAction(path)
        self.download = download_action.DownloadAction(path)
        self.root_path = path
        self.download_file_paths = set() # set of download file path names
        # if remote:  # poll lingotek cloud periodically if this option enabled
github Lingotek / filesystem-connector / python3 / ltk / watch.py View on Github external
self.observers = []  # watchdog observers that will watch the files
        self.handler = WatchHandler()
        self.handler.on_modified = self._on_modified
        self.handler.on_created = self._on_created
        self.handler.on_moved = self._on_moved
        self.watch_queue = []  # not much slower than deque unless expecting 100+ items
        self.locale_delimiter = None
        self.ignore_ext = []  # file types to ignore as specified by the user
        self.detected_locales = {}  # dict to keep track of detected locales
        self.watch_folder = True
        self.timeout = timeout
        self.updated = {}
        self.git_auto = Git_Auto(path)
        self.polled_list = set([])
        self.force_poll = False
        self.add = add_action.AddAction(path)
        self.download = download_action.DownloadAction(path)
        self.root_path = path
        self.download_file_paths = set() # set of download file path names
        # if remote:  # poll lingotek cloud periodically if this option enabled