~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Gui/PythonConsolePy.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
ImportĀ upstreamĀ versionĀ 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (c) 2004 Werner Mayer <werner.wm.mayer@gmx.de>              *
 
3
 *                                                                         *
 
4
 *   This file is part of the FreeCAD CAx development system.              *
 
5
 *                                                                         *
 
6
 *   This library is free software; you can redistribute it and/or         *
 
7
 *   modify it under the terms of the GNU Library General Public           *
 
8
 *   License as published by the Free Software Foundation; either          *
 
9
 *   version 2 of the License, or (at your option) any later version.      *
 
10
 *                                                                         *
 
11
 *   This library  is distributed in the hope that it will be useful,      *
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
14
 *   GNU Library General Public License for more details.                  *
 
15
 *                                                                         *
 
16
 *   You should have received a copy of the GNU Library General Public     *
 
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
 
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
 
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
 
20
 *                                                                         *
 
21
 ***************************************************************************/
 
22
 
 
23
 
 
24
#ifndef GUI_PYTHONCONSOLE_PY_H
 
25
#define GUI_PYTHONCONSOLE_PY_H
 
26
 
 
27
#include <CXX/Extensions.hxx>
 
28
 
 
29
namespace Gui {
 
30
class PythonConsole;
 
31
 
 
32
/**
 
33
 * Python class for redirection of stdout to FreeCAD's Python
 
34
 * console window. This allows to show all Python messages in  
 
35
 * the same window where the commands are performed.
 
36
 * @see PythonStderr
 
37
 * @see PythonConsole
 
38
 * @author Werner Mayer
 
39
 */
 
40
class PythonStdout : public Py::PythonExtension<PythonStdout> 
 
41
{
 
42
private:
 
43
    PythonConsole* pyConsole;
 
44
 
 
45
public:
 
46
    static void init_type(void);    // announce properties and methods
 
47
 
 
48
    PythonStdout(PythonConsole *pc);
 
49
    ~PythonStdout();
 
50
 
 
51
    Py::Object repr();
 
52
    Py::Object write(const Py::Tuple&);
 
53
    Py::Object flush(const Py::Tuple&);
 
54
};
 
55
 
 
56
/**
 
57
 * Python class for redirection of stderr to FreeCAD's Python
 
58
 * console window. This allows to show all Python messages in 
 
59
 * the same window where the commands are performed.
 
60
 * @see PythonStdout
 
61
 * @see PythonConsole
 
62
 * @author Werner Mayer
 
63
 */
 
64
class PythonStderr : public Py::PythonExtension<PythonStderr> 
 
65
{
 
66
private:
 
67
    PythonConsole* pyConsole;
 
68
 
 
69
public:
 
70
    static void init_type(void);    // announce properties and methods
 
71
 
 
72
    PythonStderr(PythonConsole *pc);
 
73
    ~PythonStderr();
 
74
 
 
75
    Py::Object repr();
 
76
    Py::Object write(const Py::Tuple&);
 
77
    Py::Object flush(const Py::Tuple&);
 
78
};
 
79
 
 
80
/**
 
81
 * Python class for redirection of stdin to an input dialog of Qt.
 
82
 * @author Werner Mayer
 
83
 */
 
84
class PythonStdin : public Py::PythonExtension<PythonStdin> 
 
85
{
 
86
private:
 
87
    PythonConsole* pyConsole;
 
88
 
 
89
public:
 
90
    static void init_type(void);    // announce properties and methods
 
91
 
 
92
    PythonStdin(PythonConsole *pc);
 
93
    ~PythonStdin();
 
94
 
 
95
    Py::Object repr();
 
96
    Py::Object readline(const Py::Tuple&);
 
97
};
 
98
 
 
99
} // namespace Gui
 
100
 
 
101
#endif // GUI_PYTHONCONSOLE_PY_H