from ...Internal.Core import Core
from ...Internal.CommandsGroup import CommandsGroup
from ...Internal import Conversions
from ...Internal.Types import DataType
from ...Internal.Utilities import trim_str_response
from ...Internal.ArgSingleList import ArgSingleList
from ...Internal.ArgSingle import ArgSingle
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class MassMemoryCls:
"""
| Commands in total: 15
| Subgroups: 4
| Direct child commands: 9
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("massMemory", core, parent)
@property
def catalog(self):
"""
| Commands in total: 2
| Subgroups: 1
| Direct child commands: 1
"""
if not hasattr(self, '_catalog'):
from .Catalog import CatalogCls
self._catalog = CatalogCls(self._core, self._cmd_group)
return self._catalog
@property
def dcatalog(self):
"""
| Commands in total: 2
| Subgroups: 1
| Direct child commands: 1
"""
if not hasattr(self, '_dcatalog'):
from .Dcatalog import DcatalogCls
self._dcatalog = DcatalogCls(self._core, self._cmd_group)
return self._dcatalog
@property
def load(self):
"""
| Commands in total: 1
| Subgroups: 1
| Direct child commands: 0
"""
if not hasattr(self, '_load'):
from .Load import LoadCls
self._load = LoadCls(self._core, self._cmd_group)
return self._load
@property
def store(self):
"""
| Commands in total: 1
| Subgroups: 1
| Direct child commands: 0
"""
if not hasattr(self, '_store'):
from .Store import StoreCls
self._store = StoreCls(self._core, self._cmd_group)
return self._store
[docs]
def get_current_directory(self) -> str:
"""
``MMEMory:CDIRectory`` \n
Snippet: ``value: str = driver.massMemory.get_current_directory()`` \n
Changes the default directory for mass memory storage. All following MMEM commands use the new directory, if you do not
specify another directory explicitly in the command string.
:return: directory: directory_name Complete file path or relative file path of the target directory. To change to a higher directory, use two dots: :MMEMory:CDIRectory '..'
"""
response = self._core.io.query_str('MMEMory:CDIRectory?')
return trim_str_response(response)
[docs]
def set_current_directory(self, directory: str) -> None:
"""
``MMEMory:CDIRectory`` \n
Snippet: ``driver.massMemory.set_current_directory(directory = 'abc')`` \n
Changes the default directory for mass memory storage. All following MMEM commands use the new directory, if you do not
specify another directory explicitly in the command string.
:param directory: directory_name Complete file path or relative file path of the target directory. To change to a higher directory, use two dots: :MMEMory:CDIRectory '..'
"""
param = Conversions.value_to_quoted_str(directory)
self._core.io.write(f'MMEMory:CDIRectory {param}')
[docs]
def copy(self, source_file: str, destination_file: str) -> None:
"""
``MMEMory:COPY`` \n
Snippet: ``driver.massMemory.copy(source_file = 'abc', destination_file = 'abc')`` \n
Copies an existing file to a new file. Instead of just a file, this command can also be used to copy a complete directory
together with all its files.
:param source_file: string Complete file path or relative file path and filename of the source file.
:param destination_file: string Complete file path or relative file path and filename of the target file. If DestinationFile is not specified, the SourceFile is copied to the current directory, queried with the method ``RsSmw.massMemory.current_directory()`` command. Note: Existing files with the same name in the destination directory are overwritten without an error message.
"""
param = ArgSingleList().compose_cmd_string(ArgSingle('source_file', source_file, DataType.String), ArgSingle('destination_file', destination_file, DataType.String))
self._core.io.write(f'MMEMory:COPY {param}'.rstrip())
[docs]
def delete(self, filename: str) -> None:
"""
``MMEMory:DELete`` \n
Snippet: ``driver.massMemory.delete(filename = 'abc')`` \n
Removes a file from the specified directory.
:param filename: string Filename or complete file path
"""
param = Conversions.value_to_quoted_str(filename)
self._core.io.write(f'MMEMory:DELete {param}')
[docs]
def get_drives(self) -> str:
"""
``MMEMory:DRIVes`` \n
Snippet: ``value: str = driver.massMemory.get_drives()`` \n
No help available
"""
response = self._core.io.query_str('MMEMory:DRIVes?')
return trim_str_response(response)
[docs]
def make_directory(self, directory: str) -> None:
"""
``MMEMory:MDIRectory`` \n
Snippet: ``driver.massMemory.make_directory(directory = 'abc')`` \n
Creates a subdirectory for mass memory storage in the specified directory. If no directory is specified, a subdirectory
is created in the default directory. This command can also be used to create a directory tree.
:param directory: string Specifies the complete file path of the new directory.
"""
param = Conversions.value_to_quoted_str(directory)
self._core.io.write(f'MMEMory:MDIRectory {param}')
[docs]
def move(self, source_file: str, destination_file: str) -> None:
"""
``MMEMory:MOVE`` \n
Snippet: ``driver.massMemory.move(source_file = 'abc', destination_file = 'abc')`` \n
Moves an existing file to a new location or, if no path is specified, renames an existing file.
:param source_file: string Filename of the file that you want to move.
:param destination_file: string Filename of the new file.
"""
param = ArgSingleList().compose_cmd_string(ArgSingle('source_file', source_file, DataType.String), ArgSingle('destination_file', destination_file, DataType.String))
self._core.io.write(f'MMEMory:MOVE {param}'.rstrip())
[docs]
def get_msis(self) -> str:
"""
``MMEMory:MSIS`` \n
Snippet: ``value: str = driver.massMemory.get_msis()`` \n
Defines the drive or network resource for instruments with windows operating system, using msis (MSIS = Mass Storage
Identification String) . Note: Instruments with the Linux operating system ignore this command, since Linux does not use
drive letter assignment.
"""
response = self._core.io.query_str('MMEMory:MSIS?')
return trim_str_response(response)
[docs]
def set_msis(self, path: str) -> None:
"""
``MMEMory:MSIS`` \n
Snippet: ``driver.massMemory.set_msis(path = 'abc')`` \n
Defines the drive or network resource for instruments with windows operating system, using msis (MSIS = Mass Storage
Identification String) . Note: Instruments with the Linux operating system ignore this command, since Linux does not use
drive letter assignment.
"""
param = Conversions.value_to_quoted_str(path)
self._core.io.write(f'MMEMory:MSIS {param}')
[docs]
def delete_directory(self, directory: str) -> None:
"""
``MMEMory:RDIRectory`` \n
Snippet: ``driver.massMemory.delete_directory(directory = 'abc')`` \n
Removes an empty directory from the mass memory storage system. If no directory is specified, the subdirectory with the
specified name is deleted in the default directory.
:param directory: string Specifies the complete file path or relative file path of the directory that you want to delete.
"""
param = Conversions.value_to_quoted_str(directory)
self._core.io.write(f'MMEMory:RDIRectory {param}')
[docs]
def delete_directory_recursive(self, directory: str) -> None:
"""
``MMEMory:RDIRectory:RECursive`` \n
Snippet: ``driver.massMemory.delete_directory_recursive(directory = 'abc')`` \n
Removes the specified directory, including files and subdirectories from the mass memory storage system. If no directory
is specified, the command removes the subdirectories of the default directory. The command the entire directory without
further prompt or notification.
:param directory: string String parameter to specify the directory to be deleted.
"""
param = Conversions.value_to_quoted_str(directory)
self._core.io.write(f'MMEMory:RDIRectory:RECursive {param}')
def clone(self) -> 'MassMemoryCls':
"""
Clones the group by creating new object from it and its whole existing subgroups.
Also copies all the existing default Repeated Capabilities setting,
which you can change independently without affecting the original group.
"""
new_group = MassMemoryCls(self._core, self._cmd_group.parent)
self._cmd_group.synchronize_repcaps(new_group)
return new_group