def CreateEditorCtrl(self, parent, rect, value): PM = ParametersManager.get() f_tids = [ObjectManager.get_tid_friendly_name(tid) \ for tid in PM.get_tids()] _editor = wx.Choice(parent, wx.ID_ANY, rect.GetTopLeft(), wx.Size(rect.GetWidth(), -1), choices=f_tids) _editor.SetRect(rect) return _editor
def GetValue(self, item, col): obj = self.ItemToObject(item) # if col == 8: # print('\nGetValue: ', col) # print (type(obj)) if isinstance(obj, IOWell): if col == 0: return obj.name elif col == 7: for run in obj.data: for log in run.data: if not log._import: return False return True elif col == 8: soma = 0.0 i = 0 for run in obj.data: for log in run.data: soma += log._progress i += 1 if i == 0: return 0.0 return (soma / i) * 100.0 else: return "" elif isinstance(obj, IOWellRun): if col == 0: return obj.name elif col == 7: for log in obj.data: if not log._import: return False return True elif col == 8: if len(obj.data) == 0: return 0.0 soma = 0.0 for log in obj.data: soma += log._progress return (soma / len(obj.data)) * 100.0 else: return "" elif isinstance(obj, IOWellLog): if col == 0: return "" elif col == 1: if not obj.tid: return "" friendly_tid = ObjectManager.get_tid_friendly_name(obj.tid) if friendly_tid is None: return "" return friendly_tid elif col == 2: if obj.datatype is None: return "" return obj.datatype elif col == 3: return obj.mnem elif col == 4: first_depth_pos = obj.get_first_occurence_pos() parent_item = self.GetParent(item) run = self.ItemToObject(parent_item) value = run.get_depth().data[first_depth_pos] # return "{0:.2f}".format(value) + ' (' + str(first_depth_pos) +')' return "{0:.2f}".format(value) elif col == 5: last_depth_pos = obj.get_last_occurence_pos() parent_item = self.GetParent(item) run = self.ItemToObject(parent_item) value = run.get_depth().data[last_depth_pos] # return "{0:.2f}".format(value) + ' (' + str(last_depth_pos) +')' return "{0:.2f}".format(value) elif col == 6: return str.lower(obj.unit) elif col == 7: return obj._import elif col == 8: return obj._progress