Skip to content

Commit

Permalink
FIX: modifying an array using .i/.points/.ipoints/.iflat now refreshe…
Browse files Browse the repository at this point in the history
…s the view (fixes issue #269)
  • Loading branch information
gdementen committed Jun 20, 2024
1 parent ca101a8 commit fcf1bb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 40 deletions.
39 changes: 3 additions & 36 deletions doc/source/changes/version_0_34_3.rst.inc
Original file line number Diff line number Diff line change
@@ -1,41 +1,8 @@
.. py:currentmodule:: larray_editor

Syntax changes
^^^^^^^^^^^^^^

* renamed ``MappingEditor.old_method_name()`` to :py:obj:`MappingEditor.new_method_name()` (closes :editor_issue:`1`).

* renamed ``old_argument_name`` argument of :py:obj:`MappingEditor.method_name()` to ``new_argument_name``.


Backward incompatible changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* other backward incompatible changes


New features
^^^^^^^^^^^^

* added a feature (see the :ref:`miscellaneous section <misc_editor>` for details).

* added another feature in the editor (closes :editor_issue:`1`).

.. note::

- It works for foo bar !
- It does not work for foo baz !


.. _misc_editor:

Miscellaneous improvements
^^^^^^^^^^^^^^^^^^^^^^^^^^

* improved something.


Fixes
^^^^^

* fixed something (closes :editor_issue:`1`).
* changes made to arrays in the console using the "points" syntax (for example: `arr.points['a0,a1', 'b0,b1'] = 0`)
and the other special `.something[]` syntaxes were not detected by the viewer and thus not displayed (closes
:editor_issue:`269`).
8 changes: 4 additions & 4 deletions larray_editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
REOPEN_LAST_FILE = object()

assignment_pattern = re.compile(r'[^\[\]]+[^=]=[^=].+')
setitem_pattern = re.compile(r'(.+)\[.+\][^=]=[^=].+')
setitem_pattern = re.compile(r'(\w+)(\.i|\.iflat|\.points|\.ipoints)?\[.+\][^=]=[^=].+')
history_vars_pattern = re.compile(r'_i?\d+')
# XXX: add all scalars except strings (from numpy or plain Python)?
# (long) strings are not handled correctly so should NOT be in this list
Expand Down Expand Up @@ -695,9 +695,9 @@ def ipython_cell_executed(self):
# 'In' and '_ih' point to the same object (but '_ih' is supposed to be the non-overridden one)
cur_input_num = len(user_ns['_ih']) - 1
last_input = user_ns['_ih'][-1]
if setitem_pattern.match(last_input):
m = setitem_pattern.match(last_input)
varname = m.group(1)
setitem_match = setitem_pattern.match(last_input)
if setitem_match:
varname = setitem_match.group(1)
# otherwise it should have failed at this point, but let us be sure
if varname in clean_ns:
if self._display_in_grid(varname, clean_ns[varname]):
Expand Down

0 comments on commit fcf1bb3

Please sign in to comment.