diff --git a/ExplorerCreateFile/a2_local_element_file_list.py b/ExplorerCreateFile/a2_local_element_file_list.py index 0b8316c..ca31b94 100644 --- a/ExplorerCreateFile/a2_local_element_file_list.py +++ b/ExplorerCreateFile/a2_local_element_file_list.py @@ -1,6 +1,5 @@ import os -import a2ahk import a2util import a2ctrl from a2ctrl import Icons @@ -22,6 +21,10 @@ def __init__(self, *args): self.editor.ui.item_editor_layout.setStretch(0, 1) self.editor.ui.item_editor_layout.setStretch(1, 4) self.editor.ignore_default_values = False + if not self.user_cfg: + self.editor.set_data(a2util.json_read(os.path.join(THIS_DIR, 'defaults.json'))) + self.check() + self.editor.set_data(self.user_cfg) self.editor.data_changed.connect(self.delayed_check) self.main_layout.addWidget(self.editor) @@ -52,7 +55,6 @@ def __init__(self, *args): encoding_combo = a2combo.A2Combo(self) encoding_combo.setEditable(True) encoding_combo.addItems(ENCODINGS) - icon_size = self.a2.win.style.get('icon_size_small') encoding_help = QtWidgets.QToolButton(autoRaise=True, icon=Icons.help) encoding_help.clicked.connect(_encoding_docs) combo_lyt = QtWidgets.QHBoxLayout() @@ -97,7 +99,7 @@ def element_name(): @staticmethod def element_icon(): - return a2ctrl.Icons.inst().check + return a2ctrl.Icons.check def get_settings(module_key, cfg, db_dict, user_cfg): diff --git a/ExplorerCreateFile/a2module.json b/ExplorerCreateFile/a2module.json index 3f8b952..780e4fb 100644 --- a/ExplorerCreateFile/a2module.json +++ b/ExplorerCreateFile/a2module.json @@ -11,7 +11,7 @@ ], "typ": "nfo", "url": "https://github.com/ewerybody/a2.modules/tree/master/ExplorerCreateFile#explorercreatefile", - "version": "0.4" + "version": "0.5" }, { "children": [ diff --git a/ExplorerCreateFile/defaults.json b/ExplorerCreateFile/defaults.json new file mode 100644 index 0000000..c18d1f8 --- /dev/null +++ b/ExplorerCreateFile/defaults.json @@ -0,0 +1,24 @@ +{ + "Autohotkey": { + "ext": ".ahk", + "file_name": "ahk_script", + "content": "#SingleInstance, Force\nSendMode, Input\nSetWorkingDir, %A_ScriptDir%", + "encoding": "UTF-8 (with BOM)", + "ask": true + }, + "Python": { + "ext": ".py", + "file_name": "__init__", + "content": "def main():\n pass\n\nif __name__ == '__main__':\n main()", + "ask": true + }, + "Text": { + "ext": ".txt", + "file_name": "readme", + "encoding": "UTF-8 (Raw)", + "ask": true + }, + ".any": { + "ask": true + } +} \ No newline at end of file