Commit ca637fde authored by James Harle's avatar James Harle
Browse files

2to3 in gui

parent 67505f90
......@@ -199,7 +199,7 @@ class Mask(object):
mask_data[index] = self.data[index]
#connected components
label_mask, num_labels = ndimage.label(mask_data)
mean_values = ndimage.sum(np.ones(self.data.shape),label_mask,range(1, num_labels+1))
mean_values = ndimage.sum(np.ones(self.data.shape),label_mask,list(range(1, num_labels+1)))
max_area_mask = None
if mean_values.size != 0:
max_area_index = np.argmax(mean_values)+1
......@@ -228,7 +228,7 @@ class Mask(object):
label_mask, num_labels = ndimage.label(mask_data)
if num_labels == 0: #if mask is empty/clear
return
mean_values = ndimage.sum(np.ones(self.data.shape),label_mask,range(1, num_labels+1))
mean_values = ndimage.sum(np.ones(self.data.shape),label_mask,list(range(1, num_labels+1)))
max_area_mask = None
if mean_values.size != 0:
max_area_index = np.argmax(mean_values)+1
......
......@@ -11,7 +11,7 @@ import numpy as np
from .selection_editor import PolygonEditor, BoxEditor
import os.path
from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt
from nemo_bdy_mask import Mask
from .nemo_bdy_mask import Mask
import logging
from PyQt4.QtGui import QSizePolicy
from matplotlib.colors import Normalize
......@@ -126,7 +126,7 @@ class MatplotlibWidget(QtGui.QWidget):
x = np.arange(0, self.mask.lon.shape[0])
y = np.arange(0, self.mask.lon.shape[1])
x_vals, y_vals = np.meshgrid(y, x)
grid = zip(x_vals.ravel(), y_vals.ravel())
grid = list(zip(x_vals.ravel(), y_vals.ravel()))
self._drawing_tool.polygon.set_linewidth(1.0)
p_path = Path(self._drawing_tool.polygon.xy)
......@@ -146,7 +146,7 @@ class MatplotlibWidget(QtGui.QWidget):
x = np.arange(0, self.mask.lon.shape[0])
y = np.arange(0, self.mask.lon.shape[1])
x_vals, y_vals = np.meshgrid(y, x)
grid = zip(x_vals.ravel(), y_vals.ravel()) #check for the index
grid = list(zip(x_vals.ravel(), y_vals.ravel())) #check for the index
self._drawing_tool.polygon.set_linewidth(1.0)
p_path = Path(self._drawing_tool.polygon.xy)
......
......@@ -51,7 +51,7 @@ class NameListEditor(QtGui.QWidget):
text.setText(str(self.settings[setting]))
text.textChanged.connect(lambda value=setting,\
var_name=setting: self.label_changed(value, var_name))
if self.bool_settings.has_key(setting):
if setting in self.bool_settings:
chkbox = QtGui.QCheckBox(self)
chkbox.setChecked(self.bool_settings[setting])
chkbox.stateChanged.connect(lambda value=setting,\
......@@ -109,7 +109,7 @@ class NameListEditor(QtGui.QWidget):
def label_changed(self, value, name):
""" callback when the text is changed in the text box"""
self.new_settings[name] = unicode(value).encode('utf_8')
self.new_settings[name] = str(value).encode('utf_8')
def combo_index_changed(self, value, name):
""" callback when the True/False drop down for the settings which has boolean value
......@@ -153,7 +153,7 @@ class NameListEditor(QtGui.QWidget):
try:
self.mask_settings_update.emit(float(self.settings['mask_max_depth']), float(self.settings['mask_shelfbreak_dist']))
except KeyError:
print 'Set the mask setting mask_max_depth and mask_shelfbreak_dist'
print('Set the mask setting mask_max_depth and mask_shelfbreak_dist')
if self.bool_settings['mask_file']:
self.bathymetry_update.emit(self.settings['bathy'],self.settings['mask_file'])
......
This diff is collapsed.
This diff is collapsed.
......@@ -58,12 +58,12 @@ class PolygonEditor(object):
self.reset_line()
self.reset_polygon()
elif self.xy_values.shape[0] <= 2: # point or line for 1 or 2 points
xval, yval = zip(*self.xy_values)
xval, yval = list(zip(*self.xy_values))
if self.line == None:
self.line = Line2D(xval, yval, marker='o', markerfacecolor='r', animated=True)
self.axis.add_line(self.line)
else:
self.line.set_data(zip(*self.xy_values))
self.line.set_data(list(zip(*self.xy_values)))
self.reset_polygon()
else: # more than 2 points if polygon is not created then creates one and draws
if self.polygon == None:
......@@ -72,7 +72,7 @@ class PolygonEditor(object):
self.axis.add_patch(self.polygon)
else:
self.polygon.xy = self.xy_values
self.line.set_data(zip(*self.xy_values))
self.line.set_data(list(zip(*self.xy_values)))
self.draw_callback(None)
self.canvas.draw()
......
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