def __init__(self, parent = None, layout = 'vertical', title = 'Color List Dialog', data = ''): QDialog.__init__(self, parent) self.setWindowTitle(title) if layout == 'horizontal': self.setLayout(QHBoxLayout()) else: self.setLayout(QVBoxLayout()) self.listOfColors = [] self.controlArea = widgetBox(self) mainArea = widgetBox(self.controlArea, 'horizontal') leftBox = widgetBox(mainArea) rightBox = widgetBox(mainArea) ## GUI # color list self.colorList = listBox(leftBox, label = 'Color List') button(leftBox, label = 'Add Color', callback = self.addColor) button(leftBox, label = 'Remove Color', callback = self.removeColor) button(leftBox, label = 'Clear Colors', callback = self.colorList.clear) button(mainArea, label = 'Finished', callback = self.accept) # attribute list self.attsList = listBox(rightBox, label = 'Data Parameters', callback = self.attsListSelected) if data: names = self.R('names('+data+')') print names self.attsList.update(names) self.data = data
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["apply"]) self.numDims = 2 self.data = None self.inputs.addInput('id0', _('X'), redRRMatrix, self.processX) self.outputs.addOutput('id0', _('apply Output'), redRRDataFrame) area = widgetBox(self.controlArea, orientation='horizontal') box = widgetBox(area) box.setMinimumWidth(200) area.layout().setAlignment(box, Qt.AlignLeft) self.functions = listBox( box, label=_("Select Function"), items=['mean', 'median', 'max', 'min', 'sum', 'log2', 'log10'], callback=self.functionSelect) self.functions.setSelectionMode(QAbstractItemView.SingleSelection) separator(box, height=10) self.functionText = redRTextEdit(box, label=_('Function:'), orientation='vertical') self.parameters = redRLineEdit(box, label=_('Additional Parameters:'), orientation='vertical') self.demension = radioButtons(box, label=_("To:"), buttons=[_('Rows'), _('Columns'), _('')], setChecked=_('Rows'), orientation='horizontal', callback=lambda: self.dimensionChange(1)) self.indexSpinBox = RedRSpinBox( self.demension.box, label=_('Demension'), displayLabel=False, min=1, value=1, callback=lambda: self.dimensionChange(2)) buttonBox = widgetBox(box, orientation='horizontal') self.commit = redRCommitButton(buttonBox, _("Commit"), alignment=Qt.AlignLeft, callback=self.commitFunction, processOnInput=True, processOnChange=True) self.outputTable = redRFilterTable(area, label=_('Results of Apply'), sortable=True)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["intersect"]) self.dataA = None self.dataB = None self.inputs.addInput('id0', _('Input Data A'), redRRList, self.processA) self.inputs.addInput('id1', _('Input Data B'), redRRList, self.processB) self.outputs.addOutput('id0', _('intersect Output'), redRRVector) box = widgetBox(self.controlArea, orientation='vertical') dataSetBox = widgetBox(box, orientation='horizontal') #pickA = groupBox(dataSetBox, "Dataset A:") self.colA = listBox(dataSetBox, label=_('Input Data A'), callback=self.onSelect) #pickB = groupBox(dataSetBox, "Dataset B:") self.colB = listBox(dataSetBox, label=_('Input Data B'), callback=self.onSelect) self.resultInfo = textEdit(box, label=_('Results'), displayLabel=False, includeInReports=False, editable=False, alignment=Qt.AlignHCenter) self.resultInfo.setMaximumWidth(170) self.resultInfo.setMaximumHeight(25) self.resultInfo.setMinimumWidth(170) self.resultInfo.setMinimumHeight(25) #box.layout().setAlignment(self.resultInfo,Qt.AlignHCenter) self.resultInfo.hide() self.type = radioButtons(self.bottomAreaLeft, label=_("Perform"), buttons=[ _('Intersect'), _('Union'), _('Set Difference'), _('Set Equal') ], setChecked=_('Intersect'), orientation='horizontal', callback=self.onTypeSelect) commitBox = widgetBox(self.bottomAreaRight, orientation='horizontal') self.bottomAreaRight.layout().setAlignment(commitBox, Qt.AlignBottom) self.commit = redRCommitButton(commitBox, _("Commit"), callback=self.commitFunction, processOnChange=True, processOnInput=True)
def __init__(self, parent, name = '', data = None): ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget. QGraphicsView.__init__(self, parent) self.controlArea = widgetBox(parent) self.topArea = widgetBox(self.controlArea) self.middleArea = widgetBox(self.controlArea) self.bottomArea = widgetBox(self.controlArea) self.middleArea.layout().addWidget(self) # place the widget into the parent widget scene = QGraphicsScene() self.setScene(scene) self.parent = parent
def __init__(self, parent=None, signalManager=None): settingsList = ['output_txt', 'parameters'] OWRpy.__init__(self) self.functionParams = '' self.widgetInputsName = [] self.widgetInputsClass = [] self.widgetInputsFunction = [] self.numberInputs = 0 self.numberOutputs = 0 self.fieldList = {} self.functionInputs = {} self.processOnConnect = 1 # GUI # several tabs with different parameters such as loading in a function, setting parameters, setting inputs and outputs tabs = tabWidget.tabWidget(self.controlArea) functionTab = tabs.createTabPage(_("Function Info")) codeTab = tabs.createTabPage(_("Code")) box = widgetBox.widgetBox(functionTab, "") box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) self.infoa = widgetLabel.widgetLabel(box, '') self.packageName = lineEdit.lineEdit(box, label = _('Package:'), orientation = 1) button.button(box, 'Load Package', callback = self.loadRPackage) self.functionName = lineEdit.lineEdit(box, label = _('Function Name:'), orientation = 1) button.button(box, 'Parse Function', callback = self.parseFunction) self.argsLineEdit = lineEdit.lineEdit(box, label = _('GUI Args')) self.connect(self.argsLineEdit, SIGNAL('textChanged(QString)'), self.setArgsLineEdit) box = widgetBox.widgetBox(functionTab) box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.inputArea = QTableWidget() box.layout().addWidget(self.inputArea) self.inputArea.setColumnCount(7) box = widgetBox.widgetBox(functionTab, orientation = 'horizontal') #self.inputArea.hide() self.connect(self.inputArea, SIGNAL("itemClicked(QTableWidgetItem*)"), self.inputcellClicked) self.functionAllowOutput = checkBox.checkBox(box, label = _('Allow Output'), displayLable = False, buttons = [_('Allow Output')]) self.captureROutput = checkBox.checkBox(box, buttons = [_('Show Output')]) #self.inputsCombobox = redRGUI.comboBox(box, label = 'Input Class:', items = self.getRvarClass_classes()) self.outputsCombobox = comboBox.comboBox(box, label = _('Output Class:'), items = self.getRvarClass_classes()) button.button(box, label = _('Accept Inputs'), callback = self.acceptInputs) button.button(box, _('Generate Code'), callback = self.generateCode) button.button(box, _('Launch Widget'), callback = self.launch) self.codeArea = QTextEdit() codeTab.layout().addWidget(self.codeArea)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self, wantGUIDialog=1) self.setRvariableNames(["lm"]) self.RFunctionParam_formula = "" self.RFunctionParam_data = '' self.modelFormula = '' self.processingComplete = 0 self.inputs.addInput('id0', 'data', redRRDataFrame, self.processdata) self.outputs.addOutput('id0', 'lm Output', redRRLMFit) self.outputs.addOutput('id1', 'lm plot attribute', redRRPlotAttribute) #GUI box = widgetBox(self.GUIDialog, orientation='horizontal') paramBox = groupBox(self.GUIDialog, 'Parameters') formulaBox = widgetBox(self.controlArea) self.RFunctionParam_subset = lineEdit(paramBox, 'NULL', label="subset:") self.RFunctionParam_qr = lineEdit(paramBox, 'TRUE', label="qr:") self.RFunctionParam_singular_ok = lineEdit(paramBox, 'TRUE', label="singular_ok:") self.RFunctionParam_y = lineEdit(paramBox, 'FALSE', label="y:") self.RFunctionParam_weights = lineEdit(paramBox, "", label="weights:") self.RFunctionParam_offset = lineEdit(paramBox, "", label="offset:") self.RFunctionParam_contrasts = lineEdit(paramBox, "NULL", label="contrasts:") self.RFunctionParam_x = lineEdit(paramBox, "FALSE", label="x:") self.RFunctionParam_model = lineEdit(paramBox, "TRUE", label="model:") self.RFunctionParam_method = lineEdit(paramBox, "qr", label="method:") #start formula entry section buttonsBox = widgetBox(formulaBox, "Commands") self.formulEntry = RFormulaEntry(buttonsBox, label='Formula', displayLabel=False) self.commit = redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction, processOnInput=True) #self.processButton.setEnabled(False) self.status.setText('Data Not Connected Yet')
def __init__(self, widget, label=None, displayLabel=True, includeInReports=True, value=None, orientation='horizontal', decimals=0, max = None, min = None, callback=None, toolTip = None, *args): self.widget = widget widgetState.__init__(self,widget,label,includeInReports) QDoubleSpinBox.__init__(self) self.setDecimals(decimals) self.label = label if displayLabel: self.hb = widgetBox(self.controlArea,orientation=orientation) widgetLabel(self.hb, label) self.hb.layout().addWidget(self) else: self.controlArea.layout().addWidget(self) if max: self.setMaximum(int(max)) if min: self.setMinimum(int(min)) if toolTip: self.setToolTip(unicode(toolTip)) self.setWrapping(True) # we always allow the spin box to wrap around if value: self.setValue(value) if callback: QObject.connect(self, SIGNAL('valueChanged(double)'), callback)
def __init__(self, widget, label = _('Formula Entry'), displayLabel=True, includeInReports=True): # make a widgetBox to hold everything widgetState.__init__(self,widget,label,includeInReports) box = groupBox(self.controlArea,label=label) ## add the elements to the box #place the command keys self.buttonsBox = groupBox(box, label = _("Formula Commands")) self.plusButton = button(self.buttonsBox, _("And (+)"), callback = self.plusButtonClicked) self.plusButton.setEnabled(False) self.colonButton = button(self.buttonsBox, _("Interacting With (:)"), callback = self.colonButtonClicked) self.colonButton.setEnabled(False) self.starButton = button(self.buttonsBox, _("Together and Interacting (*)"), callback = self.starButtonClicked) self.starButton.setEnabled(False) button(self.buttonsBox, _('Clear'), self.clearFormula) self.elementsListBox = listBox(self.buttonsBox, label = _('Elements'), callback = self.FormulaEntryElementSelected) self.elementsListBox.setEnabled(True) # place the formula line edit self.modelBox = groupBox(box, label = _("Model Formula"), orientation = 'horizontal') self.extrasBox = widgetBox(self.modelBox) self.outcomeVariable = comboBox(self.modelBox, label = _('Outcome (f(x)):')) widgetLabel(self.modelBox, ' = ') self.modelLineEdit = lineEdit(self.modelBox, label = _('model'), displayLabel=False) self.label = label
def __init__(self, parent=None, signalManager = None): OWRpy.__init__(self) self.data = None self.orriginalData = '' # a holder for data that we get from a connection self.currentDataTransformation = '' # holder for data transformations ex: ((data[1:5,])[,1:3])[1:2,] self.dataParent = None self.currentRow = 0 self.currentColumn = 0 self.rowNameSelectionCriteria = '' self.criteriaList = {} self.setRvariableNames(['dataExplorer']) self.criteriaDialogList = [] self.inputs.addInput('id0', _('Data Table'), redRRDataFrame, self.processData) self.outputs.addOutput('id0', _('Data Table'), redRRDataFrame) ######## GUI ############ self.tableArea = widgetBox(self.controlArea) self.table = filterTable(self.controlArea, sortable=True,label=_('Data Table'),displayLabel=False, filterable=True,selectionMode = QAbstractItemView.NoSelection,onFilterCallback=self.onFilter) self.commitOnInput = redRCheckBox(self.bottomAreaRight, label=_('Commit'), displayLabel=False, buttons = [_('Commit on Filter')], toolTips = [_('On filter send data forward.')]) redRCommitButton(self.bottomAreaRight, _("Commit"), callback = self.commitSubset)
def __init__(self, widget, label=None, displayLabel=True, includeInReports=True, items=None, editable=False, orientation='horizontal', callback=None): widgetState.__init__(self, widget, label, includeInReports) QComboBox.__init__(self, self.controlArea) if displayLabel: self.hb = widgetBox(self.controlArea, orientation=orientation) widgetLabel(self.hb, label) self.hb.layout().addWidget(self) self.hasLabel = True else: self.controlArea.layout().addWidget(self) self.hasLabel = False self.label = label self.items = OrderedDict() self.setEditable(editable) if items: self.addItems(items) if callback: QObject.connect(self, SIGNAL('activated(int)'), callback)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["pairwise.t.test"]) self.RFunctionParam_x = "" self.RFunctionParam_pool_sd = "TRUE" self.RFunctionParam_g = "" self.RFunctionParam_p_adjust_method = "p.adjust.methods" self.indata = '' self.inputs.addInput('id0', 'R Data Frame', redRRDataFrame, self.process) self.outputs.addOutput('id0', 'pairwise.t.test Output', redRRVariable) box = widgetBox(self.controlArea) self.RFunctionParam_x = comboBox(box, label="Values:") self.RFunctionParam_pool_sd = comboBox( box, label="Pool Standard Deviation:", items=['True', 'False']) self.RFunctionParam_g = comboBox(box, label="Groups Column:") self.RFunctionParam_p_adjust_method = comboBox( box, label="P-value Adjust Method:", items=[ "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" ]) self.alternative = comboBox(box, label='Alternative Hypothesis:', items=['two.sided', 'greater', 'less']) redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction) self.RoutputWindow = textEdit(box, label='R Output')
def __init__(self, widget, html='', label=None, displayLabel=True, includeInReports=True, orientation='vertical', alignment=None, editable=True, printable=False, clearable=False, **args): widgetState.__init__(self, widget, label, includeInReports) QTextEdit.__init__(self, self.controlArea) self.label = label if displayLabel: self.hb = groupBox(self.controlArea, label=label, orientation=orientation) else: self.hb = widgetBox(self.controlArea, orientation=orientation) self.hb.layout().addWidget(self) if alignment: self.controlArea.layout().setAlignment(self.hb, alignment) if printable: button(self.hb, _("Print"), self.printMe) if clearable: button(self.hb, _("Clear"), callback=self.clear) if not editable: self.setReadOnly(True) self.setFontFamily('Courier') self.insertHtml(html)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.outputs.addOutput('id0', _('R Session'), redRREnvironment) # print os.path.abspath('/') self.path = os.path.abspath('/') self.setRvariableNames(['sessionEnviron']) gbox = groupBox(self.controlArea, orientation='vertical', label=_('Select R session')) box = widgetBox(gbox, orientation='horizontal') self.filecombo = fileNamesComboBox(box, label=_('Session File'), displayLabel=False, orientation='vertical') self.filecombo.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Maximum) button(box, label=_('Browse'), callback=self.browseFile) self.commit = commitButton(gbox, label=_('Load Session'), callback=self.loadSession, alignment=Qt.AlignRight) #gbox.layout().setAlignment(self.commit,Qt.AlignRight) self.infoa = widgetLabel(self.controlArea, '') self.varBox = listBox(self.controlArea, label=_('Variables')) self.varBox.hide() self.infob = widgetLabel(self.controlArea, '')
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["rownames"]) self.data = {} self.RFunctionParam_x = '' self.inputs.addInput('id0', _('Input Data'), redRRDataFrame, self.processx) self.outputs.addOutput('id0', _('Row or Column Names'), redRRVector) box = widgetBox(self.controlArea) self.controlArea.layout().setAlignment(box, Qt.AlignTop | Qt.AlignLeft) widgetLabel(box, _('Get row or column names from input object.')) separator(box, height=10) self.function = radioButtons( box, label=_('Row or Column'), displayLabel=False, buttons=[_('Row Names'), _('Column Names')], setChecked=_('Row Names'), orientation='horizontal') separator(box, height=10) self.RFunctionParamprefix_lineEdit = lineEdit( box, label=_("prefix:"), toolTip=_('Prepend prefix to simple numbers when creating names.')) separator(box, height=10) self.doNullButton = radioButtons( box, label=_("do.NULL:"), toolTips=[ _('logical. Should this create names if they are NULL?') ] * 2, buttons=[_('TRUE'), _('FALSE')], setChecked=_('TRUE'), orientation='horizontal') buttonBox = widgetBox(box, orientation='horizontal') redRCommitButton(buttonBox, _("Commit"), callback=self.commitFunction) self.autoCommit = checkBox(buttonBox, label=_('commit'), displayLabel=False, buttons=[_('Commit on Input')], setChecked=[_('Commit on Input')])
def __init__(self, widget, label=None, displayLabel=True, includeInReports=True, buttons=None, toolTips=None, setChecked=None, orientation='vertical', callback=None): if toolTips and len(toolTips) != len(buttons): raise RuntimeError( _('Number of buttons and toolTips must be equal')) QWidget.__init__(self, widget) widgetState.__init__(self, widget, label, includeInReports) self.controlArea.layout().setAlignment(Qt.AlignTop | Qt.AlignLeft) self.controlArea.layout().addWidget(self) if displayLabel: self.box = groupBox(self.controlArea, label=label, orientation=orientation) # self.layout().addWidget(self.box) else: self.box = widgetBox(self.controlArea, orientation=orientation) # if orientation=='vertical': # self.box.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, # QSizePolicy.MinimumExpanding)) # else: # self.box.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, # QSizePolicy.Preferred)) self.label = label self.items = OrderedDict() self.buttons = QButtonGroup(self.box) self.buttons.setExclusive(False) if buttons: self.addButtons(buttons) # if buttons: # for i,b in zip(range(len(buttons)),buttons): # w = QCheckBox(b,self.box) # if toolTips: # w.setToolTip(toolTips[i]) # self.buttons.addButton(w,i) # self.box.layout().addWidget(w) if callback: QObject.connect(self.buttons, SIGNAL('buttonClicked(int)'), callback) if setChecked: self.setChecked(setChecked)
def __init__(self, widget, value=None, label=None, displayLabel=True, includeInReports=True, orientation='vertical', selectionMode=QAbstractItemView.SingleSelection, enableDragDrop=0, dragDropCallback=None, dataValidityCallback=None, sizeHint=None, callback=None, toolTip=None, items=None, *args): widgetState.__init__(self, widget, label, includeInReports) QListWidget.__init__(self, *args) self.label = label self.widget = self.controlArea if displayLabel: self.hb = groupBox(self.controlArea, label=label, orientation=orientation) else: self.hb = widgetBox(self.controlArea, orientation=orientation) self.hb.layout().addWidget(self) self.ogValue = value self.ogLabels = label self.enableDragDrop = enableDragDrop self.dragDopCallback = dragDropCallback self.dataValidityCallback = dataValidityCallback if not sizeHint: self.defaultSizeHint = QSize(150, 100) else: self.defaultSizeHint = sizeHint self.setSelectionMode(selectionMode) if enableDragDrop: self.setDragEnabled(1) self.setAcceptDrops(1) self.setDropIndicatorShown(1) #self.setDragDropMode(QAbstractItemView.DragDrop) self.dragStartPosition = 0 if toolTip: self.setToolTip(toolTip) self.listItems = OrderedDict() if items: self.addItems(items) if callback: QObject.connect(self, SIGNAL('itemClicked(QListWidgetItem*)'), callback)
def __init__(self,widget,text='', label=None, displayLabel=True, includeInReports=True, id=None, orientation='horizontal', toolTip = None, width = 0, callback = None, textChangedCallBack=None, sp='shrinking', **args): widgetState.__init__(self,widget,label,includeInReports) QLineEdit.__init__(self,widget) if displayLabel: self.hb = widgetBox(self.controlArea,orientation=orientation, spacing=2) if sp == 'shrinking': self.hb.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) lb = widgetLabel(self.hb, label) if width != -1: sb = widgetBox(self.hb) sb.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) self.hb.layout().addWidget(self) self.hb.layout().setAlignment(lb,Qt.AlignRight) else: self.controlArea.layout().addWidget(self) if toolTip and displayLabel: self.hb.setToolTip(toolTip) elif toolTip: self.setToolTip(toolTip) if width == 0: self.setMaximumWidth(175) self.setMinimumWidth(175) elif width == -1: pass else: self.setMaximumWidth(width) self.setMinimumWidth(width) self.setText(text) self.id = id self.label = label # self.setText('asdf') if callback: QObject.connect(self, SIGNAL('returnPressed()'), callback) if textChangedCallBack: QObject.connect(self, SIGNAL('textEdited(QString)'), textChangedCallBack)
def __init__(self, widget, label = None, displayLabel=False, includeInReports=True, orientation='vertical', toolTip = None, callback = None): widgetState.__init__(self,widget,label,includeInReports) QTreeWidget.__init__(self, self.controlArea) if displayLabel: self.hb = widgetBox(self.controlArea,orientation=orientation) widgetLabel(self.hb, label) if width != -1: sb = widgetBox(self.hb) sb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.hb.layout().addWidget(self) else: self.controlArea.layout().addWidget(self) if toolTip: self.setToolTip(toolTip) if callback: QObject.connect(self, SIGNAL('currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)'), callback)
def __init__(self, parent=None, signalManager=None, forceInSignals=None, forceOutSignals=None): OWRpy.__init__(self) # the variables self.parentData = {} self.data = '' self.setRvariableNames(['nameProtector', 'newDataFromNameProtector']) self.inputs.addInput('id0', _('Data Frame'), redRRDataFrame, self.gotDF) self.inputs.addInput('id1', _('Vector'), redRRVector, self.gotV) self.outputs.addOutput('id0', _('Data Frame'), redRRDataFrame) self.outputs.addOutput('id1', _('Vector'), redRRVector) ### The data frame GUI self.dfbox = widgetBox(self.controlArea) self.nameProtectDFcheckBox = checkBox( self.dfbox, label=_('Protect the names in:'), buttons=[_('Rows'), _('Columns')], toolTips=[ _('Use make.names to protect the names in the rows.'), _('Use make.names to protect the names in the columns.') ]) self.namesProtectDFcomboBox = comboBox( self.dfbox, label=_('Column names to protect:')) self.commit = commitButton(self.dfbox, _("Commit"), callback=self.dfCommit, processOnInput=True) ### The Vector GUI self.vbox = widgetBox(self.controlArea) self.vbox.hide() self.commitVbutton = button(self.vbox, _("Commit"), callback=self.vCommit, alignment=Qt.AlignRight)
def __init__(self, parent, label): box = widgetBox(parent,orientation='horizontal') a = widgetLabel(box,label=label) QToolButton.__init__(self, box) box.layout().addWidget(self) # if not color: self.color = '#000000' # else: # self.color = color self.setMaximumSize(20,20) self.connect(self, SIGNAL("clicked()"), self.showColorDialog)
def createTabPage(self, name, widgetToAdd = None, canScroll = False): #print 'start: ' + name if widgetToAdd == None: # print _('make widgetBox') widgetToAdd = widgetBox(self, addToLayout = 0, margin = 4) if canScroll: scrollArea = QScrollArea() self.addTab(scrollArea, name) scrollArea.setWidget(widgetToAdd) scrollArea.setWidgetResizable(1) scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) else: #print 'add' self.addTab(widgetToAdd, name) self.tabs[name] = widgetToAdd return widgetToAdd
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) # self.dataParentA = {} # self.dataParentB = {} self.dataA = '' self.dataB = '' self.inputs.addInput('id0', _('Dataset A'), redRRDataFrame, self.processA) self.inputs.addInput('id1', _('Dataset B'), redRRDataFrame, self.processB) self.outputs.addOutput('id0', _('Merged'), redRRDataFrame) #default values self.colAsel = None self.colBsel = None #self.forceMergeAll = 0 #checkbox value for forcing merger on all data, default is to remove instances from the rows or cols. #set R variable names self.setRvariableNames(['merged']) #GUI box = widgetBox(self.controlArea,orientation='horizontal') self.colA = listBox(box, label=_('Columns to Merge From A'), callback = self.setcolA) self.colB = listBox(box, label=_('Columns to Merge From B'), callback = self.setcolB) self.sortOption = checkBox(self.bottomAreaLeft, label=_('Sort by Selected Column'), displayLabel=False, buttons = [_('Sort by Selected Column')], toolTips = [_('logical. Should the results be sorted on the by columns?')]) self.rownamesOption = checkBox(self.bottomAreaLeft, label = _('Include Row Names in Merge'), displayLabel = False, buttons = [_('Include Row in Merge')], toolTips = [_('This will include the row names in the data after merge.')], setChecked = [_('Include Row in Merge')]) self.sortOption.layout().setAlignment(Qt.AlignLeft) self.mergeOptions = radioButtons(self.bottomAreaCenter,label=_('Type of merge'), displayLabel=False, buttons=['A+B','B+A','AB'],setChecked='A+B', orientation='horizontal') self.mergeOptions.layout().setAlignment(Qt.AlignCenter) self.commit = redRCommitButton(self.bottomAreaRight, _('Commit'), callback = self.run, processOnChange=True,processOnInput=True)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["melt.data.frame", "melt.data.frame.cm"]) self.RFunctionParam_data = '' self.data = {} self.inputs.addInput('id0', _('data'), redRRDataFrame, self.processdata) self.outputs.addOutput('id0', _('melt.data.frame Output'), redRRDataFrame) box = widgetBox(self.controlArea, _("Widget Box")) self.RFunctionParam_na_rm = comboBox(box, label = _("Remove NA:"), items = [_('Yes'), _('No')]) self.RFunctionParam_measure_var = listBox(box, label = _("Result Variable:"), toolTip = _('The column that contains the result or the measurement that the data should be melted around.')) self.RFunctionParam_measure_var.setSelectionMode(QAbstractItemView.ExtendedSelection) self.RFunctionParam_id_var = listBox(box, label = _("Groupings:"), toolTip = _('The columns indicating the groupings of the data.')) self.RFunctionParam_id_var.setSelectionMode(QAbstractItemView.ExtendedSelection) self.RFunctionParam_variable_name = lineEdit(box, label = _("New Group Name:"), toolTip = _('The name of the new column that the groupings will be put into.')) self.commit = redRCommitButton(self.bottomAreaRight, _("Commit"), callback = self.commitFunction, processOnInput=True)
def __init__(self,widget,label=None, displayLabel=True,includeInReports=True, url=None,orientation='vertical', followHere = False): widgetState.__init__(self,widget,label,includeInReports) QtWebKit.QWebView.__init__(self,self.controlArea) if displayLabel: hb = widgetBox(self.controlArea,orientation=orientation) widgetLabel(hb, label) hb.layout().addWidget(self) else: self.controlArea.layout().addWidget(self) self.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks) if not followHere: self.connect(self, SIGNAL('linkClicked(QUrl)'), self.followLink) if url: try: self.load(QUrl(url)) except: pass
def __init__(self,widget,label=None, displayLabel=True, includeInReports=True, buttons=None,toolTips = None, setChecked = None, orientation='vertical',callback = None, **args): QWidget.__init__(self,widget) widgetState.__init__(self,widget,label,includeInReports,**args) self.controlArea.layout().setAlignment(Qt.AlignTop | Qt.AlignLeft) self.label = label if displayLabel: self.box = groupBox(self.controlArea,label=label,orientation=orientation) self.controlArea.layout().addWidget(self.box) else: self.box = widgetBox(self.controlArea,orientation=orientation) # if orientation=='vertical': # self.box.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, # QSizePolicy.MinimumExpanding)) # else: # self.box.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, # QSizePolicy.Preferred)) self.items = OrderedDict() self.buttons = QButtonGroup(self.box) if buttons: self.addButtons(buttons) # for i,b in zip(range(len(buttons)),buttons): # w = QRadioButton(b) # if toolTips: # w.setToolTip(toolTips[i]) # self.buttons.addButton(w) # self.box.layout().addWidget(w) if callback: QObject.connect(self.buttons, SIGNAL('buttonClicked(int)'), callback) if setChecked: self.setChecked(setChecked)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["sort"]) self.data = {} self.RFunctionParam_x = '' self.inputs.addInput('id0', _('Data Tabel'), redRRDataFrame, self.processx) self.outputs.addOutput('id0', _('Sorted Data Table'), redRRDataFrame) self.standardTab = widgetBox(self.controlArea) self.options = checkBox(self.standardTab,label=_('Options'), buttons = [_("Decreasing"), _('NA Last')], orientation='horizontal') # self.standardTab.layout().setAlignment(self.options,Qt.AlignLeft) self.sortingColumn1 = comboBox(self.standardTab, label = _('First Column to Sort:')) self.sortingColumn2 = comboBox(self.standardTab, label = _('Second Column to Sort:')) self.sortingColumn3 = comboBox(self.standardTab, label = _('Third Column to Sort:')) self.commit = redRCommitButton(self.bottomAreaRight, _("Commit"), callback = self.commitFunction, processOnInput=True)
def __init__(self, widget, label=None, displayLabel=True, includeInReports=True, data=None, rows=0, columns=0, sortable=False, selectionMode=-1, addToLayout=1, callback=None): widgetState.__init__(self, widget, label, includeInReports) if displayLabel: mainBox = groupBox(self.controlArea, label=label, orientation='vertical') else: mainBox = widgetBox(self.controlArea, orientation='vertical') QTableWidget.__init__(self, rows, columns, widget) mainBox.layout().addWidget(self) self.sortIndex = None self.oldSortingIndex = None self.data = None ### if selectionMode != -1: self.setSelectionMode(selectionMode) if data: self.setTable(data) if sortable: self.setSortingEnabled(True) self.connect(self.horizontalHeader(), SIGNAL("sectionClicked(int)"), self.sort) if callback: QObject.connect(self, SIGNAL('cellClicked(int, int)'), callback)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.setRvariableNames(["cbind"]) self.data = {} self.RFunctionParam_a = '' self.RFunctionParam_b = '' self.inputs.addInput('id0', _('Input Data A'), redRRDataFrame, self.processa) self.inputs.addInput('id1', _('Input Data B'), redRRDataFrame, self.processb) self.outputs.addOutput('id0', _('Output Data'), redRRDataFrame) self.RFunctionParamdeparse_level_lineEdit = lineEdit( self.controlArea, label=_("deparse_level:"), text='1') buttonBox = widgetBox(self.controlArea, orientation='horizontal', alignment=Qt.AlignRight) self.commit = redRCommitButton(buttonBox, _("Commit"), callback=self.commitFunction, processOnInput=True)
def __init__(self, parent=None, signalManager=None): OWRpy.__init__(self) self.inputs.addInput('id0', _('R Environment'), renv.REnvironment, self.process) self.outputs.addOutput('id0', _('R Session'), renv.REnvironment) self.outputs.addOutput('id1', _('Non-Standard R Variable'), rvar.RVariable) self.outputs.addOutput('id2', _('R Data Frame (Data Table)'), rdf.RDataFrame) self.outputs.addOutput('id3', _('R List'), rlist.RList) self.outputs.addOutput('id4', _('R Vector'), rvec.RVector) self.outputs.addOutput('ral', _('R Arbitrary List'), ral.RArbitraryList) # self.help.setHtml('The R Variable Separator is used to separate variables from a loaded R session. Connecting the R Loader widget to this widget will display a list of available variables in the local environment to which the session was loaded. Clicking on an element in the list will send that element on to downstream widgets. One should take note of the class of the element that is sent as this will specify the output connection of the data. More infromation is available on the <a href="http://www.red-r.org/?cat=10">RedR website</a>.') self.controlArea.setMinimumWidth(300) self.varBox = listBox(self.controlArea, label = _('Variables'), callback = self.select) box = widgetBox(self.controlArea, orientation='horizontal') #self.filecombo.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum) self.controlArea.layout().setAlignment(box,Qt.AlignRight) self.commitButton = redRCommitButton(box,label=_('Commit'),callback=self.commit, processOnInput=True,processOnChange=True)
def __init__(self, parent,label=None, displayLabel=True,includeInReports=True, name = '', data = None): ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget. widgetState.__init__(self,parent,label,includeInReports) QGraphicsView.__init__(self, self.controlArea) # if displayLabel: # self.controlArea = groupBox(parent,label=label, orientation='vertical') # else: # self.controlArea = widgetBox(parent,orientation='vertical') #self.controlArea = widgetBox(parent) self.topArea = widgetBox(self.controlArea, sizePolicy = QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Maximum),includeInReports=False) self.middleArea = widgetBox(self.controlArea) self.bottomArea = widgetBox(self.controlArea,includeInReports=False) self.middleArea.layout().addWidget(self) # place the widget into the parent widget scene = QGraphicsScene() self.setScene(scene) self.parent = parent self.data = data self.widgetSelectionRect = None self.mainItem = None self.query = '' self.function = 'plot' self.layers = [] self.image = 'plot'+unicode(time.time()) # the base file name without an extension self.imageFileName = '' self.currentScale = 1 ################################ #### Themes ##### ################################ self.options = { 'device': { 'Rcall': 'Cairo', 'parameters': { 'type':{ 'default':'svg', 'qtWidget': 'imageType' } ,'dpi':{ 'default':'75', 'qtWidget': 'dpi' } ,'bg': { 'default':'#FFFFFF', 'color': '#FFFFFF', 'qtWidget':'bgColor' } ,'height': { 'default':400, 'qtWidget': 'dheight' } ,'width': { 'default':400, 'qtWidget': 'dwidth' } ,'units': { 'default':'px', 'qtWidget': 'units' } } } ,'main': { 'Rcall': 'plot', 'parameters': { 'col': { 'default':None, 'qtWidget':'colorSeries', 'series': '', 'seriesLen': 0, 'getFunction': self.getColorSeries, 'setFunction': self.setColorSeries, } ,'lty': { 'default':None, 'qtWidget':'linesListBox', 'getFunction': self.getLineTypes, 'setFunction': self.setLineTypes, } ,'lwd': { 'default':None, 'qtWidget':'lineWidth' } ,'pch': { 'default':None, 'qtWidget':'pointListBox', 'getFunction': self.getLineTypes, 'setFunction': self.setLineTypes, } } }, 'title': { 'Rcall': 'title', 'parameters': { 'main': { 'default':"Title", 'qtWidget':'mainTitle' } ,'xlab': { 'default':"XLab", 'qtWidget':'xLab' } ,'ylab': { 'default':"YLab", 'qtWidget':'yLab' } ,'col.main': { 'default':'#000000', 'qtWidget':'titleColor' } ,'col.sub': { 'default':'#000000', 'qtWidget':'subColor' } ,'col.lab': { 'default':'#000000', 'qtWidget':'labColor' } } }, 'par': { 'Rcall':'par', 'parameters': { 'cex.axis': { 'default':1, 'qtWidget':'axisFont' } ,'cex.lab': { 'default':1, 'qtWidget':'labFont' } ,'cex': { 'default':1, 'qtWidget':'plotFont' } ,'cex.main': { 'default':1, 'qtWidget':'mainFont' } ,'cex.sub': { 'default':1, 'qtWidget':'subFont' } ,'col.axis': { 'default':'#000000', 'qtWidget':'axisColor' } # ,'family': { # 'default':'serif', # 'qtWidget':'fontCombo' # } } } } # ,'fg' : None # ,'legendNames' : None # ,'legendLocation' : "'bottomleft'" # } self.optionWidgets = {} self.colorList = ['#000000', '#ff0000', '#00ff00', '#0000ff'] ################################ #### Setup Tabs ##### ################################ self.graphicOptionsButton = button(self.topArea,label='Graphic Options', toggleButton = True,callback=self.displayGraphicOptions) self.graphicOptionsWidget = widgetBox(self.topArea) self.graphicOptions = tabWidget(self.graphicOptionsWidget) self.graphicOptions.setFixedHeight(180) hbox = widgetBox(self.graphicOptionsWidget,orientation='horizontal',alignment= Qt.AlignLeft) self.resizeCheck = checkBox(hbox,label='resize',displayLabel=False,buttons={'true':'Resize Image'},setChecked='true') button(hbox,label='Update Graphic', alignment=Qt.AlignLeft, callback=self.plotMultiple) self.labels = self.graphicOptions.createTabPage('Main') self.points = self.graphicOptions.createTabPage('Points/Lines') self.advanced = self.graphicOptions.createTabPage('Advanced') #self.graphicOptions.hide() firstTab = widgetBox(self.labels,orientation='horizontal',alignment=Qt.AlignLeft | Qt.AlignTop) secondTab = widgetBox(self.points,orientation='horizontal',alignment=Qt.AlignLeft | Qt.AlignTop) advancedTab = widgetBox(self.advanced,orientation='vertical',alignment=Qt.AlignLeft | Qt.AlignTop) ################################ #### Advanced Tabs ##### ################################ self.optionWidgets['extrasLineEdit'] = lineEdit(advancedTab, label = 'Advanced plotting parameters', toolTip = 'Add extra parameters to the main plot.\nPlease see documentation for more details about parameters.') self.optionWidgets['onlyAdvanced'] = checkBox(advancedTab, buttons=['Only use the advanced options here'], label='advancedOnly',displayLabel=False) ################################ #### First Tabs ##### ################################ imageBox = groupBox(firstTab,label='Image Properties', orientation='vertical', sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum)) self.optionWidgets['imageType'] = comboBox(imageBox,label='Image Type',items=['svg','png']) self.optionWidgets['imageType'].setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Minimum) hbox = widgetBox(imageBox,orientation='horizontal') self.optionWidgets['dheight'] = spinBox(hbox, label = 'Height', min = 1, max = 5000, value = 400) self.optionWidgets['dwidth'] = spinBox(hbox, label = 'Width', min = 1, max = 5000, value = 400) hbox = widgetBox(imageBox,orientation='horizontal') self.optionWidgets['units'] = comboBox(hbox,label='units',items=[('px','Pixel'),('in','Inches')]) self.optionWidgets['dpi'] = comboBox(hbox,label='DPI',items=['75','100','150','auto'],editable=True) labelBox = groupBox(firstTab,label='Labels', orientation='vertical', sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum)) self.optionWidgets['mainTitle'] = lineEdit(labelBox,label='Main Title') self.optionWidgets['xLab'] = lineEdit(labelBox,label='X Axis Label') self.optionWidgets['yLab'] = lineEdit(labelBox,label='Y Axis Label') fontBox = groupBox(firstTab,label='Sizes', orientation='vertical', sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum)) fontColumnBox = widgetBox(fontBox,orientation='horizontal') fontColumn1 = widgetBox(fontColumnBox,orientation='vertical') fontColumn2 = widgetBox(fontColumnBox,orientation='vertical') #self.optionWidgets['fontCombo'] = comboBox(fontColumn1, items = ['serif', 'sans', 'mono'], label='Font Family') self.optionWidgets['lineWidth'] = spinBox(fontColumn1,label='Point/Line Size',decimals=2,min=1,max=50) self.optionWidgets['plotFont'] = spinBox(fontColumn1, label = 'Plot Text Size',decimals=2, min = 1, max = 50) self.optionWidgets['axisFont'] = spinBox(fontColumn1, label = 'Axis Text Size',decimals=2, min = 1, max = 50) self.optionWidgets['mainFont'] = spinBox(fontColumn2, label = 'Title Text Size',decimals=2, min = 1, max = 50) self.optionWidgets['subFont'] = spinBox(fontColumn2, label = 'Subtitle Text Size',decimals=2, min = 1, max = 50) self.optionWidgets['labFont'] = spinBox(fontColumn2, label = ' XY Label Text Size',decimals=2, min = 1, max = 50) colorBox = groupBox(firstTab,label='Colors', orientation='vertical', sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum)) hbox = widgetBox(colorBox,orientation='horizontal') self.optionWidgets['colorSeries'] = comboBox(hbox,label='Generate Colors Series',orientation='vertical', items = ['select','rainbow','heat.colors','terrain.colors','topo.colors','cm.colors']) self.optionWidgets['colorSeriesLen'] = spinBox(hbox,label='Length of Series',displayLabel=False, min=0, max=500) hbox.layout().setAlignment(self.optionWidgets['colorSeriesLen'].controlArea, Qt.AlignBottom) self.optionWidgets['bgColor'] = ColorIcon(colorBox,label='Background') #self.optionWidgets['customColors'] = button(colorBox,label='Custom Plot Colors',callback=self.setPlotColors) ################################ #### Second Tabs ##### ################################ colorBox2 = groupBox(secondTab,label='Colors', orientation='vertical', sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum)) # colorColumnBox = widgetBox(colorBox2,orientation='horizontal') # colorColumn1 = widgetBox(colorColumnBox,orientation='vertical') # colorColumn2 = widgetBox(colorColumnBox,orientation='vertical') self.optionWidgets['titleColor'] = ColorIcon(colorBox2,label='Title') self.optionWidgets['subColor'] = ColorIcon(colorBox2,label='Subtitle') self.optionWidgets['labColor'] = ColorIcon(colorBox2,label='Subtitle') self.optionWidgets['axisColor'] = ColorIcon(colorBox2,label='Axis') lineBox = groupBox(secondTab,label='Lines', orientation='vertical', sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum)) self.optionWidgets['linesListBox'] = listBox(lineBox, label = 'Line types', displayLabel=False, selectionMode = QAbstractItemView.ExtendedSelection, items = [(1,'________'), (2,'- - - -'), (3,'........'), (4,'_._._._.'), (5,'__ __ __'), (6,'__.__.__.')]) pointBox = groupBox(secondTab,label='Points', orientation='vertical', sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum)) items = [] for i in range(1,26): items.append((i-1,QListWidgetItem(QIcon(os.path.join(redREnviron.directoryNames['picsDir'], 'R icon (%d).png' %i)),''))) for i in range(32,128): items.append((i-1,'%s' % (chr(i)))) self.optionWidgets['pointListBox'] = listBox(pointBox, label = 'Line types', displayLabel=False, selectionMode = QAbstractItemView.ExtendedSelection, items = items) self.setTheme(self.options) ################################ ### right click menu ####### ################################ self.menu = QMenu(self) save = self.menu.addMenu('Save As') save.addAction('Bitmap') save.addAction('PDF') save.addAction('Post Script') save.addAction('JPEG') self.menu.addAction('Copy') self.menu.addAction('Fit In Window') self.menu.addAction('Zoom Out') self.menu.addAction('Zoom In') self.menu.addAction('Undock') self.menu.addAction('Redock') self.dialog = QDialog() self.dialog.setWindowTitle('Red-R Graphics View' + name) self.dialog.setLayout(QHBoxLayout()) self.standardImageType = 'svg' QObject.connect(self.dialog, SIGNAL('finished(int)'), self.dialogClosed)