rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def sp(l):
def sp(l, capitalize=False):
def sp(l): n = len(l) if n <> 1: return n, 's' else: return n, ''
if n <> 1: return n, 's' else: return n, ''
if n == 0: if capitalize: return "No", "s" else: return "no", "s" elif n == 1: return str(n), '' else: return str(n), 's'
def sp(l): n = len(l) if n <> 1: return n, 's' else: return n, ''
self.infoEx.setText('No data loaded.')
self.infoEx.setText('No data on input.')
def sp(l): n = len(l) if n <> 1: return n, 's' else: return n, ''
self.infoEx.setText("%i example%s," % sp(data))
self.infoEx.setText("%s example%s," % sp(data))
def sp(l): n = len(l) if n <> 1: return n, 's' else: return n, ''
self.infoMiss.setText('%i (%.1f%s) with missing values.' % (len(missData), 100.*len(missData)/len(data), "%")) self.infoAttr.setText("%i attribute%s," % sp(data.domain.attributes)) self.infoMeta.setText("%i meta%s." % sp(data.domain.getmetas()))
self.infoMiss.setText('%s (%.1f%s) with missing values.' % (len(missData), 100.*len(missData)/len(data), "%")) self.infoAttr.setText("%s attribute%s," % sp(data.domain.attributes,True)) self.infoMeta.setText("%s meta attribute%s." % sp(data.domain.getmetas()))
def sp(l): n = len(l) if n <> 1: return n, 's' else: return n, ''
self.infoClass.setText('Discrete class with %d value%s.' % sp(data.domain.classVar.values))
self.infoClass.setText('Discrete class with %s value%s.' % sp(data.domain.classVar.values))
def sp(l): n = len(l) if n <> 1: return n, 's' else: return n, ''
if self.showMetas: m = data.domain.getmetas() ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0], x[0])) metas = [x[1] for x in ml] metaKeys = [x[0] for x in ml] else: metas = [] metaKeys = []
m = data.domain.getmetas() ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0], x[0])) metas = [x[1] for x in ml] metaKeys = [x[0] for x in ml]
def set_table(self, table, data): """Writes data into table, adjusts the column width. """ qApp.setOverrideCursor(QWidget.waitCursor) if data==None: return vars = data.domain.variables if self.showMetas: m = data.domain.getmetas() # getmetas returns a dictionary ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0],...
table.setNumCols(numVarsMetas)
table.setNumCols(numVarsMetas+1)
def set_table(self, table, data): """Writes data into table, adjusts the column width. """ qApp.setOverrideCursor(QWidget.waitCursor) if data==None: return vars = data.domain.variables if self.showMetas: m = data.domain.getmetas() # getmetas returns a dictionary ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0],...
self.header=table.horizontalHeader()
hheader=table.horizontalHeader()
def set_table(self, table, data): """Writes data into table, adjusts the column width. """ qApp.setOverrideCursor(QWidget.waitCursor) if data==None: return vars = data.domain.variables if self.showMetas: m = data.domain.getmetas() # getmetas returns a dictionary ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0],...
self.header.setLabel(i, var.name)
hheader.setLabel(i, var.name) hheader.setLabel(numVarsMetas, "")
def set_table(self, table, data): """Writes data into table, adjusts the column width. """ qApp.setOverrideCursor(QWidget.waitCursor) if data==None: return vars = data.domain.variables if self.showMetas: m = data.domain.getmetas() # getmetas returns a dictionary ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0],...
table.setColumnWidth(j, table.columnWidth(j)+22) for i in range(numEx): OWGUI.tableItem(table, i, numVarsMetas, "", editType=QTableItem.Never, sortingKey=self.sortingKey(i, numSpaces)) table.hideColumn(numVarsMetas) table.verticalHeader().setClickEnabled(False) table.verticalHeader().setResizeEnabled(False) table.v...
def set_table(self, table, data): """Writes data into table, adjusts the column width. """ qApp.setOverrideCursor(QWidget.waitCursor) if data==None: return vars = data.domain.variables if self.showMetas: m = data.domain.getmetas() # getmetas returns a dictionary ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0],...
self.connect(self.header,SIGNAL("clicked(int)"),self.sort)
self.connect(hheader,SIGNAL("clicked(int)"),self.sort)
def set_table(self, table, data): """Writes data into table, adjusts the column width. """ qApp.setOverrideCursor(QWidget.waitCursor) if data==None: return vars = data.domain.variables if self.showMetas: m = data.domain.getmetas() # getmetas returns a dictionary ml = [(k, m[k]) for k in m] ml.sort(lambda x,y: cmp(y[0],...
table.horizontalHeader().setSortIndicator(col, self.sortby>=0)
table.horizontalHeader().setSortIndicator(col, self.sortby<0)
def sort(self, col): """Sorts the table by column col. """ qApp.setOverrideCursor(QWidget.waitCursor) if col == self.sortby-1: self.sortby = - self.sortby else: self.sortby = col+1 table = self.tabs.currentPage() table.sortColumn(col, self.sortby>=0, TRUE) table.horizontalHeader().setSortIndicator(col, self.sortby>=0)
ow.dataset(d4,"wpbc")
def sortingKey(self, val, len): """Returns a string with leading spaces followed by str(val), whose length is at least len. """ s = "%0" + str(len) + "s" return s % str(val)
if self.attrInfo == {} and len(data) == len(orange.Preprocessor_dropMissing(data)): arr = data.toNumeric("ac")[0]
if self.attrInfo == {}: arr = data.toNumeric("ac", 0, 1, 1e20)[0]
def __call__(self, attr, data): # if the data changed clear the attribute values if data != self.data: self.attrInfo = {} self.data = data
sel = Numeric.compress(a, arr[i]).tolist()
sel = Numeric.compress(a, arr[i]) sel = Numeric.compress(Numeric.where(sel != 1e20, 1, 0), sel).tolist()
def __call__(self, attr, data): # if the data changed clear the attribute values if data != self.data: self.attrInfo = {} self.data = data
elif not self.attrInfo.has_key(attr): mis = []; stds = []; ts = [] arrs = [[] for v in range(len(data.domain.classVar.values))] for i in range(len(data)): if data[i].getclass().isSpecial() or data[i][attr].isSpecial(): continue arrs[int(data[i][data.domain.classVar])].append(data[i][attr].value) for i in range(len(ar...
def __call__(self, attr, data): # if the data changed clear the attribute values if data != self.data: self.attrInfo = {} self.data = data
def __init__(self): S2NMeasure.__init__(self)
pass
def __init__(self): S2NMeasure.__init__(self)
contAttrs.append(attr.name)
else: contAttrs.append(attr.name)
def evaluateAttributes(data, contMeasure, discMeasure): attrs = []; contAttrs = [] corr = MeasureCorrelation() for attr in data.domain.attributes: if data.domain.classVar.varType == orange.VarTypes.Continuous and attr.varType == orange.VarTypes.Continuous: attrs.append((corr(attr.name, data), attr.name)) elif data.doma...
v.reverse()
def evaluateAttributes(data, contMeasure, discMeasure): attrs = []; contAttrs = [] corr = MeasureCorrelation() for attr in data.domain.attributes: if data.domain.classVar.varType == orange.VarTypes.Continuous and attr.varType == orange.VarTypes.Continuous: attrs.append((corr(attr.name, data), attr.name)) elif data.doma...
for i in range(len(cls[0])): for j in range(len(data.domain.classVar.values)): if cls[j][i][1] not in attrs: attrs.append(cls[j][i])
while len(attrs2) < len(contAttrs): for i in range(len(data.domain.classVar.values)): for j in range(len(cls[i])): (v,attr) = cls[i].pop() if attr not in attrs2: attrs2.append(attr) break
def evaluateAttributes(data, contMeasure, discMeasure): attrs = []; contAttrs = [] corr = MeasureCorrelation() for attr in data.domain.attributes: if data.domain.classVar.varType == orange.VarTypes.Continuous and attr.varType == orange.VarTypes.Continuous: attrs.append((corr(attr.name, data), attr.name)) elif data.doma...
return [attr for (val, attr) in attrs]
return [attr for (val, attr) in attrs] + attrs2
def evaluateAttributes(data, contMeasure, discMeasure): attrs = []; contAttrs = [] corr = MeasureCorrelation() for attr in data.domain.attributes: if data.domain.classVar.varType == orange.VarTypes.Continuous and attr.varType == orange.VarTypes.Continuous: attrs.append((corr(attr.name, data), attr.name)) elif data.doma...
self.resultListLen = 1000
def __init__(self, parallelWidget, parent=None): OWBaseWidget.__init__(self, parent, "Parallel Optimization Dialog", "Find attribute subsets that are interesting to visualize using parallel coordinates", FALSE, FALSE, FALSE)
self.resultListCombo = OWGUI.comboBoxWithCaption(self.manageBox, self, "resultListLen", "Number of interesting projections: ", tooltip = "Maximum length of the list of interesting projections", items = self.resultListList, callback = self.updateShownProjections, sendSelectedValue = 1, valueType = int)
def __init__(self, parallelWidget, parent=None): OWBaseWidget.__init__(self, parent, "Parallel Optimization Dialog", "Find attribute subsets that are interesting to visualize using parallel coordinates", FALSE, FALSE, FALSE)
def setData(self, data): if hasattr(data, "name"): self.datasetName = data.name else: self.datasetName = ""
def getSelectedAttributes(self): if self.resultList.count() == 0: return None return self.allResults[self.resultList.currentItem()][1]
if (shortFileName, name) not in self.fileBuffer: self.fileBuffer.insert(0, (shortFileName, name)) self.vizrankFileCombo.insertItem(shortFileName) if len(self.fileBuffer) > 10: self.fileBuffer.remove(self.fileBuffer[-1])
if (shortFileName, name) in self.fileBuffer: self.fileBuffer.remove((shortFileName, name)) self.fileBuffer.insert(0, (shortFileName, name)) if len(self.fileBuffer) > 10: self.fileBuffer.remove(self.fileBuffer[-1]) self.vizrankFileCombo.clear() for i in range(len(self.fileBuffer)): self.vizrankFileCombo.insertItem(s...
def loadProjections(self, name = None): self.projections = [] self.kNeighborsLabel.setText("Number of neighbors (k): " ) self.percentDataUsedLabel.setText("Percent of data used:" ) self.testingMethodLabel.setText("Testing method used:" ) self.qualityMeasureLabel.setText("Quality measure used:" ) if name == None: name ...
if index > self.resultListLen: return
def addProjection(self, val, attrList): index = self.findTargetIndex(val, max) if index > self.resultListLen: return self.allResults.insert(index, (val, attrList)) self.resultList.insertItem("%.3f - %s" % (val, str(attrList)), index) if len(self.allResults) > self.resultListLen: self.allResults.remove(self.allResults[-...
if len(self.allResults) > self.resultListLen: self.allResults.remove(self.allResults[-1]) self.resultList.removeItem(self.resultList.count()-1) self.worstVal = self.allResults[-1][0]
def addProjection(self, val, attrList): index = self.findTargetIndex(val, max) if index > self.resultListLen: return self.allResults.insert(index, (val, attrList)) self.resultList.insertItem("%.3f - %s" % (val, str(attrList)), index) if len(self.allResults) > self.resultListLen: self.allResults.remove(self.allResults[-...
OWVisAttrSelection.optimizeAttributeOrder(attrInfo, self.numberOfAttributes, self, qApp)
qApp.processEvents() if self.orderAllAttributes: OWVisAttrSelection.optimizeAttributeOrder(attrInfo, len(self.parallelWidget.data.domain.attributes), self, qApp) else: OWVisAttrSelection.optimizeAttributeOrder(attrInfo, self.numberOfAttributes, self, qApp)
def startOptimization(self): self.clearResults() if self.optimizationMeasure == VIZRANK and self.fileName == "": QMessageBox.information(self, "No projection file", "If you wish to optimize using VizRank you first have to load a projection file \ncreated by VizRank using Scatterplot widget.", QMessageBox.Ok) return if...
for i in range(min(len(self.allResults), self.resultListLen)):
for i in range(len(self.allResults)):
def updateShownProjections(self, *args): self.resultList.clear() for i in range(min(len(self.allResults), self.resultListLen)): self.resultList.insertItem("%.2f - %s" % (self.allResults[i][0], str(self.allResults[i][1])), i) if self.resultList.count() > 0: self.resultList.setCurrentItem(0)
name = str(QFileDialog.getSaveFileName( self.lastSaveDirName + "/" + "Parallel projections", "Parallel projections (*.papr)", self, "", "Save Parallel Projections"))
filename = "" if self.datasetName != "": filename = os.path.splitext(os.path.split(self.datasetName)[1])[0] if self.optimizationMeasure == CORRELATION: filename += " - " + "correlation" else: filename += " - " + "vizrank" name = str(QFileDialog.getSaveFileName( os.path.join(self.l...
def saveResults(self, filename = None): if filename == None: name = str(QFileDialog.getSaveFileName( self.lastSaveDirName + "/" + "Parallel projections", "Parallel projections (*.papr)", self, "", "Save Parallel Projections")) if name == "": return else: name = filename
if os.path.splitext(name)[1] != ".papr": name = name + ".papr"
if os.path.splitext(name)[1] != ".papr": name += ".papr"
def saveResults(self, filename = None): if filename == None: name = str(QFileDialog.getSaveFileName( self.lastSaveDirName + "/" + "Parallel projections", "Parallel projections (*.papr)", self, "", "Save Parallel Projections")) if name == "": return else: name = filename
import os
def browseFile(self, inDemos=0): "Display a FileDialog and select a file" if inDemos: try: import win32api, win32con t = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, "SOFTWARE\\Python\\PythonCore\\%i.%i\\PythonPath\\Orange" % sys.version_info[:2], 0, win32con.KEY_READ) t = win32api.RegQueryValueEx(t, "")[0] startfi...
list[self.idx+3] = self.missing
list[self.idx+2] = self.missing
def apply(self,ex,list): (value,spec) = _getattr(ex,self.attr) if spec: list[self.idx] = self.missing list[self.idx+1] = self.missing list[self.idx+3] = self.missing else: list[self.idx] = (float(value)-self.disp)*self.mult list[self.idx+1] = (list[self.idx]**2)*self.correction2 list[self.idx+2] = (list[self.idx]**3)*s...
cateS = IndexStore(name, [(title, filename, counter)])
cateS.entries.append((title, filename, counter))
def addIndex(indexStoreList, name, title=None, filename=None, counter = None): if title: cateS = IndexStore(name, [(title, filename, counter)]) newID("%s#HH%i" % (filename, counter)) else: cateS = IndexStore(name) indexStoreList.setdefault(name.lower(), cateS) return cateS
cateS = IndexStore(name) indexStoreList.setdefault(name.lower(), cateS) return cateS
tags = "<%s>" % tag, "<%s " % tag for l in range(start or len(outp)-1, -1, -1): ri = max([outp[l].lower().rfind(tg) for tg in tags]) if ri > -1: return l, ri return -1, -1 def addAName(outp, aname, lasttag=None): if not lasttag or lasttag == "here": ri = -1 elif lasttag == "head": l, ri = findLastTag(outp, "h") eli...
def addIndex(indexStoreList, name, title=None, filename=None, counter = None): if title: cateS = IndexStore(name, [(title, filename, counter)]) newID("%s#HH%i" % (filename, counter)) else: cateS = IndexStore(name) indexStoreList.setdefault(name.lower(), cateS) return cateS
re_idx = re.compile(r'<index(\s+name\s*=\s*(?P<name>("[^"]*"|0)))?>')
re_idx = re.compile(r'<index(?P<options>\s+[^>]+)?>')
def findIndices(page, filename, title): lowpage = page.lower() outp = [] lastout = 0 counter = 0 lidx = 0 H2Entry = None re_idx = re.compile(r'<index(\s+name\s*=\s*(?P<name>("[^"]*"|0)))?>') re_h2 = re.compile(r'<h2(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') re_h3 = re.compile(r'<h3(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') w...
nameg = idxm.group("name")
optionsg = idxm.group("options") posg = "phead" name = "" if optionsg: mg = re_opt_name.match(optionsg) if mg: nameg = mg.group("name") begopt = idxm.span("options")[0] b, e = mg.span("name") name = addNewlines(page[begopt+b+1:begopt+e-1]) mg = re_opt_pos.match(optionsg) if mg: posg = mg.group("posg") if posg == "here...
def findIndices(page, filename, title): lowpage = page.lower() outp = [] lastout = 0 counter = 0 lidx = 0 H2Entry = None re_idx = re.compile(r'<index(\s+name\s*=\s*(?P<name>("[^"]*"|0)))?>') re_h2 = re.compile(r'<h2(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') re_h3 = re.compile(r'<h3(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') w...
if nameg: b, e = idxm.span("name") name = addNewlines(page[b+1:e-1]) else:
if not name:
def findIndices(page, filename, title): lowpage = page.lower() outp = [] lastout = 0 counter = 0 lidx = 0 H2Entry = None re_idx = re.compile(r'<index(\s+name\s*=\s*(?P<name>("[^"]*"|0)))?>') re_h2 = re.compile(r'<h2(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') re_h3 = re.compile(r'<h3(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') w...
outp.append('<a name="HH%i">' % counter)
addAName(outp, '<a name="HH%i">' % counter, posg)
def findIndices(page, filename, title): lowpage = page.lower() outp = [] lastout = 0 counter = 0 lidx = 0 H2Entry = None re_idx = re.compile(r'<index(\s+name\s*=\s*(?P<name>("[^"]*"|0)))?>') re_h2 = re.compile(r'<h2(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') re_h3 = re.compile(r'<h3(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') w...
cate, name = name.split("+") cateS = addIndex(index, cate) addIndex(index, name, title, filename, counter) addIndex(cateS.subentries, name, title, filename, counter)
catename = name.split("+") if len(catename) == 2: cate, name = catename cateS = addIndex(index, cate) addIndex(index, name, title, filename, counter) addIndex(cateS.subentries, name, title, filename, counter) else: addIndex(index, name, title, filename, counter)
def findIndices(page, filename, title): lowpage = page.lower() outp = [] lastout = 0 counter = 0 lidx = 0 H2Entry = None re_idx = re.compile(r'<index(\s+name\s*=\s*(?P<name>("[^"]*"|0)))?>') re_h2 = re.compile(r'<h2(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') re_h3 = re.compile(r'<h3(\s+toc\s*=\s*(?P<toc>("[^"]*"|0)))?>') w...
self.probGraphValues = [(x, ps, [v*1.96 for v in ps.variances]) for (x, ps) in g.probabilities.items()]
self.probGraphValues = [(x, ps, [math.sqrt(v)*1.96 for v in ps.variances]) for (x, ps) in g.probabilities.items()]
def calcHistogramAndProbGraph(self): "Calculates the histogram." if self.data == None: return
self.dataA = data if data: self.varListA = data.domain.variables.native() + data.domain.getmetas().values()
if data and self.dataB and data.domain == self.dataB.domain: if data.domain.classVar: classVar = data.domain.classVar.clone() else: classVar = None dc = orange.Domain([x.clone() for x in data.domain], classVar) for i, a in enumerate(dc): a.getValueFrom = lambda ex,f,i=i: ex[i] dc.addmetas(data.domain.getmetas()) self....
def onDataAInput(self, data): # update self.dataA, self.varListA and self.varA self.dataA = data if data: self.varListA = data.domain.variables.native() + data.domain.getmetas().values() else: self.varListA = [] if not self.varA in self.varListA: self.varA = None # update info self.updateInfoA() # update attribute A li...
self.dataB = data if data: self.varListB = data.domain.variables.native() + data.domain.getmetas().values()
if data and self.dataA and data.domain == self.dataA.domain: if data.domain.classVar: classVar = data.domain.classVar.clone() else: classVar = None dc = orange.Domain([x.clone() for x in data.domain.attributes], classVar) for i, a in enumerate(dc): a.getValueFrom = lambda ex,f,i=i: ex[i] dc.addmetas(data.domain.getmet...
def onDataBInput(self, data): # update self.dataB, self.varListB and self.varB self.dataB = data if data: self.varListB = data.domain.variables.native() + data.domain.getmetas().values() else: self.varListB = [] if not self.varB in self.varListB: self.varB = None # update info self.updateInfoB() # update attribute B li...
if self.varA.varType == orange.VarTypes.String: for eIdx, e in enumerate(self.dataA): val2idxDictA[str(e[self.varA])] = eIdx else: for eIdx, e in enumerate(self.dataA): val2idxDictA[e[self.varA].native()] = eIdx
for eIdx, e in enumerate(self.dataA): val2idxDictA[e[self.varA].native()] = eIdx
def sendData(self): """Sends out data. """ if self.varA and self.varB: # create dictionaries: attribute values -> example index val2idxDictA = {} if self.varA.varType == orange.VarTypes.String: # odstrani, ko Janez popravi bug #60 for eIdx, e in enumerate(self.dataA): val2idxDictA[str(e[self.varA])] = eIdx else: for eI...
if self.varB.varType == orange.VarTypes.String: for eIdx, e in enumerate(self.dataB): val2idxDictB[str(e[self.varB])] = eIdx else: for eIdx, e in enumerate(self.dataB): val2idxDictB[e[self.varB].native()] = eIdx
for eIdx, e in enumerate(self.dataB): val2idxDictB[e[self.varB].native()] = eIdx if val2idxDictA.has_key("?"): val2idxDictA.pop("?") if val2idxDictA.has_key("~"): val2idxDictA.pop("~") if val2idxDictA.has_key(""): val2idxDictA.pop("") if val2idxDictB.has_key("?"): val2idxDictB.pop("?") if val2idxDictB.has_key(...
def sendData(self): """Sends out data. """ if self.varA and self.varB: # create dictionaries: attribute values -> example index val2idxDictA = {} if self.varA.varType == orange.VarTypes.String: # odstrani, ko Janez popravi bug #60 for eIdx, e in enumerate(self.dataA): val2idxDictA[str(e[self.varA])] = eIdx else: for eI...
if self.varA.varType == orange.VarTypes.String: for e in self.dataA: dataBidx = val2idxDictB.get(str(e[self.varA]), None) if dataBidx <> None: etBreduced.append(self.dataB[dataBidx]) else: etBreduced.append(orange.Example(domBreduced, exBDK)) else: for e in self.dataA: dataBidx = val2idxDictB.get(e[self.varA].native()...
for e in self.dataA: dataBidx = val2idxDictB.get(e[self.varA].native(), None) if dataBidx <> None: etBreduced.append(self.dataB[dataBidx]) else: etBreduced.append(orange.Example(domBreduced, exBDK))
def sendData(self): """Sends out data. """ if self.varA and self.varB: # create dictionaries: attribute values -> example index val2idxDictA = {} if self.varA.varType == orange.VarTypes.String: # odstrani, ko Janez popravi bug #60 for eIdx, e in enumerate(self.dataA): val2idxDictA[str(e[self.varA])] = eIdx else: for eI...
if self.varB.varType == orange.VarTypes.String: for e in self.dataB: dataAidx = val2idxDictA.get(str(e[self.varB]), None) if dataAidx <> None: etAreduced.append(self.dataA[dataAidx]) else: etAreduced.append(orange.Example(domAreduced, exADK)) else: for e in self.dataB: dataAidx = val2idxDictA.get(e[self.varB].native()...
for e in self.dataB: dataAidx = val2idxDictA.get(e[self.varB].native(), None) if dataAidx <> None: etAreduced.append(self.dataA[dataAidx]) else: etAreduced.append(orange.Example(domAreduced, exADK))
def sendData(self): """Sends out data. """ if self.varA and self.varB: # create dictionaries: attribute values -> example index val2idxDictA = {} if self.varA.varType == orange.VarTypes.String: # odstrani, ko Janez popravi bug #60 for eIdx, e in enumerate(self.dataA): val2idxDictA[str(e[self.varA])] = eIdx else: for eI...
dataA = orange.ExampleTable(r'c:\Documents and Settings\peterjuv\My Documents\STEROLTALK\Sterolgene v.0 mouse\sterolgene v.0 mouse controlGeneRatios.tab') dataB = orange.ExampleTable(r'c:\Documents and Settings\peterjuv\My Documents\STEROLTALK\Sterolgene v.0 mouse\sterolgene v.0 mouse controlGeneRatios 2 ecoli.tab')
dataA = orange.ExampleTable(r'c:\Documents and Settings\peterjuv\My Documents\et1.tab') dataB = orange.ExampleTable(r'c:\Documents and Settings\peterjuv\My Documents\et2.tab')
def _sp(self, l, capitalize=True): """Input: list; returns tupple (str(len(l)), "s"/"") """ n = len(l) if n == 0: if capitalize: return "No", "s" else: return "no", "s" elif n == 1: return str(n), '' else: return str(n), 's'
expCDTs = corn.computeCDT(exp, classIndex, useweights) for i in range(len(CDTs)): CDTs[i].C += expCDTs[i].C CDTs[i].D += expCDTs[i].D CDTs[i].T += expCDTs[i].T return CDTs
pass
def computeCDT(res, classIndex=-1, **argkw): if classIndex<0: if res.baseClass>=0: classIndex = res.baseClass else: classIndex = 1 import corn useweights = res.weights and not argkw.get("unweighted", 0) if (res.numberOfIterations>1): CDTs = [CDT() for i in range(res.numberOfLearners)] iterationExperiments = splitByIt...
data.name = string.split(os.path.split(fn)[1], '.')[0]
fName = os.path.split(fn)[1] if "." in fName: data.name = string.join(string.split(fName, '.')[:-1], '.') else: data.name = fName
def sp(l): n = len(l) if n <> 1: return n, 's' else: return n, ''
title="O&range Widget",
title="Qt Orange Widget",
def __init__(
print self.getMeasure(self.sortBy-3).items()
def resort(self): self.attributeOrder = self.usefulAttributes
print st
def resort(self): self.attributeOrder = self.usefulAttributes
self.bnomogram.addAttribute(a)
if len(a.attValues)>1: self.bnomogram.addAttribute(a)
def err(condDist, att, value, targetClass, priorError, data): sumE = sum(condDist) valueE = condDist[targetClass] distAtt = orange.Distribution(att, data) inf = distAtt[value]*(valueE/sumE)*(1-valueE/sumE) inf = max(inf, aproxZero) var = max(1/inf - priorError*priorError, 0) return (math.sqrt(var))
self.bnomogram.addAttribute(a)
if len(a.attValues)>1: self.bnomogram.addAttribute(a)
def lrClassifier(self, cl): if self.TargetClassIndex == 0 or self.TargetClassIndex == cl.domain.classVar[0]: mult = -1 else: mult = 1
self.bnomogram.addAttribute(a)
if len(a.attValues)>1: self.bnomogram.addAttribute(a)
def svmClassifier(self, cl): import Numeric import orngLinVis if self.TargetClassIndex == 0 or self.TargetClassIndex == cl.domain.classVar[0]: mult = -1 else: mult = 1
discretizer = orange.EntropyDiscretization() catData = orange.Preprocessor_discretize(data, method=discretizer)
def showNomogram(self): if self.bnomogram and self.cl: self.bnomogram.show()
ow.cdata(data)
def showNomogram(self): if self.bnomogram and self.cl: self.bnomogram.show()
self.openContext("",self.data)
if data and type(data) == orange.ExampleTable: self.openContext("",self.data)
def cmatrix(self, matrix=None): self.closeContext() self.origMatrix=matrix self.data=data=None if matrix: self.data=data=getattr(matrix, "items") if data and type(data)==orange.ExampleTable: self.setExampleTable(data) elif type(data)==list: self.setList(data) self.graph.ColorAttr=0 self.graph.SizeAttr=0 self.graph.Shap...
def setVarList(self, data): self.colorCombo.clear() self.sizeCombo.clear() self.shapeCombo.clear() self.nameCombo.clear() for name in ["One color", "Variable"]: self.colorCombo.insertItem(name) for name in ["No name", "Var name"]: self.nameCombo.insertItem(name) self.colors=[[Qt.black]*3 for i in range(len(data))] self...
def setList(self, data): self.colorCombo.clear() self.sizeCombo.clear() self.shapeCombo.clear() self.nameCombo.clear() for name in ["One color", "strain"]: self.colorCombo.insertItem(name) for name in ["No name", "name", "strain"]: self.nameCombo.insertItem(name) self.colors=[[Qt.black]*3 for i in range(len(data))] se...
self.attributeCountCombo = OWGUI.comboBox(self.buttonBox, self, "attributeCount", items = range(3, 100), tooltip = "Evaluate only projections with exactly (or maximum) this number of attributes", sendSelectedValue = 1, valueType = int)
self.attributeCountCombo = OWGUI.comboBox(self.buttonBox, self, "attributeCount", items = range(3, 20), tooltip = "Evaluate only projections with exactly (or maximum) this number of attributes", sendSelectedValue = 1, valueType = int, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.stopOptimizationButton = OWGUI.button(self.optimizationBox, self, "Stop evaluation", callback = self.stopEvaluationClick)
self.stopOptimizationButton = OWGUI.button(self.optimizationBox, self, "Stop evaluation", callback = self.stopEvaluationClick, debuggingEnabled = 0 )
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
if self.parentWidget: self.connect(self.resultList, SIGNAL("selectionChanged()"), self.parentWidget.showSelectedAttributes)
if self.parentWidget: self.connect(self.resultList, SIGNAL("selectionChanged()"), self.parentWidget.showSelectedAttributes) self._guiElements = getattr(self, "_guiElements", []) + [("listBox", self.resultList, None, self.parentWidget.showSelectedAttributes)]
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Use time limit: ", 1, 1000, "useTimeLimit", "timeLimit", " (minutes)") OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Use projection count limit: ", 1, 1000000, "useProjectionLimit", "projectionLimit", " (projections)")
OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Use time limit: ", 1, 1000, "useTimeLimit", "timeLimit", " (minutes)", debuggingEnabled = 0) OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Use projection count limit: ", 1, 1000000, "useProjectionLimit", "projectionLimit", " (projections...
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.findArgumentsButton = OWGUI.button(self.argumentationBox, self, "Find Arguments", callback = self.findArguments)
self.findArgumentsButton = OWGUI.button(self.argumentationBox, self, "Find Arguments", callback = self.findArguments, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.classValueList = OWGUI.comboBox(self.ArgumentationTab, self, "argumentationClassValue", box = " Arguments for Class: ", tooltip = "Select the class value that you wish to see arguments for", callback = self.argumentationClassChanged)
self.classValueList = OWGUI.comboBox(self.ArgumentationTab, self, "argumentationClassValue", box = " Arguments for Class: ", tooltip = "Select the class value that you wish to see arguments for", callback = self.argumentationClassChanged, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.evaluationTimeEdit = OWGUI.comboBoxWithCaption(b, self, "evaluationTime", "Time for evaluating projections (minutes): ", tooltip = "What is the maximum time that the classifier is allowed for evaluating projections (learning)", items = self.evaluationTimeNums, sendSelectedValue = 1, valueType = floa...
self.evaluationTimeEdit = OWGUI.comboBoxWithCaption(b, self, "evaluationTime", "Time for evaluating projections (minutes): ", tooltip = "What is the maximum time that the classifier is allowed for evaluating projections (learning)", items = self.evaluationTimeNums, sendSelectedValue = 1, valueType = floa...
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.optimizeBestProjectionCheck = OWGUI.checkBox(b2, self, "optimizeBestProjection", "Afterwards use local optimization for (minutes): ", tooltip = "Do you want to try to locally optimize the best projection when the time for evaluating projections runs out?") self.optimizeBestProjectionCombo = OWGUI.comboBox(b2, self...
self.optimizeBestProjectionCheck = OWGUI.checkBox(b2, self, "optimizeBestProjection", "Afterwards use local optimization for (minutes): ", tooltip = "Do you want to try to locally optimize the best projection when the time for evaluating projections runs out?", debuggingEnabled = 0) self.optimizeBestProjectionCombo = O...
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.argumentCountEdit = OWGUI.comboBoxWithCaption(projCountBox, self, "argumentCount", "Number of projections used when classifying: ", tooltip = "What is the maximum number of projections (arguments) that will be used when classifying an example.", items = self.argumentCounts, sendSelectedValue = 1, va...
self.argumentCountEdit = OWGUI.comboBoxWithCaption(projCountBox, self, "argumentCount", "Number of projections used when classifying: ", tooltip = "What is the maximum number of projections (arguments) that will be used when classifying an example.", items = self.argumentCounts, sendSelectedValue = 1, va...
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
OWGUI.button(self.buttonBox7, self, "Attribute Ranking", self.attributeAnalysis) OWGUI.button(self.buttonBox7, self, "Attribute Interactions", self.interactionAnalysis)
OWGUI.button(self.buttonBox7, self, "Attribute Ranking", self.attributeAnalysis, debuggingEnabled = 0) OWGUI.button(self.buttonBox7, self, "Attribute Interactions", self.interactionAnalysis, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
OWGUI.button(self.buttonBox8, self, "Graph Projection Scores", self.graphProjectionQuality) OWGUI.button(self.buttonBox8, self, "Outlier Identification", self.identifyOutliers)
OWGUI.button(self.buttonBox8, self, "Graph Projection Scores", self.graphProjectionQuality, debuggingEnabled = 0) OWGUI.button(self.buttonBox8, self, "Outlier Identification", self.identifyOutliers, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.loadButton = OWGUI.button(self.buttonBox6, self, "Load", self.loadProjections) self.saveButton = OWGUI.button(self.buttonBox6, self, "Save", self.saveProjections)
self.loadButton = OWGUI.button(self.buttonBox6, self, "Load", self.loadProjections, debuggingEnabled = 0) self.saveButton = OWGUI.button(self.buttonBox6, self, "Save", self.saveProjections, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.saveBestButton = OWGUI.button(self.buttonBox9, self, "Save Best Graphs", self.exportMultipleGraphs) OWGUI.button(self.buttonBox9, self, "Remove Similar Projections", callback = self.removeTooSimilarProjections)
self.saveBestButton = OWGUI.button(self.buttonBox9, self, "Save Best Graphs", self.exportMultipleGraphs, debuggingEnabled = 0) OWGUI.button(self.buttonBox9, self, "Remove Similar Projections", callback = self.removeTooSimilarProjections, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
self.evaluateProjectionButton = OWGUI.button(self.buttonBox3, self, 'Evaluate Projection', callback = self.evaluateCurrentProjection)
self.evaluateProjectionButton = OWGUI.button(self.buttonBox3, self, 'Evaluate Projection', callback = self.evaluateCurrentProjection, debuggingEnabled = 0)
def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog")
def removeTooSimilarProjections(self): (text, ok) = QInputDialog.getText('Qt Allowed Similarity', 'How many attributes can be present in some better projection for a projection to be still considered as different (in pecents. Default = 70)?') if not ok: return percents = int(str(text))
def removeTooSimilarProjections(self, allowedPercentOfEqualAttributes = -1): if allowedPercentOfEqualAttributes == -1: (text, ok) = QInputDialog.getText('Qt Allowed Similarity', 'How many attributes can be present in some better projection for a projection to be still considered as different (in pecents. Default = 70)?...
def removeTooSimilarProjections(self): (text, ok) = QInputDialog.getText('Qt Allowed Similarity', 'How many attributes can be present in some better projection for a projection to be still considered as different (in pecents. Default = 70)?') if not ok: return percents = int(str(text)) qApp.setOverrideCursor(QWidget.wa...
if self.existsABetterSimilarProjection(i, allowedPercentOfEqualAttributes = percents):
if self.existsABetterSimilarProjection(i, allowedPercentOfEqualAttributes = allowedPercentOfEqualAttributes):
def removeTooSimilarProjections(self): (text, ok) = QInputDialog.getText('Qt Allowed Similarity', 'How many attributes can be present in some better projection for a projection to be still considered as different (in pecents. Default = 70)?') if not ok: return percents = int(str(text)) qApp.setOverrideCursor(QWidget.wa...
def __init__(self, scons, attributes, rand = random.Random()):
def __init__(self, scons, attributes, rand = None):
def __init__(self, scons, attributes, rand = random.Random()): self.scons = scons # split constructor of original tree self.attributes = attributes # number of attributes to consider self.rand = rand # a random generator
self.rand = rand
if rand: self.rand = rand else: self.rand = random.Random() self.rand.seed(0)
def __init__(self, scons, attributes, rand = random.Random()): self.scons = scons # split constructor of original tree self.attributes = attributes # number of attributes to consider self.rand = rand # a random generator
ext = ext.replace(".","") if ext == "":
ext = ext.replace(".",""); ext = ext.upper() if ext == "" or not (ext == "BMP" or ext == "GIF" or ext == "PNG") :
def saveToFile(self): if self.sizeOriginal.isChecked(): size = self.graph.size() elif self.size400.isChecked(): size = QSize(400,400) elif self.size600.isChecked(): size = QSize(600,600) elif self.size800.isChecked(): size = QSize(800,800) elif self.custom.isChecked(): size = QSize(int(str(self.xSize.text())), int(str...
ext = ext.upper()
def saveToFile(self): if self.sizeOriginal.isChecked(): size = self.graph.size() elif self.size400.isChecked(): size = QSize(400,400) elif self.size600.isChecked(): size = QSize(600,600) elif self.size800.isChecked(): size = QSize(800,800) elif self.custom.isChecked(): size = QSize(int(str(self.xSize.text())), int(str...
y = offset + lineskip*(i+2)
y = offset + lineskip*(i+1.5)
def matrix(self,labels, diss, margin = 10, hook = 10, block = None, line_size = 2.0, att_colors = [], canvas = None,color_mode=0): # prevent divide-by-zero... if len(labels) < 2: return canvas
def __init__(self,estdomain,estimator):
def __init__(self,coeff,estdomain,estimator): self.coeff = coeff
def __init__(self,estdomain,estimator): self.estdomain = estdomain self.cv = self.estdomain.classVar(0) self.estimator = estimator
ex = orange.Example(self.estdomain,[r,self.cv])
ex = orange.Example(self.estdomain,[r*self.coeff,self.cv])
def __call__(self, r): # got a margin ex = orange.Example(self.estdomain,[r,self.cv]) # need a dummy class value p = self.estimator(ex,orange.GetProbabilities)
return (beta, coeffs, coeff_names, basis, m, _marginConverter(self.marginc.estdomain, self.marginc.estimator))
return (beta, coeffs, coeff_names, basis, m, _marginConverter(self.marginc.coeff, self.marginc.estdomain, self.marginc.estimator))
def __call__(self,classifier,examples, buckets): (beta, coeffs, coeff_names, basis, m, _probfunc) = self.parser(classifier.classifier,examples, buckets) return (beta, coeffs, coeff_names, basis, m, _marginConverter(self.marginc.estdomain, self.marginc.estimator))
slider.setMaximumSize(maxWidth,40)
if maxWidth: slider.setMaximumSize(maxWidth,40)
def qwtHSlider(widget, master, value, box=None, label=None, labelWidth=None, minValue=1, maxValue=10, step=0.1, precision=1, callback=None, logarithmic=0, ticks=0, maxWidth=80): init = mygetattr(master, value) if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = widget hb = QHBox(sliderBox) if label: lbl =...
format = "%s%d.%df" % ("%", precision+3, precision)
format = " %s.%df" % ("%", precision)
def qwtHSlider(widget, master, value, box=None, label=None, labelWidth=None, minValue=1, maxValue=10, step=0.1, precision=1, callback=None, logarithmic=0, ticks=0, maxWidth=80): init = mygetattr(master, value) if box: sliderBox = QHButtonGroup(box, widget) else: sliderBox = widget hb = QHBox(sliderBox) if label: lbl =...
if widgetFrom.linksOut.has_key(signalNameFrom) and enabled:
if not widgetFrom.linksOut.has_key(signalNameFrom): widgetFrom.linksOut[signalNameFrom] = {None:None} if enabled:
def addLink(self, widgetFrom, widgetTo, signalNameFrom, signalNameTo, enabled): self.addEvent("add link from " + widgetFrom.title + " to " + widgetTo.title) if not self.canConnect(widgetFrom, widgetTo): return 0 # check if signal names still exist found = 0 for o in widgetFrom.outputs: output = OutputSignal(*o) if out...
self.mainArea.setFixedWidth(1)
self.mainArea.setFixedWidth(0)
def __init__(self,parent = None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Data Domain") #initialize base class
self.applyButton.setMaximumWidth(101)
self.applyButton.setMaximumWidth(applyButtonWidth)
def __init__(self,parent = None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Data Domain") #initialize base class
self.resetButton.setMaximumWidth(101)
self.resetButton.setMaximumWidth(applyButtonWidth) self.icons = {orange.VarTypes.Continuous: self.createAttributePixmap("C"), orange.VarTypes.Discrete: self.createAttributePixmap("D"), orange.VarTypes.String: self.createAttributePixmap("S")}
def __init__(self,parent = None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Data Domain") #initialize base class
self.attributesList.insertItem(self.createListItem(attr.varType, attr.name))
self.attributesList.insertItem(self.icons[attr.varType], attr.name)
def onDataInput(self, data): self.data = data
self.classList.insertItem(self.createListItem(data.domain.classVar.varType, data.domain.classVar.name))
self.classList.insertItem(self.icons[data.domain.classVar.varType], data.domain.classVar.name)
def onDataInput(self, data): self.data = data
self.metaList.insertItem(self.createListItem(attr.varType, attr.name))
self.metaList.insertItem(self.icons[attr.varType], attr.name)
def onDataInput(self, data): self.data = data
self.attributesList.insertItem(self.createListItem(itemType,itemText))
self.attributesList.insertItem(self.icons[itemType],itemText)
def onAttributesButtonClicked(self): self.internalSelectionUpdateFlag = self.internalSelectionUpdateFlag + 1 if self.attributesButtonLeft: self.removeSelectedItems(self.attributesList) else: for i in range(0, self.inputAttributesList.count()): if (self.inputAttributesList.isSelected(i)): itemText = str(self.inputAttrib...
self.classList.insertItem(self.createListItem(itemType,itemText))
self.classList.insertItem(self.icons[itemType],itemText)
def onClassButtonClicked(self): self.internalSelectionUpdateFlag = self.internalSelectionUpdateFlag + 1 self.classList.clear() if not self.classButtonLeft: for i in range(0, self.inputAttributesList.count()): if (self.inputAttributesList.isSelected(i)): itemText = str(self.inputAttributesList.text(i)) itemType = self.d...
self.metaList.insertItem(self.createListItem(itemType,itemText))
self.metaList.insertItem(self.icons[itemType],itemText)
def onMetaButtonClicked(self): self.internalSelectionUpdateFlag = self.internalSelectionUpdateFlag + 1 if self.metaButtonLeft: self.removeSelectedItems(self.metaList) else: for i in range(0, self.inputAttributesList.count()): if (self.inputAttributesList.isSelected(i)): itemText = str(self.inputAttributesList.text(i)) ...
def createListItem(self, varType, text): marks = {} marks[orange.VarTypes.Continuous] = 'C' marks[orange.VarTypes.Discrete] = 'D' marks[orange.VarTypes.String] = 'S' pixmap = QPixmap() pixmap.resize(13,13) painter = QPainter() painter.begin(pixmap) painter.setPen( Qt.black ); painter.setBrush( Qt.white ); painter....
def createAttributePixmap(self, char): pixmap = QPixmap() pixmap.resize(13,13) painter = QPainter() painter.begin(pixmap) painter.setPen( Qt.black ); painter.setBrush( Qt.white ); painter.drawRect( 0, 0, 13, 13 ); painter.drawText(3, 11, char) painter.end() return pixmap
def createListItem(self, varType, text): marks = {} marks[orange.VarTypes.Continuous] = 'C' marks[orange.VarTypes.Discrete] = 'D' marks[orange.VarTypes.String] = 'S'
item1 = self.createListItem(self.data.domain[str(listBox.text(i-1))].varType, str(listBox.text(i-1))) item2 = self.createListItem(self.data.domain[str(listBox.text(i))].varType, str(listBox.text(i))) listBox.changeItem(item1, i) listBox.changeItem(item2, i-1)
txt1 = str(listBox.text(i-1)) txt2 = str(listBox.text(i)) listBox.changeItem(self.icons[self.data.domain[txt1].varType], txt1, i) listBox.changeItem(self.icons[self.data.domain[txt2].varType], txt2, i-1)
def moveSelectionUp(self, listBox): selection = [] for i in range(0, listBox.count()): if (listBox.isSelected(i)): selection.append(i) for i in selection: item1 = self.createListItem(self.data.domain[str(listBox.text(i-1))].varType, str(listBox.text(i-1))) item2 = self.createListItem(self.data.domain[str(listBox.text(i...
item1 = self.createListItem(self.data.domain[str(listBox.text(i))].varType, str(listBox.text(i))) item2 = self.createListItem(self.data.domain[str(listBox.text(i+1))].varType, str(listBox.text(i+1))) listBox.changeItem(item1, i+1) listBox.changeItem(item2, i)
txt1 = str(listBox.text(i)) txt2 = str(listBox.text(i+1)) listBox.changeItem(self.icons[self.data.domain[txt1].varType], txt1, i+1) listBox.changeItem(self.icons[self.data.domain[txt2].varType], txt2, i)
def moveSelectionDown(self, listBox): selection = [] for i in range(0, listBox.count()): if (listBox.isSelected(i)): selection.append(i)