def check_out(self, undolist=[]): index = self.widget.get_active() if index != self.old_value: model = self.widget.get_model() value = model[index][1] uwrap.smart_set(self.container, self.key, value, undolist=undolist) self.old_value = index
def check_out(self, undolist=[]): # TOOD: make sure we are finished with editing the treeview ul = UndoList().describe("Set Line Property") model = self.treeview.get_model() model_lines = [] def get_column(column, default=None): """ Returns the value of the specified column from the model, or if it is an empty string, returns the default value given. """ rv = model.get_value(treeiter, column) if isinstance(rv, basestring) and len(rv) == 0: return default else: return rv n=0 treeiter = model.get_iter_first() while treeiter: # Is this row an existing line or a new one? line = model.get_value(treeiter, self.COL_LINE) if line in self.layer.lines: # existing line source_key = model.get_value(treeiter, self.COL_SOURCE_KEY) if not source_key: source = None else: source = self.app.project.get_dataset(source_key, default=None) uwrap.smart_set(line, 'visible', get_column(self.COL_VISIBLE), 'label', get_column(self.COL_LABEL), 'style', get_column(self.COL_STYLE), 'marker', get_column(self.COL_MARKER), 'width', get_column(self.COL_WIDTH), 'source', source, 'cx', get_column(self.COL_CX), 'cy', get_column(self.COL_CY), 'row_first', get_column(self.COL_ROW_FIRST), 'row_last', get_column(self.COL_ROW_LAST), 'cxerr', get_column(self.COL_CXERR), 'cyerr', get_column(self.COL_CYERR), undolist=ul) else: ulist.append( self.layer.lines, line, undolist=ul ) model_lines.append(line) treeiter = model.iter_next(treeiter) n+=1 # now we need to check if we have removed any lines for line in self.layer.lines: if line not in model_lines: ulist.remove( self.layer.lines, line, undolist=ul) undolist.append(ul)
def check_out_row(owner, iter, undolist=[]): n = 0 adict = {} for key in self.keys: adict[key]=model.get_value(iter, n) n += 1 adict['undolist'] = ul uwrap.smart_set(owner, **adict)
def check_out(self, undolist=[]): index = self.widget.get_active() print "combobox: ", self.key, if index != self.old_value: if index < 0: val = None else: model = self.widget.get_model() val = model[index][1] uwrap.smart_set(self.container, self.key, val, undolist=undolist) self.old_value = index
def check_out(self, undolist=[]): " Set value in container " new_value = self.get_data() if new_value != self.last_value: uwrap.smart_set(self.container, self.key, new_value, undolist=undolist) self.last_value = new_value