Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1292 - trunk/SwigInterface
- Date: Tue, 20 Feb 2007 17:27:25 -0700 (MST)
Author: bigler
Date: Tue Feb 20 17:27:25 2007
New Revision: 1292
Modified:
trunk/SwigInterface/manta.i
trunk/SwigInterface/wxManta.py
Log:
Fixes to get Light Dialog working again.
manta.i
Can't extend a class that is in another interface (namely Light in
mantainterface). Instead extend each light class with their own
cast operators.
wxManta.py
Updates for the new Light casting method.
LightFrame can now be started via menu option.
Added container for other dialogs to ease opening them. Create an
ID for the new menu item and add the dialog to the dialog_map using
the ID as the key.
Modified: trunk/SwigInterface/manta.i
==============================================================================
--- trunk/SwigInterface/manta.i (original)
+++ trunk/SwigInterface/manta.i Tue Feb 20 17:27:25 2007
@@ -102,23 +102,32 @@
namespace Manta {
- %extend Light {
- Manta::PointLight* asPointLight() {
- return dynamic_cast<Manta::PointLight*>(self);
+ // We used to be able to do this when Light was in the same
+ // interface as these. Now we have to extend new lights.
+
+// %extend Light {
+// Manta::PointLight* asPointLight() {
+// return dynamic_cast<Manta::PointLight*>(self);
+// }
+// };
+
+// %extend Light {
+// Manta::HeadLight* asHeadLight() {
+// return dynamic_cast<Manta::HeadLight*>(self);
+// }
+// };
+
+ %extend PointLight {
+ static PointLight* fromLight(Light* parent) {
+ return dynamic_cast<Manta::PointLight*>(parent);
}
};
- %extend Light {
- Manta::HeadLight* asHeadLight() {
- return dynamic_cast<Manta::HeadLight*>(self);
+ %extend HeadLight {
+ static HeadLight* fromLight(Light* parent) {
+ return dynamic_cast<Manta::HeadLight*>(parent);
}
};
-
-// %extend PointLight {
-// static PointLight* fromLight(Light* parent) {
-// return dynamic_cast<Manta::PointLight*>(parent);
-// }
-// };
}
/////////////////////////////////////////////////////
Modified: trunk/SwigInterface/wxManta.py
==============================================================================
--- trunk/SwigInterface/wxManta.py (original)
+++ trunk/SwigInterface/wxManta.py Tue Feb 20 17:27:25 2007
@@ -182,10 +182,10 @@
self.Destroy()
def addLight(self, where, light):
- point_light = light.asPointLight()
+ point_light = PointLight.fromLight(light)
if (point_light != None):
return self.addPointLight(where, point_light)
- head_light = light.asHeadLight()
+ head_light = HeadLight.fromLight(light)
if (head_light != None):
return self.addHeadLight(where, head_light)
@@ -293,6 +293,9 @@
# Create the StatusBar
self.statusbar = self.CreateStatusBar()
+ # Create the dialog map
+ self.dialog_map = {}
+
# Create the menu
self.menuBar = wx.MenuBar()
@@ -301,6 +304,10 @@
manta_menu.Append(wx.NewId(), "About Manta"))
self.Bind(wx.EVT_MENU, self.OnCloseWindow,
manta_menu.Append(wx.NewId(), "&Quit Manta"))
+ light_dialog_id = wx.NewId()
+ self.dialog_map[light_dialog_id] = LightFrame
+ self.Bind(wx.EVT_MENU, self.OnShowDialog,
+ manta_menu.Append(light_dialog_id, "Modify Lights"))
self.menuBar.Append(manta_menu, "&Manta")
file_menu = wx.Menu()
@@ -536,6 +543,17 @@
print "Found special key '%s'" % key
event.Skip()
+
+
###########################################################################
+ ## OnShowDialog
+
###########################################################################
+ def OnShowDialog(self, event):
+ # Get the dialog
+ dialog = self.dialog_map[event.GetId()]
+ if (dialog == None):
+ wx.LogError("Unknown dialog ID")
+ return
+ dialog(self, self.engine).Show()
###########################################################################
## OnAbout
- [MANTA] r1292 - trunk/SwigInterface, bigler, 02/20/2007
Archive powered by MHonArc 2.6.16.