summaryrefslogtreecommitdiff
path: root/lib/py_aes.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2011-08-18 21:50:32 -0400
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2011-08-18 21:50:32 -0400
commit0fd0a98369b72d63e923b527c4dbcccefc2b0c83 (patch)
treea92c01cfc0eff8671fd542d9c9b90bbbe4a65b21 /lib/py_aes.c
parent024a2c85d087fa2b90e20923eeb351a637eca97e (diff)
downloadgempy-0fd0a98369b72d63e923b527c4dbcccefc2b0c83.tar.gz
gempy-0fd0a98369b72d63e923b527c4dbcccefc2b0c83.zip
Added an interface to the basic GEM file selection dialog.
Diffstat (limited to 'lib/py_aes.c')
-rw-r--r--lib/py_aes.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/lib/py_aes.c b/lib/py_aes.c
index 2372705..f7e8a3d 100644
--- a/lib/py_aes.c
+++ b/lib/py_aes.c
@@ -570,4 +570,50 @@ int ret;
Py_INCREF(Py_None);
return Py_None;
-} \ No newline at end of file
+}
+
+/* File Selector Library */
+PyObject* __CDECL py_fsel_input(PyObject *self, PyObject *args)
+{
+PyObject *ret;
+char *path;
+char *default_file;
+
+char *use_path;
+char *use_file;
+int result;
+int pathlen;
+
+ default_file = NULL;
+
+ if(!PyArg_ParseTuple(args,"s|s",&path,&default_file))
+ return NULL;
+
+ pathlen = strlen(path);
+ if(pathlen < 200) pathlen = 200;
+
+ use_path = (char *)malloc(pathlen*sizeof(char));
+ strcpy(use_path,path);
+
+ use_file = (char *)malloc(13*sizeof(char));
+ use_file[0] = '\0';
+ if(default_file != NULL) {
+ if(strlen(default_file) <= 12)
+ strcpy(use_file,default_file);
+ }
+
+ if(fsel_input(use_path,use_file,&result) == 0) {
+ PyErr_SetString(GEMError,"Basic File Selector call failed.");
+ return NULL;
+ }
+
+ if(result == 0) {
+ free(use_path);
+ free(use_file);
+ Py_INCREF(Py_None);
+ return Py_None;
+ } else {
+ ret = Py_BuildValue("ss",use_path,use_file);
+ return ret;
+ }
+}