Skip to content

Commit 77745d4

Browse files
committed
Default to console for stdout in console.run
- Fix sphinx conf.py to grab version number from PythonScriptVersion.h - docs update for console - Update versions and links for website
1 parent 7d6a492 commit 77745d4

File tree

6 files changed

+31
-13
lines changed

6 files changed

+31
-13
lines changed

PythonScript/src/PythonConsole.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ class PythonConsole : public NppPythonScript::PyProducerConsumer<const char *>,
5050
{
5151
boost::python::object sys_module( (boost::python::handle<>(PyImport_ImportModule("sys"))) );
5252
boost::python::object sys_namespace = sys_module.attr("__dict__");
53-
return runCommand(text, sys_namespace["stdout"], sys_namespace["stderr"]);
53+
boost::python::object npp_module( (boost::python::handle<>(PyImport_ImportModule("Npp"))) );
54+
boost::python::object npp_namespace = npp_module.attr("__dict__");
55+
return runCommand(text, npp_namespace["console"], sys_namespace["stderr"]);
5456
}
5557

5658

docs/source/conf.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
14+
import sys, os, re
1515

1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the
@@ -48,9 +48,20 @@
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = '0.6.2.1'
51+
pyscr_base = r"E:\work\PythonScript"
52+
version_file = open(pyscr_base + r"\PythonScript\src\PythonScriptVersion.h")
53+
version_contents = version_file.read()
54+
version_file.close()
55+
match = re.search(r'#define PYSCR_VERSION_STRING "([0-9.]+)"', version_contents)
56+
if match:
57+
version = match.group(1)
58+
release = match.group(1)
59+
else:
60+
raise RuntimeError("Unknown version")
61+
62+
#version = '0.6.2.1'
5263
# The full version, including alpha/beta/rc tags.
53-
release = '0.6.2.1'
64+
#release = '0.6.2.1'
5465

5566
# The language for content autogenerated by Sphinx. Refer to documentation
5667
# for a list of supported languages.

docs/source/console.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Console Object
3030

3131
Runs an external program, with output optionally directed to the given objects (which must support a `write` method).
3232

33-
Not supplying stdout or stderr means that the default values from sys.stdout and sys.stderr (normally the console) are used.
33+
Not supplying stdout means that the console is used for stdout.
34+
35+
Not supplying stderr means that the default values from sys.stderr (normally the console, in red) is used.
3436

3537
e.g.::
3638

docs/source/intro.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ You can unregister the callback later, either by using the name of the function,
7979
A simple example
8080
----------------
8181

82-
Let's register a callback for the FILESAVING event - the occurs just before the file is saved, and we'll add a "saved on" log entry to the end of the file, if the filename ends in '.log'.::
82+
Let's register a callback for the FILESAVING event - the occurs just before the file is saved,
83+
and we'll add a "saved on" log entry to the end of the file, if the filename ends in '.log'.::
8384

8485
import datetime
8586
@@ -103,7 +104,8 @@ Really, we should improve this function a little. Currently, it assumes the file
103104

104105
The ``args`` parameter to the function is a map (similar a dictionary in C# or a hashmap in Java), that contains the arguments for the event - many events are signalled for a ``BufferID``, which is the Notepad++ internal number for a particular file or tab. We can do things with the bufferID like get the filename, switch to it to make it active and so on.
105106

106-
So, first we'll change it so that we check the filename of the bufferID being saved, rather than the active document. Then, if the filename has a '.log' extension, we'll change to it and add our "File saved on ....." line.
107+
So, first we'll change it so that we check the filename of the bufferID being saved, rather than the active document.
108+
Then, if the filename has a '.log' extension, we'll change to it and add our "File saved on ....." line.::
107109

108110
import datetime
109111
@@ -116,7 +118,8 @@ So, first we'll change it so that we check the filename of the bufferID being sa
116118

117119

118120

119-
Great, now it works properly. There's a side effect though, if we do use save-all, we might change the active document, which might seem a bit strange when we use it. Again, very easy to fix.
121+
Great, now it works properly. There's a side effect though, if we do use save-all, we might change the active document,
122+
which might seem a bit strange when we use it. Again, very easy to fix.::
120123

121124

122125
import datetime

www/download.shtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ There are two download locations - one's at <a href="http://sourceforge.net/proj
1919
<br/>
2020
<br/>
2121
Here are the local server links if you can't get to sourceforge.
22-
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_full_0.6.2.1.7z">Python Script 0.6.2.1 FULL 7zip version (2.8MB)</a>
23-
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_full_0.6.2.1.zip">Python Script 0.6.2.1 FULL zip version (4MB)</a>
24-
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_min_0.6.2.1.7z">Python Script 0.6.2.1 MINIMUM 7zip version (1.8MB)</a>
25-
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_full_0.6.2.1.7z">Python Script 0.6.2.1 MINIMUM zip version (2.8MB)</a>
22+
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_full_0.6.3.0.7z">Python Script 0.6.3.0 FULL 7zip version (2.8MB)</a>
23+
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_full_0.6.3.0.zip">Python Script 0.6.3.0 FULL zip version (4MB)</a>
24+
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_min_0.6.3.0.7z">Python Script 0.6.3.0 MINIMUM 7zip version (1.8MB)</a>
25+
<br/><a href="http://www.brotherstone.co.uk/npp/ps/downloads/PythonScript_full_0.6.3.0.7z">Python Script 0.6.3.0 MINIMUM zip version (2.8MB)</a>
2626
<!--<h3><a href="http://sourceforge.net/projects/npppythonscript/files">Ok...I get it already... take me to the downloads</a></h3> -->
2727

2828

www/header.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<br/>
2828
<br/>
2929
<br/>
30-
Latest Version: 0.6.2.1
30+
Latest Version: 0.6.3.0
3131
<br/>
3232
<br/>
3333
License: <a href="http://www.gnu.org/licenses/gpl-2.0.html">GPL2</a>

0 commit comments

Comments
 (0)