def _file_name_changed ( self, old_file_name, new_file_name ): """ Handles the 'file_name' trait being changed. """ if old_file_name != '': file_watch.watch( self._update, old_file_name, remove = True ) if new_file_name != '': file_watch.watch( self._update, new_file_name ) self._update( new_file_name )
def _selected_changed ( self, record ): """ Handles the user selecting a local variable. """ # Only set up the file watch when a UI is actually active: if not self.initialized: self.initialized = True file_watch.watch( self.update_all_items, ui_db_name() ) if record is not None: # Display the contents of the selected data base record: db = get_ui_db() if db is not None: id = record.id self.value = HasPayload( payload = db[ id ], payload_name = id.split( '.' )[-1], payload_full_name = id ) db.close() else: self.value = None
def _selected_changed(self, record): """ Handles the user selecting a local variable. """ # Only set up the file watch when a UI is actually active: if not self.initialized: self.initialized = True file_watch.watch(self.update_all_items, ui_db_name()) if record is not None: # Display the contents of the selected data base record: db = get_ui_db() if db is not None: id = record.id self.value = HasPayload(payload=db[id], payload_name=id.split('.')[-1], payload_full_name=id) db.close() else: self.value = None
def set_listener ( self, file_name, remove ): """ Sets up/Removes a file watch on a specified file. """ if exists( file_name ): file_watch.watch( self.file_changed, file_name, remove = remove )
def stop_monitoring(self): """ Stops monitoring the associated path for file changes. """ file_watch.watch(self._file_changed, self.path, remove=True)
def start_monitoring(self): """ Starts monitoring the associated path for file changes. """ file_watch.watch(self._file_changed, self.path)
def stop_monitoring ( self ): """ Stops monitoring the associated path for file changes. """ file_watch.watch( self._file_changed, self.path, remove = True )
def start_monitoring ( self ): """ Starts monitoring the associated path for file changes. """ file_watch.watch( self._file_changed, self.path )
def _set_listener ( self, file_name, remove ): """ Sets up/Removes a file watch on a specified file. """ if exists( file_name ): file_watch.watch( self._file_changed, file_name, remove = remove )