changed data dir creation

This commit is contained in:
DYefremov
2020-05-03 00:22:16 +03:00
parent 1c9c58d48a
commit 7c2840c570

View File

@@ -160,7 +160,6 @@ class Application(Gtk.Application):
self._settings = Settings.get_instance() self._settings = Settings.get_instance()
self._s_type = self._settings.setting_type self._s_type = self._settings.setting_type
os.makedirs(os.path.dirname(self._settings.data_local_path), exist_ok=True)
# Used for copy/paste. When adding the previous data will not be deleted. # Used for copy/paste. When adding the previous data will not be deleted.
# Clearing only after the insertion! # Clearing only after the insertion!
self._rows_buffer = [] self._rows_buffer = []
@@ -1054,23 +1053,29 @@ class Application(Gtk.Application):
def update_data(self, data_path, callback=None): def update_data(self, data_path, callback=None):
self._profile_combo_box.set_sensitive(False) self._profile_combo_box.set_sensitive(False)
self._wait_dialog.show() self._wait_dialog.show()
yield True
data_path = self._settings.data_local_path if data_path is None else data_path
yield from self.clear_current_data() yield from self.clear_current_data()
try: try:
current_profile = self._profile_combo_box.get_active_text() current_profile = self._profile_combo_box.get_active_text()
if not current_profile:
self.show_error_dialog("No profile selected!")
return
if current_profile != self._settings.current_profile: if current_profile != self._settings.current_profile:
self.init_profiles(self._settings.current_profile) self.init_profiles(self._settings.current_profile)
if data_path != self._settings.data_local_path: data_path = self._settings.data_local_path if data_path is None else data_path
local_path = self._settings.data_local_path
os.makedirs(os.path.dirname(local_path), exist_ok=True)
if data_path != local_path:
from shutil import copyfile from shutil import copyfile
for f in STC_XML_FILE: for f in STC_XML_FILE:
xml_src = data_path + f xml_src = data_path + f
if os.path.isfile(xml_src): if os.path.isfile(xml_src):
copyfile(xml_src, self._settings.data_local_path + f) copyfile(xml_src, local_path + f)
prf = self._s_type prf = self._s_type
black_list = get_blacklist(data_path) black_list = get_blacklist(data_path)