-
Notifications
You must be signed in to change notification settings - Fork 765
Expand file tree
/
Copy pathPythonProjectEditor.h
More file actions
118 lines (78 loc) · 3.03 KB
/
PythonProjectEditor.h
File metadata and controls
118 lines (78 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowCentricApplication.h"
#include "Editor/Kismet/Public/WorkflowOrientedApp/WorkflowTabManager.h"
#include "Runtime/Launch/Resources/Version.h"
class FPythonProjectEditor : public FWorkflowCentricApplication, public FGCObject
{
public:
FPythonProjectEditor();
// IToolkit interface
virtual void RegisterTabSpawners(const TSharedRef<class FTabManager>& TabManager) override;
// End of IToolkit interface
// FAssetEditorToolkit
virtual FName GetToolkitFName() const override;
virtual FText GetBaseToolkitName() const override;
virtual FText GetToolkitName() const override;
virtual FText GetToolkitToolTipText() const override;
virtual FLinearColor GetWorldCentricTabColorScale() const override;
virtual FString GetWorldCentricTabPrefix() const override;
// End of FAssetEditorToolkit
// FSerializableObject interface
virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
// End of FSerializableObject interface
static TSharedPtr<FPythonProjectEditor> Get()
{
return PythonEditor.Pin();
}
public:
/** Initialize the Python editor */
void InitPythonEditor(const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, class UPythonProject* PythonProject);
/** Try to open a new file for editing */
void OpenFileForEditing(class UPythonProjectItem* Item);
void CloseFileForEditing(class UPythonProjectItem* Item);
/** Get the current project being edited by this Python editor */
UPythonProject* GetPythonProjectBeingEdited() const { return PythonProjectBeingEdited.Get(); }
TSharedRef<SWidget> CreatePythonEditorWidget(TSharedRef<FTabInfo> TabInfo, UPythonProjectItem* Item);
void RegisterToolbarTab(const TSharedRef<class FTabManager>& TabManager);
/** Access the toolbar builder for this editor */
TSharedPtr<class FPythonProjectEditorToolbar> GetToolbarBuilder() { return ToolbarBuilder; }
bool New();
bool NewDirectory();
bool Delete();
bool Save();
bool SaveAll();
bool Execute();
#if PLATFORM_MAC
bool ExecuteInMainThread();
#endif
bool PEP8ize();
FString GetSafeName(bool IsDirectory);
private:
void BindCommands();
void New_Internal();
void NewDirectory_Internal();
void Delete_Internal();
void Save_Internal();
void SaveAll_Internal();
void Execute_Internal();
#if PLATFORM_MAC
void ExecuteInMainThread_Internal();
#endif
void PEP8ize_Internal();
bool CanNew() const;
bool CanSave() const;
bool CanSaveAll() const;
bool CanExecute() const;
bool CanDelete() const;
protected:
TSharedPtr<FDocumentTracker> DocumentManager;
/** The Python project we are currently editing */
TWeakObjectPtr<UPythonProject> PythonProjectBeingEdited;
TSharedPtr<class FPythonProjectEditorToolbar> ToolbarBuilder;
static TWeakPtr<FPythonProjectEditor> PythonEditor;
virtual bool CanSaveAsset() const override { return false; }
#if ENGINE_MINOR_VERSION > 17
virtual bool CanFindInContentBrowser() const override { return false; }
#endif
};