Utilities¶
Clipboard¶
-
class
mhi.pscad.utilities.clipboard.Clipboard¶ This Clipboard class allows saving Device Independent Bitmaps (DIBs) to a file
-
classmethod
getFormatName(fmt)¶ Convert a format identifier (integer) to a readable name
-
classmethod
saveBitmap(filename)¶ Save the clipboard contents as a Device Independent Bitmap (DIB)
Returns True if successful, or False if the clipboard does not contain DIB content.
-
classmethod
File¶
-
class
mhi.pscad.utilities.file.File¶ Useful File utilities
-
static
compare_files(file1, file2)¶ Compares two text files. Return
Trueif the contents match.
-
static
move_files(src_dir, dest_dir, *exts)¶ Copies files from the source directory to a destination directory.
The destination directory must not exist; it will be created. Only files which match the given extension(s) are copied.
-
static
copy_files(src_dir, dst_dir, *exts, recursive=False)¶ Copies files from the source directory to a destination directory.
Only files matching the given extensions are copied. If no extensions are given, all files are copied.
If recursive is True, subdirectories are copied.
-
static
copy_file(file, dest_dir)¶ Copies a file to the destination directory
-
static
convert_out_to_csv(directory, out_file, csv_file)¶ Converts PSCAD output file into a csv file
-
static
-
class
mhi.pscad.utilities.file.OutFile(basename)¶ PSCAD Output files utility class
-
__init__(basename)¶ Construct an instance which can manipulate a set of PSCAD output files (
<basename>.inf, &<basename>_##.out)
-
open()¶ Open all of the internal data files
-
close()¶ Close all of the internal data files
-
read_values()¶ Return next row of data, read from all
*.outdata files
-
column(name)¶ Turn a column name into a number
-
column_name(column)¶ Turn a column number into a column name
-
toCSV(csv=None, columns=None, start=0, end=inf)¶ Convert OutFile into a Comma Separated Value (CSV) file
If no csv file is specified, defaults to “<basename>.csv”. If no column names are specified, defaults to all columns. If no start time is given, defaults to start of file. If no end time is given, defaults to end of file.
-
Mail¶
E-Mail Helper Utility
-
class
mhi.pscad.utilities.mail.Mail¶ E-Mail Helper Utility
-
static
send_gmail(sender, password, recipients, subject, body, attachments=None)¶ Sends a document using a GMail account
-
static
send_outlook_mail(recipients, subject, body, attachments=None)¶ Sends a document using a Microsoft Outlook account
-
static
Word¶
Microsoft Word Document Helper
-
class
mhi.pscad.utilities.word.Word¶ Microsoft Word Document helper
-
addPageBreak()¶ Adds a Page Break to the current document
-
textParagraph(text, size=None, bold=None)¶ Adds a paragraph to the current document
-
pasteImage()¶ Adds an image from the clipboard to the current document
-
save(filename=None, close=False)¶ Save (and possibly close) the current document
-
close()¶ Close the current document
-
open_document(document)¶ Opens the given document
-
new_document()¶ Creates a new document
-