Show More
@@ -23,16 +23,31 b' __license__ = Release.license' | |||
|
23 | 23 | import os |
|
24 | 24 | |
|
25 | 25 | ignore_termtitle = 0 |
|
26 | def set_term_title(title): | |
|
27 | """ Set terminal title using the 'title' command """ | |
|
28 | 26 | |
|
29 | global ignore_termtitle | |
|
27 | try: | |
|
28 | from ctypes import windll | |
|
29 | SetConsoleTitleA=windll.kernel32.SetConsoleTitleA | |
|
30 | 30 | |
|
31 |
|
|
|
32 | return | |
|
31 | def _set_term_title(title): | |
|
32 | """ Set terminal title using the ctypes""" | |
|
33 | SetConsoleTitleA(str(title)) | |
|
33 | 34 | |
|
35 | except ImportError: | |
|
36 | def _set_term_title(title): | |
|
37 | """ Set terminal title using the 'title' command """ | |
|
38 | curr=os.getcwd() | |
|
39 | os.chdir("C:") #Cannot be on network share when issuing system commands | |
|
34 | 40 | ret = os.system("title " + title) |
|
41 | os.chdir(curr) | |
|
35 | 42 | if ret: |
|
36 | 43 | ignore_termtitle = 1 |
|
37 | 44 | |
|
45 | def set_term_title(title): | |
|
46 | """ Set terminal title using the 'title' command """ | |
|
47 | global ignore_termtitle | |
|
48 | ||
|
49 | if ignore_termtitle: | |
|
50 | return | |
|
51 | _set_term_title(title) | |
|
52 | ||
|
38 | 53 |
@@ -1,3 +1,10 b'' | |||
|
1 | 2007-05-29 J�rgen Stenarson <jorgen.stenarson@bostream.nu> | |
|
2 | ||
|
3 | * fixing set_term_title to use ctypes as default | |
|
4 | ||
|
5 | * fixing set_term_title fallback to work when curent dir | |
|
6 | is on a windows network share | |
|
7 | ||
|
1 | 8 | 2007-05-28 Ville Vainio <vivainio@gmail.com> |
|
2 | 9 | |
|
3 | 10 | * %cpaste: strip + with > from left (diffs). |
General Comments 0
You need to be logged in to leave comments.
Login now