[Python-checkins] CVS: python/dist/src/Modules _tkinter.c,1.120,1.121 tkappinit.c,1.9,1.10
Jack Jansen
jackjansen@users.sourceforge.net
2001年12月09日 15:15:58 -0800
- Previous message: [Python-checkins] CVS: python/dist/src/Mac/Wastemods WEObjectHandlers.h,1.1,1.2 WETabHooks.h,1.1,1.2 WETabs.c,1.1,1.2 WETabs.h,1.1,1.2
- Next message: [Python-checkins] CVS: python/dist/src/Mac/OSX README,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv22685
Modified Files:
_tkinter.c tkappinit.c
Log Message:
Mods by Tony Lownds (patch 490100, slightly massaged by me) to make Tkinter
work with Mac OS X Aqua-Tk, all nicely within ifdefs.
The process is not for the faint of heart, though: you need to download
and install the (alfa) Aqua-Tk, obtain a few needed X11 headers from
somewhere else and then everything builds. To run scripts using Tkinter
you must build with --enable-framework, build Python.app in Mac/OSX
and run your Tkinter scripts with that. Then, about half the tests in
Demo/tkinter work (or at least do something).
Checking this in anyway because it shouldn't break anything, and newer
versions of Aqua-Tk will streamline the process.
Index: _tkinter.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -d -r1.120 -r1.121
*** _tkinter.c 2001年11月28日 20:27:42 1.120
--- _tkinter.c 2001年12月09日 23:15:56 1.121
***************
*** 42,47 ****
--- 42,52 ----
#endif
+ #ifdef TK_FRAMEWORK
+ #include <Tcl/tcl.h>
+ #include <Tk/tk.h>
+ #else
#include <tcl.h>
#include <tk.h>
+ #endif
#define TKMAJORMINOR (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION)
***************
*** 455,458 ****
--- 460,464 ----
TkMacInitMenus(v->interp);
#endif
+
/* Delete the 'exit' command, which can screw things up */
Tcl_DeleteCommand(v->interp, "exit");
***************
*** 1581,1585 ****
PyOS_snprintf(buf, sizeof(buf), "<tktimertoken at %p%s>", v,
! v->func == NULL ? ", handler deleted" : "");
return PyString_FromString(buf);
}
--- 1587,1591 ----
PyOS_snprintf(buf, sizeof(buf), "<tktimertoken at %p%s>", v,
! v->func == NULL ? ", handler deleted" : "");
return PyString_FromString(buf);
}
***************
*** 2137,2140 ****
--- 2143,2162 ----
Tktt_Type.ob_type = &PyType_Type;
PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
+
+
+ #ifdef TK_AQUA
+ /* Tk_MacOSXSetupTkNotifier must be called before Tcl's subsystems
+ * start waking up. Note that Tcl_FindExecutable will do this, this
+ * code must be above it! The original warning from
+ * tkMacOSXAppInit.c is copied below.
+ *
+ * NB - You have to swap in the Tk Notifier BEFORE you start up the
+ * Tcl interpreter for now. It probably should work to do this
+ * in the other order, but for now it doesn't seem to.
+ *
+ */
+ Tk_MacOSXSetupTkNotifier();
+ #endif
+
/* This helps the dynamic loader; in Unicode aware Tcl versions
Index: tkappinit.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/tkappinit.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** tkappinit.c 2000年08月04日 15:53:06 1.9
--- tkappinit.c 2001年12月09日 23:15:56 1.10
***************
*** 21,26 ****
--- 21,72 ----
Tk_Window main_window;
+ #ifdef TK_AQUA
+ #ifndef MAX_PATH_LEN
+ #define MAX_PATH_LEN 1024
+ #endif
+ char tclLibPath[MAX_PATH_LEN], tkLibPath[MAX_PATH_LEN];
+ Tcl_Obj* pathPtr;
+
+ /* pre- Tcl_Init code copied from tkMacOSXAppInit.c */
+ Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tcllibrary",
+ tclLibPath, MAX_PATH_LEN, 0);
+
+ if (tclLibPath[0] != '0円') {
+ Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY);
+ }
+
+ if (tclLibPath[0] != '0円') {
+ Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY);
+ Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY);
+ }
+ #endif
if (Tcl_Init (interp) == TCL_ERROR)
return TCL_ERROR;
+
+ #ifdef TK_AQUA
+ /* pre- Tk_Init code copied from tkMacOSXAppInit.c */
+ Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tklibrary",
+ tkLibPath, MAX_PATH_LEN, 1);
+
+ if (tclLibPath[0] != '0円') {
+ pathPtr = Tcl_NewStringObj(tclLibPath, -1);
+ } else {
+ Tcl_Obj *pathPtr = TclGetLibraryPath();
+ }
+
+ if (tkLibPath[0] != '0円') {
+ Tcl_Obj *objPtr;
+
+ Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY);
+ objPtr = Tcl_NewStringObj(tkLibPath, -1);
+ Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
+ }
+
+ TclSetLibraryPath(pathPtr);
+ #endif
+
if (Tk_Init (interp) == TCL_ERROR)
return TCL_ERROR;
***************
*** 28,31 ****
--- 74,82 ----
main_window = Tk_MainWindow(interp);
+ #ifdef TK_AQUA
+ TkMacOSXInitAppleEvents(interp);
+ TkMacOSXInitMenus(interp);
+ #endif
+
#ifdef WITH_MOREBUTTONS
{
- Previous message: [Python-checkins] CVS: python/dist/src/Mac/Wastemods WEObjectHandlers.h,1.1,1.2 WETabHooks.h,1.1,1.2 WETabs.c,1.1,1.2 WETabs.h,1.1,1.2
- Next message: [Python-checkins] CVS: python/dist/src/Mac/OSX README,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]