Browse Source

setting frame title now

Arkady Trestman 15 years ago
parent
commit
827585febc

+ 9 - 0
direct/src/leveleditor/LevelEditorBase.py

@@ -157,6 +157,14 @@ class LevelEditorBase(DirectObject):
         self.loadSettings()
         self.loadSettings()
         self.reset()
         self.reset()
         
         
+    def setTitleWithFilename(self, filename=""):
+        import pdb;pdb.set_trace()
+        title = self.ui.appname
+        if filename != "":
+           filenameshort = os.path.basename(filename)
+           title = title + " (%s)"%filenameshort
+        self.ui.SetLabel(title)
+
     def removeNodePathHook(self, nodePath):
     def removeNodePathHook(self, nodePath):
         if nodePath is None:
         if nodePath is None:
             return
             return
@@ -283,6 +291,7 @@ class LevelEditorBase(DirectObject):
         self.resetOrthoCam(self.ui.frontView)
         self.resetOrthoCam(self.ui.frontView)
         self.resetOrthoCam(self.ui.leftView)
         self.resetOrthoCam(self.ui.leftView)
         self.fNeedToSave = False
         self.fNeedToSave = False
+        self.setTitleWithFilename()
         
         
     def resetOrthoCam(self, view):
     def resetOrthoCam(self, view):
         base.direct.drList[base.camList.index(NodePath(view.camNode))].orthoFactor = 0.1
         base.direct.drList[base.camList.index(NodePath(view.camNode))].orthoFactor = 0.1

+ 2 - 0
direct/src/leveleditor/LevelEditorUIBase.py

@@ -444,6 +444,7 @@ class LevelEditorUIBase(WxAppShell):
         dialog = wx.FileDialog(None, "Choose a file", os.getcwd(), "", "*.py", wx.OPEN)
         dialog = wx.FileDialog(None, "Choose a file", os.getcwd(), "", "*.py", wx.OPEN)
         if dialog.ShowModal() == wx.ID_OK:
         if dialog.ShowModal() == wx.ID_OK:
             self.editor.load(dialog.GetPath())
             self.editor.load(dialog.GetPath())
+            self.editor.setTitleWithFilename(dialog.GetPath())
         dialog.Destroy()
         dialog.Destroy()
 
 
     def onSave(self, evt=None):
     def onSave(self, evt=None):
@@ -458,6 +459,7 @@ class LevelEditorUIBase(WxAppShell):
         result = True
         result = True
         if dialog.ShowModal() == wx.ID_OK:
         if dialog.ShowModal() == wx.ID_OK:
             self.editor.saveAs(dialog.GetPath())
             self.editor.saveAs(dialog.GetPath())
+            self.editor.setTitleWithFilename(dialog.GetPath())
         else:
         else:
             result = False
             result = False
         dialog.Destroy()
         dialog.Destroy()