Commit b6cf9df279fc6c957419b4a5e7ba690a7292b41d
1 parent
c501d7d9
Exists in
master
and in
5 other branches
Todos os principais métodos aparentam estar ok.
Showing
5 changed files
with
28 additions
and
2 deletions
Show diff stats
src/include/pw3270/class.h
| ... | ... | @@ -184,7 +184,7 @@ |
| 184 | 184 | string ebc2asc(string &str); |
| 185 | 185 | |
| 186 | 186 | // Get/Set/Text with charset translation |
| 187 | - string get_string(int baddr, size_t len); | |
| 187 | + string get_string(int baddr = 0, size_t len = -1); | |
| 188 | 188 | string get_string_at(int row, int col, size_t sz); |
| 189 | 189 | int set_string_at(int row, int col, const char *str); |
| 190 | 190 | int cmp_string_at(int row, int col, const char *text); | ... | ... |
src/python/get.cc
| ... | ... | @@ -132,3 +132,23 @@ PyObject * terminal_get_string_at(PyObject *self, PyObject *args) { |
| 132 | 132 | return PyString_FromString(rc.c_str()); |
| 133 | 133 | |
| 134 | 134 | } |
| 135 | + | |
| 136 | +PyObject * terminal_get_contents(PyObject *self) { | |
| 137 | + | |
| 138 | + string rc; | |
| 139 | + | |
| 140 | + try { | |
| 141 | + | |
| 142 | + rc = ((pw3270_TerminalObject *) self)->session->get_string(); | |
| 143 | + | |
| 144 | + } catch(std::exception &e) { | |
| 145 | + | |
| 146 | + PyErr_SetString(terminalError, e.what()); | |
| 147 | + return NULL; | |
| 148 | + } | |
| 149 | + | |
| 150 | + return PyString_FromString(rc.c_str()); | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | +} | ... | ... |
src/python/private.h
| ... | ... | @@ -64,6 +64,7 @@ |
| 64 | 64 | PyObject * terminal_disconnect(PyObject *self, PyObject *args); |
| 65 | 65 | |
| 66 | 66 | PyObject * terminal_get_string_at(PyObject *self, PyObject *args); |
| 67 | + PyObject * terminal_get_contents(PyObject *self); | |
| 67 | 68 | PyObject * terminal_set_string_at(PyObject *self, PyObject *args); |
| 68 | 69 | PyObject * terminal_cmp_string_at(PyObject *self, PyObject *args); |
| 69 | 70 | ... | ... |
src/python/py3270.cc
src/python/sample.py
| ... | ... | @@ -18,6 +18,11 @@ print term.IsReady() |
| 18 | 18 | |
| 19 | 19 | print term.GetStringAt(14,19,38) |
| 20 | 20 | |
| 21 | +print "-----------------------------------------------------------------------" | |
| 22 | +print term | |
| 23 | +print "-----------------------------------------------------------------------" | |
| 24 | + | |
| 25 | + | |
| 21 | 26 | |
| 22 | 27 | |
| 23 | 28 | ... | ... |