Skip to content
Open
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
4 changes: 4 additions & 0 deletions i18n/si/msgs.jaml
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,10 @@ utils/filedialogs.py:
(none): false
def `update_file_list`:
basedir: false
class `LocalRecentPathsWComboMixin`:
def `migrate_to_local_recent_paths`:
recent_paths: false
active_path: false
utils/itemdelegates.py:
A: false
class `ModelItemCache`:
Expand Down
7 changes: 7 additions & 0 deletions orangewidget/utils/filedialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,3 +624,10 @@ def merge_paths(cls, old_paths: list[RecentPath]):

def last_path(self):
return self.active_path and self.active_path.abspath

@classmethod
def migrate_to_local_recent_paths(cls, settings):
paths = settings.pop("recent_paths", [])
if paths:
cls.merge_paths(paths)
settings["active_path"] = paths[0]
8 changes: 8 additions & 0 deletions orangewidget/utils/tests/test_filedialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import unittest
from unittest.mock import Mock, patch
from tempfile import NamedTemporaryFile
import time

from AnyQt.QtCore import QSettings, QCoreApplication

Expand Down Expand Up @@ -336,6 +337,13 @@ def test_add_select_file(self):
self.assertEqual(["baz.txt", "foo.txt", "bar.txt"],
[path.basename for path in a.recent_paths])

def test_use_migrate_settings_from_mixin(self):
# Fail after jan 1, 2028
if time.gmtime().tm_year >= 2028:
self.fail(
"The mixin provides migrate_to_local_recent_paths, but widgets duplicate its code instead.\n"
"Call the provided method instead, and remove this test.")


class TestLocalRecentPathsWComboMixin(WidgetTest):
def test_init(self):
Expand Down
Loading