mirror of
https://github.com/Relintai/pandemonium_cms.git
synced 2024-11-12 09:35:02 +01:00
Setup work for page entry editing.
This commit is contained in:
parent
1e71271517
commit
36e8b84eec
13
game/addons/web_pages/editor/AddEntryPopup.gd
Normal file
13
game/addons/web_pages/editor/AddEntryPopup.gd
Normal file
@ -0,0 +1,13 @@
|
||||
tool
|
||||
extends AcceptDialog
|
||||
|
||||
signal on_entry_class_selected(entry_class)
|
||||
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_INSTANCED:
|
||||
get_ok().set_text("Close")
|
||||
|
||||
get_node("HFlowContainer/AddTitleTextButton").connect("pressed", self, "_add_title_text_button_pressed")
|
||||
|
||||
func _add_title_text_button_pressed() -> void:
|
||||
emit_signal("on_entry_class_selected" , "WebPageEntryTitleText")
|
@ -1,45 +1,34 @@
|
||||
tool
|
||||
extends VBoxContainer
|
||||
extends PanelContainer
|
||||
|
||||
var PageEditor : PackedScene = null
|
||||
|
||||
var _wne_tool_bar_button : Button = null
|
||||
|
||||
var _page : WebPage = null
|
||||
var undo_redo : UndoRedo = null
|
||||
|
||||
var _entry_name_line_edit : LineEdit = null
|
||||
var _uri_segment_line_edit : LineEdit = null
|
||||
var _add_entry_popup : AcceptDialog = null
|
||||
|
||||
func set_page(page : WebPage):
|
||||
_page = page
|
||||
get_node("Name/PostNameLE").text = page.name
|
||||
get_node("URISegment/URISegmentLE").text = page.uri_segment
|
||||
# name = page.name
|
||||
|
||||
func _on_pageNameLE_text_entered(new_text : String):
|
||||
var le : LineEdit = get_node("Name/PostNameLE")
|
||||
|
||||
undo_redo.create_action("Page name changed.")
|
||||
undo_redo.add_do_property(_page, "name", new_text)
|
||||
undo_redo.add_undo_property(_page, "name", _page.name)
|
||||
undo_redo.add_do_property(le, "text", new_text)
|
||||
undo_redo.add_undo_property(le, "text", _page.name)
|
||||
undo_redo.add_do_property(self, "name", new_text)
|
||||
undo_redo.add_undo_property(self, "name", _page.name)
|
||||
undo_redo.commit_action()
|
||||
|
||||
func _on_URISegmentLE_text_entered(new_text : String):
|
||||
var le : LineEdit = get_node("URISegment/URISegmentLE")
|
||||
|
||||
undo_redo.create_action("Page uri segment changed.")
|
||||
undo_redo.add_do_property(_page, "uri_segment", new_text)
|
||||
undo_redo.add_undo_property(_page, "uri_segment", _page.uri_segment)
|
||||
undo_redo.add_do_property(le, "text", new_text)
|
||||
undo_redo.add_undo_property(le, "text", _page.uri_segment)
|
||||
undo_redo.commit_action()
|
||||
_entry_name_line_edit.text = page.name
|
||||
_uri_segment_line_edit.text = page.uri_segment
|
||||
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_INSTANCED:
|
||||
var le : LineEdit = get_node("Name/PostNameLE")
|
||||
le.connect("text_entered", self, "_on_pageNameLE_text_entered")
|
||||
var USle : LineEdit = get_node("URISegment/URISegmentLE")
|
||||
USle.connect("text_entered", self, "_on_URISegmentLE_text_entered")
|
||||
_entry_name_line_edit = get_node("MC/Name/EntryNameLineEdit")
|
||||
_entry_name_line_edit.connect("text_entered", self, "_on_entry_name_line_edit_text_entered")
|
||||
|
||||
_uri_segment_line_edit = get_node("MC/URISegment/URISegmentLE")
|
||||
_uri_segment_line_edit.connect("text_entered", self, "_on_uri_segment_line_edit_text_entered")
|
||||
|
||||
_add_entry_popup = get_node("Popups/AddEntryPopup")
|
||||
_add_entry_popup.connect("on_entry_class_selected", self, "_on_add_entry_class_selected")
|
||||
|
||||
PageEditor = ResourceLoader.load("res://addons/web_pages/editor/PageEditor.tscn", "PackedScene") as PackedScene
|
||||
elif what == NOTIFICATION_ENTER_TREE:
|
||||
var wne : Control = Engine.get_global("WebNodeEditor")
|
||||
if wne:
|
||||
@ -60,7 +49,24 @@ func _notification(what):
|
||||
var wne : Control = Engine.get_global("WebNodeEditor")
|
||||
if wne:
|
||||
wne.disconnect("edited_node_changed", self, "_edited_node_changed")
|
||||
|
||||
func _on_entry_name_line_edit_text_entered(new_text : String):
|
||||
undo_redo.create_action("Page name changed.")
|
||||
undo_redo.add_do_property(_page, "name", new_text)
|
||||
undo_redo.add_undo_property(_page, "name", _page.name)
|
||||
undo_redo.add_do_property(_entry_name_line_edit, "text", new_text)
|
||||
undo_redo.add_undo_property(_entry_name_line_edit, "text", _page.name)
|
||||
undo_redo.add_do_property(self, "name", new_text)
|
||||
undo_redo.add_undo_property(self, "name", _page.name)
|
||||
undo_redo.commit_action()
|
||||
|
||||
func _on_uri_segment_line_edit_text_entered(new_text : String):
|
||||
undo_redo.create_action("Page uri segment changed.")
|
||||
undo_redo.add_do_property(_page, "uri_segment", new_text)
|
||||
undo_redo.add_undo_property(_page, "uri_segment", _page.uri_segment)
|
||||
undo_redo.add_do_property(_uri_segment_line_edit, "text", new_text)
|
||||
undo_redo.add_undo_property(_uri_segment_line_edit, "text", _page.uri_segment)
|
||||
undo_redo.commit_action()
|
||||
|
||||
func _on_blog_editor_button_toggled(on):
|
||||
if on:
|
||||
@ -87,3 +93,5 @@ func _edited_node_changed(web_node : WebNode):
|
||||
#add method to switch off to the prev screen
|
||||
#wne.switch_to_main_screen_tab(self)
|
||||
|
||||
func _on_add_entry_class_selected(cls_name : String) -> void:
|
||||
print(cls_name)
|
||||
|
@ -1,46 +1,99 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/web_pages/editor/PageEditor.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/web_pages/icons/icon_web_page_entry_title_text.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/web_pages/editor/AddEntryPopup.gd" type="Script" id=3]
|
||||
|
||||
[node name="PostEditor" type="VBoxContainer"]
|
||||
margin_top = 28.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 28.0
|
||||
[node name="PostEditor" type="PanelContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Name" type="HBoxContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
[node name="MC" type="VBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 593.0
|
||||
|
||||
[node name="Name" type="HBoxContainer" parent="MC"]
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Label" type="Label" parent="Name"]
|
||||
[node name="Label" type="Label" parent="MC/Name"]
|
||||
margin_top = 5.0
|
||||
margin_right = 70.0
|
||||
margin_bottom = 19.0
|
||||
text = "Post Name"
|
||||
|
||||
[node name="PostNameLE" type="LineEdit" parent="Name"]
|
||||
[node name="EntryNameLineEdit" type="LineEdit" parent="MC/Name"]
|
||||
margin_left = 74.0
|
||||
margin_right = 1024.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
text = "BlogPost"
|
||||
align = 1
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="URISegment" type="HBoxContainer" parent="."]
|
||||
[node name="URISegment" type="HBoxContainer" parent="MC"]
|
||||
margin_top = 28.0
|
||||
margin_right = 1024.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 52.0
|
||||
|
||||
[node name="Label" type="Label" parent="URISegment"]
|
||||
[node name="Label" type="Label" parent="MC/URISegment"]
|
||||
margin_top = 5.0
|
||||
margin_right = 87.0
|
||||
margin_bottom = 19.0
|
||||
text = "URI Segment:"
|
||||
|
||||
[node name="URISegmentLE" type="LineEdit" parent="URISegment"]
|
||||
[node name="URISegmentLE" type="LineEdit" parent="MC/URISegment"]
|
||||
margin_left = 91.0
|
||||
margin_right = 1024.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 3
|
||||
text = "BlogPost"
|
||||
align = 1
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="EntriesContainer" type="ScrollContainer" parent="MC"]
|
||||
margin_top = 56.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 586.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Entries" type="VBoxContainer" parent="MC/EntriesContainer"]
|
||||
margin_right = 1010.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Popups" type="Control" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 593.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="AddEntryPopup" type="AcceptDialog" parent="Popups"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -100.0
|
||||
margin_top = -35.0
|
||||
margin_right = 100.0
|
||||
margin_bottom = 35.0
|
||||
window_title = "Add"
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="HFlowContainer" type="HFlowContainer" parent="Popups/AddEntryPopup"]
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 192.0
|
||||
margin_bottom = 34.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="AddTitleTextButton" type="Button" parent="Popups/AddEntryPopup/HFlowContainer"]
|
||||
margin_right = 89.0
|
||||
margin_bottom = 22.0
|
||||
text = "Title Text"
|
||||
icon = ExtResource( 2 )
|
||||
|
27
game/addons/web_pages/editor/PageEntryEditor.gd
Normal file
27
game/addons/web_pages/editor/PageEntryEditor.gd
Normal file
@ -0,0 +1,27 @@
|
||||
tool
|
||||
extends PanelContainer
|
||||
|
||||
var _entry : WebPageEntry = null
|
||||
|
||||
func set_entry(entry : WebPageEntry) -> void:
|
||||
_entry = entry
|
||||
|
||||
func _on_add_button_pressed():
|
||||
pass
|
||||
|
||||
func _on_up_button_pressed():
|
||||
pass
|
||||
|
||||
func _on_down_button_pressed():
|
||||
pass
|
||||
|
||||
func _on_delete_button_pressed():
|
||||
pass
|
||||
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_INSTANCED:
|
||||
get_node("VBoxContainer/HBoxContainer/AddButton").connect("pressed", self, "_on_add_button_pressed")
|
||||
get_node("VBoxContainer/HBoxContainer/UpButton").connect("pressed", self, "_on_up_button_pressed")
|
||||
get_node("VBoxContainer/HBoxContainer/DownButton").connect("pressed", self, "_on_down_button_pressed")
|
||||
get_node("VBoxContainer/HBoxContainer/Delete").connect("pressed", self, "_on_delete_button_pressed")
|
||||
|
53
game/addons/web_pages/editor/PageEntryEditor.tscn
Normal file
53
game/addons/web_pages/editor/PageEntryEditor.tscn
Normal file
@ -0,0 +1,53 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/web_pages/editor/PageEntryEditor.gd" type="Script" id=1]
|
||||
|
||||
[node name="Entry" type="PanelContainer"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 20.0
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 1017.0
|
||||
margin_bottom = 39.0
|
||||
|
||||
[node name="MainContainer" type="MarginContainer" parent="VBoxContainer"]
|
||||
margin_right = 1010.0
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||
margin_top = 4.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 8.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 12.0
|
||||
margin_right = 1010.0
|
||||
margin_bottom = 32.0
|
||||
alignment = 1
|
||||
|
||||
[node name="AddButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 414.0
|
||||
margin_right = 451.0
|
||||
margin_bottom = 20.0
|
||||
text = "Add"
|
||||
|
||||
[node name="UpButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 455.0
|
||||
margin_right = 485.0
|
||||
margin_bottom = 20.0
|
||||
text = "Up"
|
||||
|
||||
[node name="DownButton" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 489.0
|
||||
margin_right = 537.0
|
||||
margin_bottom = 20.0
|
||||
text = "Down"
|
||||
|
||||
[node name="Delete" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 541.0
|
||||
margin_right = 596.0
|
||||
margin_bottom = 20.0
|
||||
text = "Delete"
|
Loading…
Reference in New Issue
Block a user