From 0fd0a98369b72d63e923b527c4dbcccefc2b0c83 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 18 Aug 2011 21:50:32 -0400 Subject: Added an interface to the basic GEM file selection dialog. --- lib/py_aes.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'lib/py_aes.c') 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; + } +} -- cgit v1.2.3