Skip to content

Commit

Permalink
Fixes for plotly. Ensure that auto-closed latex cells are marked as s…
Browse files Browse the repository at this point in the history
…uch in the document, not just in the visual representation.
  • Loading branch information
Kasper Peeters committed Nov 11, 2024
1 parent a0036f7 commit b98eabf
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 29 deletions.
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,35 @@ set(CADABRA_CMAKE_VERSION 3.12)

if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
message(STATUS "Set CMake policy CM0042 to NEW")
message(STATUS "Set CMake policy CMP0042 to NEW")
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
message(STATUS "Set CMake policy CM0054 to NEW")
message(STATUS "Set CMake policy CMP0054 to NEW")
endif()
if(POLICY CMP0127)
cmake_policy(SET CMP0127 NEW)
message(STATUS "Set CMake policy CM0127 to NEW")
message(STATUS "Set CMake policy CMP0127 to NEW")
endif()
if(POLICY CMP0148)
cmake_policy(SET CMP0148 NEW)
message(STATUS "Set CMake policy CM0148 to NEW")
message(STATUS "Set CMake policy CMP0148 to NEW")
endif()
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
message(STATUS "Set CMake policy CM0167 to NEW")
message(STATUS "Set CMake policy CMP0167 to NEW")
endif()
if(POLICY CMP0094)
cmake_policy(SET CMP0094 NEW)
message(STATUS "Set CMake policy CM0094 to NEW (use first Python found)")
message(STATUS "Set CMake policy CMP0094 to NEW (use first Python found)")
endif()
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD) # CMake 3.30: call FetchContent_Populate() with just the name of a dependency. This modern alternative was introduced in cmake 3.14 but we still support 3.12.
cmake_policy(SET CMP0169 NEW)
message(STATUS "Set CMake policy CMP0169 to NEW (use new FetchContent)")
# CMake 3.30: call FetchContent_Populate() with just the name of a
# dependency. This modern alternative was introduced in cmake 3.14
# but we still support 3.12; we call the old behaviour in
# frontend/gtkmm/CMakeLists.txt
endif()

cmake_minimum_required(VERSION ${CADABRA_CMAKE_VERSION})
Expand Down
3 changes: 1 addition & 2 deletions core/cadabra2_defaults.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ except ImportError:

have_plotly=True
try:
import plotly
import plotly.graph_objs
import plotly.graph_objs._figure
except ImportError:
have_plotly=False

Expand Down
45 changes: 31 additions & 14 deletions core/packages/cdb/graphics/plot.cnb

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions frontend/gtkmm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ if(USE_MICROTEX)
# GIT_REPOSITORY file:///home/kasper/git/microtex/
GIT_TAG kpeeters/cadabra
)
# FetchContent_MakeAvailable(microtex)
FetchContent_GetProperties(microtex)
if(NOT microtex_POPULATED)
FetchContent_Populate(microtex)
add_subdirectory(${microtex_SOURCE_DIR} ${microtex_BINARY_DIR} EXCLUDE_FROM_ALL)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14")
FetchContent_MakeAvailable(microtex)
else()
FetchContent_GetProperties(microtex)
if(NOT microtex_POPULATED)
FetchContent_Populate(microtex)
add_subdirectory(${microtex_SOURCE_DIR} ${microtex_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()
endif()

Expand Down
4 changes: 3 additions & 1 deletion frontend/gtkmm/NotebookWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,8 @@ bool NotebookWindow::cell_content_execute(DTree::iterator it, int canvas_number,
compute->execute_cell(it);

// If this is a LaTeX input cell, and auto-close is turned on, close
// the input cell.
// the input cell. Make sure to also feed that into the document
// itself!
if(it->cell_type==DataCell::CellType::latex) {
if(prefs.auto_close_latex) {
for(unsigned int i=0; i<canvasses.size(); ++i) {
Expand All @@ -1865,6 +1866,7 @@ bool NotebookWindow::cell_content_execute(DTree::iterator it, int canvas_number,
}
else {
(*vis).second.inbox->edit.hide();
it->hidden=true;
}
}
}
Expand Down

0 comments on commit b98eabf

Please sign in to comment.