Skip to content

Commit 4c52e80

Browse files
authored
fix bug with showing self.exporting_done and self.applying_done functions
1 parent 290b221 commit 4c52e80

File tree

1 file changed

+75
-78
lines changed

1 file changed

+75
-78
lines changed

src/main_window.py

Lines changed: 75 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ def open_itemsDialog(self, w):
954954
self.desktop_row.set_activatable_widget(self.switch_de)
955955
self.itemsBox.append(child=self.desktop_row)
956956

957-
if flatpak:
957+
if flatpak:
958958
self.flatpak_row = Adw.ExpanderRow.new()
959959
self.flatpak_row.set_title(title=_["save_installed_flatpaks"])
960960
self.flatpak_row.set_subtitle(f'<a href="{flatpak_wiki}">{_["learn_more"]}</a>')
@@ -1168,7 +1168,7 @@ def open_config_save(self):
11681168
except Exception as e:
11691169
print("Can't run the config.py file!")
11701170
finally:
1171-
GLib.idle_add(self.exporting_done)
1171+
self.exporting_done()
11721172

11731173
# Import config from list
11741174
def imp_cfg_from_list(self, w):
@@ -1197,7 +1197,7 @@ def open_config_import(self):
11971197
except Exception as e:
11981198
print("Can't run the config.py file!")
11991199
finally:
1200-
GLib.idle_add(self.applying_done)
1200+
self.applying_done()
12011201

12021202
# "Please wait" information page on the "Save" page
12031203
def please_wait_save(self):
@@ -1266,40 +1266,39 @@ def back_to_main(w):
12661266
self.savewaitBox.remove(self.backtomButton)
12671267

12681268
# show the content below only if exists this file
1269-
if os.path.exists(f"{CACHE}/save_config/done_gui"):
1270-
self.notification_save = Gio.Notification.new("SaveDesktop")
1271-
self.notification_save.set_body(_["config_saved"])
1272-
active_window = app.get_active_window()
1273-
if active_window is None or not active_window.is_active():
1274-
app.send_notification(None, self.notification_save)
1275-
1276-
self.savewaitSpinner.stop()
1277-
self.savewaitBox.remove(self.savewaitButton)
1278-
1279-
# set title to "Configuration has been saved!"
1280-
self.set_title(_['config_saved'])
1281-
1282-
# use widget for showing done.svg icon
1283-
self.sdoneImage.set_from_icon_name("done")
1284-
self.sdoneImage.set_pixel_size(128)
1285-
1286-
# edit label for the purposes of this page
1287-
self.savewaitLabel.set_label(_["config_saved_desc"].format(_['config_saved']))
1288-
self.opensaveButton = Gtk.Button.new_with_label(_["open_folder"])
1289-
self.opensaveButton.add_css_class('pill')
1290-
self.opensaveButton.add_css_class('suggested-action')
1291-
self.opensaveButton.set_action_name('app.open-dir')
1292-
self.opensaveButton.set_margin_start(170)
1293-
self.opensaveButton.set_margin_end(170)
1294-
self.savewaitBox.append(self.opensaveButton)
1295-
1296-
# create button for backing to the previous page
1297-
self.backtomButton = Gtk.Button.new_with_label(_["back_to_page"])
1298-
self.backtomButton.connect("clicked", back_to_main)
1299-
self.backtomButton.add_css_class("pill")
1300-
self.backtomButton.set_margin_start(170)
1301-
self.backtomButton.set_margin_end(170)
1302-
self.savewaitBox.append(self.backtomButton)
1269+
self.notification_save = Gio.Notification.new("SaveDesktop")
1270+
self.notification_save.set_body(_["config_saved"])
1271+
active_window = app.get_active_window()
1272+
if active_window is None or not active_window.is_active():
1273+
app.send_notification(None, self.notification_save)
1274+
1275+
self.savewaitSpinner.stop()
1276+
self.savewaitBox.remove(self.savewaitButton)
1277+
1278+
# set title to "Configuration has been saved!"
1279+
self.set_title(_['config_saved'])
1280+
1281+
# use widget for showing done.svg icon
1282+
self.sdoneImage.set_from_icon_name("done")
1283+
self.sdoneImage.set_pixel_size(128)
1284+
1285+
# edit label for the purposes of this page
1286+
self.savewaitLabel.set_label(_["config_saved_desc"].format(_['config_saved']))
1287+
self.opensaveButton = Gtk.Button.new_with_label(_["open_folder"])
1288+
self.opensaveButton.add_css_class('pill')
1289+
self.opensaveButton.add_css_class('suggested-action')
1290+
self.opensaveButton.set_action_name('app.open-dir')
1291+
self.opensaveButton.set_margin_start(170)
1292+
self.opensaveButton.set_margin_end(170)
1293+
self.savewaitBox.append(self.opensaveButton)
1294+
1295+
# create button for backing to the previous page
1296+
self.backtomButton = Gtk.Button.new_with_label(_["back_to_page"])
1297+
self.backtomButton.connect("clicked", back_to_main)
1298+
self.backtomButton.add_css_class("pill")
1299+
self.backtomButton.set_margin_start(170)
1300+
self.backtomButton.set_margin_end(170)
1301+
self.savewaitBox.append(self.backtomButton)
13031302

13041303
# remove content in the cache directory
13051304
os.popen(f"rm -rf {CACHE}/save_config/")
@@ -1375,47 +1374,45 @@ def back_to_main(w):
13751374
self.importwaitBox.remove(self.logoutButton)
13761375
self.importwaitBox.remove(self.backtomButton)
13771376
self.headerbar.set_title_widget(self.switcher_title)
1378-
1379-
# show the content below only if exists this file
1380-
if os.path.exists(f"{CACHE}/import_config/done"):
1381-
self.notification_import = Gio.Notification.new("SaveDesktop")
1382-
self.notification_import.set_body(_["config_imported"])
1383-
active_window = app.get_active_window()
1384-
if active_window is None or not active_window.is_active():
1385-
app.send_notification(None, self.notification_import)
1386-
1387-
self.importwaitSpinner.stop()
1388-
self.importwaitBox.remove(self.importwaitButton)
1389-
1390-
# set title to "Configuration has been applied!"
1391-
self.set_title(_['config_imported'])
1392-
1393-
# widget for showing done.svg icon
1394-
self.idoneImage.set_from_icon_name("done")
1395-
self.idoneImage.set_pixel_size(128)
1396-
1397-
# edit label for the purposes of this page
1398-
self.importwaitLabel.set_label(_["config_imported_desc"].format(_['config_imported']))
1399-
1400-
# create button for loging out of the system
1401-
self.logoutButton = Gtk.Button.new_with_label(_["logout"])
1402-
self.logoutButton.add_css_class('pill')
1403-
self.logoutButton.add_css_class('suggested-action')
1404-
self.logoutButton.set_action_name('app.logout')
1405-
self.logoutButton.set_margin_start(170)
1406-
self.logoutButton.set_margin_end(170)
1407-
self.importwaitBox.append(self.logoutButton)
1408-
1409-
# create button for backing to the previous page
1410-
self.backtomButton = Gtk.Button.new_with_label(_["back_to_page"])
1411-
self.backtomButton.connect("clicked", back_to_main)
1412-
self.backtomButton.add_css_class("pill")
1413-
self.backtomButton.set_margin_start(170)
1414-
self.backtomButton.set_margin_end(170)
1415-
self.importwaitBox.append(self.backtomButton)
1416-
1417-
if not flatpak:
1418-
os.popen(f"rm -rf {CACHE}/import_config/*")
1377+
1378+
self.notification_import = Gio.Notification.new("SaveDesktop")
1379+
self.notification_import.set_body(_["config_imported"])
1380+
active_window = app.get_active_window()
1381+
if active_window is None or not active_window.is_active():
1382+
app.send_notification(None, self.notification_import)
1383+
1384+
self.importwaitSpinner.stop()
1385+
self.importwaitBox.remove(self.importwaitButton)
1386+
1387+
# set title to "Configuration has been applied!"
1388+
self.set_title(_['config_imported'])
1389+
1390+
# widget for showing done.svg icon
1391+
self.idoneImage.set_from_icon_name("done")
1392+
self.idoneImage.set_pixel_size(128)
1393+
1394+
# edit label for the purposes of this page
1395+
self.importwaitLabel.set_label(_["config_imported_desc"].format(_['config_imported']))
1396+
1397+
# create button for loging out of the system
1398+
self.logoutButton = Gtk.Button.new_with_label(_["logout"])
1399+
self.logoutButton.add_css_class('pill')
1400+
self.logoutButton.add_css_class('suggested-action')
1401+
self.logoutButton.set_action_name('app.logout')
1402+
self.logoutButton.set_margin_start(170)
1403+
self.logoutButton.set_margin_end(170)
1404+
self.importwaitBox.append(self.logoutButton)
1405+
1406+
# create button for backing to the previous page
1407+
self.backtomButton = Gtk.Button.new_with_label(_["back_to_page"])
1408+
self.backtomButton.connect("clicked", back_to_main)
1409+
self.backtomButton.add_css_class("pill")
1410+
self.backtomButton.set_margin_start(170)
1411+
self.backtomButton.set_margin_end(170)
1412+
self.importwaitBox.append(self.backtomButton)
1413+
1414+
if not flatpak:
1415+
os.popen(f"rm -rf {CACHE}/import_config/*")
14191416

14201417
# a warning indicating that the user must log out
14211418
def show_warn_toast(self):

0 commit comments

Comments
 (0)