equal
deleted
inserted
replaced
14 """ |
14 """ |
15 |
15 |
16 import win32api |
16 import win32api |
17 |
17 |
18 import errno, os, sys, pywintypes, win32con, win32file, win32process |
18 import errno, os, sys, pywintypes, win32con, win32file, win32process |
19 import winerror, win32gui |
19 import winerror, win32gui, win32console |
20 import osutil, encoding |
20 import osutil, encoding |
21 from win32com.shell import shell, shellcon |
21 from win32com.shell import shell, shellcon |
22 |
22 |
23 def os_link(src, dst): |
23 def os_link(src, dst): |
24 try: |
24 try: |
187 if pid == wpid: |
187 if pid == wpid: |
188 win32gui.ShowWindow(hwnd, win32con.SW_HIDE) |
188 win32gui.ShowWindow(hwnd, win32con.SW_HIDE) |
189 |
189 |
190 pid = win32process.GetCurrentProcessId() |
190 pid = win32process.GetCurrentProcessId() |
191 win32gui.EnumWindows(callback, pid) |
191 win32gui.EnumWindows(callback, pid) |
|
192 |
|
193 def termwidth_(): |
|
194 try: |
|
195 # Query stderr to avoid problems with redirections |
|
196 screenbuf = win32console.GetStdHandle(win32console.STD_ERROR_HANDLE) |
|
197 try: |
|
198 window = screenbuf.GetConsoleScreenBufferInfo()['Window'] |
|
199 width = window.Right - window.Left |
|
200 return width |
|
201 finally: |
|
202 screenbuf.Detach() |
|
203 except pywintypes.error: |
|
204 return 79 |