Skip to content

Commit 18feb4e

Browse files
committed
FIX: modifying an array using .i/.points/.ipoints/.iflat now refreshes the view (fixes issue #269)
1 parent 92ef874 commit 18feb4e

File tree

2 files changed

+7
-40
lines changed

2 files changed

+7
-40
lines changed
+3-36
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,8 @@
11
.. py:currentmodule:: larray_editor
22

3-
Syntax changes
4-
^^^^^^^^^^^^^^
5-
6-
* renamed ``MappingEditor.old_method_name()`` to :py:obj:`MappingEditor.new_method_name()` (closes :editor_issue:`1`).
7-
8-
* renamed ``old_argument_name`` argument of :py:obj:`MappingEditor.method_name()` to ``new_argument_name``.
9-
10-
11-
Backward incompatible changes
12-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13-
14-
* other backward incompatible changes
15-
16-
17-
New features
18-
^^^^^^^^^^^^
19-
20-
* added a feature (see the :ref:`miscellaneous section <misc_editor>` for details).
21-
22-
* added another feature in the editor (closes :editor_issue:`1`).
23-
24-
.. note::
25-
26-
- It works for foo bar !
27-
- It does not work for foo baz !
28-
29-
30-
.. _misc_editor:
31-
32-
Miscellaneous improvements
33-
^^^^^^^^^^^^^^^^^^^^^^^^^^
34-
35-
* improved something.
36-
37-
383
Fixes
394
^^^^^
405

41-
* fixed something (closes :editor_issue:`1`).
6+
* changes made to arrays in the console using the "points" syntax (for example: `arr.points['a0,a1', 'b0,b1'] = 0`)
7+
and the other special `.something[]` syntaxes were not detected by the viewer and thus not displayed (closes
8+
:editor_issue:`269`).

larray_editor/editor.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
REOPEN_LAST_FILE = object()
7676

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

0 commit comments

Comments
 (0)