[pycharm] PY-70541 hotfix for HF card icons: those from AllIcons pack

GitOrigin-RevId: 17d442f232310896850e0e6d18dd35d5bb8c4f3d
This commit is contained in:
Bogdan Kirilenko
2024-03-07 00:34:47 +00:00
committed by intellij-monorepo-bot
parent 59d57eff05
commit f0b627a002
8 changed files with 37 additions and 15 deletions
@@ -5,7 +5,6 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
@@ -0,0 +1,19 @@
{
"com": {
"intellij": {
"python": {
"community": {
"impl": {
"huggingFace": {
"icons": {
"download.svg": "com/intellij/python/community/impl/huggingFace/icons/download.svg",
"like.svg": "com/intellij/python/community/impl/huggingFace/icons/like.svg",
"logo.svg": "com/intellij/python/community/impl/huggingFace/icons/logo.svg"
}
}
}
}
}
}
}
}

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 716 B

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

@@ -12,5 +12,6 @@
implementation="com.intellij.python.community.impl.huggingFace.documentation.HuggingFaceDocumentationTargetProvider"/>
<lang.inspectionSuppressor language="Python" implementationClass="com.intellij.python.community.impl.huggingFace.service.HuggingFaceTypoInspectionSuppressor"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.python.community.impl.huggingFace.service.HuggingFaceCardsUsageCollector"/>
<iconMapper mappingFile="HuggingFaceIconMappings.json"/>
</extensions>
</idea-plugin>
@@ -12,12 +12,6 @@ import com.intellij.python.community.impl.huggingFace.api.HuggingFaceURLProvider
import com.intellij.python.community.impl.huggingFace.documentation.HuggingFaceQuickDocStyles.LINK_TOP_MARGIN
import com.intellij.python.community.impl.huggingFace.service.PyHuggingFaceBundle
private val DOWNLOADS_ICON = HtmlChunk.tag("icon")
.attr("src", "icons/download.svg")
private val LIKES_ICON = HtmlChunk.tag("icon")
.attr(".src", "icons/like.svg")
private val LOGO_ICON = HtmlChunk.tag("icon")
.attr(".src", "icons/logo.svg")
class HuggingFaceHtmlBuilder(
private val project: Project,
@@ -52,8 +46,8 @@ class HuggingFaceHtmlBuilder(
val modelNameWithIconRow = HtmlChunk.tag("h3")
.children(
HtmlChunk.raw(cardTitle),
HtmlChunk.nbsp(2),
LOGO_ICON
// HtmlChunk.nbsp(2),
// LOGO_ICON
)
// modelPurpose chunk is not applicable for datasets
@@ -91,8 +85,6 @@ class HuggingFaceHtmlBuilder(
.wrapWith("p")
.style("margin-top: ${LINK_TOP_MARGIN}px;") // compensate h3 tag bottom margin
val headerContainer = HtmlChunk.div()
.setClass(DocumentationMarkup.CLASS_DEFINITION)
.children(
@@ -102,4 +94,15 @@ class HuggingFaceHtmlBuilder(
)
return headerContainer
}
companion object {
private val DOWNLOADS_ICON = HtmlChunk.tag("icon")
// .attr("src", "com.intellij.python.community.impl.huggingFace.icons.PythonCommunityImplHuggingFaceIcons.Download")
.attr("src", "AllIcons.Actions.Download")
private val LIKES_ICON = HtmlChunk.tag("icon")
// .attr(".src", "com.intellij.python.community.impl.huggingFace.icons.PythonCommunityImplHuggingFaceIcons.Like")
.attr(".src", "AllIcons.Toolwindows.ToolWindowFavorites")
//private val LOGO_ICON = HtmlChunk.tag("icon")
// .attr(".src", "/com/intellij/python/community/impl/huggingFace/icons/logo.svg")
}
}
@@ -1,5 +1,5 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.python.community.impl.huggingFace;
package com.intellij.python.community.impl.huggingFace.icons;
import com.intellij.ui.IconManager;
import org.jetbrains.annotations.NotNull;
@@ -14,7 +14,7 @@ public final class PythonCommunityImplHuggingFaceIcons {
private static @NotNull Icon load(@NotNull String path, int cacheKey, int flags) {
return IconManager.getInstance().loadRasterizedIcon(path, PythonCommunityImplHuggingFaceIcons.class.getClassLoader(), cacheKey, flags);
}
/** 14x14 */ public static final @NotNull Icon Download = load("icons/download.svg", -459821553, 0);
/** 14x14 */ public static final @NotNull Icon Like = load("icons/like.svg", -1702501286, 0);
/** 16x16 */ public static final @NotNull Icon Logo = load("icons/logo.svg", 59143455, 0);
/** 14x14 */ public static final @NotNull Icon Download = load("com/intellij/python/community/impl/huggingFace/icons/download.svg", -459821553, 0);
/** 14x14 */ public static final @NotNull Icon Like = load("com/intellij/python/community/impl/huggingFace/icons/like.svg", -1702501286, 0);
/** 16x16 */ public static final @NotNull Icon Logo = load("com/intellij/python/community/impl/huggingFace/icons/logo.svg", 59143455, 0);
}