[PyCharm Tables] PY-84611 Fixed once again

(cherry picked from commit af34abdd058021f5ee9ece44d0aa5b9268ae5eca)

IJ-CR-184067

GitOrigin-RevId: baef41d39c29550fcaf01bde3c3af6917529aec4
This commit is contained in:
Natalia.Murycheva
2025-10-17 00:04:58 +02:00
committed by intellij-monorepo-bot
parent df20cd76ad
commit 057f12b46e
2 changed files with 8 additions and 6 deletions

View File

@@ -75,6 +75,8 @@ abstract class PyDataViewerAbstractPanel(
}
fun apply(debugValue: PyDebugValue, modifier: Boolean, commandSource: DataViewerCommandSource? = null) {
val dimensions: List<Int>? = getValueDimensions(debugValue)
val dimensionsSize = dimensions?.size ?: 0
if (!modifier) {
when (commandSource) {
DataViewerCommandSource.SLICING -> PyDataViewerCollector.logDataSlicingApplied(isPanelFromFactory)
@@ -83,9 +85,8 @@ abstract class PyDataViewerAbstractPanel(
else -> Unit
}
val dimensions = getValueDimensions(debugValue)
PyDataViewerCollector.logDataOpened(dataViewerModel.project, debugValue.type,
dimensions?.size,
dimensionsSize,
dimensions?.getOrNull(0) ?: 0,
dimensions?.getOrNull(1) ?: 0,
isNewTable = isPanelFromFactory)
@@ -98,11 +99,12 @@ abstract class PyDataViewerAbstractPanel(
return
}
// For 3D, 4D, we should pass the "%" as the format parameter to correctly reduce tables' dimensions to 2.
val format = if (dimensionsSize > 2) "%" else formatValueFromUI
ApplicationManager.getApplication().executeOnPooledThread {
try {
doStrategyInitExecution(debugValue.frameAccessor, strategy)
// For this initial request, we should pass the "%" as the format parameter to correctly reduce 3D tables' dimension to 2.
val arrayChunk = debugValue.frameAccessor.getArrayItems(debugValue, 0, 0, 0, 0, "%")
val arrayChunk = debugValue.frameAccessor.getArrayItems(debugValue, 0, 0, 0, 0, format)
ApplicationManager.getApplication().invokeLater {
updateUI(arrayChunk, debugValue, strategy, modifier)
dataViewerModel.isModified = modifier

View File

@@ -63,7 +63,7 @@ internal object PyDataViewerCollector : CounterUsagesCollector() {
companion object {
fun getDataDimensions(dimensions: Int?): DataDimensions {
return when (dimensions) {
null -> UNKNOWN
0 -> UNKNOWN
1 -> ONE
2 -> TWO
3 -> THREE
@@ -78,7 +78,7 @@ internal object PyDataViewerCollector : CounterUsagesCollector() {
fun logDataOpened(
project: Project?,
type: String?,
dimensions: Int?,
dimensions: Int,
rowsCount: Int,
columnsCount: Int,
isNewTable: Boolean,