Skip to content

Commit 4466385

Browse files
author
Roberto De Ioris
committed
improved threading support
1 parent 7502c05 commit 4466385

29 files changed

+87
-322
lines changed

Source/PythonEditor/Private/PythonEditorStyle.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ void FPythonEditorStyle::Initialize()
5858
StyleSet->Set("PythonEditor.SaveAll.Small", new IMAGE_BRUSH("UI/SaveAll_40x", Icon16x16));
5959
StyleSet->Set("PythonEditor.Execute", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40));
6060
StyleSet->Set("PythonEditor.Execute.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16));
61-
StyleSet->Set("PythonEditor.ExecuteInSandbox", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40));
62-
StyleSet->Set("PythonEditor.ExecuteInSandbox.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16));
6361
StyleSet->Set("PythonEditor.PEP8ize", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40));
6462
StyleSet->Set("PythonEditor.PEP8ize.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16));
6563
}

Source/PythonEditor/Private/PythonProjectEditor.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,6 @@ void FPythonProjectEditor::BindCommands()
268268
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanExecute)
269269
);
270270

271-
ToolkitCommands->MapAction(FPythonProjectEditorCommands::Get().ExecuteInSandbox,
272-
FExecuteAction::CreateSP(this, &FPythonProjectEditor::ExecuteInSandbox_Internal),
273-
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanExecute)
274-
);
275-
276271
ToolkitCommands->MapAction(FPythonProjectEditorCommands::Get().PEP8ize,
277272
FExecuteAction::CreateSP(this, &FPythonProjectEditor::PEP8ize_Internal),
278273
FCanExecuteAction::CreateSP(this, &FPythonProjectEditor::CanExecute)
@@ -503,12 +498,6 @@ void FPythonProjectEditor::PEP8ize_Internal()
503498
PEP8ize();
504499
}
505500

506-
void FPythonProjectEditor::ExecuteInSandbox_Internal()
507-
{
508-
Execute();
509-
}
510-
511-
512501
bool FPythonProjectEditor::Execute()
513502
{
514503
if (DocumentManager.IsValid() && DocumentManager->GetActiveTab().IsValid())
@@ -520,17 +509,6 @@ bool FPythonProjectEditor::Execute()
520509
return true;
521510
}
522511

523-
bool FPythonProjectEditor::ExecuteInSandbox()
524-
{
525-
if (DocumentManager.IsValid() && DocumentManager->GetActiveTab().IsValid())
526-
{
527-
TSharedRef<SPythonEditor> PythonEditorRef = StaticCastSharedRef<SPythonEditor>(DocumentManager->GetActiveTab()->GetContent());
528-
PythonEditorRef->ExecuteInSandbox();
529-
}
530-
531-
return true;
532-
}
533-
534512
bool FPythonProjectEditor::PEP8ize()
535513
{
536514
if (DocumentManager.IsValid() && DocumentManager->GetActiveTab().IsValid())

Source/PythonEditor/Private/PythonProjectEditor.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ class FPythonProjectEditor : public FWorkflowCentricApplication, public FGCObjec
6161

6262
bool Execute();
6363

64-
bool ExecuteInSandbox();
65-
6664
bool PEP8ize();
6765

6866
FString GetSafeName(bool IsDirectory);
@@ -82,8 +80,6 @@ class FPythonProjectEditor : public FWorkflowCentricApplication, public FGCObjec
8280

8381
void Execute_Internal();
8482

85-
void ExecuteInSandbox_Internal();
86-
8783
void PEP8ize_Internal();
8884

8985
bool CanNew() const;
@@ -105,4 +101,7 @@ class FPythonProjectEditor : public FWorkflowCentricApplication, public FGCObjec
105101
TSharedPtr<class FPythonProjectEditorToolbar> ToolbarBuilder;
106102

107103
static TWeakPtr<FPythonProjectEditor> PythonEditor;
104+
105+
virtual bool CanSaveAsset() const override { return false; }
106+
virtual bool CanFindInContentBrowser() const override { return false; }
108107
};

Source/PythonEditor/Private/PythonProjectEditorCommands.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ void FPythonProjectEditorCommands::RegisterCommands()
2121
UI_COMMAND(Save, "Save", "Save the currently active document.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::S));
2222
UI_COMMAND(SaveAll, "Save All", "Save all open documents.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::S));
2323
UI_COMMAND(Execute, "Execute", "Execute Current Python File.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control, EKeys::Enter));
24-
UI_COMMAND(ExecuteInSandbox, "Execute In Sandbox", "Execute Current Python File in a Sandbox.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::Enter));
2524
UI_COMMAND(PEP8ize, "PEP8-ize", "Enforce PEP8 to the current code.", EUserInterfaceActionType::Button, FInputGesture(EModifierKey::Control | EModifierKey::Shift, EKeys::P));
2625

2726
}

Source/PythonEditor/Private/PythonProjectEditorCommands.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class FPythonProjectEditorCommands : public TCommands<FPythonProjectEditorComman
1515
TSharedPtr<FUICommandInfo> Save;
1616
TSharedPtr<FUICommandInfo> SaveAll;
1717
TSharedPtr<FUICommandInfo> Execute;
18-
TSharedPtr<FUICommandInfo> ExecuteInSandbox;
1918
TSharedPtr<FUICommandInfo> PEP8ize;
2019
/** Initialize commands */
2120
virtual void RegisterCommands() override;

Source/PythonEditor/Private/PythonProjectEditorToolbar.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void FPythonProjectEditorToolbar::FillEditorToolbar(FToolBarBuilder& ToolbarBuil
3636
ToolbarBuilder.BeginSection(TEXT("CodeExcute"));
3737
{
3838
ToolbarBuilder.AddToolBarButton(FPythonProjectEditorCommands::Get().Execute);
39-
ToolbarBuilder.AddToolBarButton(FPythonProjectEditorCommands::Get().ExecuteInSandbox);
4039
ToolbarBuilder.AddToolBarButton(FPythonProjectEditorCommands::Get().PEP8ize);
4140
}
4241
ToolbarBuilder.EndSection();

Source/PythonEditor/Private/SPythonEditor.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,6 @@ void SPythonEditor::Execute() const
108108
PythonModule.RunString(TCHAR_TO_UTF8(*SelectionString));
109109
}
110110

111-
void SPythonEditor::ExecuteInSandbox() const
112-
{
113-
Save();
114-
FUnrealEnginePythonModule &PythonModule = FModuleManager::GetModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
115-
116-
FString SelectionString = PythonEditableText->GetSelectedText().ToString();
117-
if (SelectionString.Len() == 0) {
118-
SelectionString = PythonEditableText->GetText().ToString();
119-
}
120-
PythonModule.RunStringSandboxed(TCHAR_TO_UTF8(*SelectionString));
121-
}
122-
123111
void SPythonEditor::PEP8ize() const
124112
{
125113
Save();

Source/PythonEditor/Private/SPythonEditor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ class SPythonEditor : public SCompoundWidget
1616

1717
void Execute() const;
1818

19-
void ExecuteInSandbox() const;
20-
2119
void GotoLineAndColumn(int32 LineNumber, int32 ColumnNumber);
2220

2321
void PEP8ize() const;

Source/UnrealEnginePython/Private/PythonScript.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ void UPythonScript::Run()
2020
}
2121
}
2222

23-
void UPythonScript::RunSandboxed()
24-
{
25-
FUnrealEnginePythonModule &PythonModule = FModuleManager::GetModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
26-
PythonModule.RunFileSandboxed(TCHAR_TO_UTF8(*ScriptPath), callback, this);
27-
}
28-
2923
void UPythonScript::CallSpecificFunctionWithArgs()
3024
{
3125
PyObject *function_to_call = PyDict_GetItemString(PyEval_GetGlobals(), TCHAR_TO_UTF8(*FunctionToCall));

Source/UnrealEnginePython/Private/Slate/UEPyFMenuBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static PyObject *py_ue_fmenu_builder_add_menu_entry(ue_PyFMenuBuilder *self, PyO
3838
if (!PyArg_ParseTuple(args, "ssO|OO:add_menu_entry", &label, &tooltip, &py_callable, &py_obj, &py_uiaction_obj))
3939
return nullptr;
4040

41-
if (!PyCalllable_Check_Extended(py_callable))
41+
if (!PyCallable_Check(py_callable))
4242
{
4343
return PyErr_Format(PyExc_Exception, "argument is not callable");
4444
}

0 commit comments

Comments
 (0)