Add files via upload

This commit is contained in:
fenix-hub 2019-09-24 17:03:49 +02:00 committed by GitHub
parent a4a2ca2d48
commit 436994326a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 183 additions and 35 deletions

View File

@ -2,7 +2,7 @@
A little plugin to easy-way manage your text files inside your project folder.
Author: *"Nicolo (fenix) Santilio"*
Version: *0.2.5*
Version: *0.3.1*
Godot Version: *3.1.1-stable*
**This repository was pushed directly from Godot Engine Editor thanks to [GitHub Integration](https://github.com/fenix-hub/godot-engine.github-integration)!**
@ -28,11 +28,12 @@ Then, go to `Project > Plugins > "File Editor" > Status > Activate`.
You can find this plugin in the AssetLib of Godot Engine Editor. Just download it from there and everything should be fine!
(Remember to activate this plugin)
#### Current version
### Current version
To check all the features included in the current version, please read the [VERSION file](./VERSION.md)
#### Upcoming features
### Upcoming features
To check all the features I'm currently working on, please read the [TODO file](./TODO.md)
# Want to contact me?
I'm planning to create a Discord group to collect each plugin I've made (and I will make), but until then you can directly talk with my via e-mail at *n.santilio97@gmail.com*

View File

@ -1,2 +1,4 @@
### to do (v-0.x.x)
- Popup dialog when closing a tab if there is new content
- Module for markdown support/conversion

View File

@ -23,8 +23,6 @@
**version 0.2.5**
*removed*
- Old layout
-----------------------
*added*
- New Layout
@ -33,3 +31,13 @@
-----------------------
**version 0.3.1**
*added*
- Version check
- Preview support
- Context menu in editor
- BBCode converter
- Light Mardkwon converter (DEMO)
-----------------------

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,6 +2,6 @@
name="File Editor"
description="An internal file editor to view and edit text files in your project folder."
author="Nicolò 'fenix' Santi"
version="0.2.5"
author="Nicolò 'fenix' Santilio"
version="0.3.1"
script="scripts/file-editor.gd"

View File

@ -1,11 +1,16 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://addons/file-editor/scripts/FileEditor.gd" type="Script" id=1]
[ext_resource path="res://addons/file-editor/icons/new.svg" type="Texture" id=2]
[ext_resource path="res://addons/file-editor/icons/file.svg" type="Texture" id=3]
[ext_resource path="res://addons/file-editor/icons/delete.svg" type="Texture" id=4]
[ext_resource path="res://addons/file-editor/fonts/Roboto-Black.ttf" type="DynamicFontData" id=5]
[sub_resource type="StyleBoxFlat" id=1]
[sub_resource type="DynamicFont" id=1]
size = 13
font_data = ExtResource( 5 )
[sub_resource type="StyleBoxFlat" id=2]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color( 0.196078, 0.231373, 0.309804, 1 )
@ -25,7 +30,7 @@ border_width_right = 1
border_color = Color( 0.121569, 0.145098, 0.192157, 1 )
expand_margin_bottom = 1.0
[sub_resource type="StyleBoxFlat" id=2]
[sub_resource type="StyleBoxFlat" id=4]
bg_color = Color( 0.121569, 0.145098, 0.192157, 1 )
draw_center = false
border_width_left = 1
@ -44,42 +49,50 @@ anchor_right = 1.0
anchor_bottom = 1.0
[node name="Buttons" type="HBoxContainer" parent="Container"]
editor/display_folded = true
margin_right = 1024.0
margin_bottom = 22.0
[node name="newfile_btn" type="Button" parent="Container/Buttons"]
margin_right = 338.0
margin_right = 337.0
margin_bottom = 22.0
size_flags_horizontal = 3
text = "Create new File"
icon = ExtResource( 2 )
[node name="openfile_btn" type="Button" parent="Container/Buttons"]
margin_left = 342.0
margin_right = 680.0
margin_left = 341.0
margin_right = 678.0
margin_bottom = 22.0
size_flags_horizontal = 3
text = "Open File"
icon = ExtResource( 3 )
[node name="deletefile_btn" type="Button" parent="Container/Buttons"]
margin_left = 684.0
margin_right = 1024.0
margin_left = 682.0
margin_right = 1019.0
margin_bottom = 22.0
size_flags_horizontal = 3
text = "Delete File"
icon = ExtResource( 4 )
[node name="version" type="Label" parent="Container/Buttons"]
margin_left = 1023.0
margin_top = 2.0
margin_right = 1023.0
margin_bottom = 19.0
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.121569, 0.145098, 0.192157, 1 )
align = 1
[node name="Editor" type="TabContainer" parent="Container"]
visible = false
margin_top = 32.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_vertical = 3
custom_styles/tab_fg = SubResource( 1 )
custom_styles/tab_fg = SubResource( 2 )
custom_styles/tab_bg = SubResource( 3 )
custom_styles/panel = SubResource( 2 )
custom_styles/panel = SubResource( 4 )
custom_colors/font_color_fg = Color( 1, 1, 1, 1 )
tab_align = 0
drag_to_rearrange_enabled = true

View File

@ -5,13 +5,11 @@
[ext_resource path="res://addons/file-editor/icons/edit.png" type="Texture" id=3]
[ext_resource path="res://addons/file-editor/fonts/Roboto-Black.ttf" type="DynamicFontData" id=4]
[sub_resource type="StyleBoxFlat" id=8]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color( 0.145098, 0.172549, 0.231373, 1 )
[sub_resource type="StyleBoxEmpty" id=1]
[sub_resource type="StyleBoxEmpty" id=2]
[sub_resource type="StyleBoxEmpty" id=3]
@ -22,7 +20,9 @@ bg_color = Color( 0.145098, 0.172549, 0.231373, 1 )
[sub_resource type="StyleBoxEmpty" id=6]
[sub_resource type="DynamicFont" id=7]
[sub_resource type="StyleBoxEmpty" id=7]
[sub_resource type="DynamicFont" id=8]
font_data = ExtResource( 4 )
[node name="filename" type="VBoxContainer"]
@ -40,7 +40,6 @@ margin_right = 1016.0
margin_bottom = 4.0
[node name="TopBar" type="HBoxContainer" parent="."]
editor/display_folded = true
margin_top = 8.0
margin_right = 1016.0
margin_bottom = 28.0
@ -53,11 +52,11 @@ margin_bottom = 20.0
margin_left = 8.0
margin_right = 51.0
margin_bottom = 20.0
custom_styles/hover = SubResource( 8 )
custom_styles/normal = SubResource( 8 )
custom_styles/hover = SubResource( 1 )
custom_styles/normal = SubResource( 1 )
text = "File"
flat = false
items = [ "Save File", null, 0, false, false, 0, 0, null, "", false, "Save file As...", null, 0, false, false, 1, 0, null, "", false ]
items = [ "Save File", null, 0, false, false, 0, 0, null, "", false, "Save file As...", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Normal Preview", null, 0, false, false, 2, 0, null, "", false, "BBCode Preview", null, 0, false, false, 3, 0, null, "", false, "Markdown Preview (DEMO)", null, 0, false, false, 4, 0, null, "", false ]
[node name="filepath" type="Label" parent="TopBar"]
margin_left = 519.0
@ -90,7 +89,8 @@ highlight_all_occurrences = true
smooth_scrolling = true
wrap_enabled = true
caret_blink = true
caret_blink_speed = 0.1
caret_blink_speed = 1.0
caret_moving_by_right_click = false
[node name="FileInfo" type="HBoxContainer" parent="."]
editor/display_folded = true
@ -117,13 +117,13 @@ margin_bottom = 19.0
size_flags_horizontal = 10
custom_icons/checked = ExtResource( 2 )
custom_icons/unchecked = ExtResource( 3 )
custom_styles/hover = SubResource( 1 )
custom_styles/pressed = SubResource( 2 )
custom_styles/focus = SubResource( 3 )
custom_styles/disabled = SubResource( 4 )
custom_styles/hover_pressed = SubResource( 5 )
custom_styles/normal = SubResource( 6 )
custom_fonts/font = SubResource( 7 )
custom_styles/hover = SubResource( 2 )
custom_styles/pressed = SubResource( 3 )
custom_styles/focus = SubResource( 4 )
custom_styles/disabled = SubResource( 5 )
custom_styles/hover_pressed = SubResource( 6 )
custom_styles/normal = SubResource( 7 )
custom_fonts/font = SubResource( 8 )
custom_colors/font_color = Color( 0.145098, 0.172549, 0.231373, 1 )
custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
text = "Can Edit"

View File

@ -0,0 +1,53 @@
[gd_scene load_steps=12 format=2]
[ext_resource path="res://addons/file-editor/scripts/Preview.gd" type="Script" id=1]
[ext_resource path="res://addons/file-editor/fonts/COUR.TTF" type="DynamicFontData" id=2]
[ext_resource path="res://addons/file-editor/fonts/Carlito-BoldItalic.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://addons/file-editor/fonts/Carlito-Italic.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://addons/file-editor/fonts/Carlito-Bold.ttf" type="DynamicFontData" id=5]
[ext_resource path="res://addons/file-editor/fonts/Carlito-Regular.ttf" type="DynamicFontData" id=6]
[sub_resource type="DynamicFont" id=5]
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=1]
font_data = ExtResource( 3 )
[sub_resource type="DynamicFont" id=2]
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=3]
font_data = ExtResource( 5 )
[sub_resource type="DynamicFont" id=4]
font_data = ExtResource( 6 )
[node name="Preview" type="WindowDialog"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 81.0
margin_top = 47.0
margin_right = -80.0
margin_bottom = -48.0
window_title = "File preview"
resizable = true
script = ExtResource( 1 )
[node name="Container" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="TextPreview" type="RichTextLabel" parent="Container"]
margin_right = 863.0
margin_bottom = 505.0
size_flags_vertical = 3
custom_fonts/mono_font = SubResource( 5 )
custom_fonts/bold_italics_font = SubResource( 1 )
custom_fonts/italics_font = SubResource( 2 )
custom_fonts/bold_font = SubResource( 3 )
custom_fonts/normal_font = SubResource( 4 )
bbcode_enabled = true
scroll_following = true
[connection signal="popup_hide" from="." to="." method="_on_Preview_popup_hide"]

View File

@ -12,6 +12,8 @@ onready var DeleteFile = $Container/Buttons/deletefile_btn
onready var NewFileDialogue = $NewFileDialogue
onready var NewFileDialogue_name = $NewFileDialogue/VBoxContainer/new_filename
onready var Version = $Container/Buttons/version
var FileScene = load("res://addons/file-editor/scenes/FileScene.tscn")
var DIRECTORY : String = "res://"
@ -31,7 +33,6 @@ var EXTENSIONS : PoolStringArray = [
var directories = []
var files = []
func _ready():
OpenFile.connect("pressed",self,"open_selected_file")
NewFile.connect("pressed",self,"open_newfiledialogue")
@ -45,6 +46,16 @@ func _ready():
FileList.set_filters(EXTENSIONS)
Editor.hide()
var plugin_version = ""
var config = ConfigFile.new()
var err = config.load("res://addons/file-editor/plugin.cfg")
if err == OK:
plugin_version = config.get_value("plugin","version")
update_version("v"+plugin_version)
func update_version(v : String):
Version.set_text(v)
func open_file(path : String):
var current_file : File = File.new()

View File

@ -17,6 +17,8 @@ onready var FilePath = $TopBar/filepath
var current_path = ""
var current_filename = ""
var Preview = load("res://addons/file-editor/scenes/Preview.tscn")
func _ready():
FileButton.connect("id_pressed",self,"button_pressed")
@ -55,6 +57,7 @@ func save_file(current_path : String):
current_content = ""
current_file.store_line(current_content)
current_file.close()
var last_modified = OS.get_datetime_from_unix_time(current_file.get_modified_time(current_path))
LastModified.set_text(str(last_modified.hour)+":"+str(last_modified.minute)+" "+str(last_modified.day)+"/"+str(last_modified.month)+"/"+str(last_modified.year))
@ -84,6 +87,30 @@ func button_pressed(id : int):
save_file(current_path)
elif id == 1:
save_file_as()
elif id == 2:
open_preview()
elif id == 3:
bbcode_preview()
elif id == 4:
markdown_preview()
func open_preview():
var preview = Preview.instance()
get_parent().get_parent().get_parent().add_child(preview)
preview.popup()
preview.print_preview(TextEditor.get_text())
func bbcode_preview():
var preview = Preview.instance()
get_parent().get_parent().get_parent().add_child(preview)
preview.popup()
preview.print_bb(TextEditor.get_text())
func markdown_preview():
var preview = Preview.instance()
get_parent().get_parent().get_parent().add_child(preview)
preview.popup()
preview.print_markdown(TextEditor.get_text())
func close_editor():
queue_free()

View File

@ -0,0 +1,31 @@
tool
extends WindowDialog
onready var TextPreview = $Container/TextPreview
func _ready():
pass
func print_preview(content : String):
TextPreview.append_bbcode(content)
func print_bb(content : String):
TextPreview.append_bbcode(content)
func print_markdown(content : String):
content = content.replace(" **"," [b]")
content = content.replace("**","[/b]")
content = content.replace(" *"," [i]")
content = content.replace("*","[/i] ")
content = content.replace(" ~~","[s] ")
content = content.replace("~~","[/s]")
content = content.replace(" `"," [code]")
content = content.replace("`","[/code]")
TextPreview.append_bbcode(content)
func _on_Preview_popup_hide():
queue_free()

View File

@ -2,11 +2,13 @@ tool
extends EditorPlugin
var doc
var plugin_version
func _enter_tree():
doc = preload("../scenes/FileEditor.tscn").instance()
add_control_to_dock(EditorPlugin.DOCK_SLOT_LEFT_BR,doc)
func _exit_tree():
remove_control_from_docks(doc)
doc.queue_free()