993 if self._ProjectFilesView is not None: |
993 if self._ProjectFilesView is not None: |
994 self.AppFrame.EditProjectElement(self._ProjectFilesView, name) |
994 self.AppFrame.EditProjectElement(self._ProjectFilesView, name) |
995 |
995 |
996 return self._ProjectFilesView |
996 return self._ProjectFilesView |
997 |
997 |
998 elif name is not None and os.path.isfile(name): |
998 elif name is not None and name.find("::") != -1: |
999 if not self._FileEditors.has_key(name): |
999 filepath, editor_name = name.split("::") |
1000 file_extension = os.path.splitext(name)[1] |
1000 if not self._FileEditors.has_key(filepath): |
|
1001 if os.path.isfile(filepath): |
|
1002 file_extension = os.path.splitext(filepath)[1] |
|
1003 |
|
1004 editors = dict([(editor_name, editor) |
|
1005 for extension, editor_name, editor in features.file_editors |
|
1006 if extension == file_extension]) |
|
1007 |
|
1008 if editor_name == "": |
|
1009 if len(editors) == 1: |
|
1010 editor_name = editors.keys()[0] |
|
1011 elif len(editors) > 0: |
|
1012 names = editors.keys() |
|
1013 dialog = wx.SingleChoiceDialog(self.AppFrame, |
|
1014 _("Select an editor:"), _("Editor selection"), |
|
1015 names, wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) |
|
1016 if dialog.ShowModal() == wx.ID_OK: |
|
1017 editor_name = names[dialog.GetSelection()] |
|
1018 dialog.Destroy() |
|
1019 |
|
1020 if editor_name != "": |
|
1021 name = "::".join([filepath, editor_name]) |
|
1022 |
|
1023 editor = editors[editor_name]() |
|
1024 self._FileEditors[filepath] = editor(self.AppFrame.TabsOpened, self, name, self.AppFrame) |
|
1025 self._FileEditors[filepath].SetIcon(GetBitmap("FILE")) |
|
1026 |
|
1027 if self._FileEditors.has_key(filepath): |
|
1028 editor = self._FileEditors[filepath] |
|
1029 self.AppFrame.EditProjectElement(editor, editor.GetTagName()) |
1001 |
1030 |
1002 editors = dict([(editor_name, editor) |
1031 return self._FileEditors.get(filepath) |
1003 for extension, editor_name, editor in features.file_editors |
|
1004 if extension == file_extension]) |
|
1005 |
|
1006 editor_name = None |
|
1007 if len(editors) == 1: |
|
1008 editor_name = editors.keys()[0] |
|
1009 elif len(editors) > 0: |
|
1010 names = editors.keys() |
|
1011 dialog = wx.SingleChoiceDialog(self.ParentWindow, |
|
1012 _("Select an editor:"), _("Editor selection"), |
|
1013 names, wx.OK|wx.CANCEL) |
|
1014 if dialog.ShowModal() == wx.ID_OK: |
|
1015 editor_name = names[dialog.GetSelection()] |
|
1016 dialog.Destroy() |
|
1017 |
|
1018 if editor_name is not None: |
|
1019 editor = editors[editor_name]() |
|
1020 self._FileEditors[name] = editor(self.AppFrame.TabsOpened, self, name, self.AppFrame) |
|
1021 self._FileEditors[name].SetIcon(GetBitmap("FILE")) |
|
1022 |
|
1023 if self._FileEditors.has_key(name): |
|
1024 self.AppFrame.EditProjectElement(self._FileEditors[name], name) |
|
1025 |
|
1026 return self._FileEditors[name] |
|
1027 else: |
1032 else: |
1028 return ConfigTreeNode._OpenView(self, self.CTNName(), onlyopened) |
1033 return ConfigTreeNode._OpenView(self, self.CTNName(), onlyopened) |
1029 |
1034 |
1030 def OnCloseEditor(self, view): |
1035 def OnCloseEditor(self, view): |
1031 ConfigTreeNode.OnCloseEditor(self, view) |
1036 ConfigTreeNode.OnCloseEditor(self, view) |
1359 BeremizRoot.\ |
1364 BeremizRoot.\ |
1360 setURI_location(uri) |
1365 setURI_location(uri) |
1361 self.ChangesToSave = True |
1366 self.ChangesToSave = True |
1362 if self._View is not None: |
1367 if self._View is not None: |
1363 self._View.RefreshView() |
1368 self._View.RefreshView() |
|
1369 if self.AppFrame is not None: |
1364 self.AppFrame.RefreshTitle() |
1370 self.AppFrame.RefreshTitle() |
1365 self.AppFrame.RefreshFileMenu() |
1371 self.AppFrame.RefreshFileMenu() |
1366 self.AppFrame.RefreshEditMenu() |
1372 self.AppFrame.RefreshEditMenu() |
1367 self.AppFrame.RefreshPageTitles() |
1373 self.AppFrame.RefreshPageTitles() |
1368 |
1374 |