Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions xray_vision/qt_widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import logging
logger = logging.getLogger(__name__)


class CrossSectionMainWindow(QtGui.QMainWindow):
"""
MainWindow
Expand Down Expand Up @@ -100,6 +101,17 @@ def __init__(self, data_list, key_list,
# trigger the image to draw
self._messenger.sl_update_image(0)

self.key_list = key_list

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not performed at the messenger level?


def add_data(self, new_data, new_key_names):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc strings in this would be appreciated. Please use the numpy doc string format.

old_length = len(self.key_list)
for key in new_key_names:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You most likely could do this in one line as self.key_list.extend(new_key_names)

self.key_list.append(key)
for i in range(old_length, len(self.key_list)):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to state this more pythonicly as:

for new_key, new_value in zip(new_key_names, new_data):
    # enter the data

self._messenger._view._data_dict[self.key_list[i]] = new_data[i-old_length]
self._messenger._ctrl_widget._slider_img.setMaximum(len(self.key_list)-1)
self._messenger._ctrl_widget._spin_img.setMaximum(len(self.key_list)-1)


class Stack1DMainWindow(QtGui.QMainWindow):
"""
Expand Down