Skip to content

Commit

Permalink
move autostart signal to misc_tab
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSpeedX committed Mar 5, 2023
1 parent 44998e5 commit 5752d81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/vorta/store/connection.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
from datetime import datetime, timedelta
from peewee import Tuple, fn
from playhouse import signals
from vorta.autostart import open_app_at_startup
from .migrations import run_migrations
from .models import (
DB,
Expand All @@ -21,12 +19,6 @@
SCHEMA_VERSION = 20


@signals.post_save(sender=SettingsModel)
def setup_autostart(model_class, instance, created):
if instance.key == 'autostart':
open_app_at_startup(instance.value)


def cleanup_db():
# Clean up database
DB.execute_sql("VACUUM")
Expand Down
3 changes: 3 additions & 0 deletions src/vorta/views/misc_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QCheckBox, QFormLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem
from vorta._version import __version__
from vorta.autostart import open_app_at_startup
from vorta.config import LOG_DIR
from vorta.i18n import translate
from vorta.store.models import BackupProfileMixin, SettingsModel
Expand Down Expand Up @@ -132,6 +133,8 @@ def on_setting_update(self, sender, instance: SettingsModel, created=False):
"""
if not created and instance.type == 'checkbox':
self.update_checkbox(instance.key, instance.value)
if instance.key == 'autostart':
open_app_at_startup(instance.value)

def update_checkbox(self, key, value):
"""
Expand Down

0 comments on commit 5752d81

Please sign in to comment.