Skip to content

Commit 0bbfb19

Browse files
author
Roberto De Ioris
committed
removed additional log tab from the python editor
1 parent b33a04f commit 0bbfb19

File tree

10 files changed

+36
-644
lines changed

10 files changed

+36
-644
lines changed

Source/PythonEditor/Private/PythonAssetTypeActions.cpp

Lines changed: 0 additions & 44 deletions
This file was deleted.

Source/PythonEditor/Private/PythonAssetTypeActions.h

Lines changed: 0 additions & 17 deletions
This file was deleted.

Source/PythonEditor/Private/PythonEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FPythonEditor : public IModuleInterface
5353
// Add Python editor extension to main menu
5454
Extender->AddMenuExtension(
5555
"WindowLayout",
56-
EExtensionHook::First,
56+
EExtensionHook::After,
5757
TSharedPtr<FUICommandList>(),
5858
FMenuExtensionDelegate::CreateStatic( &Local::ExtendMenu ) );
5959

Source/PythonEditor/Private/PythonProjectEditor.cpp

Lines changed: 35 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "SPythonProjectEditor.h"
66
#include "SDockTab.h"
77
#include "PythonProjectEditorToolbar.h"
8-
#include "SPythonLog.h"
98
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowUObjectDocuments.h"
109
#include "Editor/Kismet/Public/WorkflowOrientedApp/ApplicationMode.h"
1110
#define LOCTEXT_NAMESPACE "PythonEditor"
@@ -26,7 +25,6 @@ namespace PythonEditorTabs
2625
// Tab identifiers
2726
static const FName ProjectViewID(TEXT("ProjectView"));
2827
static const FName PythonViewID(TEXT("Document"));
29-
static const FName PythonLogViewID(TEXT("Log"));
3028
};
3129

3230
struct FPythonTabSummoner : public FDocumentTabFactoryForObjects<UPythonProjectItem>
@@ -45,21 +43,21 @@ struct FPythonTabSummoner : public FDocumentTabFactoryForObjects<UPythonProjectI
4543
virtual void OnTabActivated(TSharedPtr<SDockTab> Tab) const override
4644
{
4745
TSharedRef<SPythonEditor> PythonEditor = StaticCastSharedRef<SPythonEditor>(Tab->GetContent());
48-
// InPythonProjectEditorPtr.Pin()->OnPythonEditorFocused(PythonEditor);
46+
// InPythonProjectEditorPtr.Pin()->OnPythonEditorFocused(PythonEditor);
4947
}
5048

5149
virtual void OnTabRefreshed(TSharedPtr<SDockTab> Tab) const override
5250
{
5351
TSharedRef<SPythonEditor> GraphEditor = StaticCastSharedRef<SPythonEditor>(Tab->GetContent());
54-
// GraphEditor->NotifyItemChanged();
52+
// GraphEditor->NotifyItemChanged();
5553
}
5654

5755
virtual void SaveState(TSharedPtr<SDockTab> Tab, TSharedPtr<FTabPayload> Payload) const override
5856
{
5957
TSharedRef<SPythonEditor> GraphEditor = StaticCastSharedRef<SPythonEditor>(Tab->GetContent());
6058

61-
// UPythonProjectItem* Graph = FTabPayload_UObject::CastChecked<UPythonProjectItem>(Payload);
62-
// BlueprintEditorPtr.Pin()->GetBlueprintObj()->LastEditedDocuments.Add(FEditedDocumentInfo(Graph, ViewLocation, ZoomAmount));
59+
// UPythonProjectItem* Graph = FTabPayload_UObject::CastChecked<UPythonProjectItem>(Payload);
60+
// BlueprintEditorPtr.Pin()->GetBlueprintObj()->LastEditedDocuments.Add(FEditedDocumentInfo(Graph, ViewLocation, ZoomAmount));
6361
}
6462

6563
protected:
@@ -79,10 +77,10 @@ struct FPythonTabSummoner : public FDocumentTabFactoryForObjects<UPythonProjectI
7977
return FPythonEditorStyle::Get().GetBrush("ProjectEditor.Icon.File");
8078
}
8179

82-
/* virtual TSharedRef<FGenericTabHistory> CreateTabHistoryNode(TSharedPtr<FTabPayload> Payload) override
83-
{
84-
return MakeShareable(new FSourceTabHistory(SharedThis(this), Payload));
85-
}*/
80+
/* virtual TSharedRef<FGenericTabHistory> CreateTabHistoryNode(TSharedPtr<FTabPayload> Payload) override
81+
{
82+
return MakeShareable(new FSourceTabHistory(SharedThis(this), Payload));
83+
}*/
8684

8785
protected:
8886
TWeakPtr<class FPythonProjectEditor> PythonProjectEditorPtr;
@@ -107,33 +105,11 @@ struct FProjectViewSummoner : public FWorkflowTabFactory
107105
virtual TSharedRef<SWidget> CreateTabBody(const FWorkflowTabSpawnInfo& Info) const override
108106
{
109107
TSharedPtr<FPythonProjectEditor> PythonEditorPtr = StaticCastSharedPtr<FPythonProjectEditor>(HostingApp.Pin());
110-
return SAssignNew(MyPythonProjectEditor,SPythonProjectEditor, PythonEditorPtr->GetPythonProjectBeingEdited());
111-
}
112-
};
113-
114-
struct FPythonLogViewSummoner : public FWorkflowTabFactory
115-
{
116-
public:
117-
FPythonLogViewSummoner(TSharedPtr<class FAssetEditorToolkit> InHostingApp)
118-
: FWorkflowTabFactory(PythonEditorTabs::PythonLogViewID, InHostingApp)
119-
{
120-
TabLabel = LOCTEXT("ProjectLogTabLabel", "OutptutLog");
121-
122-
bIsSingleton = true;
123-
124-
ViewMenuDescription = LOCTEXT("ProjectLogTabMenu_Description", "OutptutLog");
125-
ViewMenuTooltip = LOCTEXT("ProjectLogTabMenu_ToolTip", "Shows the OutptutLog panel");
126-
}
127-
128-
virtual TSharedRef<SWidget> CreateTabBody(const FWorkflowTabSpawnInfo& Info) const override
129-
{
130-
TSharedPtr<FPythonProjectEditor> PythonEditorPtr = StaticCastSharedPtr<FPythonProjectEditor>(HostingApp.Pin());
131-
return SNew(SPythonLog);
108+
return SAssignNew(MyPythonProjectEditor, SPythonProjectEditor, PythonEditorPtr->GetPythonProjectBeingEdited());
132109
}
133110
};
134111

135112

136-
137113
class FBasicPythonEditorMode : public FApplicationMode
138114
{
139115
public:
@@ -146,7 +122,6 @@ class FBasicPythonEditorMode : public FApplicationMode
146122
protected:
147123
TWeakPtr<FPythonProjectEditor> MyPythonEditor;
148124
FWorkflowAllowedTabSet ProjectViewTabFactories;
149-
FWorkflowAllowedTabSet ProjectLogViewTabFactories;
150125

151126
};
152127

@@ -156,7 +131,6 @@ FBasicPythonEditorMode::FBasicPythonEditorMode(TSharedPtr<class FPythonProjectEd
156131
MyPythonEditor = InPythonEditor;
157132

158133
ProjectViewTabFactories.RegisterFactory(MakeShareable(new FProjectViewSummoner(InPythonEditor)));
159-
ProjectLogViewTabFactories.RegisterFactory(MakeShareable(new FPythonLogViewSummoner(InPythonEditor)));
160134

161135
TabLayout = FTabManager::NewLayout("Standalone_PythonEditor_Layout_v1.01")
162136
->AddArea
@@ -169,52 +143,19 @@ FBasicPythonEditorMode::FBasicPythonEditorMode(TSharedPtr<class FPythonProjectEd
169143
->SetSizeCoefficient(0.1f)
170144
->SetHideTabWell(true)
171145
->AddTab(InPythonEditor->GetToolbarTabId(), ETabState::OpenedTab)
172-
)
173-
->Split
174-
(
175-
FTabManager::NewSplitter()
176-
->SetSizeCoefficient(0.9f)
177-
->SetOrientation(Orient_Horizontal)
178-
->Split
179-
(
180-
FTabManager::NewStack()
181-
->SetSizeCoefficient(0.2f)
182-
->SetHideTabWell(true)
183-
->AddTab(PythonEditorTabs::ProjectViewID, ETabState::OpenedTab)
184-
)
185-
->Split
186-
(
187-
FTabManager::NewSplitter()
188-
->SetSizeCoefficient(0.8f)
189-
->SetOrientation(Orient_Vertical)
190-
->Split
191-
(
192-
FTabManager::NewStack()
193-
->SetSizeCoefficient(0.7f)
194-
->SetHideTabWell(false)
195-
->AddTab(PythonEditorTabs::PythonViewID, ETabState::OpenedTab)
196-
)
197-
->Split
198-
(
199-
FTabManager::NewStack()
200-
->SetSizeCoefficient(0.3f)
201-
->SetHideTabWell(true)
202-
->AddTab(PythonEditorTabs::PythonLogViewID, ETabState::OpenedTab)
203-
)
204146
)
205-
)
206-
);
147+
148+
);
207149

208150
InPythonEditor->GetToolbarBuilder()->AddEditorToolbar(ToolbarExtender);
209151
}
210152

211153
void FBasicPythonEditorMode::RegisterTabFactories(TSharedPtr<FTabManager> InTabManager)
212154
{
213155
TSharedPtr<FPythonProjectEditor> Editor = MyPythonEditor.Pin();
214-
156+
215157
Editor->RegisterToolbarTab(InTabManager.ToSharedRef());
216158
Editor->PushTabFactories(ProjectViewTabFactories);
217-
Editor->PushTabFactories(ProjectLogViewTabFactories);
218159

219160
FApplicationMode::RegisterTabFactories(InTabManager);
220161
}
@@ -241,7 +182,7 @@ void FPythonProjectEditor::InitPythonEditor(const EToolkitMode::Type Mode, const
241182
PythonProjectBeingEdited = PythonProject;
242183

243184
TSharedPtr<FPythonProjectEditor> ThisPtr(SharedThis(this));
244-
if(!DocumentManager.IsValid())
185+
if (!DocumentManager.IsValid())
245186
{
246187
DocumentManager = MakeShareable(new FDocumentTracker);
247188
DocumentManager->Initialize(ThisPtr);
@@ -267,7 +208,7 @@ void FPythonProjectEditor::InitPythonEditor(const EToolkitMode::Type Mode, const
267208

268209
// Create the modes and activate one (which will populate with a real layout)
269210
AddApplicationMode(
270-
PythonEditorModes::StandardMode,
211+
PythonEditorModes::StandardMode,
271212
MakeShareable(new FBasicPythonEditorMode(ThisPtr, PythonEditorModes::StandardMode)));
272213
SetCurrentMode(PythonEditorModes::StandardMode);
273214

@@ -279,20 +220,20 @@ void FPythonProjectEditor::BindCommands()
279220
ToolkitCommands->MapAction(FPythonProjectEditorCommands::Get().New,
280221
FExecuteAction::CreateSP(this, &FPythonProjectEditor::New_Internal),
281222
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanNew)
282-
);
223+
);
283224
ToolkitCommands->MapAction(FPythonProjectEditorCommands::Get().Delete,
284225
FExecuteAction::CreateSP(this, &FPythonProjectEditor::Delete_Internal),
285226
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanDelete)
286-
);
227+
);
287228
ToolkitCommands->MapAction(FPythonProjectEditorCommands::Get().Save,
288-
FExecuteAction::CreateSP(this, &FPythonProjectEditor::Save_Internal),
289-
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanSave)
290-
);
229+
FExecuteAction::CreateSP(this, &FPythonProjectEditor::Save_Internal),
230+
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanSave)
231+
);
291232

292233
ToolkitCommands->MapAction(FPythonProjectEditorCommands::Get().SaveAll,
293-
FExecuteAction::CreateSP(this, &FPythonProjectEditor::SaveAll_Internal),
294-
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanSaveAll)
295-
);
234+
FExecuteAction::CreateSP(this, &FPythonProjectEditor::SaveAll_Internal),
235+
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanSaveAll)
236+
);
296237
ToolkitCommands->MapAction(FPythonProjectEditorCommands::Get().Execute,
297238
FExecuteAction::CreateSP(this, &FPythonProjectEditor::Execute_Internal),
298239
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanExecute)
@@ -319,7 +260,7 @@ FName FPythonProjectEditor::GetToolkitFName() const
319260

320261
FText FPythonProjectEditor::GetBaseToolkitName() const
321262
{
322-
return LOCTEXT( "AppLabel", "Python Editor" );
263+
return LOCTEXT("AppLabel", "Python Editor");
323264
}
324265

325266
FText FPythonProjectEditor::GetToolkitName() const
@@ -356,7 +297,7 @@ TSharedRef<SWidget> FPythonProjectEditor::CreatePythonEditorWidget(TSharedRef<FT
356297
FString FPythonProjectEditor::GetNoneRepeatName()
357298
{
358299
UPythonProject* PythonProject = PythonProjectBeingEdited.Get();
359-
300+
360301
int suf = 2;
361302
FString scriptName;
362303
while (true)
@@ -367,28 +308,28 @@ FString FPythonProjectEditor::GetNoneRepeatName()
367308
if (!FPaths::FileExists(scriptName)) {
368309
return scriptName;
369310
}
370-
311+
371312
suf++;
372313
}
373314
}
374315
void FPythonProjectEditor::New_Internal()
375316
{
376-
New();
317+
New();
377318
}
378319

379320
bool FPythonProjectEditor::New()
380321
{
381322
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
382-
323+
383324
FString scriptName = GetNoneRepeatName();
384-
IFileHandle* fileHandle=PlatformFile.OpenWrite(*scriptName);
325+
IFileHandle* fileHandle = PlatformFile.OpenWrite(*scriptName);
385326
if (fileHandle == NULL) {
386327
return false;
387328
}
388329
fileHandle->~IFileHandle();
389330
UPythonProject* PythonProject = PythonProjectBeingEdited.Get();
390331
PythonProject->RescanChildren();
391-
UPythonProjectItem* item=MyPythonProjectEditor->SelectByPath(scriptName);
332+
UPythonProjectItem* item = MyPythonProjectEditor->SelectByPath(scriptName);
392333
OpenFileForEditing(item);
393334
return true;
394335
}
@@ -428,7 +369,7 @@ void FPythonProjectEditor::Save_Internal()
428369

429370
bool FPythonProjectEditor::Save()
430371
{
431-
if(DocumentManager.IsValid() && DocumentManager->GetActiveTab().IsValid())
372+
if (DocumentManager.IsValid() && DocumentManager->GetActiveTab().IsValid())
432373
{
433374
TSharedRef<SPythonEditor> PythonEditorRef = StaticCastSharedRef<SPythonEditor>(DocumentManager->GetActiveTab()->GetContent());
434375
return PythonEditorRef->Save();
@@ -439,7 +380,7 @@ bool FPythonProjectEditor::Save()
439380

440381
bool FPythonProjectEditor::CanSave() const
441382
{
442-
if(DocumentManager.IsValid() && DocumentManager->GetActiveTab().IsValid())
383+
if (DocumentManager.IsValid() && DocumentManager->GetActiveTab().IsValid())
443384
{
444385
TSharedRef<SWidget> Content = DocumentManager->GetActiveTab()->GetContent();
445386
TSharedRef<SPythonEditor> PythonEditorRef = StaticCastSharedRef<SPythonEditor>(Content);
@@ -458,15 +399,15 @@ bool FPythonProjectEditor::SaveAll()
458399
{
459400
bool bResult = true;
460401

461-
if(DocumentManager.IsValid())
402+
if (DocumentManager.IsValid())
462403
{
463404
TArray<TSharedPtr<SDockTab>> AllTabs = DocumentManager->GetAllDocumentTabs();
464-
for(auto& Tab : AllTabs)
405+
for (auto& Tab : AllTabs)
465406
{
466-
if(Tab.IsValid())
407+
if (Tab.IsValid())
467408
{
468409
TSharedRef<SPythonEditor> PythonEditorRef = StaticCastSharedRef<SPythonEditor>(Tab->GetContent());
469-
if(!PythonEditorRef->Save())
410+
if (!PythonEditorRef->Save())
470411
{
471412
bResult = false;
472413
}

0 commit comments

Comments
 (0)