Show More
@@ -23,16 +23,31 b' __license__ = Release.license' | |||||
23 | import os |
|
23 | import os | |
24 |
|
24 | |||
25 | ignore_termtitle = 0 |
|
25 | ignore_termtitle = 0 | |
|
26 | ||||
|
27 | try: | |||
|
28 | from ctypes import windll | |||
|
29 | SetConsoleTitleA=windll.kernel32.SetConsoleTitleA | |||
|
30 | ||||
|
31 | def _set_term_title(title): | |||
|
32 | """ Set terminal title using the ctypes""" | |||
|
33 | SetConsoleTitleA(str(title)) | |||
|
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 | |||
|
40 | ret = os.system("title " + title) | |||
|
41 | os.chdir(curr) | |||
|
42 | if ret: | |||
|
43 | ignore_termtitle = 1 | |||
|
44 | ||||
26 | def set_term_title(title): |
|
45 | def set_term_title(title): | |
27 | """ Set terminal title using the 'title' command """ |
|
46 | """ Set terminal title using the 'title' command """ | |
28 |
|
||||
29 | global ignore_termtitle |
|
47 | global ignore_termtitle | |
30 |
|
48 | |||
31 | if ignore_termtitle: |
|
49 | if ignore_termtitle: | |
32 | return |
|
50 | return | |
33 |
|
51 | _set_term_title(title) | ||
34 | ret = os.system("title " + title) |
|
52 | ||
35 | if ret: |
|
53 | ||
36 | ignore_termtitle = 1 |
|
|||
37 |
|
||||
38 |
|
@@ -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 | 2007-05-28 Ville Vainio <vivainio@gmail.com> |
|
8 | 2007-05-28 Ville Vainio <vivainio@gmail.com> | |
2 |
|
9 | |||
3 | * %cpaste: strip + with > from left (diffs). |
|
10 | * %cpaste: strip + with > from left (diffs). |
General Comments 0
You need to be logged in to leave comments.
Login now