408 self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU) |
408 self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU) |
409 |
409 |
410 def RefreshTitle(self): |
410 def RefreshTitle(self): |
411 name = _("Beremiz") |
411 name = _("Beremiz") |
412 if self.PluginRoot is not None: |
412 if self.PluginRoot is not None: |
413 self.SetTitle("%s - %s"%(name, self.PluginRoot.GetProjectName())) |
413 projectname = self.PluginRoot.GetProjectName() |
|
414 if self.PluginRoot.PlugTestModified(): |
|
415 projectname = "~%s~" % projectname |
|
416 self.SetTitle("%s - %s" % (name, projectname)) |
414 else: |
417 else: |
415 self.SetTitle(name) |
418 self.SetTitle(name) |
416 |
419 |
417 def StartLocalRuntime(self, taskbaricon = True): |
420 def StartLocalRuntime(self, taskbaricon = True): |
418 if self.local_runtime is None or self.local_runtime.finished: |
421 if self.local_runtime is None or self.local_runtime.finished: |
1204 boxsizer.AddWindow(textctrl, 0, border=0, flag=0) |
1207 boxsizer.AddWindow(textctrl, 0, border=0, flag=0) |
1205 textctrl.ChangeValue(str(element_infos["value"])) |
1208 textctrl.ChangeValue(str(element_infos["value"])) |
1206 textctrl.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(textctrl, plugin, element_path)) |
1209 textctrl.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(textctrl, plugin, element_path)) |
1207 first = False |
1210 first = False |
1208 |
1211 |
|
1212 def ResetView(self): |
|
1213 IDEFrame.ResetView(self) |
|
1214 self.PluginInfos = {} |
|
1215 self.PluginRoot = None |
|
1216 self.Log.flush() |
|
1217 self.DebugVariablePanel.SetDataProducer(None) |
|
1218 |
1209 def OnNewProjectMenu(self, event): |
1219 def OnNewProjectMenu(self, event): |
1210 if not self.Config.HasEntry("lastopenedfolder"): |
1220 if not self.Config.HasEntry("lastopenedfolder"): |
1211 defaultpath = os.path.expanduser("~") |
1221 defaultpath = os.path.expanduser("~") |
1212 else: |
1222 else: |
1213 defaultpath = self.Config.Read("lastopenedfolder") |
1223 defaultpath = self.Config.Read("lastopenedfolder") |
1216 if dialog.ShowModal() == wx.ID_OK: |
1226 if dialog.ShowModal() == wx.ID_OK: |
1217 projectpath = dialog.GetPath() |
1227 projectpath = dialog.GetPath() |
1218 dialog.Destroy() |
1228 dialog.Destroy() |
1219 self.Config.Write("lastopenedfolder", os.path.dirname(projectpath)) |
1229 self.Config.Write("lastopenedfolder", os.path.dirname(projectpath)) |
1220 self.Config.Flush() |
1230 self.Config.Flush() |
1221 self.PluginInfos = {} |
1231 self.ResetView() |
1222 self.PluginRoot = PluginsRoot(self, self.Log) |
1232 self.PluginRoot = PluginsRoot(self, self.Log) |
1223 self.Controler = self.PluginRoot |
1233 self.Controler = self.PluginRoot |
1224 result = self.PluginRoot.NewProject(projectpath) |
1234 result = self.PluginRoot.NewProject(projectpath) |
1225 if not result: |
1235 if not result: |
1226 self.DebugVariablePanel.SetDataProducer(self.PluginRoot) |
1236 self.DebugVariablePanel.SetDataProducer(self.PluginRoot) |
1227 self._Refresh(TITLE, FILEMENU, EDITMENU, TYPESTREE, INSTANCESTREE, |
1237 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE) |
1228 LIBRARYTREE) |
|
1229 self.RefreshAll() |
1238 self.RefreshAll() |
1230 else: |
1239 else: |
1231 self.ShowErrorMessage(result) |
1240 self.ShowErrorMessage(result) |
|
1241 self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU) |
1232 event.Skip() |
1242 event.Skip() |
1233 |
1243 |
1234 def OnOpenProjectMenu(self, event): |
1244 def OnOpenProjectMenu(self, event): |
1235 if not self.Config.HasEntry("lastopenedfolder"): |
1245 if not self.Config.HasEntry("lastopenedfolder"): |
1236 defaultpath = os.path.expanduser("~") |
1246 defaultpath = os.path.expanduser("~") |
1241 if dialog.ShowModal() == wx.ID_OK: |
1251 if dialog.ShowModal() == wx.ID_OK: |
1242 projectpath = dialog.GetPath() |
1252 projectpath = dialog.GetPath() |
1243 if os.path.isdir(projectpath): |
1253 if os.path.isdir(projectpath): |
1244 self.Config.Write("lastopenedfolder", os.path.dirname(projectpath)) |
1254 self.Config.Write("lastopenedfolder", os.path.dirname(projectpath)) |
1245 self.Config.Flush() |
1255 self.Config.Flush() |
1246 self.PluginInfos = {} |
1256 self.ResetView() |
1247 self.PluginRoot = PluginsRoot(self, self.Log) |
1257 self.PluginRoot = PluginsRoot(self, self.Log) |
1248 self.Controler = self.PluginRoot |
1258 self.Controler = self.PluginRoot |
1249 result = self.PluginRoot.LoadProject(projectpath) |
1259 result = self.PluginRoot.LoadProject(projectpath) |
1250 if not result: |
1260 if not result: |
1251 self.DebugVariablePanel.SetDataProducer(self.PluginRoot) |
1261 self.DebugVariablePanel.SetDataProducer(self.PluginRoot) |
1270 dialog.Destroy() |
1280 dialog.Destroy() |
1271 if answer == wx.ID_YES: |
1281 if answer == wx.ID_YES: |
1272 self.PluginRoot.SaveProject() |
1282 self.PluginRoot.SaveProject() |
1273 elif answer == wx.ID_CANCEL: |
1283 elif answer == wx.ID_CANCEL: |
1274 return |
1284 return |
1275 self.PluginInfos = {} |
1285 self.ResetView() |
1276 self.PluginRoot = None |
|
1277 self.Log.flush() |
|
1278 self.DeleteAllPages() |
|
1279 self.VariablePanelIndexer.RemoveAllPanels() |
|
1280 self.TypesTree.DeleteAllItems() |
|
1281 self.InstancesTree.DeleteAllItems() |
|
1282 self.LibraryTree.DeleteAllItems() |
|
1283 self.Controler = None |
|
1284 self.DebugVariablePanel.SetDataProducer(None) |
|
1285 self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU) |
1286 self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU) |
1286 self.RefreshAll() |
1287 self.RefreshAll() |
1287 event.Skip() |
1288 event.Skip() |
1288 |
1289 |
1289 def OnSaveProjectMenu(self, event): |
1290 def OnSaveProjectMenu(self, event): |