Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rayforge/addon_mgr/update_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def check_for_updates_on_startup(self):
Initiates a background task to check for addon updates.
This method is non-blocking.
"""
if not self._context.config.check_for_addon_updates:
logger.info("Automatic addon update check disabled by user.")
return
logger.info("Scheduling startup addon update check.")
self._task_mgr.add_coroutine(
self._check_for_updates_worker, key="addon-update-check"
Expand Down
12 changes: 12 additions & 0 deletions rayforge/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __init__(self):
self.auto_pipeline: bool = True
self.ops_color_mode: OpsColorMode = OpsColorMode.LASER
self.check_for_app_updates: bool = True
self.check_for_addon_updates: bool = True
# Whether to watch imported files and offer to reload them when
# they change on disk.
self.watch_source_files: bool = True
Expand Down Expand Up @@ -224,6 +225,13 @@ def set_check_for_app_updates(self, enabled: bool):
self.check_for_app_updates = enabled
self.changed.send(self)

def set_check_for_addon_updates(self, enabled: bool):
"""Sets whether to check for addon updates on startup."""
if self.check_for_addon_updates == enabled:
return
self.check_for_addon_updates = enabled
self.changed.send(self)

def set_watch_source_files(self, enabled: bool):
"""Sets whether imported files are watched for changes."""
if self.watch_source_files == enabled:
Expand Down Expand Up @@ -352,6 +360,7 @@ def to_dict(self) -> dict[str, Any]:
"canvas_view": self.canvas_view.to_dict(),
"auto_pipeline": self.auto_pipeline,
"check_for_app_updates": self.check_for_app_updates,
"check_for_addon_updates": self.check_for_addon_updates,
"watch_source_files": self.watch_source_files,
"ops_color_mode": self.ops_color_mode.value,
"usage_consent_date": self.usage_consent_date,
Expand Down Expand Up @@ -417,6 +426,9 @@ def from_dict(cls, data: dict[str, Any], get_machine_by_id) -> "Config":
)
config.auto_pipeline = data.get("auto_pipeline", True)
config.check_for_app_updates = data.get("check_for_app_updates", True)
config.check_for_addon_updates = data.get(
"check_for_addon_updates", True
)
config.watch_source_files = data.get("watch_source_files", True)

ops_color_mode_str = data.get(
Expand Down
15 changes: 15 additions & 0 deletions rayforge/ui_gtk/settings/general_preferences_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ def __init__(self, **kwargs):
)
startup_group.add(self.check_updates_row)

self.check_addon_updates_row = Adw.SwitchRow(
title=_("Check for addon updates"),
subtitle=_("Automatically check for addon updates on startup"),
)
self.check_addon_updates_row.set_active(config.check_for_addon_updates)
self.check_addon_updates_row.connect(
"notify::active", self.on_check_addon_updates_changed
)
startup_group.add(self.check_addon_updates_row)

self.watch_sources_row = Adw.SwitchRow(
title=_("Watch imported files"),
subtitle=_(
Expand Down Expand Up @@ -594,6 +604,11 @@ def on_check_updates_changed(self, switch_row, _):
enabled = switch_row.get_active()
get_context().config.set_check_for_app_updates(enabled)

def on_check_addon_updates_changed(self, switch_row, _):
"""Called when the user toggles addon update checks."""
enabled = switch_row.get_active()
get_context().config.set_check_for_addon_updates(enabled)

def on_watch_sources_changed(self, switch_row, _):
"""Called when the user toggles watching imported files."""
enabled = switch_row.get_active()
Expand Down
18 changes: 18 additions & 0 deletions tests/addon_mgr/test_addon_update_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def mock_context():
"""Provides a mock RayforgeContext with mocked managers."""
context = MagicMock()
context.addon_mgr = MagicMock()
context.config.check_for_addon_updates = True
return context


Expand All @@ -54,6 +55,23 @@ def update_command(mock_context):


class TestUpdateCheck:
async def test_startup_check_schedules_when_enabled(self, update_command):
update_command.check_for_updates_on_startup()

update_command._task_mgr.add_coroutine.assert_called_once_with(
update_command._check_for_updates_worker,
key="addon-update-check",
)

async def test_startup_check_does_not_schedule_when_disabled(
self, update_command, mock_context
):
mock_context.config.check_for_addon_updates = False

update_command.check_for_updates_on_startup()

update_command._task_mgr.add_coroutine.assert_not_called()

async def test_check_for_updates_worker_no_updates(
self, update_command, mock_context
):
Expand Down
1 change: 1 addition & 0 deletions tests/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ canvas_view:
show_workpiece_image: false
show_workpieces: true
check_for_app_updates: true
check_for_addon_updates: true
default_stock_material_uid: null
default_stock_thickness_mm: 18.0
import_dpi: 96.0
Expand Down
33 changes: 33 additions & 0 deletions tests/core/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,36 @@ def test_round_trip(self):
def test_absent_key_falls_back_to_true(self):
restored = Config.from_dict({}, get_machine_by_id=lambda mid: None)
assert restored.watch_source_files is True


class TestAddonUpdateChecks:
def test_defaults_to_true(self):
assert Config().check_for_addon_updates is True

def test_setter_emits_changed_once(self):
config = Config()
calls = []

def on_changed(sender, **kwargs):
calls.append(sender)

config.changed.connect(on_changed, weak=False)

config.set_check_for_addon_updates(False)
config.set_check_for_addon_updates(False)

assert len(calls) == 1

def test_round_trip(self):
config = Config()
config.set_check_for_addon_updates(False)
data = config.to_dict()

restored = Config.from_dict(data, get_machine_by_id=lambda mid: None)

assert data["check_for_addon_updates"] is False
assert restored.check_for_addon_updates is False

def test_absent_key_falls_back_to_true(self):
restored = Config.from_dict({}, get_machine_by_id=lambda mid: None)
assert restored.check_for_addon_updates is True
3 changes: 3 additions & 0 deletions website/docs/ui/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ recalculation manually via the toolbar button instead.
Rayforge can **Check for updates** automatically on startup. When enabled, you will be notified when
a new version is available.

Rayforge can also **Check for addon updates** automatically on startup. Disabling this does not
prevent manual checks from the Addons page.

With **Watch imported files** enabled, Rayforge monitors the files behind imported workpieces and
offers to reload them when they change on disk. See
[Keeping Imported Files in Sync](../files/importing.md#keeping-imported-files-in-sync) for details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Symbolleisten-Schaltfläche auslösen.
Rayforge kann beim Start **automatisch nach Updates suchen**. Wenn aktiviert, wirst du
benachrichtigt, wenn eine neue Version verfügbar ist.

Rayforge kann beim Start außerdem **automatisch nach Addon-Updates suchen**. Das Deaktivieren
verhindert keine manuellen Prüfungen auf der Addons-Seite.

Ist **Importierte Dateien beobachten** aktiviert, überwacht Rayforge die Dateien hinter importierten
Werkstücken und bietet an, sie neu zu laden, wenn sie sich auf der Festplatte ändern. Details
findest du unter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ operaciones** y activar el recálculo manualmente vía el botón de la barra de
Rayforge puede **Buscar actualizaciones** automáticamente al inicio. Cuando está habilitado, se te
notificará cuando haya una nueva versión disponible.

Rayforge también puede **Buscar actualizaciones de complementos** automáticamente al inicio.
Desactivar esta opción no impide las comprobaciones manuales desde la página Complementos.

Con **Vigilar archivos importados** activado, Rayforge supervisa los archivos detrás de las piezas
de trabajo importadas y ofrece recargarlas cuando cambian en el disco. Consulta
[Mantener los archivos importados sincronizados](../files/importing.md#mantener-los-archivos-importados-sincronizados)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ la barre d'outils.
Rayforge peut **Vérifier les mises à jour** automatiquement au démarrage. Lorsqu'activé, tu seras
informé lorsqu'une nouvelle version est disponible.

Rayforge peut aussi **Vérifier les mises à jour des extensions** automatiquement au démarrage.
Désactiver cette option n'empêche pas les vérifications manuelles depuis la page Extensions.

Lorsque **Surveiller les fichiers importés** est activé, Rayforge surveille les fichiers derrière
les pièces importées et propose de les recharger lorsqu'ils changent sur le disque. Voir
[Garder les fichiers importés synchronisés](../files/importing.md#garder-les-fichiers-importés-synchronisés)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ Settings** द्वारा खोलें या <kbd>ctrl+comma</kbd> द
Rayforge स्टार्टअप पर स्वतः **अपडेट के लिए जाँच** कर सकता है. सक्षम होने पर, नया संस्करण उपलब्ध होने
पर आपको सूचित किया जाएगा.

Rayforge स्टार्टअप पर **ऐडऑन अपडेट की जाँच** भी स्वतः कर सकता है. इसे अक्षम करने से ऐडऑन पृष्ठ से
मैन्युअल जाँच नहीं रुकती.

**Watch imported files** चालू होने पर, Rayforge आयातित वर्कपीस के पीछे की फ़ाइलों पर नज़र रखता है और
जब वे डिस्क पर बदलती हैं तो उन्हें फिर से लोड करने का प्रस्ताव देता है. विवरण के लिए
[आयात की गई फ़ाइलों को सिंक में रखना](../files/importing.md#आयात-की-गई-फ़ाइलों-को-सिंक-में-रखना)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ automaticamente** e acionar o recálculo manualmente pelo botão na barra de fer
O Rayforge pode **Verificar atualizações** automaticamente na inicialização. Quando habilitado, você
será notificado quando uma nova versão estiver disponível.

O Rayforge também pode **Verificar atualizações de addons** automaticamente na inicialização.
Desativar essa opção não impede verificações manuais na página Addons.

Com **Vigiar arquivos importados** ativado, o Rayforge monitora os arquivos por trás das peças de
trabalho importadas e oferece recarregá-los quando eles mudam no disco. Veja
[Mantendo os arquivos importados sincronizados](../files/importing.md#mantendo-os-arquivos-importados-sincronizados)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
Rayforge може **Перевіряти оновлення** автоматично при запуску. Якщо увімкнено, ви отримаєте
сповіщення, коли буде доступна нова версія.

Rayforge також може **Перевіряти оновлення доповнень** автоматично при запуску. Вимкнення цього
параметра не забороняє ручну перевірку на сторінці «Доповнення».

Коли **Стежити за імпортованими файлами** увімкнено, Rayforge стежить за файлами за імпортованими
робочими деталями та пропонує перезавантажити їх, коли вони змінюються на диску. Детальніше — у
розділі
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

Rayforge 可以在启动时**自动检查更新**。启用后,当有新版本可用时会通知您。

Rayforge 还可以在启动时**自动检查扩展更新**。禁用此选项不会阻止在“扩展”页面中手动检查更新。

启用**监视导入文件**(Watch imported
files)后,Rayforge 会监视导入工件背后的文件,并在它们在磁盘上发生更改时提议重新加载。详情请参阅
[保持导入文件同步](../files/importing.md#保持导入文件同步)。
Expand Down
Loading