Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(7)

Unified Diff: Lib/tkinter/test/support.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/threading.py ('k') | Lib/tkinter/test/test_ttk/test_widgets.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/tkinter/test/support.py Tue Jul 26 09:37:46 2011 +0300
+++ b/Lib/tkinter/test/support.py Mon Jul 25 09:47:18 2011 -0400
@@ -1,52 +1,6 @@
-import sys
import tkinter
-import unittest
-
-_tk_unavailable = None
-
-def check_tk_availability():
- """Check that Tk is installed and available."""
- global _tk_unavailable
-
- if _tk_unavailable is None:
- _tk_unavailable = False
- if sys.platform == 'darwin':
- # The Aqua Tk implementations on OS X can abort the process if
- # being called in an environment where a window server connection
- # cannot be made, for instance when invoked by a buildbot or ssh
- # process not running under the same user id as the current console
- # user. To avoid that, raise an exception if the window manager
- # connection is not available.
- from ctypes import cdll, c_int, pointer, Structure
- from ctypes.util import find_library
-
- app_services = cdll.LoadLibrary(find_library("ApplicationServices"))
-
- if app_services.CGMainDisplayID() == 0:
- _tk_unavailable = "cannot run without OS X window manager"
- else:
- class ProcessSerialNumber(Structure):
- _fields_ = [("highLongOfPSN", c_int),
- ("lowLongOfPSN", c_int)]
- psn = ProcessSerialNumber()
- psn_p = pointer(psn)
- if ( (app_services.GetCurrentProcess(psn_p) < 0) or
- (app_services.SetFrontProcess(psn_p) < 0) ):
- _tk_unavailable = "cannot run without OS X gui process"
- else: # not OS X
- import tkinter
- try:
- tkinter.Button()
- except tkinter.TclError as msg:
- # assuming tk is not available
- _tk_unavailable = "tk not available: %s" % msg
-
- if _tk_unavailable:
- raise unittest.SkipTest(_tk_unavailable)
- return
def get_tk_root():
- check_tk_availability() # raise exception if tk unavailable
try:
root = tkinter._default_root
except AttributeError:
« no previous file with comments | « Lib/threading.py ('k') | Lib/tkinter/test/test_ttk/test_widgets.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+