From 67aea54efb91aec95d42005e5519c43fc27dddaf 2007-05-29 21:31:36 From: jstenar Date: 2007-05-29 21:31:36 Subject: [PATCH] change platutils_win32.set_window_title to use ctypes as default. Fix bug when caling same when current directory is on a network share. --- diff --git a/IPython/platutils_win32.py b/IPython/platutils_win32.py index 4679326..337bcc3 100644 --- a/IPython/platutils_win32.py +++ b/IPython/platutils_win32.py @@ -23,16 +23,31 @@ __license__ = Release.license import os ignore_termtitle = 0 + +try: + from ctypes import windll + SetConsoleTitleA=windll.kernel32.SetConsoleTitleA + + def _set_term_title(title): + """ Set terminal title using the ctypes""" + SetConsoleTitleA(str(title)) + +except ImportError: + def _set_term_title(title): + """ Set terminal title using the 'title' command """ + curr=os.getcwd() + os.chdir("C:") #Cannot be on network share when issuing system commands + ret = os.system("title " + title) + os.chdir(curr) + if ret: + ignore_termtitle = 1 + def set_term_title(title): """ Set terminal title using the 'title' command """ - global ignore_termtitle - + if ignore_termtitle: - return - - ret = os.system("title " + title) - if ret: - ignore_termtitle = 1 - - + return + _set_term_title(title) + + diff --git a/doc/ChangeLog b/doc/ChangeLog index 6f6057a..27b6b41 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2007-05-29 J�rgen Stenarson + + * fixing set_term_title to use ctypes as default + + * fixing set_term_title fallback to work when curent dir + is on a windows network share + 2007-05-28 Ville Vainio * %cpaste: strip + with > from left (diffs).