fortrace.utility.applications.file_manager package
Submodules
fortrace.utility.applications.file_manager.file_manager module
- class fortrace.utility.applications.file_manager.file_manager.GenericFileManager(name: str, qs: QEMUMonitorSession, parent_notifier: ParentNotifier)[source]
Bases:
GenericApplicationOS-independent representation of a file manager window.
- abstractmethod bookmark_current_location()[source]
Create a bookmark of the current location.
Notes
OS specific method
- browse_to_directory(path: PathLike)[source]
Browse to a specified directory.
- Parameters:
path – directory to be browsed to. If <path> points to a file, the file CAN be selected (application specific behavior)
- copy_file(source: PurePath, destination: PurePath, overwrite: bool = False, ignore_suffix: bool = True)[source]
Copy a file <source> to the folder <destination>.
- Parameters:
source – file/folder to be copied
destination – destination folder
overwrite – should a file with the same name in destination be overwritten
ignore_suffix – should the suffix of a file be ignored (useful if ending is changed by, e.g., the browser)
Note
The file manager will remain at <destination>.
- create_folder(name: str)[source]
Create folder at the current location.
- Parameters:
name – name of the folder to be created
- delete_file(path: PathLike)[source]
Move a file to system trash.
- Perform a normal delete. The file manager will remain at the parent of the
file/dir that was deleted.
- Parameters:
path – file/directory to be deleted
- abstractmethod focus_on_item(name: str)[source]
Lays the focus on an item.
Then the focused item can be opened, moved, …
Notes
- some file managers support pattern matching and will select multiple
matching items
- Parameters:
name – name of the item to be matched
- abstractmethod move_file(source: PathLike, destination: PathLike, overwrite: bool = False, ignore_suffix: bool = True)[source]
Moves a file <source> to the folder <destination>.
- Parameters:
source – the file to be moved
destination – the destination folder
overwrite – should a file with the same name in destination be overwritten
ignore_suffix – should the suffix of a file be ignored (useful if ending is changed by, e.g., the browser)
Note
The file manager will remain at <destination>.
- abstractmethod open_file(path: PathLike, app_type: ApplicationType, app_name: str) GenericApplication[source]
Browse to a directory and open the specified file.
Browse to the specified directory and open the file (assuming the specified application is used). This method will not fail if the wrong application is specified. It might even work if no complex action with the opened application is performed (e.g. it is closed after the file was opened). The opened application will be focused. You have to refocus the file manager before continuing.
- Parameters:
path – path of the file to be opened (relative paths are allowed, including only the name of the file)
app_type – assumed type of application which opens the file
app_name – assumed name of the application which opens the file
TODO (#) – determine application name and type
- Returns:
handle to the new application that opened the file
- rename_file(source: PathLike, name: str)[source]
Rename a file behind source to a specified name.
- Parameters:
source – file to be renamed
name – the name to be given
- abstractmethod search(query: str)[source]
Perform a search and focus result window (NOT results themselves).
Toggle the state of showing hidden files in the file browser.
fortrace.utility.applications.file_manager.file_manager_factory module
- fortrace.utility.applications.file_manager.file_manager_factory.get_file_browser(name: str, qs: QEMUMonitorSession, parent_notifier: ParentNotifier) GenericFileManager[source]
Factory to create a specific file browser application object.
- Parameters:
name – name of the application (if not included ValueError is thrown)
qs – handle to QEMUMonitor
parent_notifier – attribute of desktop environment to handle changes in windows
- Returns:
Application handle to opened file manager
fortrace.utility.applications.file_manager.files module
- class fortrace.utility.applications.file_manager.files.Files(qs: QEMUMonitorSession, parent_notifier: ParentNotifier)[source]
Bases:
PosixFileManagerRepresentation of GNOME’s default file manager Files.
- bookmark_current_location()[source]
Create a bookmark of the current location.
Notes
OS specific method
- create_folder(name: str)[source]
Create folder at the current location.
- Parameters:
name – name of the folder to be created
- focus_on_item(name: str)[source]
Focus a specific item.
Files support pattern matching, thus multiple files matching name can be selected.
- Parameters:
name – name of the file(s) to put selection on
Toggle the state of showing hidden files in the file browser.
fortrace.utility.applications.file_manager.posix_file_manager module
- class fortrace.utility.applications.file_manager.posix_file_manager.PosixFileManager(name: str, qs: QEMUMonitorSession, parent_notifier: ParentNotifier)[source]
Bases:
GenericFileManager- move_file(source: PathLike, destination: PathLike, overwrite: bool = False, ignore_suffix: bool = True)[source]
Moves a file <source> to the folder <destination>.
- Parameters:
source – the file to be moved
destination – the destination folder
overwrite – should a file with the same name in destination be overwritten
ignore_suffix – should the suffix of a file be ignored (useful if ending is changed by, e.g., the browser)
Note
The file manager will remain at <destination>.
- open_file(path: PathLike, app_type: ApplicationType, app_name: str) GenericApplication[source]
Browse to a directory and open the specified file.
Browse to the specified directory and open the file (assuming the specified application is used). This method will not fail if the wrong application is specified. It might even work if no complex action with the opened application is performed (e.g. it is closed after the file was opened). The opened application will be focused. You have to refocus the file manager before continuing.
- Parameters:
path – path of the file to be opened (relative paths are allowed, including only the name of the file)
app_type – assumed type of application which opens the file
app_name – assumed name of the application which opens the file
TODO (#) – determine application name and type
- Returns:
handle to the new application that opened the file
fortrace.utility.applications.file_manager.windows_explorer module
- class fortrace.utility.applications.file_manager.windows_explorer.Explorer(qs: QEMUMonitorSession, parent_notifier: ParentNotifier)[source]
Bases:
GenericFileManagerRepresentation of a Windows Explorer application window.
Notes
Please use ‘File Explorer’ when creating this class, since Windows yields Edge when entering ‘Explorer’. When using paths, make sure to use PureWindowsPath in this class
- bookmark_current_location()[source]
Create a bookmark of the current location.
Notes
OS specific method
- browse_to_directory(path: PathLike)[source]
Browse the given path to a directory.
- Parameters:
path – Windows path to be browsed to
Notes
When specifying only a drive letter, make sure to include the double colon, or else this is not recognized as a Windows path
- copy_file(source: PathLike, destination: PathLike, overwrite: bool = False, ignore_suffix: bool = True)[source]
Copy a file <source> to the folder <destination>.
- Parameters:
source – file/folder to be copied
destination – destination folder
overwrite – should a file with the same name in destination be overwritten
ignore_suffix – should the suffix of a file be ignored (useful if ending is changed by, e.g., the browser)
Note
The file manager will remain at <destination>.
- focus_on_item(name: str)[source]
Lays the focus on an item.
Then the focused item can be opened, moved, …
Notes
- some file managers support pattern matching and will select multiple
matching items
- Parameters:
name – name of the item to be matched
- move_file(source: PathLike, destination: PathLike, overwrite: bool = False, ignore_suffix: bool = True)[source]
Moves a file <source> to the folder <destination>.
- Parameters:
source – the file to be moved
destination – the destination folder
overwrite – should a file with the same name in destination be overwritten
ignore_suffix – should the suffix of a file be ignored (useful if ending is changed by, e.g., the browser)
Note
The file manager will remain at <destination>.
- open_file(path: PathLike, app_type: ApplicationType, app_name: str) GenericApplication[source]
Browse to a directory and open the specified file.
Browse to the specified directory and open the file (assuming the specified application is used). This method will not fail if the wrong application is specified. It might even work if no complex action with the opened application is performed (e.g. it is closed after the file was opened). The opened application will be focused. You have to refocus the file manager before continuing.
- Parameters:
path – path of the file to be opened (relative paths are allowed, including only the name of the file)
app_type – assumed type of application which opens the file
app_name – assumed name of the application which opens the file
TODO (#) – determine application name and type
- Returns:
handle to the new application that opened the file
Toggle the state of showing hidden files in the file browser.