Skip to content
Snippets Groups Projects
Commit b6914cac authored by Phil's avatar Phil
Browse files

Re #26869 move float conversion to view

parent be629871
No related branches found
No related tags found
No related merge requests found
...@@ -37,8 +37,8 @@ class AxProperties(dict): ...@@ -37,8 +37,8 @@ class AxProperties(dict):
def from_view(cls, view): def from_view(cls, view):
props = dict() props = dict()
props['title'] = view.get_title() props['title'] = view.get_title()
props['xlim'] = (float(view.get_xlower_limit()), float(view.get_xupper_limit())) props['xlim'] = (view.get_xlower_limit(), view.get_xupper_limit())
props['ylim'] = (float(view.get_ylower_limit()), float(view.get_yupper_limit())) props['ylim'] = (view.get_ylower_limit(), view.get_yupper_limit())
props['xlabel'] = view.get_xlabel() props['xlabel'] = view.get_xlabel()
props['xscale'] = view.get_xscale() props['xscale'] = view.get_xscale()
props['ylabel'] = view.get_ylabel() props['ylabel'] = view.get_ylabel()
......
...@@ -41,10 +41,6 @@ class AxesTabWidgetPresenterTest(unittest.TestCase): ...@@ -41,10 +41,6 @@ class AxesTabWidgetPresenterTest(unittest.TestCase):
def _generate_presenter(self): def _generate_presenter(self):
mock_view = mock.Mock(get_selected_ax_name=lambda: "My Axes: (0, 0)") mock_view = mock.Mock(get_selected_ax_name=lambda: "My Axes: (0, 0)")
mock_view.get_xlower_limit.return_value = 0
mock_view.get_xupper_limit.return_value = 5
mock_view.get_ylower_limit.return_value = 0
mock_view.get_yupper_limit.return_value = 5
return Presenter(self.fig, view=mock_view) return Presenter(self.fig, view=mock_view)
def test_generate_ax_name_returns_correct_name(self): def test_generate_ax_name_returns_correct_name(self):
...@@ -146,10 +142,6 @@ class AxesTabWidgetPresenterTest(unittest.TestCase): ...@@ -146,10 +142,6 @@ class AxesTabWidgetPresenterTest(unittest.TestCase):
ax.get_ylim()[1], self.x_label, self.y_label, ax.get_ylim()[1], self.x_label, self.y_label,
self.x_scale, self.y_scale] self.x_scale, self.y_scale]
with mock.patch.object(presenter, 'view', new_view_mock): with mock.patch.object(presenter, 'view', new_view_mock):
new_view_mock.get_xlower_limit.return_value = 0
new_view_mock.get_xupper_limit.return_value = 5
new_view_mock.get_ylower_limit.return_value = 0
new_view_mock.get_yupper_limit.return_value = 5
presenter.update_view() presenter.update_view()
for setter, value in zip(setters, expected_vals): for setter, value in zip(setters, expected_vals):
getattr(new_view_mock, setter).assert_called_once_with(value) getattr(new_view_mock, setter).assert_called_once_with(value)
...@@ -55,10 +55,10 @@ class AxesTabWidgetView(QWidget): ...@@ -55,10 +55,10 @@ class AxesTabWidgetView(QWidget):
# X-Axis getters # X-Axis getters
def get_xlower_limit(self): def get_xlower_limit(self):
return self.xlower_limit_line_edit.text() return float(self.xlower_limit_line_edit.text())
def get_xupper_limit(self): def get_xupper_limit(self):
return self.xupper_limit_line_edit.text() return float(self.xupper_limit_line_edit.text())
def get_xlabel(self): def get_xlabel(self):
return self.xlabel_line_edit.text() return self.xlabel_line_edit.text()
...@@ -68,10 +68,10 @@ class AxesTabWidgetView(QWidget): ...@@ -68,10 +68,10 @@ class AxesTabWidgetView(QWidget):
# Y-Axis getters # Y-Axis getters
def get_ylower_limit(self): def get_ylower_limit(self):
return self.ylower_limit_line_edit.text() return float(self.ylower_limit_line_edit.text())
def get_yupper_limit(self): def get_yupper_limit(self):
return self.yupper_limit_line_edit.text() return float(self.yupper_limit_line_edit.text())
def get_ylabel(self): def get_ylabel(self):
return self.ylabel_line_edit.text() return self.ylabel_line_edit.text()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment