remove native dialogs
This commit is contained in:
		@@ -68,12 +68,21 @@ margin_right = 350.0
 | 
			
		||||
margin_bottom = 750.0
 | 
			
		||||
size_flags_vertical = 3
 | 
			
		||||
 | 
			
		||||
[node name="TasksList" parent="VBoxContainer/TabContainer" instance=ExtResource( 2 )]
 | 
			
		||||
[node name="Task List" type="VBoxContainer" parent="VBoxContainer/TabContainer"]
 | 
			
		||||
anchor_right = 1.0
 | 
			
		||||
anchor_bottom = 1.0
 | 
			
		||||
margin_left = 5.0
 | 
			
		||||
margin_top = 46.0
 | 
			
		||||
margin_right = -5.0
 | 
			
		||||
margin_bottom = -5.0
 | 
			
		||||
 | 
			
		||||
[node name="TasksList" parent="VBoxContainer/TabContainer/Task List" instance=ExtResource( 2 )]
 | 
			
		||||
anchor_right = 0.0
 | 
			
		||||
anchor_bottom = 0.0
 | 
			
		||||
margin_right = 340.0
 | 
			
		||||
margin_bottom = 550.0
 | 
			
		||||
size_flags_horizontal = 3
 | 
			
		||||
size_flags_vertical = 3
 | 
			
		||||
 | 
			
		||||
[node name="Settings" type="ScrollContainer" parent="VBoxContainer/TabContainer"]
 | 
			
		||||
visible = false
 | 
			
		||||
 
 | 
			
		||||
@@ -2,17 +2,15 @@ extends Control
 | 
			
		||||
 | 
			
		||||
var config: ConfigManager = preload("res://config_manager.tres")
 | 
			
		||||
 | 
			
		||||
const NativeDialogs := preload("res://addons/native_dialogs/native_dialogs.gd")
 | 
			
		||||
 | 
			
		||||
onready var file_path_line_edit := $"%FilePathLineEdit" as LineEdit
 | 
			
		||||
onready var file_path_button := $"%FilePathButton" as Button
 | 
			
		||||
onready var theme_path_button := $"%ThemePathButton" as Button
 | 
			
		||||
onready var sound_check_box := $"%SoundCheckBox" as CheckBox
 | 
			
		||||
onready var open_data_dir_button := $"%OpenDataDirButton" as Button
 | 
			
		||||
onready var file_path_open_button := $"%FilePathOpenButton" as Button
 | 
			
		||||
onready var attributions_rich_text_label := $"%AttributionsRichTextLabel" as RichTextLabel
 | 
			
		||||
var file_path_file_dialog := NativeDialogs.SaveFile.new()
 | 
			
		||||
var theme_path_file_dialog := NativeDialogs.OpenFile.new()
 | 
			
		||||
onready var file_path_line_edit: LineEdit = $"%FilePathLineEdit" as LineEdit
 | 
			
		||||
onready var file_path_button: Button = $"%FilePathButton" as Button
 | 
			
		||||
onready var theme_path_button: Button = $"%ThemePathButton" as Button
 | 
			
		||||
onready var sound_check_box: CheckBox = $"%SoundCheckBox" as CheckBox
 | 
			
		||||
onready var open_data_dir_button: Button = $"%OpenDataDirButton" as Button
 | 
			
		||||
onready var file_path_open_button: Button = $"%FilePathOpenButton" as Button
 | 
			
		||||
onready var attributions_rich_text_label: RichTextLabel = $"%AttributionsRichTextLabel" as RichTextLabel
 | 
			
		||||
onready var file_path_file_dialog: FileDialog = $"%FilePathFileDialog" as  FileDialog
 | 
			
		||||
onready var theme_path_file_dialog: FileDialog = $"%ThemePathFileDialog" as FileDialog
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func _ready() -> void:
 | 
			
		||||
@@ -26,9 +24,8 @@ func _ready() -> void:
 | 
			
		||||
	# warning-ignore:return_value_discarded
 | 
			
		||||
	file_path_button.connect("pressed", self, "_on_file_path_button_pressed")
 | 
			
		||||
	
 | 
			
		||||
	file_path_file_dialog.filters = ["*.csv ; CSV Files"]
 | 
			
		||||
	file_path_file_dialog.force_overwrite = true
 | 
			
		||||
	add_child(file_path_file_dialog)
 | 
			
		||||
	# warning-ignore:return_value_discarded
 | 
			
		||||
	file_path_file_dialog.connect("visibility_changed", self, "_resize_on_dialog", [file_path_file_dialog])
 | 
			
		||||
	# warning-ignore:return_value_discarded
 | 
			
		||||
	file_path_file_dialog.connect("file_selected", self, "_on_current_file_selected")
 | 
			
		||||
	
 | 
			
		||||
@@ -38,10 +35,10 @@ func _ready() -> void:
 | 
			
		||||
	# warning-ignore:return_value_discarded
 | 
			
		||||
	theme_path_button.connect("pressed", self, "_on_theme_path_button_pressed")
 | 
			
		||||
	
 | 
			
		||||
	theme_path_file_dialog.filters = ["*.theme ; Theme Files"]
 | 
			
		||||
	add_child(theme_path_file_dialog)
 | 
			
		||||
	# warning-ignore:return_value_discarded
 | 
			
		||||
	theme_path_file_dialog.connect("files_selected", self, "_on_new_theme_selected")
 | 
			
		||||
	theme_path_file_dialog.connect("visibility_changed", self, "_resize_on_dialog", [theme_path_file_dialog])
 | 
			
		||||
	# warning-ignore:return_value_discarded
 | 
			
		||||
	theme_path_file_dialog.connect("file_selected", self, "_on_new_theme_selected")
 | 
			
		||||
	
 | 
			
		||||
	theme_path_file_dialog.hide()
 | 
			
		||||
	file_path_file_dialog.hide()
 | 
			
		||||
@@ -71,8 +68,7 @@ func _on_theme_changed() -> void:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func _on_file_path_button_pressed() -> void:
 | 
			
		||||
	file_path_file_dialog.initial_path = config.current_timesheet_file_path
 | 
			
		||||
	file_path_file_dialog.show()
 | 
			
		||||
	_set_file_dialog_file_path(file_path_file_dialog, config.current_timesheet_file_path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func _on_current_file_selected(new_file: String) -> void:
 | 
			
		||||
@@ -84,7 +80,7 @@ func _on_sound_toggle(is_on: bool) -> void:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func _on_theme_path_button_pressed() -> void:
 | 
			
		||||
	theme_path_file_dialog.initial_path = config.theme_file_path
 | 
			
		||||
	_set_file_dialog_file_path(theme_path_file_dialog, config.theme_file_path)
 | 
			
		||||
	theme_path_file_dialog.show()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -110,3 +106,19 @@ func _open_path(path: String):
 | 
			
		||||
	var canonical_path := ProjectSettings.globalize_path(path).strip_edges()
 | 
			
		||||
	# warning-ignore:return_value_discarded
 | 
			
		||||
	OS.shell_open("file://"+canonical_path)
 | 
			
		||||
 | 
			
		||||
func _set_file_dialog_file_path(dialog: FileDialog, path: String) -> void:
 | 
			
		||||
	#dialog.current_path = path
 | 
			
		||||
	#dialog.current_file = path
 | 
			
		||||
	dialog.current_dir = path.get_base_dir()
 | 
			
		||||
	dialog.show()
 | 
			
		||||
	dialog.invalidate()
 | 
			
		||||
 | 
			
		||||
var previous_window_size := OS.window_size
 | 
			
		||||
 | 
			
		||||
func _resize_on_dialog(dialog: Control) -> void:
 | 
			
		||||
	if dialog.visible == true:
 | 
			
		||||
		previous_window_size = OS.window_size
 | 
			
		||||
		OS.window_size = file_path_file_dialog.rect_size
 | 
			
		||||
	else:
 | 
			
		||||
		OS.window_size = previous_window_size
 | 
			
		||||
 
 | 
			
		||||
@@ -126,31 +126,26 @@ This game uses Godot Engine, available under the following license:
 | 
			
		||||
 | 
			
		||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
 | 
			
		||||
 | 
			
		||||
[node name="FilePathFileDialog" type="FileDialog" parent="CanvasLayer"]
 | 
			
		||||
unique_name_in_owner = true
 | 
			
		||||
visible = true
 | 
			
		||||
margin_top = 39.0
 | 
			
		||||
margin_right = 875.0
 | 
			
		||||
margin_bottom = 765.0
 | 
			
		||||
size_flags_horizontal = 3
 | 
			
		||||
size_flags_vertical = 3
 | 
			
		||||
window_title = "Pick a file"
 | 
			
		||||
resizable = true
 | 
			
		||||
dialog_hide_on_ok = true
 | 
			
		||||
mode_overrides_title = false
 | 
			
		||||
access = 2
 | 
			
		||||
filters = PoolStringArray( "*.csv ; Comma Separated Files" )
 | 
			
		||||
[node name="Popups" type="Control" parent="CanvasLayer"]
 | 
			
		||||
margin_right = 40.0
 | 
			
		||||
margin_bottom = 40.0
 | 
			
		||||
mouse_filter = 2
 | 
			
		||||
 | 
			
		||||
[node name="ThemePathFileDialog" type="FileDialog" parent="CanvasLayer"]
 | 
			
		||||
[node name="FilePathFileDialog" type="FileDialog" parent="CanvasLayer/Popups"]
 | 
			
		||||
unique_name_in_owner = true
 | 
			
		||||
anchor_right = 1.0
 | 
			
		||||
anchor_bottom = 1.0
 | 
			
		||||
size_flags_horizontal = 3
 | 
			
		||||
size_flags_vertical = 3
 | 
			
		||||
window_title = "Open a File"
 | 
			
		||||
resizable = true
 | 
			
		||||
margin_right = 1092.0
 | 
			
		||||
margin_bottom = 762.0
 | 
			
		||||
window_title = "Select CSV"
 | 
			
		||||
dialog_hide_on_ok = true
 | 
			
		||||
access = 2
 | 
			
		||||
filters = PoolStringArray( "*.csv ; CSV Files" )
 | 
			
		||||
 | 
			
		||||
[node name="ThemePathFileDialog" type="FileDialog" parent="CanvasLayer/Popups"]
 | 
			
		||||
unique_name_in_owner = true
 | 
			
		||||
margin_right = 1092.0
 | 
			
		||||
margin_bottom = 762.0
 | 
			
		||||
window_title = "Select a Theme File"
 | 
			
		||||
dialog_hide_on_ok = true
 | 
			
		||||
mode_overrides_title = false
 | 
			
		||||
mode = 0
 | 
			
		||||
access = 2
 | 
			
		||||
filters = PoolStringArray( "*.theme ; Theme Files" )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user