Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.misc.pluginlist.fc_bookmarks_order #3328

Merged
merged 1 commit into from
Jan 4, 2025
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
14 changes: 7 additions & 7 deletions lib/python/Plugins/Extensions/FileCommander/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ def makeSymlinkCallback(newName):

def keyManageBookmarks(self, current):
bookmarks = config.plugins.FileCommander.bookmarks.value
order = config.misc.pluginlist.fc_bookmarks_order.value.split(",")
order = eval(config.misc.pluginlist.fcBookmarksOrder.value)
directory = current and self.sourceColumn.getCurrentDirectory() or self.sourceColumn.getPath()
if directory in bookmarks:
bookmarks.remove(directory)
Expand All @@ -1024,8 +1024,8 @@ def keyManageBookmarks(self, current):
self.displayStatus(_("Bookmark added."))
config.plugins.FileCommander.bookmarks.value = bookmarks
config.plugins.FileCommander.bookmarks.save()
config.misc.pluginlist.fc_bookmarks_order.value = ",".join(order)
config.misc.pluginlist.fc_bookmarks_order.save()
config.misc.pluginlist.fcBookmarksOrder.value = str(order)
config.misc.pluginlist.fcBookmarksOrder.save()

def keyMediaInfo(self):
self.shortcutAction("mediainfo")
Expand Down Expand Up @@ -1576,13 +1576,13 @@ def selectBookmarkCallback(answer):

bookmarks = [(x, x) for x in config.plugins.FileCommander.bookmarks.value]
bookmarks.insert(0, (_("Storage Devices"), None))
order = config.misc.pluginlist.fc_bookmarks_order.value.split(",")
order = eval(config.misc.pluginlist.fcBookmarksOrder.value)
if order and _("Storage Devices") in order:
order.remove(_("Storage Devices"))
order.insert(0, _("Storage Devices"))
config.misc.pluginlist.fc_bookmarks_order.value = ",".join(order)
config.misc.pluginlist.fc_bookmarks_order.save()
self.session.openWithCallback(selectBookmarkCallback, ChoiceBox, title=_("Select Bookmark"), list=bookmarks, reorderConfig="fc_bookmarks_order")
config.misc.pluginlist.fcBookmarksOrder.value = str(order)
config.misc.pluginlist.fcBookmarksOrder.save()
self.session.openWithCallback(selectBookmarkCallback, ChoiceBox, title=_("Select Bookmark"), list=bookmarks, reorderConfig="fcBookmarksOrder")

def keySettings(self):
def settingsCallback(*answer):
Expand Down
10 changes: 5 additions & 5 deletions lib/python/Screens/ChoiceBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from Screens.Screen import Screen, ScreenSummary

config.misc.pluginlist = ConfigSubsection()
config.misc.pluginlist.eventinfo_order = ConfigText(default="")
config.misc.pluginlist.extension_order = ConfigText(default="")
config.misc.pluginlist.fc_bookmarks_order = ConfigText(default="")
config.misc.pluginlist.eventinfoOrder = ConfigText(default="[]")
config.misc.pluginlist.extensionOrder = ConfigText(default="[]")
config.misc.pluginlist.fcBookmarksOrder = ConfigText(default=f"['{_("Storage Devices")}']")


class ChoiceBoxNew(Screen):
Expand All @@ -32,7 +32,7 @@ def __init__(self, session, text="", choiceList=None, selection=0, buttonList=No
if self.configOrder.value:
prevList = [x for x in zip(choiceList, buttonList)]
newList = []
for button in self.configOrder.value.split(","):
for button in eval(self.configOrder.value):
for entry in prevList:
if entry[0][0] == button:
prevList.remove(entry)
Expand Down Expand Up @@ -181,7 +181,7 @@ def moveItem(self, direction):
self["list"].instance.goLineDown()
else:
self["list"].instance.goLineUp()
self.configOrder.value = ",".join(x[0][0] for x in self.choiceList)
self.configOrder.value = str([x[0][0] for x in self.choiceList])
self.configOrder.save()

def keyResetList(self):
Expand Down
Loading