mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Remove dependency on tkpanels and tkwidgets modules when building .p3d package
This commit is contained in:
parent
d3885b665e
commit
2d6c2c5c6d
@ -1534,8 +1534,10 @@ class Actor(DirectObject, NodePath):
|
|||||||
|
|
||||||
# actions
|
# actions
|
||||||
def animPanel(self):
|
def animPanel(self):
|
||||||
from direct.showbase import TkGlobal
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
from direct.tkpanels import AnimPanel
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
AnimPanel = importlib.import_module('direct.tkpanels.AnimPanel')
|
||||||
return AnimPanel.AnimPanel(self)
|
return AnimPanel.AnimPanel(self)
|
||||||
|
|
||||||
def stop(self, animName=None, partName=None):
|
def stop(self, animName=None, partName=None):
|
||||||
|
@ -113,7 +113,10 @@ class DirectNotify:
|
|||||||
category.setDebug(1)
|
category.setDebug(1)
|
||||||
|
|
||||||
def popupControls(self, tl = None):
|
def popupControls(self, tl = None):
|
||||||
from direct.tkpanels import NotifyPanel
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
NotifyPanel = importlib.import_module('direct.tkpanels.NotifyPanel')
|
||||||
NotifyPanel.NotifyPanel(self, tl)
|
NotifyPanel.NotifyPanel(self, tl)
|
||||||
|
|
||||||
def giveNotify(self,cls):
|
def giveNotify(self,cls):
|
||||||
|
@ -58,13 +58,17 @@ def popupControls(self, tl = None):
|
|||||||
"""
|
"""
|
||||||
Popup control panel for interval.
|
Popup control panel for interval.
|
||||||
"""
|
"""
|
||||||
from direct.showbase.TkGlobal import Toplevel, Frame, Button, LEFT, X, Pmw
|
|
||||||
import math
|
import math
|
||||||
from direct.tkwidgets import EntryScale
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
EntryScale = importlib.import_module('direct.tkwidgets.EntryScale')
|
||||||
|
Tkinter = importlib.import_module('Tkinter')
|
||||||
|
|
||||||
if tl == None:
|
if tl == None:
|
||||||
tl = Toplevel()
|
tl = Tkinter.Toplevel()
|
||||||
tl.title('Interval Controls')
|
tl.title('Interval Controls')
|
||||||
outerFrame = Frame(tl)
|
outerFrame = Tkinter.Frame(tl)
|
||||||
def entryScaleCommand(t, s=self):
|
def entryScaleCommand(t, s=self):
|
||||||
s.setT(t)
|
s.setT(t)
|
||||||
s.pause()
|
s.pause()
|
||||||
@ -73,8 +77,8 @@ def popupControls(self, tl = None):
|
|||||||
min = 0, max = math.floor(self.getDuration() * 100) / 100,
|
min = 0, max = math.floor(self.getDuration() * 100) / 100,
|
||||||
command = entryScaleCommand)
|
command = entryScaleCommand)
|
||||||
es.set(self.getT(), fCommand = 0)
|
es.set(self.getT(), fCommand = 0)
|
||||||
es.pack(expand = 1, fill = X)
|
es.pack(expand = 1, fill = Tkinter.X)
|
||||||
bf = Frame(outerFrame)
|
bf = Tkinter.Frame(outerFrame)
|
||||||
# Jump to start and end
|
# Jump to start and end
|
||||||
def toStart(s=self, es=es):
|
def toStart(s=self, es=es):
|
||||||
s.setT(0.0)
|
s.setT(0.0)
|
||||||
@ -82,23 +86,23 @@ def popupControls(self, tl = None):
|
|||||||
def toEnd(s=self):
|
def toEnd(s=self):
|
||||||
s.setT(s.getDuration())
|
s.setT(s.getDuration())
|
||||||
s.pause()
|
s.pause()
|
||||||
jumpToStart = Button(bf, text = '<<', command = toStart)
|
jumpToStart = Tkinter.Button(bf, text = '<<', command = toStart)
|
||||||
# Stop/play buttons
|
# Stop/play buttons
|
||||||
def doPlay(s=self, es=es):
|
def doPlay(s=self, es=es):
|
||||||
s.resume(es.get())
|
s.resume(es.get())
|
||||||
|
|
||||||
stop = Button(bf, text = 'Stop',
|
stop = Tkinter.Button(bf, text = 'Stop',
|
||||||
command = lambda s=self: s.pause())
|
command = lambda s=self: s.pause())
|
||||||
play = Button(
|
play = Tkinter.Button(
|
||||||
bf, text = 'Play',
|
bf, text = 'Play',
|
||||||
command = doPlay)
|
command = doPlay)
|
||||||
jumpToEnd = Button(bf, text = '>>', command = toEnd)
|
jumpToEnd = Tkinter.Button(bf, text = '>>', command = toEnd)
|
||||||
jumpToStart.pack(side = LEFT, expand = 1, fill = X)
|
jumpToStart.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
play.pack(side = LEFT, expand = 1, fill = X)
|
play.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
stop.pack(side = LEFT, expand = 1, fill = X)
|
stop.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
jumpToEnd.pack(side = LEFT, expand = 1, fill = X)
|
jumpToEnd.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
bf.pack(expand = 1, fill = X)
|
bf.pack(expand = 1, fill = Tkinter.X)
|
||||||
outerFrame.pack(expand = 1, fill = X)
|
outerFrame.pack(expand = 1, fill = Tkinter.X)
|
||||||
# Add function to update slider during setT calls
|
# Add function to update slider during setT calls
|
||||||
def update(t, es=es):
|
def update(t, es=es):
|
||||||
es.set(t, fCommand = 0)
|
es.set(t, fCommand = 0)
|
||||||
|
@ -1079,7 +1079,10 @@ del lerpScaleXYZ
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def place(self):
|
def place(self):
|
||||||
base.startDirect(fWantTk = 1)
|
base.startDirect(fWantTk = 1)
|
||||||
from direct.tkpanels import Placer
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
Placer = importlib.import_module('direct.tkpanels.Placer')
|
||||||
return Placer.place(self)
|
return Placer.place(self)
|
||||||
|
|
||||||
Dtool_funcToMethod(place, NodePath)
|
Dtool_funcToMethod(place, NodePath)
|
||||||
@ -1087,7 +1090,10 @@ del place
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def explore(self):
|
def explore(self):
|
||||||
base.startDirect(fWantTk = 1)
|
base.startDirect(fWantTk = 1)
|
||||||
from direct.tkwidgets import SceneGraphExplorer
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
SceneGraphExplorer = importlib.import_module('direct.tkwidgets.SceneGraphExplorer')
|
||||||
return SceneGraphExplorer.explore(self)
|
return SceneGraphExplorer.explore(self)
|
||||||
|
|
||||||
Dtool_funcToMethod(explore, NodePath)
|
Dtool_funcToMethod(explore, NodePath)
|
||||||
@ -1095,7 +1101,10 @@ del explore
|
|||||||
#####################################################################
|
#####################################################################
|
||||||
def rgbPanel(self, cb = None):
|
def rgbPanel(self, cb = None):
|
||||||
base.startTk()
|
base.startTk()
|
||||||
from direct.tkwidgets import Slider
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
Slider = importlib.import_module('direct.tkwidgets.Slider')
|
||||||
return Slider.rgbPanel(self, cb)
|
return Slider.rgbPanel(self, cb)
|
||||||
|
|
||||||
Dtool_funcToMethod(rgbPanel, NodePath)
|
Dtool_funcToMethod(rgbPanel, NodePath)
|
||||||
|
@ -369,7 +369,10 @@ class ClassicFSM(DirectObject):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
from direct.tkpanels import FSMInspector
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
FSMInspector = importlib.import_module('direct.tkpanels.FSMInspector')
|
||||||
FSMInspector.FSMInspector(self)
|
FSMInspector.FSMInspector(self)
|
||||||
|
|
||||||
def isInternalStateInFlux(self):
|
def isInternalStateInFlux(self):
|
||||||
|
@ -443,16 +443,16 @@ class Interval(DirectObject):
|
|||||||
"""
|
"""
|
||||||
Popup control panel for interval.
|
Popup control panel for interval.
|
||||||
"""
|
"""
|
||||||
from direct.showbase import TkGlobal
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
import math
|
# it up as a dependency when building a .p3d package.
|
||||||
# I moved this here because Toontown does not ship Tk
|
import importlib
|
||||||
from Tkinter import Toplevel, Frame, Button, LEFT, X
|
EntryScale = importlib.import_module('direct.tkwidgets.EntryScale')
|
||||||
import Pmw
|
Tkinter = importlib.import_module('Tkinter')
|
||||||
from direct.tkwidgets import EntryScale
|
|
||||||
if tl == None:
|
if tl == None:
|
||||||
tl = Toplevel()
|
tl = Tkinter.Toplevel()
|
||||||
tl.title('Interval Controls')
|
tl.title('Interval Controls')
|
||||||
outerFrame = Frame(tl)
|
outerFrame = Tkinter.Frame(tl)
|
||||||
def entryScaleCommand(t, s=self):
|
def entryScaleCommand(t, s=self):
|
||||||
s.setT(t)
|
s.setT(t)
|
||||||
s.pause()
|
s.pause()
|
||||||
@ -461,8 +461,8 @@ class Interval(DirectObject):
|
|||||||
min = 0, max = math.floor(self.getDuration() * 100) / 100,
|
min = 0, max = math.floor(self.getDuration() * 100) / 100,
|
||||||
command = entryScaleCommand)
|
command = entryScaleCommand)
|
||||||
es.set(self.getT(), fCommand = 0)
|
es.set(self.getT(), fCommand = 0)
|
||||||
es.pack(expand = 1, fill = X)
|
es.pack(expand = 1, fill = Tkinter.X)
|
||||||
bf = Frame(outerFrame)
|
bf = Tkinter.Frame(outerFrame)
|
||||||
# Jump to start and end
|
# Jump to start and end
|
||||||
def toStart(s=self, es=es):
|
def toStart(s=self, es=es):
|
||||||
s.clearToInitial()
|
s.clearToInitial()
|
||||||
@ -472,23 +472,23 @@ class Interval(DirectObject):
|
|||||||
s.setT(s.getDuration())
|
s.setT(s.getDuration())
|
||||||
es.set(s.getDuration(), fCommand = 0)
|
es.set(s.getDuration(), fCommand = 0)
|
||||||
s.pause()
|
s.pause()
|
||||||
jumpToStart = Button(bf, text = '<<', command = toStart)
|
jumpToStart = Tkinter.Button(bf, text = '<<', command = toStart)
|
||||||
# Stop/play buttons
|
# Stop/play buttons
|
||||||
def doPlay(s=self, es=es):
|
def doPlay(s=self, es=es):
|
||||||
s.resume(es.get())
|
s.resume(es.get())
|
||||||
|
|
||||||
stop = Button(bf, text = 'Stop',
|
stop = Tkinter.Button(bf, text = 'Stop',
|
||||||
command = lambda s=self: s.pause())
|
command = lambda s=self: s.pause())
|
||||||
play = Button(
|
play = Tkinter.Button(
|
||||||
bf, text = 'Play',
|
bf, text = 'Play',
|
||||||
command = doPlay)
|
command = doPlay)
|
||||||
jumpToEnd = Button(bf, text = '>>', command = toEnd)
|
jumpToEnd = Tkinter.Button(bf, text = '>>', command = toEnd)
|
||||||
jumpToStart.pack(side = LEFT, expand = 1, fill = X)
|
jumpToStart.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
play.pack(side = LEFT, expand = 1, fill = X)
|
play.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
stop.pack(side = LEFT, expand = 1, fill = X)
|
stop.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
jumpToEnd.pack(side = LEFT, expand = 1, fill = X)
|
jumpToEnd.pack(side = Tkinter.LEFT, expand = 1, fill = Tkinter.X)
|
||||||
bf.pack(expand = 1, fill = X)
|
bf.pack(expand = 1, fill = Tkinter.X)
|
||||||
outerFrame.pack(expand = 1, fill = X)
|
outerFrame.pack(expand = 1, fill = Tkinter.X)
|
||||||
# Add function to update slider during setT calls
|
# Add function to update slider during setT calls
|
||||||
def update(t, es=es):
|
def update(t, es=es):
|
||||||
es.set(t, fCommand = 0)
|
es.set(t, fCommand = 0)
|
||||||
|
@ -327,7 +327,10 @@ def adjust(command = None, dim = 1, parent = None, **kw):
|
|||||||
10.0
|
10.0
|
||||||
"""
|
"""
|
||||||
# Make sure we enable Tk
|
# Make sure we enable Tk
|
||||||
from direct.tkwidgets import Valuator
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
Valuator = importlib.import_module('direct.tkwidgets.Valuator')
|
||||||
# Set command if specified
|
# Set command if specified
|
||||||
if command:
|
if command:
|
||||||
kw['command'] = lambda x: apply(command, x)
|
kw['command'] = lambda x: apply(command, x)
|
||||||
|
@ -14,7 +14,10 @@ assert base
|
|||||||
directNotify.setDconfigLevels()
|
directNotify.setDconfigLevels()
|
||||||
|
|
||||||
def inspect(anObject):
|
def inspect(anObject):
|
||||||
from direct.tkpanels import Inspector
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
Inspector = importlib.import_module('direct.tkpanels.Inspector')
|
||||||
return Inspector.inspect(anObject)
|
return Inspector.inspect(anObject)
|
||||||
|
|
||||||
import __builtin__
|
import __builtin__
|
||||||
|
@ -583,7 +583,10 @@ class TaskManager:
|
|||||||
return numFound
|
return numFound
|
||||||
|
|
||||||
def popupControls(self):
|
def popupControls(self):
|
||||||
from direct.tkpanels import TaskManagerPanel
|
# Don't use a regular import, to prevent ModuleFinder from picking
|
||||||
|
# it up as a dependency when building a .p3d package.
|
||||||
|
import importlib
|
||||||
|
TaskManagerPanel = importlib.import_module('direct.tkpanels.TaskManagerPanel')
|
||||||
return TaskManagerPanel.TaskManagerPanel(self)
|
return TaskManagerPanel.TaskManagerPanel(self)
|
||||||
|
|
||||||
def getProfileSession(self, name=None):
|
def getProfileSession(self, name=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user