Browse Source

Used TkGlobal instead of Tkinter and Pmw

Mark Mine 22 years ago
parent
commit
ca6a48e55b

+ 3 - 4
direct/src/directtools/DirectSession.py

@@ -7,10 +7,8 @@ from DirectSelection import *
 from DirectGrid import *
 from DirectGrid import *
 from DirectGeometry import *
 from DirectGeometry import *
 from DirectLights import *
 from DirectLights import *
-from DirectSessionPanel import *
 from ClusterClient import *
 from ClusterClient import *
 from ClusterServer import *
 from ClusterServer import *
-from tkSimpleDialog import askstring
 import Placer
 import Placer
 import Slider
 import Slider
 import SceneGraphExplorer
 import SceneGraphExplorer
@@ -169,8 +167,8 @@ class DirectSession(PandaObject):
 
 
         if base.wantTk:
         if base.wantTk:
             import TkGlobal
             import TkGlobal
-            self.panel = DirectSessionPanel(parent = tkroot)
-
+            import DirectSessionPanel
+            self.panel = DirectSessionPanel.DirectSessionPanel(parent = tkroot)
         try:
         try:
             # Has the clusterMode been set externally (i.e. via the
             # Has the clusterMode been set externally (i.e. via the
             # bootstrap application?
             # bootstrap application?
@@ -646,6 +644,7 @@ class DirectSession(PandaObject):
 
 
     def getAndSetName(self, nodePath):
     def getAndSetName(self, nodePath):
         """ Prompt user for new node path name """
         """ Prompt user for new node path name """
+        from tkSimpleDialog import askstring
         newName = askstring('Node Path: ' + nodePath.getName(),
         newName = askstring('Node Path: ' + nodePath.getName(),
                             'Enter new name:')
                             'Enter new name:')
         if newName:
         if newName:

+ 1 - 2
direct/src/leveleditor/LevelEditor.py

@@ -2,14 +2,13 @@ from ShowBaseGlobal import *
 from PandaObject import *
 from PandaObject import *
 from PieMenu import *
 from PieMenu import *
 from DirectGuiGlobals import *
 from DirectGuiGlobals import *
-from Tkinter import *
+from TkGlobal import *
 from DirectUtil import *
 from DirectUtil import *
 from DirectGeometry import *
 from DirectGeometry import *
 from SceneGraphExplorer import *
 from SceneGraphExplorer import *
 from tkMessageBox import showinfo
 from tkMessageBox import showinfo
 from tkFileDialog import *
 from tkFileDialog import *
 from whrandom import *
 from whrandom import *
-import Pmw
 import Floater
 import Floater
 import VectorWidgets
 import VectorWidgets
 import string
 import string

+ 1 - 0
direct/src/showbase/ShowBase.py

@@ -1193,6 +1193,7 @@ class ShowBase(DirectObject.DirectObject):
         self.wantTk = fWantTk
         self.wantTk = fWantTk
         if self.wantTk:
         if self.wantTk:
             import TkGlobal
             import TkGlobal
+            TkGlobal.spawnTkLoop()
 
 
     def startDirect(self, fWantDirect = 1):
     def startDirect(self, fWantDirect = 1):
         self.wantDirect = fWantDirect
         self.wantDirect = fWantDirect

+ 4 - 4
direct/src/showbase/TkGlobal.py

@@ -1,7 +1,6 @@
-
 from Tkinter import *
 from Tkinter import *
-import sys
 import Pmw
 import Pmw
+import sys
 # This is required by the ihooks.py module used by Squeeze (used by
 # This is required by the ihooks.py module used by Squeeze (used by
 # pandaSqueezer.py) so that Pmw initializes properly
 # pandaSqueezer.py) so that Pmw initializes properly
 sys.modules['_Pmw'].__name__ = '_Pmw'
 sys.modules['_Pmw'].__name__ = '_Pmw'
@@ -21,7 +20,8 @@ def tkloop(self):
 # Get the taskMgr
 # Get the taskMgr
 from TaskManagerGlobal import *
 from TaskManagerGlobal import *
 
 
-# Spawn this task
-taskMgr.add(tkloop, "tkloop")
+def spawnTkLoop():
+    # Spawn this task
+    taskMgr.add(tkloop, "tkloop")
 
 
 
 

+ 1 - 2
direct/src/tkpanels/AnimPanel.py

@@ -4,9 +4,8 @@
 
 
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 from AppShell import *
 from AppShell import *
-from Tkinter import *
+from TkGlobal import *
 from tkSimpleDialog import askfloat
 from tkSimpleDialog import askfloat
-import Pmw
 import string
 import string
 import math
 import math
 import types
 import types

+ 1 - 2
direct/src/tkpanels/DirectSessionPanel.py

@@ -3,9 +3,8 @@
 # Import Tkinter, Pmw, and the dial code
 # Import Tkinter, Pmw, and the dial code
 from PandaObject import *
 from PandaObject import *
 from AppShell import *
 from AppShell import *
-from Tkinter import *
+from TkGlobal import *
 import string
 import string
-import Pmw
 import Dial
 import Dial
 import Floater
 import Floater
 import Slider
 import Slider

+ 1 - 2
direct/src/tkpanels/FSMInspector.py

@@ -1,9 +1,8 @@
 """ Finite State Machine Inspector module """
 """ Finite State Machine Inspector module """
 from PandaObject import *
 from PandaObject import *
 from AppShell import *
 from AppShell import *
-from Tkinter import *
+from TkGlobal import *
 from tkSimpleDialog import askstring
 from tkSimpleDialog import askstring
-import Pmw
 import math
 import math
 import operator
 import operator
 
 

+ 0 - 2
direct/src/tkpanels/Inspector.py

@@ -4,9 +4,7 @@
 ### so that I can just type: inspect(anObject) any time.
 ### so that I can just type: inspect(anObject) any time.
 
 
 import string
 import string
-from Tkinter import *
 from TkGlobal import *
 from TkGlobal import *
-import Pmw
 
 
 ### public API
 ### public API
 
 

+ 1 - 2
direct/src/tkpanels/MopathRecorder.py

@@ -2,7 +2,7 @@
 
 
 # Import Tkinter, Pmw, and the dial code from this directory tree.
 # Import Tkinter, Pmw, and the dial code from this directory tree.
 from PandaObject import *
 from PandaObject import *
-from Tkinter import *
+from TkGlobal import *
 from AppShell import *
 from AppShell import *
 from DirectGlobals import *
 from DirectGlobals import *
 from DirectUtil import *
 from DirectUtil import *
@@ -11,7 +11,6 @@ from DirectSelection import *
 from tkFileDialog import *
 from tkFileDialog import *
 import os
 import os
 import string
 import string
-import Pmw
 import Dial
 import Dial
 import Floater
 import Floater
 import Slider
 import Slider

+ 1 - 2
direct/src/tkpanels/ParticlePanel.py

@@ -2,11 +2,10 @@
 
 
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 # Import Tkinter, Pmw, and the floater code from this directory tree.
 from AppShell import *
 from AppShell import *
-from Tkinter import *
+from TkGlobal import *
 from tkFileDialog import *
 from tkFileDialog import *
 from tkSimpleDialog import askstring
 from tkSimpleDialog import askstring
 import os
 import os
-import Pmw
 import Dial
 import Dial
 import Floater
 import Floater
 import Slider
 import Slider

+ 1 - 2
direct/src/tkpanels/Placer.py

@@ -2,9 +2,8 @@
 
 
 # Import Tkinter, Pmw, and the dial code from this directory tree.
 # Import Tkinter, Pmw, and the dial code from this directory tree.
 from PandaObject import *
 from PandaObject import *
-from Tkinter import *
+from TkGlobal import *
 from AppShell import *
 from AppShell import *
-import Pmw
 import Dial
 import Dial
 import Floater
 import Floater
 
 

+ 1 - 2
direct/src/tkwidgets/Dial.py

@@ -2,9 +2,8 @@
 Dial Class: Velocity style controller for floating point values with
 Dial Class: Velocity style controller for floating point values with
              a label, entry (validated), and scale
              a label, entry (validated), and scale
 """
 """
-from Tkinter import *
+from TkGlobal import *
 from Valuator import *
 from Valuator import *
-import Pmw
 import Task
 import Task
 import math
 import math
 import string
 import string

+ 1 - 2
direct/src/tkwidgets/EntryScale.py

@@ -2,8 +2,7 @@
 EntryScale Class: Scale with a label, and a linked and validated entry
 EntryScale Class: Scale with a label, and a linked and validated entry
 """
 """
 from PandaObject import *
 from PandaObject import *
-from Tkinter import *
-import Pmw
+from TkGlobal import *
 import string
 import string
 import tkColorChooser
 import tkColorChooser
 from tkSimpleDialog import *
 from tkSimpleDialog import *

+ 1 - 2
direct/src/tkwidgets/Floater.py

@@ -3,9 +3,8 @@ Floater Class: Velocity style controller for floating point values with
                 a label, entry (validated), and scale
                 a label, entry (validated), and scale
 """
 """
 from PandaObject import *
 from PandaObject import *
-from Tkinter import *
+from TkGlobal import *
 from Valuator import *
 from Valuator import *
-import Pmw
 import Task
 import Task
 import math
 import math
 import string
 import string

+ 1 - 1
direct/src/tkwidgets/ProgressBar.py

@@ -1,7 +1,7 @@
 """
 """
 A  basic widget for showing the progress being made in a task.
 A  basic widget for showing the progress being made in a task.
 """
 """
-from Tkinter import *
+from TkGlobal import *
 
 
 class ProgressBar:
 class ProgressBar:
     def __init__(self, master=None, orientation="horizontal",
     def __init__(self, master=None, orientation="horizontal",

+ 1 - 2
direct/src/tkwidgets/SceneGraphExplorer.py

@@ -1,7 +1,6 @@
 from PandaObject import *
 from PandaObject import *
-from Tkinter import *
+from TkGlobal import *
 from Tree import *
 from Tree import *
-import Pmw
 
 
 # changing these strings requires changing DirectSession.py SGE_ strs too!
 # changing these strings requires changing DirectSession.py SGE_ strs too!
 DEFAULT_MENU_ITEMS = [
 DEFAULT_MENU_ITEMS = [

+ 1 - 2
direct/src/tkwidgets/Slider.py

@@ -2,9 +2,8 @@
 Slider Class: Velocity style controller for floating point values with
 Slider Class: Velocity style controller for floating point values with
                a label, entry (validated), and min/max slider
                a label, entry (validated), and min/max slider
 """
 """
-from Tkinter import *
+from TkGlobal import *
 from Valuator import *
 from Valuator import *
-import Pmw
 import Task
 import Task
 import math
 import math
 import string
 import string

+ 1 - 1
direct/src/tkwidgets/Tree.py

@@ -18,7 +18,7 @@
 import os
 import os
 import sys
 import sys
 import string
 import string
-from Tkinter import *
+from TkGlobal import *
 from PandaObject import *
 from PandaObject import *
 
 
 # Initialize icon directory
 # Initialize icon directory

+ 1 - 2
direct/src/tkwidgets/Valuator.py

@@ -1,6 +1,5 @@
 from PandaObject import *
 from PandaObject import *
-from Tkinter import *
-import Pmw
+from TkGlobal import *
 import tkColorChooser
 import tkColorChooser
 import WidgetPropertiesDialog
 import WidgetPropertiesDialog
 import string
 import string

+ 1 - 2
direct/src/tkwidgets/VectorWidgets.py

@@ -1,5 +1,4 @@
-from Tkinter import *
-import Pmw
+from TkGlobal import *
 import Valuator
 import Valuator
 import Floater
 import Floater
 import Slider
 import Slider

+ 1 - 2
direct/src/tkwidgets/WidgetPropertiesDialog.py

@@ -1,5 +1,4 @@
-from Tkinter import *
-import Pmw
+from TkGlobal import *
 import types
 import types
 import string
 import string