Commit 58678ef5 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rf/moveitem' into 'master'

Rf/moveitem

See merge request fsl/fsleyes/widgets!70
parents 610169e6 95282bae
......@@ -2,6 +2,19 @@ This document contains the ``fsleyes-widgets`` release history in reverse
chronological order.
0.11.3 (Friday April 16th 2021)
-------------------------------
Changed
^^^^^^^
* Added the :meth:`.EditableListBox.MoveItem` method (it was previously a
private method called ``__moveItem``).
0.11.2 (Saturday March 27th 2021)
---------------------------------
......
include LICENSE
include COPYRIGHT
include CHANGELOG.rst
include README.rst
include setup.cfg
include requirements.txt
include requirements-dev.txt
include pytest.ini
recursive-include doc *
recursive-exclude doc/html *
recursive-include tests *
......@@ -54,9 +54,13 @@ Requirements for running tests and building the documentation are listed in the
Documentation
-------------
``fsleyes-widgets`` is documented using
`sphinx <http://http://sphinx-doc.org/>`_. You can build the API documentation
by running::
API documentation for ``fsleyes-widgets`` can be found at
https://open.win.ox.ac.uk/pages/fsl/fsleyes/widgets/.
``fsleyes-widgets`` is documented using `sphinx
<http://http://sphinx-doc.org/>`_. You can build the API documentation by
running::
pip install -r requirements-dev.txt
python setup.py doc
......
......@@ -33,6 +33,7 @@ date = datetime.date.today()
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.mathjax',
# 'sphinxcontrib.restbuilder',
......
......@@ -1097,12 +1097,16 @@ class EditableListBox(wx.Panel):
wx.PostEvent(self, ev)
def __moveItem(self, offset):
"""Called when the *move up* or *move down* buttons are pushed.
def MoveItem(self, offset, event=False):
"""Move the currently selected item the specified offset.
Moves the selected item by the specified offset and posts an
:data:`EVT_ELB_MOVE_EVENT`, unless it doesn't make sense to do the
move.
Called when the *move up* or *move down* buttons are pushed.
Moves the selected item by the specified offset unless it doesn't make
sense to do the move.
If the item is moved, and ``event is True``, posts a
:data:`EVT_ELB_MOVE_EVENT`,
"""
oldIdx, label, data = self.__getSelection()
......@@ -1132,23 +1136,24 @@ class EditableListBox(wx.Panel):
log.debug('ListMoveEvent (oldIdx: {}; newIdx: {}; label: {})'.format(
oldIdx, newIdx, label))
ev = ListMoveEvent(
oldIdx=oldIdx, newIdx=newIdx, label=label, data=data)
wx.PostEvent(self, ev)
if event:
ev = ListMoveEvent(
oldIdx=oldIdx, newIdx=newIdx, label=label, data=data)
wx.PostEvent(self, ev)
def __moveItemDown(self, ev):
"""Called when the *move down* button is pushed. Calls the
:meth:`__moveItem` method.
"""
self.__moveItem(1)
self.MoveItem(1, event=True)
def __moveItemUp(self, ev):
"""Called when the *move up* button is pushed. Calls the
:meth:`__moveItem` method.
"""
self.__moveItem(-1)
self.MoveItem(-1, event=True)
def __addItem(self, ev):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment