Skip to content

Commit 4a9e7c2

Browse files
committed
Version 1.0
1 parent 82fcd59 commit 4a9e7c2

File tree

6 files changed

+33
-15
lines changed

6 files changed

+33
-15
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
#%% Execution with Keyboard and Mouse
44

5-
# <Ctrl> + <Return> executes the smalles possible piece of code
5+
# <Shift> + <Return> executes the smalles possible piece of code
66
# that includes the line at the cursor or next to the cursor.
77

88
print "hello world"
99

10+
# With <Ctrl> + <Shift> + <Return> the cursor stays at its position
11+
# and the same line can be executed several times.
12+
1013
# The value of a single expression line will be printed
1114
1+2
1215

@@ -18,7 +21,7 @@
1821
s = str(i) * 8
1922
print "loop", s
2023

21-
# Multiple lines can be executed by selection and <Ctrl> + <Return>.
24+
# Multiple lines can be executed by selection and <Shift> + <Return>.
2225
# The selection doesn't have to cover the whole line.
2326
# With the middle mouse button (mouse wheel button) a single or
2427
# multi line command or a selection can be executed.
@@ -60,7 +63,7 @@ def test(x):
6063
print 'The result is:'
6164
print x / 0
6265
print "Now you"
63-
print 'removed the '
66+
print 'removed the'
6467
print 'runtime error'
6568

6669
test(5) # runtime error
@@ -151,6 +154,3 @@ def twice(x, factor=2):
151154
plt.plot(x, y, color=plt.cm.plasma(float(i)/n), alpha=0.9, lw=0.8)
152155
plt.show()
153156

154-
155-
156-

pyPadExecute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# PyPadPlusPlus: Execute command
33
#
4-
# Put a shortcut on this script to start the interactive programming
4+
# Put a shortcut on this script to start the interactive programming.
55
# Recommended is <Shift> + <Enter>
66

77
try: Npp.pypad != None

pyPadExecuteFix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# PyPadPlusPlus: Execute command while cursor stays at position
33
#
4-
# Put a shortcut on this script to start the interactive programming
4+
# Put a shortcut on this script to start the interactive programming.
55
# Recommended is <Ctrl> + <Shift> + <Enter>
66

77
try: Npp.pypad != None

pyPadPlusPlus/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__author__ = "Christian Schirm"
55
__copyright__ = "Copyright 2018"
66
__license__ = "GPLv3"
7-
__version__ = "0.8"
7+
__version__ = "1.0"
88

99
import Npp
1010
from Npp import editor, console, notepad
@@ -111,6 +111,7 @@ def clearCallbacks(self):
111111
editor.clearCallbacks([Npp.SCINTILLANOTIFICATION.DWELLSTART])
112112
editor.clearCallbacks([Npp.SCINTILLANOTIFICATION.MODIFIED])
113113
notepad.clearCallbacks([Npp.NOTIFICATION.BUFFERACTIVATED])
114+
notepad.clearCallbacks([Npp.NOTIFICATION.SHUTDOWN])
114115
if self.lexer:
115116
notepad.clearCallbacks([Npp.SCINTILLANOTIFICATION.UPDATEUI])
116117
notepad.clearCallbacks([Npp.NOTIFICATION.LANGCHANGED])
@@ -123,6 +124,8 @@ def setCallbacks(self):
123124
editor.callback(self.onMouseDwell, [Npp.SCINTILLANOTIFICATION.DWELLSTART])
124125
editor.callback(self.textModified, [Npp.SCINTILLANOTIFICATION.MODIFIED])
125126
notepad.callback(self.onBufferActivated, [Npp.NOTIFICATION.BUFFERACTIVATED])
127+
notepad.callback(self.onShutdown, [Npp.NOTIFICATION.SHUTDOWN])
128+
126129
if self.lexer:
127130
editor.callbackSync(self.lexer.on_updateui, [Npp.SCINTILLANOTIFICATION.UPDATEUI])
128131
notepad.callback(self.lexer.on_langchanged, [Npp.NOTIFICATION.LANGCHANGED])
@@ -133,6 +136,10 @@ def __del__(self):
133136
except: pass
134137
self.clearCallbacks()
135138

139+
def onShutdown(self, args):
140+
try: self.interp.proc.terminate()
141+
except: pass
142+
136143
def restartKernel(self):
137144
if self.externalPython:
138145
bufferID = self.bufferBusy

pyPadPlusPlus/pyPadHost.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ def pipeWrapper(self, *param):
1919

2020
class interpreter:
2121
def __init__(self, pythonPath='pythonw', outBuffer=None):
22+
if not pythonPath.endswith('.exe'):
23+
if pythonPath.strip().endswith('pythonw'):
24+
pythonPath = pythonPath.strip() + '.exe'
25+
else:
26+
pythonPath = os.path.join(pythonPath.strip(),'pythonw.exe')
27+
assert os.path.exists(pythonPath), 'file pythonw.exe not found.'
2228
self.outBuffer = outBuffer
2329
clientPath = os.path.join(os.path.dirname(__file__), 'pyPadClient.py')
2430
self.StartCommand = pythonPath + ' -u ' + '"' + clientPath + '"'

pyPadStart.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22
# PyPadPlusPlus: Startup script
33
#
44

5-
# Set the path to pythonw.exe, e.g. "C:\\programs\\Anaconda2\\pythonw.exe".
6-
# If pythonPath is None, the internal python of Notepad++ PythonScript
7-
# is used. Some features are only available for the external python kernel.
8-
# Python 3 is not supported, only Python 2.
5+
# Set the path to the folder that contains pythonw.exe, e.g.
6+
# "C:\\programs\\Anaconda2". If pythonPath is None, the internal Python
7+
# distribution of Notepad++ PythonScript is used. Some features are only
8+
# available for the external Python kernel. Python 3 is currently not
9+
# supported, only Python 2.
910

10-
pythonPath = "C:\\prog\\Anaconda2\\pythonw.exe"
11+
pythonPath = None
1112

1213
# To use multiple interactive matplotlib windows, pyPadPlusPlus
1314
# runs an internal matplotlib event handler during idle time.
14-
# In case this causes problems, set to False
15+
# If this cases any problems, set it to False.
16+
# The matplotlib event handler is activated when matplotlib
17+
# is imported. In case matplotlib is imported implicitly by
18+
# another module, you must add to a code line a comment that
19+
# contains the word "matplotlib".
1520

1621
matplotlib_EventHandler = True
1722

0 commit comments

Comments
 (0)