Skip to content

Commit

Permalink
Add button to resources dialog to open local cache folder
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Oct 22, 2024
1 parent d85970e commit 6e06595
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/python/plotlyst/service/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
from overrides import overrides
from pypandoc import download_pandoc
from qthandy import italic, vspacer, incr_font, bold, decr_font, transparent, decr_icon, pointy, ask_confirmation, grid, \
underline, line, spacer
underline, line, spacer, vbox
from qthandy.filter import OpacityEventFilter

from plotlyst.common import PLOTLYST_MAIN_COMPLEMENTARY_COLOR
from plotlyst.env import app_env
from plotlyst.env import app_env, open_location
from plotlyst.event.core import emit_global_event, EventListener, Event
from plotlyst.event.handler import global_event_dispatcher
from plotlyst.resources import ResourceType, resource_manager, ResourceDownloadedEvent, \
ResourceRemovedEvent, is_nltk, PANDOC_VERSION, ResourceExtension, ResourceDescriptor, ResourceStatusChangedEvent
from plotlyst.view.common import ButtonPressResizeEventFilter, spin
from plotlyst.view.common import ButtonPressResizeEventFilter, spin, push_btn
from plotlyst.view.generated.resource_manager_dialog_ui import Ui_ResourceManagerDialog
from plotlyst.view.icons import IconRegistry
from plotlyst.view.layout import group
Expand Down Expand Up @@ -368,7 +368,16 @@ def __init__(self, resourceTypes: Optional[List[ResourceType]] = None, parent=No
ResourceType.NLTK_PUNKT_TOKENIZER]
self._resources: Dict[ResourceType, _ResourceControllers] = {}

self._gridLayout: QGridLayout = grid(self)
self._wdgDisplay = QWidget()
vbox(self)

btnOpenCacheFolder = push_btn(IconRegistry.from_name('fa5.folder-open'), 'Open cache folder', transparent_=True)
btnOpenCacheFolder.installEventFilter(OpacityEventFilter(btnOpenCacheFolder))
btnOpenCacheFolder.clicked.connect(lambda: open_location(app_env.cache_dir))

self.layout().addWidget(btnOpenCacheFolder, alignment=Qt.AlignmentFlag.AlignRight)
self.layout().addWidget(self._wdgDisplay)
self._gridLayout: QGridLayout = grid(self._wdgDisplay)

header = QLabel('Resource')
underline(header)
Expand Down

0 comments on commit 6e06595

Please sign in to comment.