Skip to content

Commit e096b65

Browse files
committed
Final changes before release
1 parent 90180af commit e096b65

File tree

9 files changed

+35
-101
lines changed

9 files changed

+35
-101
lines changed

data/io.github.vikdevelop.SaveDesktop.metainfo.xml.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
<li>Refactored code base</li>
6767
<li>Snap support has been discontinued due to technical compatibility issues. Snap users can continue using v3.6.2-hotfix, but updates will only be provided for Flatpak or other methods.</li>
6868
<li>Removed the "Use Syncthing folder instead" from the Initial Synchronization setup dialog for GNOME-based environments</li>
69-
<li>Other minor UI improvements</li>
69+
<li>Removed the "Manually" option for periodic synchronization due to complications with encrypted archives</li>
70+
<li>Improved support for small screens</li>
7071
</ul>
7172
</description>
7273
</release>

po/savedesktop.pot

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ msgstr ""
112112
msgid "Monthly"
113113
msgstr ""
114114

115-
#: src/gui/more_options_dialog.py
116-
msgid "Manually"
117-
msgstr ""
118-
119115
#: src/gui/more_options_dialog.py
120116
msgid "Learn more"
121117
msgstr ""
@@ -415,11 +411,6 @@ msgstr ""
415411
msgid "From now on, you can sync the config from the menu in the header bar"
416412
msgstr ""
417413

418-
#: src/gui/templates/shortcuts_window.ui:50
419-
#: src/gui/window.py
420-
msgid "Synchronise manually"
421-
msgstr ""
422-
423414
#: src/gui/templates/shortcuts_window.ui:36
424415
#: src/gui/window.py
425416
msgid "Keyboard shortcuts"

src/core/archive.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def cleanup_cache_dir():
2121

2222
# Get password entered in the "Create a new password" dialog from the temporary file
2323
def get_password():
24-
temp_file = f"{CACHE}/temp_file"
24+
temp_file = f"{TEMP_CACHE}/temp_file"
2525
if os.path.exists(temp_file):
2626
with open(temp_file) as tmp:
2727
return tmp.read().strip()
@@ -31,8 +31,8 @@ def get_password():
3131

3232
# Remove above temporary file
3333
def remove_temp_file():
34-
if os.path.exists(f"{CACHE}/temp_file"):
35-
os.remove(f"{CACHE}/temp_file")
34+
if os.path.exists(f"{TEMP_CACHE}/temp_file"):
35+
os.remove(f"{TEMP_CACHE}/temp_file")
3636

3737
class Create:
3838
def __init__(self):

src/core/flatpaks_installer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python3
2-
import os
2+
import os, subprocess, sys
33
from pathlib import Path
4-
import subprocess
54

65
CACHE_FLATPAK = f"{Path.home()}/.var/app/io.github.vikdevelop.SaveDesktop/cache/tmp"
76

@@ -67,3 +66,6 @@
6766
autostart_file = f"{Path.home()}/.config/autostart/io.github.vikdevelop.SaveDesktop.Flatpak.desktop"
6867
if os.path.exists(autostart_file):
6968
os.remove(autostart_file)
69+
70+
# Remove this script after finishing the operations
71+
os.remove(sys.argv[0])

src/core/synchronization.py

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class Syncing:
1313
def __init__(self):
1414
self.last_sync_date = self.load_last_sync_date()
1515
if not settings["file-for-syncing"]:
16-
settings["manually-sync"] = False
1716
print("Synchronization is not set up.")
1817
else:
1918
self.get_sync_interval()
@@ -34,34 +33,21 @@ def get_sync_interval(self):
3433
"Daily2": 1,
3534
"Weekly2": 7,
3635
"Monthly2": 30,
37-
"Manually2": None
3836
}
3937
interval = intervals.get(settings["periodic-import"], None)
4038
if interval is None:
41-
settings["manually-sync"] = settings["periodic-import"] == "Manually2"
42-
if settings["manually-sync"]:
43-
self.check_manually_sync_status()
44-
else:
45-
print("Synchronization is not set up.")
39+
print("Synchronization is not set up. Maybe you have selected the Never interval?")
4640
else:
47-
settings["manually-sync"] = False
4841
self.check_and_sync(interval)
4942

5043
# Check, if the synchronization is necessary for that day
5144
def check_and_sync(self, interval):
5245
today = date.today()
5346
if (today - self.last_sync_date).days >= interval:
54-
self.check_manually_sync_status()
47+
self.download_config()
5548
else:
5649
print(f"Sync not needed today. Last sync was on {self.last_sync_date}.")
5750

58-
# Check, if "Manually" is the sync interval
59-
def check_manually_sync_status(self):
60-
if settings["periodic-import"] == "Manually2" and not os.path.exists(f"{CACHE}/.from_app"):
61-
print("Please sync from the Save Desktop app")
62-
else:
63-
self.download_config()
64-
6551
# Download the configuration archive from the cloud drive folder
6652
def download_config(self):
6753
print("MODE: Synchronization")
@@ -133,8 +119,8 @@ def try_passwordstore():
133119
self.password = try_passwordstore()
134120

135121
# #3 If password is still unavailable, get it from the {CACHE}/entered-password.txt file
136-
if not self.password and os.path.exists(f"{CACHE}/temp_file"):
137-
with open(f"{CACHE}/temp_file") as ep:
122+
if not self.password and os.path.exists(f"{CACHE}/workspace/temp_file"):
123+
with open(f"{CACHE}/workspace/temp_file") as ep:
138124
self.password = ep.read().strip()
139125

140126
# #4 Final check
@@ -151,13 +137,12 @@ def call_archive_command(self):
151137
self.archive_mode = "--unpack"
152138
self.archive_name = f"{settings['file-for-syncing']}/{self.file}.sd.zip"
153139

154-
subprocess.run([sys.executable, "-m", "savedesktop.core.archive", self.archive_mode, self.archive_name], env={**os.environ, "PYTHONPATH": f"{app_prefix}"})
140+
subprocess.run([sys.executable, "-m", "savedesktop.core.archive", self.archive_mode, self.archive_name], env={**os.environ, "PYTHONPATH": f"{app_prefix}"}, check=True)
155141
self.done()
156142

157143
def done(self):
158-
if not settings["manually-sync"]:
159-
with open(f"{DATA}/sync-info.json", "w") as s:
160-
json.dump({"last-synced": date.today().isoformat()}, s)
144+
with open(f"{DATA}/sync-info.json", "w") as s:
145+
json.dump({"last-synced": date.today().isoformat()}, s)
161146

162147
# Send a notification about finished synchronization
163148
os.system(f"notify-send 'Save Desktop Synchronization ({self.file})' '{_('The configuration has been applied!')} {_('Changes will only take effect after the next login')}' -i io.github.vikdevelop.SaveDesktop-symbolic")

src/gui/synchronization_dialogs.py

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def __init__(self, parent):
368368

369369
# Periodic sync section
370370
options = Gtk.StringList.new(strings=[
371-
_("Never"), _("Manually"), _("Daily"), _("Weekly"), _("Monthly")
371+
_("Never"), _("Daily"), _("Weekly"), _("Monthly")
372372
])
373373

374374
self.psyncRow = Adw.ComboRow.new()
@@ -377,15 +377,13 @@ def __init__(self, parent):
377377
self.psyncRow.set_title(_("Periodic synchronization"))
378378
self.psyncRow.set_title_lines(2)
379379
self.psyncRow.set_model(model=options)
380-
self.psyncRow.connect('notify::selected-item', self.on_psync_changed)
380+
self.psyncRow.connect('notify::selected-item', self._on_psync_changed)
381381
self.cloudBox.append(self.psyncRow)
382382

383383
# Load periodic sync values form GSettings database
384384
old_psync = settings["periodic-import"]
385385
if settings["periodic-import"] == "Never2":
386386
self.psyncRow.set_selected(0)
387-
elif settings["periodic-import"] == "Manually2":
388-
self.psyncRow.set_selected(1)
389387
elif settings["periodic-import"] == "Daily2":
390388
self.psyncRow.set_selected(2)
391389
elif settings["periodic-import"] == "Weekly2":
@@ -436,26 +434,25 @@ def reset_cloud_folder(self, w):
436434
[os.remove(path) for path in [f"{home}/.config/autostart/io.github.vikdevelop.SaveDesktop.sync.desktop", f"{DATA}/savedesktop-synchronization.sh"] if os.path.exists(path)]
437435

438436
# enable or disable the response of this dialog in depending on the selected periodic synchronization interval
439-
def on_psync_changed(self, psyncRow, GParamObject):
440-
if not self.psyncRow.get_selected_item().get_string() == _("Never") and not self.cfileRow.get_subtitle():
441-
self.set_response_enabled('ok', True)
437+
def _on_psync_changed(self, psyncRow, GParamObject):
438+
if not self.psyncRow.get_selected_item().get_string() == _("Never"):
439+
if not self.cfileRow.get_subtitle() == "":
440+
self.set_response_enabled('ok', True)
441+
else:
442+
self.set_response_enabled('ok', False)
442443

443444
# Action after closing URL dialog
444445
def cloudDialog_closed(self, w, response):
445446
if response == 'ok':
446447
self.check_psync = settings["periodic-import"]
447448
# translate the periodic sync options to English
448449
selected_item = self.psyncRow.get_selected_item()
449-
sync = {_("Never"): "Never2", _("Manually"): "Manually2", _("Daily"): "Daily2", _("Weekly"): "Weekly2", _("Monthly"): "Monthly2"}
450+
sync = {_("Never"): "Never2", _("Daily"): "Daily2", _("Weekly"): "Weekly2", _("Monthly"): "Monthly2"}
450451

451452
sync_item = sync.get(selected_item.get_string(), "Never2")
452453

453454
settings["periodic-import"] = sync_item
454455

455-
# if the selected periodic saving interval is "Manually2", it enables the manually-sync value
456-
if settings["periodic-import"] == "Manually2":
457-
settings["manually-sync"] = True
458-
459456
# save the status of the Bidirectional Synchronization switch
460457
settings["bidirectional-sync"] = self.bsSwitch.get_active()
461458

@@ -479,25 +476,15 @@ def _call_automount(self):
479476
else:
480477
raise AttributeError(_("You didn't select the cloud drive folder!"))
481478
except Exception as e:
482-
os.system(f'notify-send \'{_("An error occurred")}\' \'{e}\'')
479+
err_title = _("An error occurred")
480+
err_desc = str(e)
481+
subprocess.run(['notify-send', err_title, err_desc])
483482
return
484483
else:
485484
GLib.idle_add(self.__post_setup)
486485

487486
# check if the selected periodic sync interval was Never: if yes, shows the message about the necessity to log out of the system
488487
def __post_setup(self):
489488
if self.check_psync == "Never2":
490-
if not settings["periodic-import"] == "Never2" and not settings["periodic-import"] == "Manually2":
489+
if not settings["periodic-import"] == "Never2":
491490
self.parent.show_warn_toast()
492-
493-
# if it is selected to manually sync, it creates an option in the app menu in the header bar
494-
if settings["manually-sync"]:
495-
self.sync_menu = Gio.Menu()
496-
self.sync_menu.append(_("Synchronise manually"), 'app.m-sync-with-key')
497-
self.parent.main_menu.prepend_section(None, self.sync_menu)
498-
self.parent.show_special_toast()
499-
else:
500-
try:
501-
self.parent.sync_menu.remove_all()
502-
except:
503-
pass

src/gui/templates/shortcuts_window.ui

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@
4545
<property name="accelerator">&lt;primary&gt;q</property>
4646
</object>
4747
</child>
48-
<child>
49-
<object class="GtkShortcutsShortcut">
50-
<property name="title" translatable="yes">Synchronise manually</property>
51-
<property name="action-name">app.m_sync_with_key</property>
52-
<property name="accelerator">&lt;primary&gt;&lt;shift&gt;s</property>
53-
</object>
54-
</child>
5548
<child>
5649
<object class="GtkShortcutsShortcut">
5750
<property name="title" translatable="yes">More options</property>

src/gui/window.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ def __init__(self, *args, **kwargs):
4848
self.menu_button.set_primary(True)
4949
self.headerbar.pack_end(child=self.menu_button)
5050

51-
# add Manually sync section
52-
if settings["manually-sync"] == True:
53-
self.sync_menu = Gio.Menu()
54-
self.sync_menu.append(_("Synchronise manually"), 'app.m-sync-with-key')
55-
self.main_menu.prepend_section(None, self.sync_menu)
56-
5751
# primary layout
5852
self.headapp = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
5953
self.headapp.set_valign(Gtk.Align.CENTER)
@@ -466,7 +460,7 @@ def create_password_dialog(self):
466460
# Action after closing pswdDialog
467461
def _pswdDialog_closed(self, w, response):
468462
if response == 'ok':
469-
with open(f"{CACHE}/temp_file", "w") as tmp:
463+
with open(f"{CACHE}/workspace/temp_file", "w") as tmp:
470464
tmp.write(self.pswdEntry.get_text())
471465
self.save_config()
472466

@@ -523,13 +517,14 @@ def check_password_dialog(self):
523517
def _checkDialog_closed(self, w, response):
524518
if response == 'ok':
525519
self.checkDialog.set_response_enabled("ok", False)
526-
with open(f"{CACHE}/temp_file", "w") as tmp:
520+
with open(f"{CACHE}/workspace/temp_file", "w") as tmp:
527521
tmp.write(self.checkEntry.get_text())
528522

529523
self.import_config()
530524

531525
# Save configuration
532526
def save_config(self):
527+
print("Saving the configuration is in progress…\nFull output will be available after finishing this operation.")
533528
self.archive_mode = "--create"
534529
self.archive_name = f"{self.folder}/{self.filename_text}"
535530
self.status_title = _("<big><b>Saving configuration …</b></big>\nThe configuration of your desktop environment will be saved in:\n <i>{}/{}.sd.tar.gz</i>\n").split('</b>')[0].split('<b>')[-1]
@@ -549,6 +544,7 @@ def _set_status_desc_save(self):
549544

550545
# Import configuration
551546
def import_config(self):
547+
print("Importing the configuration is in progress…\nFull output will be available after finishing this operation.")
552548
self._identify_file_type()
553549

554550
self.archive_mode = "--unpack"
@@ -758,7 +754,7 @@ def on_close(self, w):
758754
os.remove(f"{CACHE}/expand_pb_row")
759755

760756
# Remove this folder to cleanup unnecessary content created during saving,
761-
# importing, or syncing the configuration only if the autostart file for
757+
# importing, or syncing the configuration only if the Python script for
762758
# installing Flatpaks is not present
763-
if not os.path.exists(f"{home}/.config/autostart/io.github.vikdevelop.SaveDesktop.Flatpak.desktop"):
759+
if not os.path.exists(f"{CACHE}/workspace/flatpaks_installer.py"):
764760
subprocess.Popen(["rm", "-rf", f"{CACHE}/workspace"])

src/main.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class SaveDesktopApp(Adw.Application):
1717
def __init__(self, **kwargs):
1818
super().__init__(**kwargs, flags=Gio.ApplicationFlags.FLAGS_NONE,
1919
application_id="io.github.vikdevelop.SaveDesktop")
20-
self.create_action('m-sync-with-key', self.sync_pc, ["<primary><shift>s"] if settings["manually-sync"] else None)
2120
self.create_action('save-config', self.call_saving_config, ["<primary>s"])
2221
self.create_action('import-config', self.call_importing_config, ["<primary>o"])
2322
self.create_action('ms-dialog', self.call_ms_dialog, ["<primary><shift>m"])
@@ -32,26 +31,6 @@ def __init__(self, **kwargs):
3231
self.create_action('about', self.on_about_action)
3332
self.connect('activate', self.on_activate)
3433

35-
# Synchronize configuation manually after clicking on the "Synchronise manually" button in the header bar menu
36-
def sync_pc(self, action, param):
37-
self.win.import_file = settings["file-for-syncing"]
38-
self.win.please_wait_import()
39-
sync_thread = Thread(target=self._sync_process)
40-
sync_thread.start()
41-
42-
def _sync_process(self):
43-
try:
44-
os.system(f'notify-send "{_("Please wait …")}"')
45-
os.system(f"echo > {CACHE}/.from_app")
46-
subprocess.run([sys.executable, "-m", "savedesktop.core.synchronization"], check=True, env={**os.environ, "PYTHONPATH": f"{app_prefix}"})
47-
except subprocess.CalledProcessError as e:
48-
GLib.idle_add(self.win.show_err_msg, e)
49-
self.toolbarview.set_content(self.headapp)
50-
self.headerbar.set_title_widget(self.switcher_title)
51-
self.switcher_bar.set_reveal(self.switcher_title.get_title_visible())
52-
finally:
53-
GLib.idle_add(self.win.applying_done())
54-
5534
# Start saving the configuration using Ctrl+S keyboard shortcut
5635
def call_saving_config(self, action, param):
5736
self.win.select_folder(w="")

0 commit comments

Comments
 (0)