00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 import sys
00021 from ost import gui
00022 import sip
00023 from ost import gfx
00024 import ost
00025 import os
00026 from PyQt4 import QtCore, QtGui
00027 from toolbar_options_widget import ToolBarOptionsWidget
00028 from render_options_widget import RenderOptionsWidget
00029 from color_options_widget import ColorOptionsWidget
00030 from ost.gui.scene.scene_observer_impl import SceneObserverImpl
00031 from map_level_widget import AdditionalSettingsWidget
00032 from scene_selection_helper import SelHelper
00033
00034 class InspectorWidget(ToolBarOptionsWidget):
00035 ICONS_PATH = os.path.join(ost.GetSharedDataPath(), "scene", "icons/")
00036 def __init__(self, parent=None):
00037 ToolBarOptionsWidget.__init__(self, parent)
00038 app=gui.GostyApp.Instance()
00039 options = [
00040 [InspectorWidget.ICONS_PATH+"render_icon.png",RenderOptionsWidget(self),None],
00041 [InspectorWidget.ICONS_PATH+"color_icon.png",ColorOptionsWidget(self),None],
00042 [InspectorWidget.ICONS_PATH+"preset_icon.png", AdditionalSettingsWidget(self),"Additional Node Settings"],
00043 [InspectorWidget.ICONS_PATH+"tool_icon.png",app.tool_options_win.qobject,"Tool Options"]
00044 ]
00045 for o in options:
00046 ToolBarOptionsWidget.AddWidget(self,o[0], o[1], o[2])
00047
00048 self.obs = SceneObserverImpl()
00049 self.obs.AttachObserver(self)
00050 ost.scene.AttachObserver(self.obs)
00051 QtCore.QObject.connect(app.scene_win.qobject,QtCore.SIGNAL("ActiveNodesChanged()"),
00052 self.ActiveNodesChanged)
00053
00054 self.setMinimumSize(250,215)
00055
00056 def OnComboChange(self, item):
00057 self.DoResize()
00058
00059
00060 def NodeRemoved(self, node):
00061 SelHelper().Update()
00062 ToolBarOptionsWidget.Update(self)
00063
00064 def RenderModeChanged(self, node):
00065 SelHelper().Update()
00066 ToolBarOptionsWidget.Update(self)
00067
00068 def NodeChanged(self, node):
00069 SelHelper().Update()
00070 ToolBarOptionsWidget.Update(self)
00071
00072 def ActiveNodesChanged(self):
00073 SelHelper().Update()
00074 ToolBarOptionsWidget.Update(self)
00075
00076 class InspectorDialog(QtGui.QDialog):
00077 def __init__(self, parent=None):
00078 QtGui.QDialog.__init__(self, parent)
00079 self.setWindowTitle("Inspector Gadget")
00080 self.setAttribute(QtCore.Qt.WA_MacSmallSize)
00081 self.layout=QtGui.QHBoxLayout()
00082 self.layout.setMargin(0)
00083 self.layout.setSpacing(0)
00084 self.setLayout(self.layout)
00085 self.mywidget_ = InspectorWidget(self)
00086 self.layout.addWidget(self.mywidget_)
00087 size_pol = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
00088 QtGui.QSizePolicy.Expanding)
00089 self.setSizePolicy(size_pol)
00090 self.DoResize()
00091
00092 def DoResize(self):
00093 if(hasattr(self, "mywidget_")):
00094 self.setMinimumSize(self.mywidget_.minimumWidth(),
00095 self.mywidget_.minimumHeight())
00096 self.resize(self.mywidget_.minimumWidth(),
00097 self.mywidget_.minimumHeight())
00098
00099 def ToggleHide(self,checked):
00100 self.setHidden(not self.isHidden())
00101
00102 def hideEvent(self, event):
00103 self.emit(QtCore.SIGNAL("visible"),False)
00104 QtGui.QDialog.hideEvent(self,event)
00105
00106 def showEvent(self, event):
00107 self.emit(QtCore.SIGNAL("visible"),True)
00108 QtGui.QDialog.showEvent(self,event)