コード例 #1
0
ファイル: RedRplsr.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["plsr"])
        self.data = {}
        self.RFunctionParam_data = ''
        self.inputs.addInput('id0', 'data', redRRDataFrame, self.processdata)

        self.outputs.addOutput('id0', 'plsr Output', redRRModelFit)

        self.RFunctionParamformula_lineEdit = lineEdit(self.controlArea,
                                                       label="formula:",
                                                       text='')
        self.RFunctionParamscale_radioButtons = radioButtons(
            self.controlArea,
            label="Scale the data:",
            buttons=['TRUE', 'FALSE'],
            setChecked='FALSE',
            orientation='horizontal')
        self.RFunctionParammethod_lineEdit = lineEdit(self.controlArea,
                                                      label="method:",
                                                      text='')
        self.RFunctionParamncomp_lineEdit = lineEdit(self.controlArea,
                                                     label="ncomp:",
                                                     text='10')
        self.RFunctionParamvalidation_comboBox = comboBox(
            self.controlArea, label="validation:", items=["none", "CV", "LOO"])
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
コード例 #2
0
ファイル: redRReports.py プロジェクト: aourednik/Red-R
    def createTreeWidgetItem(self, parent, elementName, dataPointer):
        
        n  = redRtreeWidgetItem(None, [elementName], flags=Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
        n.pointer = dataPointer
        
        if dataPointer['includeInReports']:
            n.setCheckState(0,Qt.Checked)
        else:
            n.setCheckState(0,Qt.Unchecked)
            
        parent.addChild(n)
        
        # print '##############',elementName, parent, dataPointer
        
        # parameterBox = QWidget(None)
        # parameterBox.setLayout(QHBoxLayout())
        # parameterBox.setMinimumWidth(200)
        # parameterBox.layout().setSpacing(9)
        #parameterBox.controlArea.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        # parameterBox.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)

        if 'numChrLimit' in dataPointer.keys():
            a = lineEdit(None,label=_('Word Limit'), text=unicode(dataPointer['numChrLimit']), width=50,
            textChangedCallBack=lambda: self.lineEditChanged(a.text(),dataPointer,'numChrLimit') )
            a.hb.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
            # a.hb.setMaximumWidth(100)
            #a.hb.setMinimumWidth(100)
            self.widgetList.setItemWidget(n, 1, a.controlArea)
        if 'numRowLimit' in dataPointer.keys():
            a = lineEdit(None,label=_('Table Row Limit'),text=unicode(dataPointer['numRowLimit']),width=50,
            textChangedCallBack=lambda: self.lineEditChanged(a.text(),dataPointer,'numRowLimit'))
            a.hb.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
            self.widgetList.setItemWidget(n, 1, a.controlArea)
コード例 #3
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["aov"])
        self.data = {}
        self.RFunctionParam_data = ''
        self.saveSettingsList.extend(['data', 'RFunctionParam_data'])
        self.inputs.addInput('id0', 'data', redRRDataFrame, self.processdata)

        self.outputs.addOutput('id0', 'aov Output', redRRModelFit)

        box = tabWidget(self.controlArea)
        self.standardTab = box.createTabPage(name="Standard")
        self.advancedTab = box.createTabPage(name="Advanced")
        self.RFunctionParamcontrasts_lineEdit = lineEdit(self.advancedTab,
                                                         label="contrasts:",
                                                         text='NULL')
        self.RFunctionParamformula_formulaEntry = RFormulaEntry(
            self.standardTab)
        self.RFunctionParamqr_lineEdit = lineEdit(self.advancedTab,
                                                  label="qr:",
                                                  text='TRUE')
        self.RFunctionParamprojections_lineEdit = lineEdit(
            self.advancedTab, label="projections:", text='FALSE')
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea,
                                      label="R Output Window")
コード例 #4
0
ファイル: sizeplot.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.RFunctionParam_y = ''
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', 'y', redRRVector, self.processy)
        self.inputs.addInput('id1', 'x', redRRVector, self.processx)

        self.standardTab = self.controlArea
        self.RFunctionParamy_lineEdit = lineEdit(self.standardTab,
                                                 label="y:",
                                                 text='')
        self.RFunctionParamx_lineEdit = lineEdit(self.standardTab,
                                                 label="x:",
                                                 text='')
        self.RFunctionParamscale_lineEdit = lineEdit(self.standardTab,
                                                     label="scale:",
                                                     text='1')
        self.RFunctionParamsize_lineEdit = lineEdit(self.standardTab,
                                                    label="size:",
                                                    text='c(1,4)')
        self.RFunctionParampow_lineEdit = lineEdit(self.standardTab,
                                                   label="pow:",
                                                   text='0.5')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
コード例 #5
0
ファイル: arrows.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["arrows"])
        self.data = {}
        self.outputs.addOutput('id0', 'arrows Output', redRRPlotAttribute)

        self.standardTab = self.controlArea
        self.RFunctionParamx0_lineEdit = lineEdit(self.standardTab,
                                                  label="x0:",
                                                  text='')
        self.RFunctionParamy0_lineEdit = lineEdit(self.standardTab,
                                                  label="y0:",
                                                  text='')

        self.RFunctionParamx1_lineEdit = lineEdit(self.standardTab,
                                                  label="x1:",
                                                  text='')
        self.RFunctionParamy1_lineEdit = lineEdit(self.standardTab,
                                                  label="y1:",
                                                  text='')
        self.RFunctionParamcode_lineEdit = lineEdit(self.standardTab,
                                                    label="code:",
                                                    text='1')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction)
コード例 #6
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["rug"])
        self.data = {}
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', 'x', redRRVector, self.processx)

        self.outputs.addOutput('id0', 'rug Output', redRRPlotAttribute)

        self.RFunctionParamside_lineEdit = lineEdit(self.controlArea,
                                                    label="side:",
                                                    text='1')
        self.RFunctionParamticksize_lineEdit = lineEdit(self.controlArea,
                                                        label="ticksize:",
                                                        text='0.03')
        self.RFunctionParamquiet_lineEdit = lineEdit(
            self.controlArea, label="quiet:", text='getOption("warn")<0')
        self.RFunctionParamlwd_lineEdit = lineEdit(self.controlArea,
                                                   label="lwd:",
                                                   text='0.5')
        self.RFunctionParamcol_lineEdit = lineEdit(self.controlArea,
                                                   label="col:",
                                                   text='par("fg")')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
コード例 #7
0
ファイル: heatmap2.py プロジェクト: MatthewASimonson/r-orange
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        
        self.setRvariableNames(['heatsubset'])
        self.plotOnConnect = 0
        self.plotdata = ''
        self.rowvChoice = None
        
        self.inputs.addInput('id0', 'Expression Matrix', redRRMatrix, self.processMatrix)

        
        #GUI
        mainArea = widgetBox(self.controlArea,orientation='horizontal')
        #mainArea.setMaximumWidth(300)
        options = widgetBox(mainArea,orientation='vertical')
        options.setMaximumWidth(175)
        options.setMinimumWidth(175)
        dendrogramsBox = groupBox(options, label='Calculate dendrogram ', orientation='vertical')
        self.notice = widgetLabel(dendrogramsBox,label='The data set has > 1000 rows.\nClustering on rows will likely fail.')
        self.notice.setHidden(True)
        self.dendrogramOptions = checkBox(dendrogramsBox,
        buttons = ['Rows', 'Columns'], setChecked=['Rows', 'Columns'], orientation='horizontal',
        callback=self.dendrogramChanged)
        
        functions = widgetBox(dendrogramsBox,orientation='vertical')
        self.distOptions = lineEdit(functions,label='Distance Function:', text='dist', orientation='vertical')
        self.hclustOptions = lineEdit(functions,label='Clustering Function:',text='hclust', 
        orientation='vertical')
        #self.reorderOptions = lineEdit(functions,label='Reorder Function:', text='reorder.dendrogram')
        
        
        self.scaleOptions = radioButtons(options,label='Scale',  buttons=['row','column','none'],
        setChecked='row',orientation='horizontal')
        
        otherOptions = groupBox(options,label='Other Options')
        self.narmOptions = checkBox(otherOptions, buttons = ['Remove NAs'], setChecked=['Remove NAs'])
        # self.showDendroOptions = checkBox(otherOptions,buttons=['Show dendrogram '], setChecked=['Show dendrogram '])
        
        self.colorTypeCombo = comboBox(otherOptions, label = 'Color Type:', 
        items = ['rainbow', 'heat.colors', 'terrain.colors', 'topo.colors', 'cm.colors'],callback=self.colorTypeChange)
        self.startSaturation = spinBox(otherOptions, label = 'Starting Saturation', min = 0, max = 100)
        self.endSaturation = spinBox(otherOptions, label = 'Ending Saturation', min = 0, max = 100)
        self.endSaturation.setValue(30)
        separator(otherOptions,height=10)

        self.imageWidth = spinBox(otherOptions, label = 'Image Width', min = 1, max = 1000)
        self.imageWidth.setValue(4)
        self.imageHeight = spinBox(otherOptions, label = 'Image Height', min = 1, max = 1000)
        self.imageHeight.setValue(4)
        
        
        self.notice2 = widgetLabel(options,label='The input matrix is not numeric.')
        self.notice2.setHidden(True)
        self.buttonsBox = widgetBox(options,orientation='horizontal')
        self.buttonsBox.layout().setAlignment(Qt.AlignRight)
        self.plotOnConnect = checkBox(self.buttonsBox, buttons=['Plot on Connect'])
        button(self.buttonsBox, label = "Plot", callback=self.makePlot)
コード例 #8
0
    def __init__(self, **kwargs):
        settingsList = ['output_txt', 'parameters']
        OWRpy.__init__(self, **kwargs)
        
        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"), orientation = 'vertical')
        codeTab = tabs.createTabPage(_("Code"))
        box = widgetBox.widgetBox(functionTab, orientation = 'horizontal')
        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'), buttons = [_('Allow Output')])
        self.captureROutput = checkBox.checkBox(box, label = 'Show Output', 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)
コード例 #9
0
ファイル: widgetMaker.py プロジェクト: aourednik/Red-R
    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)
コード例 #10
0
ファイル: bumpchart.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.RFunctionParam_y = ''
        self.inputs.addInput('id0', 'y', redRRDataFrame, self.processy)

        self.RFunctionParammar_lineEdit = lineEdit(self.controlArea,
                                                   label="mar:",
                                                   text='c(2,8,5,8)')
        self.RFunctionParamlty_lineEdit = lineEdit(self.controlArea,
                                                   label="lty:",
                                                   text='1')
        self.RFunctionParamlabels_lineEdit = lineEdit(self.controlArea,
                                                      label="labels:",
                                                      text='rownames(y)')
        self.RFunctionParamrank_lineEdit = lineEdit(self.controlArea,
                                                    label="rank:",
                                                    text='TRUE')
        self.RFunctionParampch_lineEdit = lineEdit(self.controlArea,
                                                   label="pch:",
                                                   text='19')
        self.RFunctionParamtop_labels_lineEdit = lineEdit(self.controlArea,
                                                          label="top_labels:",
                                                          text='colnames(y)')
        self.RFunctionParamcol_lineEdit = lineEdit(self.controlArea,
                                                   label="col:",
                                                   text='par("fg")')
        self.RFunctionParamlwd_lineEdit = lineEdit(self.controlArea,
                                                   label="lwd:",
                                                   text='1')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
コード例 #11
0
    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')
コード例 #12
0
 def headerClicked(self, index):
     globalPos = QCursor.pos() #self.mapToGlobal(pos)
     self.menu = QDialog(None,Qt.Popup)
     self.menu.setLayout(QVBoxLayout())
     box = widgetBox(self.menu, orientation = 'horizontal')
     name = lineEdit(box, label = _('New Name (Overrides Current Value)'), callback = self.menu.accept)
     equation = lineEdit(box, label = _('Equation (Overrides Current Values)'), callback = self.menu.accept)
     remove = button(box, label = _('Remove Column'), callback = lambda: self.removeColumn(index))
     done = button(box, label = _('Done'), callback = self.menu.accept)
     res = self.menu.exec_()
     if res == Qt.Accept:
         if unicode(equation.text()) != '':
             self.calculateEquation(current = index, equation = unicode(equation.text()))
         if unicode(name.text()) != '':
             self.resetName(current = index, new = unicode(name.text()))
コード例 #13
0
ファイル: dataEntry.py プロジェクト: aourednik/Red-R
 def headerClicked(self, index):
     globalPos = QCursor.pos() #self.mapToGlobal(pos)
     self.menu = QDialog(None,Qt.Popup)
     self.menu.setLayout(QVBoxLayout())
     box = widgetBox(self.menu, orientation = 'horizontal')
     name = lineEdit(box, label = _('New Name (Overrides Current Value)'), callback = self.menu.accept)
     equation = lineEdit(box, label = _('Equation (Overrides Current Values)'), callback = self.menu.accept)
     remove = button(box, label = _('Remove Column'), callback = lambda: self.removeColumn(index))
     done = button(box, label = _('Done'), callback = self.menu.accept)
     res = self.menu.exec_()
     if res == Qt.Accept:
         if unicode(equation.text()) != '':
             self.calculateEquation(current = , equation = unicode(equation.text()))
         if unicode(name.text()) != '':
             self.resetName(current = , new = unicode(name.text()))
コード例 #14
0
    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
コード例 #15
0
    def __init__(self, widget, label = _('Formula Entry'), displayLabel=True, **kwargs):
        kwargs.setdefault('includeInReports', True)
        kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        # make a widgetBox to hold everything
        widgetState.__init__(self,widget,label,**kwargs)
        
        box = groupBox(self.controlArea,label=label)

        ## add the elements to the box
        #place the command keys
        self.buttonsBox = groupBox(box, label = _("Formula Commands"), orientation = 'horizontal')
        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(box, 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
コード例 #16
0
ファイル: dotchart.py プロジェクト: MatthewASimonson/r-orange
 def __init__(self, **kwargs):
     OWRpy.__init__(self, **kwargs))
     self.setRvariableNames(["dotchart"])
     self.data = {}
     self.RFunctionParam_x = ''
     self.labels = ''
     self.inputs.addInput('id0', 'Data', redRRMatrix, self.processx)
     self.inputs.addInput('id1', 'Labels', redRList, self.processLabels)
     
     self.standardTab = self.controlArea
     
     self.RFunctionParammain_lineEdit =  lineEdit(self.standardTab,  label = "Main Title:")
     self.RFunctionParamxlab_lineEdit =  lineEdit(self.standardTab,  label = "X Label:")
     self.RFunctionParamylab_lineEdit =  lineEdit(self.standardTab,  label = "Y Label:")
     self.labelNames = comboBox(self.standardTab, label = 'Label Data')
     self.commit = redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction,
     processOnInput=True)
コード例 #17
0
ファイル: RedRpoints.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["points"])
        self.data = {}
        self.RFunctionParam_y = ''
        self.RFunctionParam_x = ''
        self.RFunctionParam_col = ''
        self.inputs.addInput('id0', 'y', redRRVector, self.processy)
        self.inputs.addInput('id1', 'x', redRRVector, self.processx)
        self.inputs.addInput('id2', 'col', redRRVector, self.processcol)

        self.outputs.addOutput('id0', 'points Output', plotsigs.RPlotAttribute)

        
        self.RFunctionParampch_lineEdit = lineEdit(self.controlArea, label = "pch:", text = '16')
        self.RFunctionParamcex_lineEdit = lineEdit(self.controlArea, label = "cex:", text = '2')
        self.commit = redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction,
        processOnInput=True)
コード例 #18
0
 def __init__(self, parent=None, signalManager=None):
     #must initalize the parent OWRpy class
     OWRpy.__init__(self)
     
     ### GUI ###
     #create input line
     self.lineEdit = lineEdit(self.controlArea, label = 'Line Edit')
     #create submit button
     self.button = button(self.controlArea,label='submit',callback=self.process)
     #create output area
     self.output = textEdit(self.controlArea,label='Output')
コード例 #19
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self, wantGUIDialog = 1)

        self.rowCount = 1
        self.colCount = 1
        self.maxRow = 0 # sets the most extreme row and cols
        self.maxCol = 0
        self.classes = None
        self.savedData = None
        self.setRvariableNames(['table', 'table_cm'])
        
        self.inputs.addInput('Data Table', 'Data Table', redRRDataFrame, self.processDF)
        self.outputs.addOutput('Data Table', 'Data Table', redRRDataFrame) # trace problem with outputs
        #GUI.
        
        
        box = groupBox(self.GUIDialog, label = "Options")
        redRCommitButton(self.bottomAreaRight, 'Commit', self.commitTable)
        self.rowHeaders = checkBox(box, label= 'Table Annotations', buttons=['Use Row Headers', 'Use Column Headers'])
        #self.colHeaders = checkBox(box, label=None, buttons=['Use Column Headers'])
        self.rowHeaders.setChecked(['Use Row Headers', 'Use Column Headers'])
        #self.colHeaders.setChecked(['Use Column Headers'])
        self.customClasses = button(box, 'Use Custom Column Classes', callback = self.setCustomClasses)
        button(box, 'Clear Classes', callback = self.clearClasses)
        
        self.columnDialog = QDialog()
        self.columnDialog.setLayout(QVBoxLayout())
        self.columnDialog.hide()
        self.columnNameLineEdit = lineEdit(self.columnDialog, label = 'Column Name:')
        button(self.columnDialog, 'Commit', callback = self.commitNewColumn)
        button(self.bottomAreaRight, "Add Column", callback = self.addColumn)
        button(self.bottomAreaRight, "Add Row", callback = self.addRow)
        box = groupBox(self.controlArea, label = "Table", 
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        #self.splitCanvas.addWidget(box)
        

        #self.R(self.Rvariables['table'] + '<- matrix("",nrow=10,ncol=10)', wantType = 'NoConversion')
        self.dataTable = table(box, label = 'Data Table', rows = 10, columns = 10)
        # if self.dataTable.columnCount() < 1:
            # self.dataTable.setColumnCount(1)
            # self.dataTable.setHorizontalHeaderLabels(['Rownames'])
        # if self.dataTable.rowCount() < 1:
            # self.dataTable.setRowCount(1)
        # self.dataTable.setHorizontalHeaderLabels(['Rownames'])
        
        self.connect(self.dataTable, SIGNAL("cellClicked(int, int)"), self.cellClicked) # works OK
        self.connect(self.dataTable, SIGNAL("cellChanged(int, int)"), self.itemChanged)
        self.window = QDialog(self)
        self.window.setLayout(QVBoxLayout())
        self.classTable = table(self.window, label = 'Data Table', rows = self.maxCol, columns = 2)
        self.resize(700,500)
        self.move(300, 25)
コード例 #20
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self, wantGUIDialog = 1)

        self.rowCount = 10
        self.colCount = 10
        self.maxRow = 0 # sets the most extreme row and cols
        self.maxCol = 0
        self.classes = None
        self.savedData = None
        self.setRvariableNames(['table', 'table_cm'])
        
        self.inputs.addInput('Data Table', 'Data Table', redRRDataFrame, self.processDF)
        self.outputs.addOutput('Data Table', 'Data Table', redRRDataFrame) # trace problem with outputs
        #GUI.
        
        
        box = groupBox(self.GUIDialog, label = "Options")
        redRCommitButton(self.bottomAreaRight, 'Commit', self.commitTable)
        self.rowHeaders = checkBox(box, label= 'Table Annotations', buttons=['Use Row Headers', 'Use Column Headers'])
        #self.colHeaders = checkBox(box, label=None, buttons=['Use Column Headers'])
        self.rowHeaders.setChecked(['Use Row Headers', 'Use Column Headers'])
        #self.colHeaders.setChecked(['Use Column Headers'])
        self.customClasses = button(box, 'Use Custom Column Classes', callback = self.setCustomClasses)
        button(box, 'Clear Classes', callback = self.clearClasses)
        
        self.columnDialog = QDialog()
        self.columnDialog.setLayout(QVBoxLayout())
        self.columnDialog.hide()
        self.columnNameLineEdit = lineEdit(self.columnDialog, label = 'Column Name:')
        button(self.columnDialog, 'Commit', callback = self.commitNewColumn)
        #button(self.bottomAreaRight, "Add Column", callback = self.addColumn)
        #button(self.bottomAreaRight, "Add Row", callback = self.addRow)
        box = groupBox(self.controlArea, label = "Table", 
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        #self.splitCanvas.addWidget(box)
        

        #self.R(self.Rvariables['table'] + '<- matrix("",nrow=10,ncol=10)', wantType = 'NoConversion')
        self.dataTable = table(box, label = 'Data Table', rows = 10, columns = 10)
        # if self.dataTable.columnCount() < 1:
            # self.dataTable.setColumnCount(1)
            # self.dataTable.setHorizontalHeaderLabels(['Rownames'])
        # if self.dataTable.rowCount() < 1:
            # self.dataTable.setRowCount(1)
        # self.dataTable.setHorizontalHeaderLabels(['Rownames'])
        
        self.connect(self.dataTable, SIGNAL("cellClicked(int, int)"), self.cellClicked) # works OK
        self.connect(self.dataTable, SIGNAL("cellChanged(int, int)"), self.itemChanged)
        self.window = QDialog(self)
        self.window.setLayout(QVBoxLayout())
        self.classTable = table(self.window, label = 'Data Table', rows = self.maxCol, columns = 2)
        self.resize(700,500)
        self.move(300, 25)
コード例 #21
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["fisher.test"])
        self.data = {}
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', 'x', redRRMatrix, self.processx)

        self.RFunctionParamB_lineEdit = lineEdit(
            self.controlArea,
            label="Number of Replicates for Monte Carlo:",
            text='2000')
        self.RFunctionParamhybrid_checkBox = checkBox(
            self.controlArea,
            label="Hybrid Probabilities:",
            buttons=['FALSE', 'TRUE'],
            setChecked='FALSE')
        self.RFunctionParamsimulate_p_value_lineEdit = checkBox(
            self.controlArea,
            label="simulate_p_value:",
            buttons=['FALSE,TRUE'],
            setChecked='FALSE')
        self.RFunctionParamconf_level_lineEdit = lineEdit(
            self.controlArea, label="Confidence Level:", text='0.95')
        self.RFunctionParamconf_int_lineEdit = checkBox(
            self.controlArea,
            label="Calculate Confidence Interval:",
            buttons=['TRUE', 'FALSE'],
            setChecked='TRUE')
        self.RFunctionParamalternative_comboBox = comboBox(
            self.controlArea,
            label="Alternative Hypothesis:",
            items=["two.sided", "greater", "less"])
        self.RFunctionParamor_lineEdit = lineEdit(self.controlArea,
                                                  label="Odds Ratio:",
                                                  text='1')
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea,
                                      label="R Output Window")
コード例 #22
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.RFunctionParam_y = ''
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', 'y', redRRVector, self.processy)
        self.inputs.addInput('id1', 'x', redRRVector, self.processx)

        self.RFunctionParamxlab_lineEdit = lineEdit(self.controlArea,
                                                    label="xlab:",
                                                    text='NULL')
        self.RFunctionParamspan_lineEdit = lineEdit(self.controlArea,
                                                    label="span:",
                                                    text='2/3')
        self.RFunctionParamdegree_lineEdit = lineEdit(self.controlArea,
                                                      label="degree:",
                                                      text='1')
        self.RFunctionParamfamily_comboBox = comboBox(
            self.controlArea, label="family:", items=['symmetric', 'gaussian'])
        self.RFunctionParamylab_lineEdit = lineEdit(self.controlArea,
                                                    label="ylab:",
                                                    text='NULL')
        self.RFunctionParamevaluation_lineEdit = lineEdit(self.controlArea,
                                                          label="evaluation:",
                                                          text='50')
        self.RFunctionParamylim_lineEdit = lineEdit(self.controlArea,
                                                    label="ylim:",
                                                    text='')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
コード例 #23
0
ファイル: RedRdata.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(['datasets', "data"])
        self.data = {}
        self.outputs.addOutput('id0', _('Example Data'), redRRDataFrame)

        self.R(
            '%s <- as.data.frame(data(package = .packages(all.available = TRUE))$results[,c(1,3:4)])'
            % self.Rvariables['datasets'],
            silent=True,
            wantType='NoConversion')
        self.R('%s$Title <- as.character(%s$Title)' %
               (self.Rvariables['datasets'], self.Rvariables['datasets']),
               silent=True,
               wantType='NoConversion')

        self.table = filterTable(
            self.controlArea,
            label='R Datasets',
            includeInReports=False,
            Rdata=self.Rvariables['datasets'],
            sortable=True,
            filterable=True,
            selectionMode=QAbstractItemView.SingleSelection,
            callback=self.selectDataSet)

        box = groupBox(self.controlArea, orientation='horizontal', margin=16)
        self.controlArea.layout().setAlignment(box, Qt.AlignHCenter)
        # the package does not need to be loaded to get its datasets
        self.package = lineEdit(box, label=_('Package:'),
                                text='')  #, callback = self.loadPackage)
        self.RFunctionParamdataName_lineEdit = lineEdit(
            box, label=_("Data Name:"), text='', callback=self.commitFunction)

        self.commit = redRCommitButton(box,
                                       _("Commit"),
                                       callback=self.commitFunction,
                                       processOnChange=True,
                                       orientation='vertical')
コード例 #24
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["dotchart"])
        self.data = {}
        self.RFunctionParam_x = ''
        self.labels = ''
        self.inputs.addInput('id0', 'Data', redRRMatrix, self.processx)
        self.inputs.addInput('id1', 'Labels', redRList, self.processLabels)

        self.standardTab = self.controlArea

        self.RFunctionParammain_lineEdit = lineEdit(self.standardTab,
                                                    label="Main Title:")
        self.RFunctionParamxlab_lineEdit = lineEdit(self.standardTab,
                                                    label="X Label:")
        self.RFunctionParamylab_lineEdit = lineEdit(self.standardTab,
                                                    label="Y Label:")
        self.labelNames = comboBox(self.standardTab, label='Label Data')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
コード例 #25
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.RFunctionParam_mymodel = ''
        self.inputs.addInput('id0', 'mymodel', redRRModelFit,
                             self.processmymodel)

        self.RFunctionParamwhich_lineEdit = lineEdit(self.controlArea,
                                                     label="which:",
                                                     text='all')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
コード例 #26
0
ファイル: RedRvar_test.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["var.test"])
        self.data = {}
        self.RFunctionParam_y = ''
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', 'y', redRRVector, self.processy)
        self.inputs.addInput('id1', 'x', redRRVector, self.processx)

        self.RFunctionParamalternative_comboBox = comboBox(
            self.controlArea,
            label="alternative:",
            items=["two.sided", "less", "greater"])
        self.RFunctionParamratio_lineEdit = lineEdit(self.controlArea,
                                                     label="ratio:",
                                                     text='1')
        self.RFunctionParamconf_level_lineEdit = lineEdit(
            self.controlArea, label='Confidence Interval:', text='0.95')
        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
        self.RoutputWindow = textEdit(self.controlArea, label="RoutputWindow")
コード例 #27
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.RFunctionParam_y = ''
        self.RFunctionParam_x = ''
        self.dataFrame = ''
        self.plotAttributes = {}
        self.RFunctionParam_plotatt = ''
        self.inputs.addInput('id0', 'y', [redRRVector, redRList], self.processy)
        self.inputs.addInput('id1', 'x', redRRVector, self.processx)
        self.inputs.addInput('id2', 'plotatt', redRRPlotAttribute, self.processplotatt, multiple = True)

        
        self.RFunctionParamxlab_lineEdit = lineEdit(self.controlArea, label = "X Label:", text = 'X Label')
        self.RFunctionParamylab_lineEdit = lineEdit(self.controlArea, label = "Y Label:", text = 'Y Label')
        self.RFunctionParammain_lineEdit = lineEdit(self.controlArea, label = "Main Title:", text = 'Main Title')
        self.namesListX = comboBox(self.controlArea, label = 'X Axis Data:')
        self.namesListX.setEnabled(False)
        self.namesListY = comboBox(self.controlArea, label = 'Y Axis Data:')
        self.namesListY.setEnabled(False)
        self.graphicsView = graphicsView(self.controlArea,label='XY Plot',displayLabel=False,
        name = self.captionTitle)
        self.commit = redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction,
        processOnInput=True)
コード例 #28
0
ファイル: RedRks_test.py プロジェクト: aourednik/Red-R
	def __init__(self, parent=None, signalManager=None):
		OWRpy.__init__(self)
		self.setRvariableNames(["ks.test"])
		self.data = {}
		self.RFunctionParam_y = ''
		self.RFunctionParam_x = ''
		self.inputs.addInput('id0', 'y', redRRVector, self.processy)
		self.inputs.addInput('id1', 'x', redRRVector, self.processx)

		
		self.RFunctionParamalternative_comboBox = comboBox(self.controlArea, label = "alternative:", items = ["two.sided","less","greater"])
		self.RFunctionParamexact_lineEdit = lineEdit(self.controlArea, label = "exact:", text = 'NULL')
		redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction)
		self.RoutputWindow = textEdit(self.controlArea, label = "RoutputWindow")
コード例 #29
0
ファイル: spline.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["spline"])
        self.data = {}
        self.RFunctionParam_y = ''
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', 'y', redRRVector, self.processy)
        self.inputs.addInput('id1', 'x', redRRVector, self.processx)

        self.outputs.addOutput('id0', 'spline Output', redRRModelFit)
        self.outputs.addOutput('id1', 'spline plot attribute', redRRPlotAttribute)

        
        self.standardTab = groupBox(self.controlArea, label = 'Parameters')
        self.RFunctionParamxmin_lineEdit =  lineEdit(self.standardTab,  label = "xmin:", text = 'min(x)')
        self.RFunctionParamties_lineEdit =  lineEdit(self.standardTab,  label = "ties:", text = 'mean')
        self.RFunctionParammethod_lineEdit =  lineEdit(self.standardTab,  label = "method:", text = '"fmm"')
        self.RFunctionParamxmax_lineEdit =  lineEdit(self.standardTab,  label = "xmax:", text = 'max(x)')
        self.RFunctionParamn_lineEdit =  lineEdit(self.standardTab,  label = "n:", text = '3*length(x)')
        
        self.xcolumnComboBox = comboBox(self.standardTab, label = 'X data')
        self.ycolumnComboBox = comboBox(self.standardTab, label = 'Y data')
        redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea, label = "RoutputWindow")
コード例 #30
0
ファイル: plot.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.data = None
        self.RFunctionParam_x = ''
        self.plotAttributes = {}
        self.saveSettingsList = [
            'plotArea', 'data', 'RFunctionParam_x', 'plotAttributes'
        ]
        self.inputs.addInput('id0', 'x', redRRVariable, self.processx)

        box = OWGUI.widgetBox(self.controlArea, "Widget Box")
        self.RFunctionParam_main = lineEdit(box, label='Main Title:')
        self.plotArea = redRGraphicsView(self.controlArea)
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
コード例 #31
0
ファイル: rownames.py プロジェクト: aourednik/Red-R
    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')])
コード例 #32
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["strsplit", "dataframe"])
        self.data = {}
        self.RFunctionParam_x = ''
        self.inputs.addInput('id0', _('Input Data'), redRRVector,
                             self.processx)

        self.outputs.addOutput('id0', _('strsplit Output'), redRRList)
        self.outputs.addOutput('id1', _('strsplit Vector'), redRRVector)
        self.outputs.addOutput('dataframe', _('Data Table'), redRDataFrame)

        self.RFunctionParamsplit_lineEdit = lineEdit(
            self.controlArea, label=_("Split Text Using:"), text='')
        self.RFunctionParamfixed_radioButtons = radioButtons(
            self.controlArea,
            label=_("fixed:"),
            buttons=[
                _('Use text exactly'),
                _('Use text as expression (Advanced)')
            ],
            setChecked=_('Use text exactly'),
            orientation='horizontal')
        self.RFunctionParamextended_radiButtons = radioButtons(
            self.controlArea,
            label=_("Extend Expressions:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('No'),
            orientation='horizontal')
        self.RFunctionParamperl_radioButtons = radioButtons(
            self.controlArea,
            label=_("Use Perl Expressions:"),
            buttons=[_('Yes'), _('No')],
            setChecked=_('No'),
            orientation='horizontal')
        self.RFunctionParamunlist_radioButtons = radioButtons(
            self.controlArea,
            label=_('Convert to RVector'),
            buttons=[_('Send only the list'),
                     _('Send list and vector')],
            setChecked=_('Send list and vector'),
            orientation='horizontal')
        redRCommitButton(self.bottomAreaRight,
                         _("Commit"),
                         callback=self.commitFunction)
コード例 #33
0
    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)
コード例 #34
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["percentileClassifier_df", "percentileClassifier", 'percentileClassifier_cm'])
        self.data = ''
        self.dataParent = None
        self.inputs.addInput('id0', _('Data Frame'), redRRDataFrame, self.processData)

        self.outputs.addOutput('id0', _('Data Frame'), redRRDataFrame)

        
        ### GUI ###
        self.colNames_listBox = listBox(self.controlArea, label = _('Column Names:'),callback=self.onChange)
        self.colNames_listBox.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.percentile_spinBox = spinBox(self.controlArea, label= _('Percentile Cutoff Selector:'), min = 0, max = 100, callback=self.onChange)
        self.percentile_lineEdit = lineEdit(self.controlArea, label = _('Percentile Cutoff:'), toolTip = _('Input multiple cutoffs in the form; a, b, c.  Where a, b, and c are cutoffs.\nThis takes the place of the Percentile Cutoff Selector if not blank.'))
        self.outputWindow = textEdit(self.controlArea, label = _('Output Summary'))
        
        self.commitButton = redRCommitButton(self.bottomAreaRight, _("Commit"), callback = self.commit,
        processOnInput=True,processOnChange=True)
コード例 #35
0
    def __init__(self, **kwargs):
        OWRpy.__init__(self, **kwargs)

        self.rowCount = 1
        self.colCount = 1
        self.maxRow = 0 # sets the most extreme row and cols
        self.maxCol = 0
        self.classes = None
        self.savedData = None
        self.setRvariableNames(['table', 'table_cm'])
        
        self.inputs.addInput('id0', _('Data Table'), UnstructuredDict, self.processDF)

        self.outputs.addOutput('id0', _('Data Table'), UnstructuredDict)
        #GUI.
        
        redRCommitButton(self.bottomAreaRight, _('Commit'), self.commitTable)

        self.columnDialog = QDialog(self)
        self.columnDialog.setLayout(QVBoxLayout())
        self.columnDialog.hide()
        self.columnNameLineEdit = lineEdit(self.columnDialog, label = _('Column Name:'))
        button(self.columnDialog, _('Commit'), callback = self.commitNewColumn)
        button(self.bottomAreaRight, _("Add Column"), callback = self.columnDialog.show)
        
        box = groupBox(self.controlArea, label = _("Table"), 
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        #self.splitCanvas.addWidget(box)
        

        self.dataTable = pyDataTable(box,label=_('Data Entry'),displayLabel=False,
        data = None)
        
        self.connect(self.dataTable, SIGNAL("cellClicked(int, int)"), self.cellClicked) # works OK
        self.connect(self.dataTable, SIGNAL("cellChanged(int, int)"), self.itemChanged)
        self.connect(self.dataTable, SIGNAL('sectionClicked (int)'), self.headerClicked)
        self.resize(700,500)
        self.move(300, 25)
コード例 #36
0
ファイル: dataEntry.py プロジェクト: aourednik/Red-R
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        self.rowCount = 1
        self.colCount = 1
        self.maxRow = 0 # sets the most extreme row and cols
        self.maxCol = 0
        self.classes = None
        self.savedData = None
        self.setRvariableNames(['table', 'table_cm'])
        
        self.inputs.addInput('id0', _('Data Table'), redRRDataFrame, self.processDF)

        self.outputs.addOutput('id0', _('Data Table'), redRRDataFrame)
        #GUI.
        
        redRCommitButton(self.bottomAreaRight, _('Commit'), self.commitTable)

        self.columnDialog = QDialog(self)
        self.columnDialog.setLayout(QVBoxLayout())
        self.columnDialog.hide()
        self.columnNameLineEdit = lineEdit(self.columnDialog, label = _('Column Name:'))
        button(self.columnDialog, _('Commit'), callback = self.commitNewColumn)
        button(self.bottomAreaRight, _("Add Column"), callback = self.columnDialog.show)
        
        box = groupBox(self.controlArea, label = _("Table"), 
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        #self.splitCanvas.addWidget(box)
        

        self.dataTable = pyDataTable(box,label=_('Data Entry'),displayLabel=False,
        data = None)
        
        self.connect(self.dataTable, SIGNAL("cellClicked(int, int)"), self.cellClicked) # works OK
        self.connect(self.dataTable, SIGNAL("cellChanged(int, int)"), self.itemChanged)
        self.connect(self.dataTable, SIGNAL('sectionClicked (int)'), self.headerClicked)
        self.resize(700,500)
        self.move(300, 25)
コード例 #37
0
ファイル: RedRcbind.py プロジェクト: aourednik/Red-R
    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)
コード例 #38
0
 def __init__(self, parent,label=_('Graph'), displayLabel=True,name = '', data = None,**kwargs):
     ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget.
     
     kwargs.setdefault('includeInReports', True)
     kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
     widgetState.__init__(self,parent,label,**kwargs)
     
     QGraphicsView.__init__(self, self.controlArea)
     self.R = RSession.Rcommand
     self.require_librarys = RSession.require_librarys
     if displayLabel:
         self.controlArea = groupBox(self.controlArea,label=label, orientation='vertical')
     else:
         self.controlArea = widgetBox(self.controlArea,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)
     self.middleArea.layout().addWidget(self)  # place the widget into the parent widget
     scene = QGraphicsScene()
     self.setScene(scene)
     self.parent = self.controlArea
     self.widgetSelectionRect = None
     self.mainItem = None
     self.query = ''
     self.function = 'plot'
     self.data = data
     self.layers = []
     self._bg = None
     self._cex = None
     self._cexAxis = None
     self._cexLab = None
     self._cexMain = None
     self._cexSub = None
     self._col = None
     self._colAxis = None
     self._colMain = None
     self._colSub = None
     self._family = None
     self._fg = None
     self._lty = None
     self._lwd = None
     self._legendNames = None
     self._legendLocation = 'bottomleft'
     self._pch = None
     self.colorList = ['#000000', '#ff0000', '#00ff00', '#0000ff']
     self._replotAfterChange = True
     self._dheight = 4
     self._dwidth = 4
     self.image = 'plot'+unicode(time.time()) # the base file name without an extension
     self.imageFileName = ''
     self.currentScale = 1
     
     ## bottom menu bar
     self.menuBar = QMenuBar(self.bottomArea)
     self.bottomArea.layout().addWidget(self.menuBar)
     
     self.menuParameters = QMenu(_('Parameters'), self)
     colors = self.menuParameters.addMenu(_('Colors'))
     colors.addAction(_('Set Plotting Colors'), self.setPlotColors)
     colors.addAction(_('Set Axis Colors'), self.setAxisColors)
     colors.addAction(_('Set Label Colors'), self.setLabelColors)
     colors.addAction(_('Set Main Title Color'), self.setTitleColors)
     colors.addAction(_('Set Subtitle Color'), self.setSubtitleColors)
     colors.addAction(_('Set Forground Color'), self.setForgroundColors)
     colors.addAction(_('Set Background Color'), self.setBackgroundColors)
     
     font = self.menuParameters.addMenu(_('Font'))
     ffa = font.addMenu(_('Set Font Family'))
     
     legend = self.menuParameters.addMenu(_('Legend'))
     ll = legend.addMenu(_('Legend Location'))
     ll.addAction(_('Set to bottom right'), lambda x = 'bottomright': self._setLegendLocation(x))
     ll.addAction(_('Set to bottom left'), lambda x = 'bottomleft': self._setLegendLocation(x))
     ll.addAction(_('Set to top right'), lambda x = 'topleft': self._setLegendLocation(x))
     ll.addAction(_('Set to top left'), lambda x = 'topright': self._setLegendLocation(x))
     fontComboAction = QWidgetAction(font)
     self.fontCombo = comboBox(None, items = ['serif', 'sans', 'mono'], label='fonts', displayLabel=False,
         #'HersheySerif', 'HersheySans', 'HersheyScript',
         #'HersheyGothicEnglish', 'HersheyGothicGerman', 'HersheyGothicItalian', 'HersheySymbol', 'HersheySansSymbol'], 
         callback = self.setFontFamily)
     fontComboAction.setDefaultWidget(self.fontCombo)
     ffa.addAction(fontComboAction)
     #font.addAction(_('Set Font Magnification'), self.setFontMagnification)
     wb = widgetBox(None)
     self.fontMag = spinBox(wb, label = _('Font Magnification:'), min = 0, max = 500, value = 100) #, callback = self.setFontMagnification)
     QObject.connect(self.fontMag, SIGNAL('editingFinished ()'), self.setFontMagnification) ## must define ourselves because the function calls the attribute and this causes an error in Qt
     magAction = QWidgetAction(font)
     magAction.setDefaultWidget(wb)
     font.addAction(magAction)
     
     self.menuParameters.setToolTip(_('Set the parameters of the rendered image.\nThese parameters are standard graphics parameters which may or may not be applicable or rendered\ndepending on the image type and the settings of the plotting widget.'))
     fa = font.addMenu(_('Font Attributes'))
     lines = self.menuParameters.addMenu(_('Lines'))
     lines.addAction(_('Set Line Type'), self.setLineType)
     lines.addAction(_('Set Line Width'), self.setLineWidth)
     points = self.menuParameters.addMenu(_('Points'))
     points.addAction(_('Set Point Characters'), self.setPointCharacters)
     
     self.imageParameters = QMenu(_('Image'), self)
     type = self.imageParameters.addMenu(_('Type'))
     type.addAction(_('Set Image Vector Graphics'), self.setImageSVG).setToolTip(_('Renders the image using vector graphics which are scaleable and zoomable,\nbut may not show all graphical options such as forground color changes.'))
     type.addAction(_('Set Image Bitmap Graphics'), self.setImagePNG).setToolTip(_('Redners the image using bitmap graphics which will become distorted on zooming,\nbut will show all graphical options.'))
     #type.addAction(_('Set Image JPEG'), self.setImageJPEG)
     type.setToolTip(_('Changes the plotting type of the rendered image.\nDifferent image types may enable or disable certain graphics parameters.'))
     
     self.fileParameters = QMenu(_('File'), self)
     save = self.fileParameters.addMenu(_('Save'))
     save.addAction(_('Bitmap'), self.saveAsBitmap)
     save.addAction(_('PDF'), self.saveAsPDF)
     save.addAction(_('Post Script'), self.saveAsPostScript)
     save.addAction(_('JPEG'), self.saveAsJPEG)
     if sys.platform == 'win32':
         save.addAction('WMF', self.saveAsWMF)
     
     printScene = self.fileParameters.addAction(_('Print'), self.printMe)
     
     self.menuBar.addMenu(self.fileParameters)
     self.menuBar.addMenu(self.menuParameters)
     #self.menuBar.addMenu(self.imageParameters)
     
     ### lower Line Edit
     self.extrasLineEdit = lineEdit(self.bottomArea, label = _('Advanced plotting parameters'), 
         toolTip = _('Add extra parameters to the main plot.\nPlease see documentation for more details about parameters.'), callback = self.replot)
     
     ### 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'
     self.plotExactlySwitch = False ## a switch that can be activated to allow plotting exactly as the plot is sent, no function generation will be performed and all attribute alteration will be disabled
     QObject.connect(self.dialog, SIGNAL('finished(int)'), self.dialogClosed)
コード例 #39
0
    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)
        self.topArea = widgetBox(self.controlArea,
        sizePolicy = QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum),includeInReports=False, orientation = 'horizontal')
        self.middleArea = widgetBox(self.controlArea)
        self.bottomArea = widgetBox(self.controlArea,includeInReports=False)  #, sizePolicy = QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
        
        self.middleArea.layout().addWidget(self)  # place the widget into the parent widget
        scene = QGraphicsScene()
        self.setScene(scene)
        self.parent = parent
        self.data = data
        self.printQuery = ''
        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' 
                          # }
                }
            }
        }
        
        
        ### ggplot options
        self.optionsDialog = dialog(self.controlArea)
        self.optionsTab = tabWidget(self.optionsDialog)
        
        plotGridTab = self.optionsTab.createTabPage("Plot Grid Area", orientation = 'vertical')
        
        self.panelGridMajorTheme = comboBox(plotGridTab, label = 'Major Grid General Theme', toolTip = 'If Ignore, no options are set for this.  If not None overrides all other options set and sets the theme specified.', items = [('ignore', 'Ignore'), ('none', 'None'), ('theme_bw()', 'Black and White'), ('theme_blank()', 'Blank Theme')])
        self.panelGridMajorColour = colorButton(plotGridTab, label = "Major Grid Color")
        self.panelGridMajorSize = spinBox(plotGridTab, label = "Major Grid Size")
        self.panelGridMajorLineType = comboBox(plotGridTab, label = "Major Grid Line Type", items = [('solid', 'Solid'), ('dotted', 'Dotted'), ('dashed', 'Dashed')])
        
        self.panelGridMinorTheme = comboBox(plotGridTab, label = 'Minor Grid General Theme', toolTip = 'If Ignore, no options are set for this.  If not None overrides all other options set and sets the theme specified.', items = [('ignore', 'Ignore'), ('none', 'None'), ('theme_bw()', 'Black and White'), ('theme_blank()', 'Blank Theme')])
        self.panelGridMinorColour = colorButton(plotGridTab, label = "Minor Grid Color")
        self.panelGridMinorSize = spinBox(plotGridTab, label = "Minor Grid Size")
        self.panelGridMinorLineType = comboBox(plotGridTab, label = "Minor Grid Line Type", items = [('solid', 'Solid'), ('dotted', 'Dotted'), ('dashed', 'Dashed')])
        
        panelTab = self.optionsTab.createTabPage("panel Background Options", orientation = 'vertical')
        
        self.panelBackgroundTheme = comboBox(panelTab, label = 'panel Background Theme', toolTip = 'If Ignore, no options are set for this.  If not None overrides all other options set and sets the theme specified.', items = [('ignore', 'Ignore'), ('none', 'None'), ('theme_bw()', 'Black and White'), ('theme_blank()', 'Blank Theme')])
        
        textTab = self.optionsTab.createTabPage("Text Options", orientation = 'vertical')
        
        self.useTextOptions = comboBox(textTab, label = 'Use Text Options', items = [('ignore', 'No'), ('yes', 'Yes')])
        self.plotTitle = lineEdit(textTab, label = 'Plot Title')
        self.plotTitleSize = spinBox(textTab, label = 'Title Font Size', min = 1, value = 20)
        self.plotTitleAngle = spinBox(textTab, label = 'Title Angle', min = 0, max = 360, value = 0)
        self.plotTitleFontFace = comboBox(textTab, label = 'Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTitleX = lineEdit(textTab, label = 'X Axis Title')
        self.axisTitleXColor = colorButton(textTab, label = 'X Axis Color')
        self.axisTitleXSize = spinBox(textTab, label = 'X Axis Title Size', min = 1, value = 14)
        self.axisTitleXAngle = spinBox(textTab, label = 'X Axis Title Angle', min = 0, max = 360, value = 0)
        self.axisTitleXFontFace = comboBox(textTab, label = 'X Axis Title Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTextXSize = spinBox(textTab, label = 'X Axis Text Size', min = 1, value = 14)
        self.axisTextXColor = colorButton(textTab, label = 'X Axis Text Color')
        self.axisTextXAngle = spinBox(textTab, label = 'X Axis Text Angle', min = 0, max = 360, value = 0)
        self.axisTextXFontFace = comboBox(textTab, label = 'X Axis Text Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTitleY = lineEdit(textTab, label = 'Y Axis Title')
        self.axisTitleYColor = colorButton(textTab, label = 'Y Axis Color')
        self.axisTitleYSize = spinBox(textTab, label = 'Y Axis Title Size', min = 1, value = 14)
        self.axisTitleYAngle = spinBox(textTab, label = 'Y Axis Title Angle', min = 0, max = 360, value = 0)
        self.axisTitleYFontFace = comboBox(textTab, label = 'Y Axis Title Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTextYSize = spinBox(textTab, label = 'Y Axis Text Size', min = 1, value = 14)
        self.axisTextYColor = colorButton(textTab, label = 'Y Axis Text Color')
        self.axisTextYAngle = spinBox(textTab, label = 'Y Axis Text Angle', min = 0, max = 360, value = 0)
        self.axisTextYFontFace = comboBox(textTab, label = 'Y Axis Text Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.optionsDialog.hide()
        
        self.optionWidgets = {}
        self.colorList = ['#000000', '#ff0000', '#00ff00', '#0000ff']       

        self.extraOptionsLineEdit = lineEdit(self.topArea, label = 'Extra Options', toolTip = 'These options will be appended to the plotting call, remember that these are ggplot options that will be added to the plot object')
        self.extraOptionsLineEdit.controlArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        
        self.heightSpinBox = spinBox(self.topArea, label = 'Height', min = 0, value = 7, decimals = 3)
        self.widthSpinBox = spinBox(self.topArea, label = 'Width', min = 0, value = 7, decimals = 3)
        button(self.topArea, label = 'Show Options', callback = self.optionsDialog.show)
        
    
    ################################
    ### 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')
        save.addAction('SVG')
        self.menu.addAction('Copy')
        self.menu.addAction('Fit In Window')
        self.menu.addAction('Zoom Out')
        self.menu.addAction('Zoom In')
        self.menu.addAction('R Graphics Device')
        #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'
        self.imageType = 'svg'
        QObject.connect(self.dialog, SIGNAL('finished(int)'), self.dialogClosed)
コード例 #40
0
ファイル: redRPlot.py プロジェクト: MatthewASimonson/r-orange
    def __init__(self, parent,label=None, displayLabel=True,includeInReports=True, name = '', data = None, prePlottingCallback = None):
        ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget.
        graphicsView.__init__(self, parent, label = label, displayLabel = displayLabel, includeInReports = includeInReports,
            name = name, data = data)
        ## __init__(self, parent,label=_('Graph'), displayLabel=True,includeInReports=True, name = '', data = None)
        
    ################################
    ####   Themes              #####
    ################################
        
        self.prePlottingCallback = prePlottingCallback
        self.options = {
            'device': {
                'imageType':'svg',
                'dpi':'75',
                'bgColor':'#FFFFFF',
                'dheight':400,
                'dwidth':400,
                'units':'px'},
            'main':{
                'col':None,
                'lty':None,
                'lwd':None,
                'pch':None,},
            'title':{
                'main':'',
                'xlab':'',
                'ylab':'',
                'col.main':'#000000',
                'col.sub':'#000000',
                'col.lab':'#000000'},
            'par':{
                'cex.axis':1,
                'cex.lab':1,
                'cex.main':1,
                'cex.sub':1,
                'cex':1,
                'col.axis':'#000000'}
            }
        
        
        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')
        self.monkey = checkBox(hbox, label='useopts', displayLabel = False, buttons={'true':'Use Custom Plot Options'}, callback = self.enablePlotOptions)
        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=[(1, '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', 'cairo' ,'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('PDF (LATEX)')
        save.addAction('Post Script')
        save.addAction('JPEG')
        if sys.platform == 'win32':
            save.addAction('WMF')
        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)

        
        self.graphicOptionsWidget.hide()
コード例 #41
0
ファイル: aplot.py プロジェクト: MatthewASimonson/r-orange
    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
        self.customPlotFunction = None
        self.controlGroups = {}
        self.tabs = {}
    ################################
    ####   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,
                        }
                    ,'xlim': {
                        'default':None, 
                        'qtWidget':['xstart','xend'],
                        'getFunction': self.getLimits,
                        'setFunction': self.setLimits,                    
                    }
                    ,'ylim': {
                        'default':None, 
                        'qtWidget':['ystart','yend'],
                        'getFunction': self.getLimits,
                        'setFunction': self.setLimits,                    
                    }
                }
            },
            '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.tabWidget = tabWidget(self.graphicOptionsWidget)
        self.tabWidget.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.updatePlot)
        
        self.createTab('General')
        self.createTab('Points/Lines')
        self.createTab('Advanced')

    ################################
    ####   Advanced Tabs       #####
    ################################
        imageBox = self.createControlGroup('Advanced',label='Image Properties')
        self.optionWidgets['extrasLineEdit'] = lineEdit(imageBox, label = 'Advanced plotting parameters', 
        orientation='horizontal',
        toolTip = 'Add extra parameters to the main plot.\nPlease see documentation for more details about parameters.')
        
        self.optionWidgets['onlyAdvanced'] = checkBox(imageBox,
        buttons=['Only use the advanced options here'],
        label='advancedOnly',displayLabel=False)

    ################################
    ####   First Tabs          #####
    ################################
        imageBox = self.createControlGroup('General',label='Image Properties')
        # 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 = self.createControlGroup('General',label='Labels')
        
        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 = self.createControlGroup('General',label='Sizes')
        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)
        
        limitBox = self.createControlGroup('General',label='Limits')
        col2Box = widgetBox(limitBox,orientation='horizontal')
        column1 = widgetBox(col2Box,orientation='vertical')
        column2 = widgetBox(col2Box,orientation='vertical')

        self.optionWidgets['xstart'] = lineEdit(column1,label='X Start', width=40)
        self.optionWidgets['xend'] = lineEdit(column2,label='X End', width=40)
        self.optionWidgets['ystart'] = lineEdit(column1,label='Y Start', width=40)
        self.optionWidgets['yend'] = lineEdit(column2,label='Y End', width=40)
        

    
    ################################
    ####   Second Tabs         #####
    ################################
        colorBox = self.createControlGroup('Points/Lines',label='Colors')
        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)
        colorBox2 = self.createControlGroup('Points/Lines',label='More Colors')
        
        # 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 = self.createControlGroup('Points/Lines',label='Lines')
       
        self.optionWidgets['linesListBox'] = listBox(lineBox, label = 'Line types', displayLabel=False,
        selectionMode = QAbstractItemView.ExtendedSelection,
        items = [(1,'________'), (2,'- - - -'), (3,'........'), (4,'_._._._.'), 
        (5,'__ __ __'), (6,'__.__.__.')])
        
        
        
        pointBox = self.createControlGroup('Points/Lines',label='Points')
        
        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)
コード例 #42
0
 def createMenu(self, selectedCol):
     '''
     self.tm.createMenu(selectedCol, sortable = self.sortable, filterable = self.filterable
     '''
     #print selectedCol, pos
     # print _('in createMenu'), self.criteriaList
     if not self.sortable and not self.filterable: return
     
     globalPos = QCursor.pos() #self.mapToGlobal(pos)
     self.menu = QDialog(None,Qt.Popup)
     self.menu.setLayout(QVBoxLayout())
     if self.sortable:
         box = widgetBox(self.menu,orientation='horizontal')
         box.layout().setAlignment(Qt.AlignLeft)
         button(box,label='A->Z',callback= lambda: self.sort(selectedCol,Qt.AscendingOrder))
         widgetLabel(box,label=_('Ascending Sort'))
         box = widgetBox(self.menu,orientation='horizontal')
         box.layout().setAlignment(Qt.AlignLeft)
         button(box,label='Z->A',callback= lambda: self.sort(selectedCol,Qt.DescendingOrder))
         widgetLabel(box,label=_('Descending Sort'))
         
     if not self.filterable:
         self.menu.move(globalPos)
         self.menu.show()
         return
     
     if self.sortable:
         hr = QFrame(self.menu)
         hr.setFrameStyle( QFrame.Sunken + QFrame.HLine );
         hr.setFixedHeight( 12 );
         self.menu.layout().addWidget(hr)
 
     
     clearButton = button(self.menu,label=_('Clear Filter'),
     callback=lambda col=selectedCol: self.createCriteriaList(col,self.menu,action='clear'))
     self.menu.layout().setAlignment(clearButton,Qt.AlignHCenter)
     clearButton.hide()
     
     self.numericLabel = widgetLabel(self.menu,label=_('Enter a value for one of these critera:'))
     self.numericLabel.hide()
     
     self.stringLabel = widgetLabel(self.menu,label=_('Enter a value for one of these critera (case sensitive):'))
     self.stringLabel.hide()
     
     self.factorLabel = widgetLabel(self.menu,label=_('Select Levels:'))
     self.factorLabel.hide()
     
     
     if selectedCol in self.criteriaList.keys():
         clearButton.show()
     
     self.optionsBox = widgetBox(self.menu)
     self.optionsBox.layout().setAlignment(Qt.AlignTop)
     
     #### Logic if R variable ###
     #if self.varType == 0:
     colClass = self.R('class(%s[,%d])' % (self.Rdata,selectedCol),silent=True)
     
     if colClass in ['factor','logical']:
         self.factorLabel.show()
         
         if selectedCol in self.criteriaList.keys():
             checked = self.criteriaList[selectedCol]['value']
         else:
             checked = []
         if colClass =='logical':
             levels = ['TRUE','FALSE']
         else:
             levels = self.R('levels(%s[,%d])' % (self.Rdata,selectedCol),wantType='list', silent=True)
             
         if len(levels) > 1:
             levels.insert(0,_('Check All'))
         scroll = scrollArea(self.optionsBox,spacing=1)
         
         c = checkBox(scroll,label=_('Levels'),displayLabel=False, buttons=levels,setChecked = checked)
         scroll.setWidget(c.controlArea)
         
         QObject.connect(c.buttons, SIGNAL('buttonClicked (int)'), lambda val : self.factorCheckBox(val,self.optionsBox))
 
     elif colClass in ['integer','numeric']:
         self.numericLabel.show()
         self.options = [_('Equals'), _('Does Not Equal'),_('Greater Than'),_('Greater Than Or Equal To'), 
         _('Less Than'), _('Less Than or Equal To'), 'Between\n(2 numbers comma\nseparated, inclusive)', 
         'Not Between\n(2 numbers comma\nseparated)']
         for x in self.options:
             if selectedCol in self.criteriaList and self.criteriaList[selectedCol]['method'] == _('Numeric ') + x:
                 e = lineEdit(self.optionsBox,label=x,text=self.criteriaList[selectedCol]['value'])
             else:
                 e = lineEdit(self.optionsBox,label=x)
             self.connect(e, SIGNAL("textEdited(QString)"),
             lambda val, col=selectedCol,field=x : self.clearOthers(val,self.optionsBox,field))
 
     elif colClass in ['character']:
         self.stringLabel.show()
         self.options = [_('Equals'), _('Does Not Equal'),_('Begins With'),_('Ends With'), 
         _('Contains'), _('Does Not Contain')]
         for x in self.options:
             if selectedCol in self.criteriaList and self.criteriaList[selectedCol]['method'] == _('String ') + x:
                 e = lineEdit(self.optionsBox,label=x,text=self.criteriaList[selectedCol]['value'])
             else:
                 e = lineEdit(self.optionsBox,label=x)
             self.connect(e, SIGNAL("textEdited(QString)"),
             lambda val, col=selectedCol,field=x : self.clearOthers(val,self.optionsBox,field))
     
     buttonBox = widgetBox(self.optionsBox,orientation='horizontal')
     buttonBox.layout().setAlignment(Qt.AlignRight)
     okButton = button(buttonBox,label=_('OK'),
     callback=lambda col=selectedCol: self.createCriteriaList(col,self.optionsBox,action=_('OK')))
     okButton.setDefault (True)
     button(buttonBox,label=_('Cancel'),
     callback=lambda col=selectedCol: self.createCriteriaList(col,self.optionsBox,action='cancel'))
     
     self.menu.move(globalPos)
     self.menu.show()