Show More
@@ -0,0 +1,33 b'' | |||
|
1 | import IPython.ipapi | |
|
2 | ip = IPython.ipapi.get() | |
|
3 | ||
|
4 | import win32api | |
|
5 | import win32ui | |
|
6 | import win32console | |
|
7 | import os | |
|
8 | ||
|
9 | path = r"C:\Program Files\emacs\bin" | |
|
10 | ||
|
11 | def synchronize_with_editor(ip, filename, lineno, columnno): | |
|
12 | if not os.path.isabs(filename): | |
|
13 | filename = os.path.join(os.getcwd(), filename) | |
|
14 | if not os.path.isfile(filename): | |
|
15 | print "couldn't find file:", file | |
|
16 | return | |
|
17 | ||
|
18 | h = win32console.GetConsoleWindow() | |
|
19 | w = win32ui.CreateWindowFromHandle(h) | |
|
20 | w.SetWindowText("%s %d" % (filename, lineno)) | |
|
21 | ||
|
22 | command = r'%s -n +%d:%d "%s" 2>nul' % (win32api.GetShortPathName(os.path.join(path, "emacsclient.exe")), lineno, columnno, filename) | |
|
23 | r = os.system(command) | |
|
24 | if r != 0: | |
|
25 | command = r'start %s --quick -f server-start +%d:%d "%s"' % (win32api.GetShortPathName(os.path.join(path, "runemacs.exe")), lineno, columnno, filename) | |
|
26 | os.system(command) | |
|
27 | win32api.Sleep(500) | |
|
28 | else: | |
|
29 | win32api.Sleep(100) | |
|
30 | ||
|
31 | w.SetForegroundWindow() | |
|
32 | ||
|
33 | ip.set_hook("synchronize_with_editor", synchronize_with_editor) |
@@ -0,0 +1,28 b'' | |||
|
1 | import IPython.ipapi | |
|
2 | ip = IPython.ipapi.get() | |
|
3 | ||
|
4 | import win32api | |
|
5 | import win32ui | |
|
6 | import win32console | |
|
7 | import os | |
|
8 | ||
|
9 | path = r"C:\Program Files\vim\vim71" | |
|
10 | ||
|
11 | def synchronize_with_editor(ip, filename, lineno, columnno): | |
|
12 | if not os.path.isabs(filename): | |
|
13 | filename = os.path.join(os.getcwd(), filename) | |
|
14 | if not os.path.isfile(filename): | |
|
15 | print "couldn't find file:", file | |
|
16 | return | |
|
17 | ||
|
18 | h = win32console.GetConsoleWindow() | |
|
19 | w = win32ui.CreateWindowFromHandle(h) | |
|
20 | w.SetWindowText("%s %d" % (filename, lineno)) | |
|
21 | ||
|
22 | command = r'start %s --remote-silent +%d "%s"' % (win32api.GetShortPathName(os.path.join(path, "gvim.exe")), lineno, filename) | |
|
23 | os.system(command) | |
|
24 | ||
|
25 | win32api.Sleep(500) | |
|
26 | w.SetForegroundWindow() | |
|
27 | ||
|
28 | ip.set_hook("synchronize_with_editor", synchronize_with_editor) |
@@ -0,0 +1,28 b'' | |||
|
1 | import IPython.ipapi | |
|
2 | ip = IPython.ipapi.get() | |
|
3 | ||
|
4 | import win32api | |
|
5 | import win32ui | |
|
6 | import win32console | |
|
7 | import os | |
|
8 | ||
|
9 | path = r"C:\Program Files\Notepad++" | |
|
10 | ||
|
11 | def synchronize_with_editor(ip, filename, lineno, columnno): | |
|
12 | if not os.path.isabs(filename): | |
|
13 | filename = os.path.join(os.getcwd(), filename) | |
|
14 | if not os.path.isfile(filename): | |
|
15 | print "couldn't find file:", file | |
|
16 | return | |
|
17 | ||
|
18 | h = win32console.GetConsoleWindow() | |
|
19 | w = win32ui.CreateWindowFromHandle(h) | |
|
20 | w.SetWindowText("%s %d" % (filename, lineno)) | |
|
21 | ||
|
22 | command = r'start %s "%s" -n%d' % (win32api.GetShortPathName(os.path.join(path, "notepad++.exe")), filename, lineno) | |
|
23 | os.system(command) | |
|
24 | ||
|
25 | win32api.Sleep(100) | |
|
26 | w.SetForegroundWindow() | |
|
27 | ||
|
28 | ip.set_hook("synchronize_with_editor", synchronize_with_editor) |
@@ -0,0 +1,28 b'' | |||
|
1 | import IPython.ipapi | |
|
2 | ip = IPython.ipapi.get() | |
|
3 | ||
|
4 | import win32api | |
|
5 | import win32ui | |
|
6 | import win32console | |
|
7 | import os | |
|
8 | ||
|
9 | path = r"C:\Program Files\PSPad editor" | |
|
10 | ||
|
11 | def synchronize_with_editor(ip, filename, lineno, columnno): | |
|
12 | if not os.path.isabs(filename): | |
|
13 | filename = os.path.join(os.getcwd(), filename) | |
|
14 | if not os.path.isfile(filename): | |
|
15 | print "couldn't find file:", file | |
|
16 | return | |
|
17 | ||
|
18 | h = win32console.GetConsoleWindow() | |
|
19 | w = win32ui.CreateWindowFromHandle(h) | |
|
20 | w.SetWindowText("%s %d" % (filename, lineno)) | |
|
21 | ||
|
22 | command = r'start %s "%s" -%d ' % (win32api.GetShortPathName(os.path.join(path, "pspad.exe")), filename, lineno) | |
|
23 | os.system(command) | |
|
24 | ||
|
25 | win32api.Sleep(100) | |
|
26 | w.SetForegroundWindow() | |
|
27 | ||
|
28 | ip.set_hook("synchronize_with_editor", synchronize_with_editor) |
@@ -0,0 +1,36 b'' | |||
|
1 | import IPython.ipapi | |
|
2 | ip = IPython.ipapi.get() | |
|
3 | ||
|
4 | import win32api | |
|
5 | import win32ui | |
|
6 | import win32console | |
|
7 | import os | |
|
8 | ||
|
9 | import scitedirector | |
|
10 | ||
|
11 | path = r"C:\Program Files\SciTE Source Code Editor" | |
|
12 | ||
|
13 | def synchronize_with_editor(ip, filename, lineno, columnno): | |
|
14 | if not os.path.isabs(filename): | |
|
15 | filename = os.path.join(os.getcwd(), filename) | |
|
16 | if not os.path.isfile(filename): | |
|
17 | print "couldn't find file:", file | |
|
18 | return | |
|
19 | ||
|
20 | scites = scitedirector.findWindows() | |
|
21 | if not scites: | |
|
22 | h = win32console.GetConsoleWindow() | |
|
23 | w = win32ui.CreateWindowFromHandle(h) | |
|
24 | w.SetWindowText("%s %d" % (filename, lineno)) | |
|
25 | ||
|
26 | command = r'start %s "-open:%s" -goto:%d' % (win32api.GetShortPathName(os.path.join(path, "scite.exe")), filename.replace("\\", "/"), lineno) | |
|
27 | os.system(command) | |
|
28 | ||
|
29 | win32api.Sleep(100) | |
|
30 | w.SetForegroundWindow() | |
|
31 | else: | |
|
32 | scite = scites[0] | |
|
33 | scitedirector.sendCommand(scite, 'open:%s' % filename.replace("\\", "/")) | |
|
34 | scitedirector.sendCommand(scite, "goto:%d" % lineno) | |
|
35 | ||
|
36 | ip.set_hook("synchronize_with_editor", synchronize_with_editor) |
@@ -0,0 +1,38 b'' | |||
|
1 | import IPython.ipapi | |
|
2 | ip = IPython.ipapi.get() | |
|
3 | ||
|
4 | import win32api | |
|
5 | import win32ui | |
|
6 | import win32console | |
|
7 | import dde | |
|
8 | import os | |
|
9 | ||
|
10 | path = r"C:\Program Files\IDM Computer Solutions\UltraEdit-32" | |
|
11 | ||
|
12 | def synchronize_with_editor(ip, filename, lineno, columnno): | |
|
13 | if not os.path.isabs(filename): | |
|
14 | filename = os.path.join(os.getcwd(), filename) | |
|
15 | if not os.path.isfile(filename): | |
|
16 | print "couldn't find file:", file | |
|
17 | return | |
|
18 | ||
|
19 | h = win32console.GetConsoleWindow() | |
|
20 | w = win32ui.CreateWindowFromHandle(h) | |
|
21 | w.SetWindowText("%s %d" % (filename, lineno)) | |
|
22 | ||
|
23 | server = dde.CreateServer() | |
|
24 | server.Create("myddeserver") | |
|
25 | conversation = dde.CreateConversation(server) | |
|
26 | try: | |
|
27 | conversation.ConnectTo("uedit32", "System") | |
|
28 | conversation.Exec(r'[open("%s/%d"])' % (filename, lineno)) | |
|
29 | win32api.Sleep(10) | |
|
30 | except: | |
|
31 | command = r'start %s "%s/%d"' % (win32api.GetShortPathName(os.path.join(path, "uedit32.exe")), filename, lineno) | |
|
32 | os.system(command) | |
|
33 | win32api.Sleep(2000) | |
|
34 | ||
|
35 | w.SetForegroundWindow() | |
|
36 | server.Shutdown() | |
|
37 | ||
|
38 | ip.set_hook("synchronize_with_editor", synchronize_with_editor) |
General Comments 0
You need to be logged in to leave comments.
Login now