GXDOCU class¶
- class GXDOCU(handle=0)[source]¶
GXDOCU class.
Class to work with documents
- copy(doc_us)[source]¶
Copy
GXDOCU
New in version 5.1.1.
License: Geosoft Open License
- classmethod create()[source]¶
Create a document onject
New in version 5.1.1.
License: Geosoft Open License
- classmethod create_s(bf)[source]¶
Create from a serialized source
New in version 5.1.1.
License: Geosoft Open License
- doc_name(name)[source]¶
The document name.
- Parameters:
name (str_ref) – Buffer to fill with document name
New in version 5.1.1.
License: Geosoft Open License
- file_name(name)[source]¶
The original document file name.
- Parameters:
name (str_ref) – Buffer to fill with document file name
New in version 5.1.1.
License: Geosoft Open License
- get_file(file)[source]¶
Get the document and place in a file.
- Parameters:
file (str) – File to which to write document
New in version 5.1.1.
License: Geosoft Open License
- get_file_meta(file)[source]¶
Get the document and place in a file with metadata.
- Parameters:
file (str) – File to which to write document
New in version 5.1.8.
License: Geosoft Open License
Note: If this document is only a URL link, the URL link will be resolved and the document downloaded from the appropriate server using the protocol specified.
The document has metadata, and the native document does not support metadata, the metadata will be placed in an associated file “filename.extension.GeosoftMeta”
- get_meta(meta)[source]¶
Get the document’s meta
New in version 5.1.1.
License: Geosoft Open License
- have_meta()[source]¶
Checks if a document has metadata.
- Return type:
bool
New in version 5.1.1.
License: Geosoft Open License
- is_null()[source]¶
Check if this is a null (undefined) instance
- Returns:
True if this is a null (undefined) instance, False otherwise.
- Return type:
bool
- is_reference()[source]¶
Is the document only a reference (a URL) ?
- Returns:
1 - Yes, 0 - No
- Return type:
int
New in version 5.1.6.
License: Geosoft Open License
- open(mode)[source]¶
Open a document in the document viewer
- Parameters:
mode (int) – DOCU_OPEN constants
New in version 5.1.1.
License: Geosoft Open License
Note: On Windows, the default application for the file extension is used to open the file.
- serial(bf)[source]¶
Serialize
GXDOCU
New in version 5.1.1.
License: Geosoft Open License
- set_file(type, name, file)[source]¶
Set the document from a file source.
- Parameters:
type (str) – Document type
name (str) – Document name, if “” file name will be used
file (str) – Document file, must exist
New in version 5.1.1.
License: Geosoft Open License
Note: Document types are normally identified by their extension. If you leave the document type blank, the extension of the document file will be used as the document type.
To resolve conflicting types, you can define your own unique type by entering your own type “extension” string.
The following types are pre-defined (as are any normal Geosoft file types):
“htm” HTML “html” HTML “txt” ASCII text file “doc” Word for Windows document “pdf” Adobe PDF “map” Geosoft map file “mmap” Mapinfo map file (real extension “map”) “grd” Geosoft grid file “gdb” Geosoft database
URL Document Links
The document name can be a URL link to the document using one of the supported protocols. The following protocols are supported:
http://www.mywebserver.com/MyFile.doc -
GXHTTP
dap://my.dap.server.com/dcs?DatasetName?MyFile.doc - DAP (DAP Document Access) ftp://my.ftp.server.com/Dir1/MyFile.doc - FTP protocolThe full file name will be stored but no data will be stored with the
GXDOCU
class and the document can be retrieved using the sGetFile_DOCU method.
- set_file_meta(type, name, file)[source]¶
Set the document from a file source with metadata.
- Parameters:
type (str) – Document type extension
name (str) – Document name, if NULL use file name
file (str) – Document file or URL
New in version 5.1.8.
License: Geosoft Open License
Note: See
set_file
. This function is the same as sSetFile_DOCU, plus insures that aGXMETA
exists that includes the “Data” class. If the file has associated metadata, either supported natively in the file, or through an associated file “filename.extension.GeosoftMeta”, that metadata will be loaded into theGXDOCU
meta, and a Data class will be constructed if one does not exist.Also, the Document type Extension is very important in that it specifies the document types that natively have metadata. The ones currently supported are:
“map” Geosoft map file “gdb” Geosoft database “grd” Geosoft grid file
- set_meta(meta)[source]¶
Set the document’s meta
New in version 5.1.1.
License: Geosoft Open License
DOCU_OPEN constants¶
How to open document