示例#1
0
    def __init__(self, **kwargs):
        OWRpy.__init__(self, **kwargs)
        self.RFunctionParam_data = ""
        self.setRvariableNames(["norm"])
        self.require_librarys(["reshape", "gregmisc"])
        self.inputs.addInput("data", "Data Table", signals.RDataFrame.RDataFrame, self.processdata)
        self.outputs.addOutput("data", "Data Table", signals.RDataFrame.RDataFrame)
        """Input sigals are base.RDataFrame, Output signals are base.RDataFrame"""

        self.GUIPARAM_Grouping = comboBox(self.controlArea, label="Sample Groupings")
        self.GUIPARAM_NormGroup = comboBox(
            self.controlArea, label="Normalization Groupings", callback=self.setGUIPARAM_NormPoint
        )
        self.GUIPARAM_NormPoint = comboBox(self.controlArea, label="Normalization Point")
        self.GUIPARAM_Measure = comboBox(self.controlArea, label="Measure Values")
        """
        .. rrgui:: Sample Groupings; the column that will be used to normalize against.

        .. rrgui:: Normalization Groupings; the column that holds the normalization descriptors for each group.
        
        .. rrgui:: Normalization Point; the point in the Normalization Groupings that the Sample Groupings values will be normalized to.
        
        .. rrgui:: Measure Values; the values that will be normalized.
        """

        self.GUIOUTPUT_Text = textEdit(self.controlArea, label="Data Sample")

        redRCommitButton(self.bottomAreaRight, "Commit", callback=self.commitFunction)
示例#2
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        self.RFunctionParam_data = None
        self.data = None

        self.inputs.addInput('id0', _('R Variable Data'), redRRVariable,
                             self.processdata)

        self.RoutputWindow = textEdit(self.controlArea,
                                      label=_('Output'),
                                      editable=False)

        self.showAll = redRCheckBox(
            self.bottomAreaLeft,
            label=_('showall'),
            displayLabel=False,
            buttons=[_('String Representation'),
                     _('Show All')],
            orientation="horizontal",
            setChecked=_('String Representation'))

        self.commit = redRCommitButton(self.bottomAreaRight,
                                       label=_("Commit"),
                                       callback=self.commitFunction,
                                       processOnInput=True)
示例#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
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["pairwise.t.test"])
        self.RFunctionParam_x = ""
        self.RFunctionParam_pool_sd = "TRUE"
        self.RFunctionParam_g = ""
        self.RFunctionParam_p_adjust_method = "p.adjust.methods"
        self.indata = ''
        self.inputs.addInput('id0', 'R Data Frame', redRRDataFrame,
                             self.process)

        self.outputs.addOutput('id0', 'pairwise.t.test Output', redRRVariable)

        box = widgetBox(self.controlArea)
        self.RFunctionParam_x = comboBox(box, label="Values:")
        self.RFunctionParam_pool_sd = comboBox(
            box, label="Pool Standard Deviation:", items=['True', 'False'])
        self.RFunctionParam_g = comboBox(box, label="Groups Column:")
        self.RFunctionParam_p_adjust_method = comboBox(
            box,
            label="P-value Adjust Method:",
            items=[
                "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr",
                "none"
            ])
        self.alternative = comboBox(box,
                                    label='Alternative Hypothesis:',
                                    items=['two.sided', 'greater', 'less'])
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(box, label='R Output')
示例#5
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["intersect"])
        self.dataA = None
        self.dataB = None

        self.inputs.addInput('id0', _('Input Data A'), redRRList,
                             self.processA)
        self.inputs.addInput('id1', _('Input Data B'), redRRList,
                             self.processB)

        self.outputs.addOutput('id0', _('intersect Output'), redRRVector)

        box = widgetBox(self.controlArea, orientation='vertical')
        dataSetBox = widgetBox(box, orientation='horizontal')
        #pickA = groupBox(dataSetBox, "Dataset A:")
        self.colA = listBox(dataSetBox,
                            label=_('Input Data A'),
                            callback=self.onSelect)

        #pickB = groupBox(dataSetBox, "Dataset B:")
        self.colB = listBox(dataSetBox,
                            label=_('Input Data B'),
                            callback=self.onSelect)

        self.resultInfo = textEdit(box,
                                   label=_('Results'),
                                   displayLabel=False,
                                   includeInReports=False,
                                   editable=False,
                                   alignment=Qt.AlignHCenter)
        self.resultInfo.setMaximumWidth(170)
        self.resultInfo.setMaximumHeight(25)
        self.resultInfo.setMinimumWidth(170)
        self.resultInfo.setMinimumHeight(25)
        #box.layout().setAlignment(self.resultInfo,Qt.AlignHCenter)
        self.resultInfo.hide()
        self.type = radioButtons(self.bottomAreaLeft,
                                 label=_("Perform"),
                                 buttons=[
                                     _('Intersect'),
                                     _('Union'),
                                     _('Set Difference'),
                                     _('Set Equal')
                                 ],
                                 setChecked=_('Intersect'),
                                 orientation='horizontal',
                                 callback=self.onTypeSelect)

        commitBox = widgetBox(self.bottomAreaRight, orientation='horizontal')
        self.bottomAreaRight.layout().setAlignment(commitBox, Qt.AlignBottom)

        self.commit = redRCommitButton(commitBox,
                                       _("Commit"),
                                       callback=self.commitFunction,
                                       processOnChange=True,
                                       processOnInput=True)
示例#6
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')
示例#7
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        self.RFunctionParam_data = ''
        self.inputs.addInput('id0', 'data', redRRVariable, self.processdata)

        self.RFunctionParamformula = RFormulaEntry(self.controlArea)
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea, label="RoutputWindow")
示例#8
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.RFunctionParam_object = ''
        self.saveSettingsList.extend(['RFunctionParam_object'])
        self.inputs.addInput('id0', 'object', 'All', self.processobject)

        
        box = groupBox(self.controlArea, "Output")
        self.commit = redRCommitButton(self.bottomAreaRight, "Commit", callback = self.commitFunction,
        processOnInput=True)
        self.RoutputWindow = textEdit(box,label='R Output', displayLabel=False)
示例#9
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["attributes"])
        self.data = {}
        self.RFunctionParam_obj = ''
        self.inputs.addInput('id0', 'obj', redRRVariable, self.processobj)

        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea,
                                      label="R Output Window")
示例#10
0
 def __init__(self, parent=None, signalManager=None):
     OWRpy.__init__(self)
     self.setRvariableNames(["summary"])
     self.data = {}
      
     self.RFunctionParam_object = ''
     self.inputs.addInput('id0', _('R Variable Object'), redRRVariable, self.processobject)
     
     self.commit = redRCommitButton(self.bottomAreaRight, _('Commit'), callback = self.commitFunction,
     processOnInput=True)
     
     self.RoutputWindow = textEdit(self.controlArea, label = _("RoutputWindow"))
示例#11
0
 def __init__(self, parent=None, signalManager=None):
     OWRpy.__init__(self)
     self.setRvariableNames(['saveData'])
     self.inputObject = None
     self.outputObject = None
     self.inputs.addInput('id0', _('Input Object'), 'All',
                          self.processobject)
     self.outputs.addOutput('id0', _('Output Object'), 'All')
     self.outputs.propogateNone = self.newPropNone  ## this is here to stop the propogation of None when a None is received.
     widgetLabel(
         self.controlArea,
         _('This widget acts as a save point for analyses so that data is not lost when upstream widgets are removed.  You can use this to help manage memory in your schemas by deleting upstream data (making the schema smaller) yet retaining the analyses.'
           ),
         wordWrap=True)
     redRCommitButton(self.bottomAreaRight,
                      label=_("Commit"),
                      callback=self.commitFunction)
     self.RoutputWindow = textEdit(self.controlArea,
                                   label=_('Input Object'))
     self.RoutputWindow2 = textEdit(self.controlArea,
                                    label=_('Output Object'))
示例#12
0
 def __init__(self, parent=None, signalManager=None):
     OWRpy.__init__(self)
     self.setRvariableNames(["summary"])
     self.data = {}
      
     self.RFunctionParam_object = ''
     self.inputs.addInput('id0', _('R Variable Object'), redRRDataFrame, self.processobject)
     self.namesList = redRListBox(self.controlArea, label = _('Splitting Element:'))
     self.namesList.setSelectionMode(QAbstractItemView.ExtendedSelection)
     self.processOnConnect = checkBox(self.controlArea, buttons = [_('Process On Connect')], setChecked = _('Process On Connect'))
     
     redRCommitButton(self.bottomAreaRight, _('Commit'), callback = self.commitFunction)
     self.RoutputWindow = textEdit(self.controlArea, label = _("RoutputWindow"))
示例#13
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["cor.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)

        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea, label="RoutputWindow")
示例#14
0
	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")
示例#15
0
 def saveAsPDFLatex(self):
     qname = QFileDialog.getSaveFileName(self, _("Save Image"), redREnviron.settings['workingDir'] + "/Image-"+unicode(datetime.date.today())+".pdf", "PDF Document (.pdf)")
     if qname.isEmpty(): return
     qname = unicode(qname)
     redREnviron.settings['workingDir'] = os.path.split(qname)[0]
     self.saveAs(unicode(qname), 'pdf')
     mb = dialog(None, title = "Latex Command")
     textbox = textEdit(mb, label = "Latex Command")
     textbox.setText(r"""
     \being{figure}[tbh]
     \centering
     \label{}
     \includegraphics[width = 90mm]{"%(qname)s"}
     \caption{}
     \end{figure}
     """ % {'qname':qname})
     mb.exec_()
示例#16
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["intersect"])
        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', _('intersect Output'), redRRVector)

        redRCommitButton(self.bottomAreaRight,
                         _("Commit"),
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea,
                                      label=_("Intersect Output"))
        self.resize(500, 200)
示例#17
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["wilcox.test"])

        self.RFunctionParam_x = ''
        self.RFunctionParam_y = ''
        self.inputs.addInput('id0', 'x', redRRVector, self.processx)
        self.inputs.addInput('id1', 'y', redRRVector, self.processy)

        self.outputs.addOutput('id0', 'wilcox.test Output', redRRVariable)

        self.commit = redRCommitButton(self.bottomAreaRight,
                                       "Commit",
                                       callback=self.commitFunction,
                                       processOnInput=True)
        self.RoutputWindow = textEdit(self.controlArea,
                                      label='R Output',
                                      displayLabel=False)
示例#18
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)
示例#19
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")
示例#20
0
    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")
示例#21
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")
示例#22
0
    def __init__(self, parent=None, signalManager=None):

        OWRpy.__init__(self)
        self.setRvariableNames(['Plot', 'paint', 'selected'])
        self.inputs.addInput('id0', 'x', redRRDataFrame, self.gotX)

        self.outputs.addOutput('id0', 'Scatterplot Output', redRRDataFrame)

        self.data = None
        self.parent = None
        self.dataParent = None

        # GUI
        area = widgetBox(self.controlArea, orientation='horizontal')

        options = widgetBox(area, orientation='vertical')
        options.setMaximumWidth(250)
        # options.setMinimumWidth(250)
        options.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        dataSelection = groupBox(options, orientation='vertical')
        self.xColumnSelector = comboBox(dataSelection,
                                        label='X data',
                                        items=[],
                                        callback=self.onSourceChange)
        self.yColumnSelector = comboBox(dataSelection,
                                        label='Y data',
                                        items=[],
                                        callback=self.onSourceChange)
        self.paintCMSelector = comboBox(dataSelection,
                                        label='Color Points By:',
                                        items=[''],
                                        callback=self.onSourceChange)

        # plot area
        plotarea = groupBox(area, label="Graph")
        plotarea.setSizePolicy(QSizePolicy.MinimumExpanding,
                               QSizePolicy.MinimumExpanding)
        #plotarea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.graph = redRGraph(plotarea,
                               label='Scatter Plot',
                               displayLabel=False,
                               onSelectionCallback=self.onSelectionCallback)

        #plotarea.layout().addWidget(self.graph)
        #self.zoomSelectToolbarBox = groupBox(self.GUIDialog, label = "Plot Tool Bar")

        separator(options, height=8)
        buttonBox = groupBox(options, orientation='vertical')

        box1 = widgetBox(buttonBox, orientation='horizontal')
        box1.layout().setAlignment(Qt.AlignRight)
        self.plotOnInput = checkBox(
            box1,
            label='commit',
            displayLabel=False,
            buttons=['Plot on Change'],
            toolTips=[
                'Whenever X, Y or color data source changes plot the results.'
            ])
        button(box1,
               label="Plot",
               callback=self.plot,
               toolTip='Plot the data.')

        box2 = widgetBox(buttonBox, orientation='horizontal')
        box2.layout().setAlignment(Qt.AlignRight)

        self.commitOnInput = checkBox(
            box2,
            label='commit',
            displayLabel=False,
            buttons=['Commit on Selection'],
            toolTips=['Whenever this selection changes, send data forward.'])
        button(box2,
               label="Select",
               callback=self.sendMe,
               toolTip='Subset the data according to your selection.')

        separator(options, height=8)
        self.zoomSelectToolbar = zoomSelectToolbar(self, options, self.graph)
        self.paintLegend = textEdit(options, label='Legend')
示例#23
0
    def __init__(self, parent=None, signalManager=None):

        OWRpy.__init__(self)
        self.path = os.path.abspath('/')
        self.colClasses = []
        self.myColClasses = []
        self.colNames = []
        self.dataTypes = []
        self.useheader = 1

        #set R variable names
        self.setRvariableNames(
            ['dataframe_org', 'dataframe_final', 'filename', 'parent'])

        #signals
        self.outputs.addOutput(
            'od1', _('Output Data'),
            rdf.RDataFrame)  #[("data.frame", rdf.RDataFrame)]
        #GUI
        area = widgetBox(self.controlArea,
                         orientation='horizontal',
                         alignment=Qt.AlignTop)
        #area.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding ,QSizePolicy.MinimumExpanding))
        #area.layout().setAlignment(Qt.AlignTop)
        options = widgetBox(area, orientation='vertical')
        options.setMaximumWidth(300)
        # options.setMinimumWidth(300)
        options.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #area.layout().setAlignment(options,Qt.AlignTop)

        self.browseBox = groupBox(options,
                                  label=_("Load File"),
                                  addSpace=True,
                                  orientation='vertical')
        box = widgetBox(self.browseBox, orientation='horizontal')
        self.filecombo = fileNamesComboBox(box,
                                           label=_('Files'),
                                           displayLabel=False,
                                           orientation='horizontal',
                                           callback=self.scanNewFile)
        self.filecombo.setSizePolicy(QSizePolicy.MinimumExpanding,
                                     QSizePolicy.Minimum)
        button(box, label=_('Browse'), callback=self.browseFile)

        self.fileType = radioButtons(options,
                                     label=_('File Type'),
                                     buttons=[_('Text'), _('Excel')],
                                     setChecked=_('Text'),
                                     callback=self.scanNewFile,
                                     orientation='horizontal')
        self.fileType.setSizePolicy(QSizePolicy.MinimumExpanding,
                                    QSizePolicy.Minimum)
        self.fileType.hide()

        self.delimiter = radioButtons(
            options,
            label=_('Column Seperator'),
            buttons=[_('Tab'), _('Comma'),
                     _('Space'), _('Other')],
            setChecked=_('Tab'),
            callback=self.scanNewFile,
            orientation='horizontal')

        self.otherSepText = lineEdit(self.delimiter.box,
                                     label=_('Seperator'),
                                     displayLabel=False,
                                     text=';',
                                     width=20,
                                     orientation='horizontal')
        QObject.connect(self.otherSepText,
                        SIGNAL('textChanged(const QString &)'), self.otherSep)

        self.headersBox = groupBox(options,
                                   label=_("Row and Column Names"),
                                   addSpace=True,
                                   orientation='horizontal')

        self.hasHeader = checkBox(
            self.headersBox,
            label=_('Column Header'),
            displayLabel=False,
            buttons=[_('Column Headers')],
            setChecked=[_('Column Headers')],
            toolTips=[
                _('a logical value indicating whether the file contains the names of the variables as its first line. If missing, the value is determined from the file format: header is set to TRUE if and only if the first row contains one fewer field than the number of columns.'
                  )
            ],
            orientation='vertical',
            callback=self.scanNewFile)

        self.rowNamesCombo = comboBox(self.headersBox,
                                      label=_('Select Row Names'),
                                      orientation='vertical',
                                      callback=self.scanFile)
        #self.rowNamesCombo.setMaximumWidth(250)

        self.otherOptionsBox = groupBox(options,
                                        label=_("Other Options"),
                                        addSpace=True,
                                        orientation='vertical')
        # box.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        split = widgetBox(self.otherOptionsBox, orientation='horizontal')
        # split.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

        self.otherOptions = checkBox(
            split,
            label=_('Options'),
            displayLabel=False,
            buttons=[
                'fill', 'strip.white', 'blank.lines.skip', 'allowEscapes',
                'StringsAsFactors'
            ],
            setChecked=['blank.lines.skip'],
            toolTips=[
                _('logical. If TRUE then in case the rows have unequal length, blank fields are implicitly added.'
                  ),
                _('logical. Used only when sep has been specified, and allows the unicodeipping of leading and trailing white space from character fields (numeric fields are always unicodeipped). '
                  ),
                _('logical: if TRUE blank lines in the input are ignored.'),
                _('logical. Should C-style escapes such as \n be processed or read verbatim (the default)? '
                  ),
                _('logical: should character vectors be converted to factors?')
            ],
            orientation='vertical',
            callback=self.scanFile)
        # box.layout().addWidget(self.otherOptions,1,1)
        box2 = widgetBox(split, orientation='vertical')
        #box2.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed)
        split.layout().setAlignment(box2, Qt.AlignTop)
        self.quote = lineEdit(box2,
                              text='"',
                              label=_('Quote:'),
                              width=50,
                              orientation='horizontal')
        self.decimal = lineEdit(
            box2,
            text='.',
            label=_('Decimal:'),
            width=50,
            orientation='horizontal',
            toolTip=_(
                'Decimal sign, some countries may want to use the \'.\''))

        self.numLinesScan = lineEdit(
            box2,
            text='10',
            label=_('# Lines to Preview:'),
            toolTip=
            _('The maximum number of rows to read in while previewing the file. Negative values are ignored.'
              ),
            width=50,
            orientation='horizontal')
        self.numLinesReads = lineEdit(
            box2,
            text='-1',
            label=_('# Lines to Read:'),
            toolTip=
            _('Number of lines to read from file. Read whole file if 0 or negative values.'
              ),
            width=50,
            orientation='horizontal')

        self.numLinesSkip = lineEdit(
            box2,
            text='0',
            label=_('# Lines to Skip:'),
            toolTip=
            _("The number of lines of the data file to skip before beginning to read data."
              ),
            width=50,
            orientation='horizontal')

        holder = widgetBox(options, orientation='horizontal')
        clipboard = button(
            holder,
            label=_('Load Clipboard'),
            toolTip=
            _('Load the file from the clipboard, you can do this if\ndata has been put in the clipboard using the copy command.'
              ),
            callback=self.loadClipboard)
        rescan = button(holder,
                        label=_('Rescan File'),
                        toolTip=_("Preview a small portion of the file"),
                        callback=self.scanNewFile)
        load = button(holder,
                      label=_('Load File'),
                      toolTip=_("Load the file into Red-R"),
                      callback=self.loadFile)
        holder.layout().setAlignment(Qt.AlignRight)

        self.FileInfoBox = groupBox(options,
                                    label=_("File Info"),
                                    addSpace=True)
        self.infob = widgetLabel(self.FileInfoBox, label='')
        self.infob.setWordWrap(True)
        self.infoc = widgetLabel(self.FileInfoBox, label='')
        self.FileInfoBox.setHidden(True)

        self.tableArea = widgetBox(area)
        self.tableArea.setMinimumWidth(500)
        #self.tableArea.setHidden(True)
        self.tableArea.setSizePolicy(QSizePolicy.MinimumExpanding,
                                     QSizePolicy.MinimumExpanding)

        self.scanarea = textEdit(self.tableArea,
                                 label=_('File Preview'),
                                 includeInReports=False)
        self.scanarea.setLineWrapMode(QTextEdit.NoWrap)
        self.scanarea.setReadOnly(True)
        self.scroll = scrollArea(self.tableArea)

        self.columnTypes = widgetBox(self,
                                     orientation=QGridLayout(),
                                     margin=10)
        self.scroll.setWidget(self.columnTypes)
        #self.columnTypes.layout().setSizeConstraint(QLayout.SetMinAndMaxSize)
        self.columnTypes.setMinimumWidth(460)
        self.columnTypes.layout().setSizeConstraint(QLayout.SetMinimumSize)
        self.columnTypes.setSizePolicy(
            QSizePolicy(QSizePolicy.MinimumExpanding,
                        QSizePolicy.MinimumExpanding))
        self.columnTypes.layout().setAlignment(Qt.AlignTop | Qt.AlignLeft)
        #self.setFileList()
        import sys
        if sys.platform == "win32":
            self.require_librarys(['RODBC'])
            self.setForExcel()
示例#24
0
    def __init__(self, parent=None, signalManager=None):
        #OWWidget.__init__(self, parent, signalManager, "Sample Data")
        OWRpy.__init__(self, wantGUIDialog=1)

        self.command = ''
        self.sendthis = ''
        self.sendt = {}
        self.dfselected = None
        self.setRvariableNames(['rExecutor', 'rExecutor_cm'])

        self.inputs.addInput('id0', _('R.object'), redRRVariable, self.process)

        self.outputs.addOutput('id0', _('R Data Frame'), redRRDataFrame)
        self.outputs.addOutput('id1', _('R List'), redRRList)
        self.outputs.addOutput('id2', _('R Vector'), redRRVector)
        self.outputs.addOutput('id3', _('R.object'), 'All')
        self.outputs.addOutput('id4', _('R Matrix'), redRRMatrix)

        #self.breakme()

        #self.help.setHtml('The R Executor widget provides direct access to the R session that runs under RedR.  R Executor can recieve any output from an R compatible widget.  The recieved data can be shown using the Recieved button.  The R history can be shown by pressing the RHistory button and the complete parsing of any recieved data is shown in the Metadata section.  More infromation is available on the <a href="http://www.red-r.org/?cat=10">RedR website</a>.')

        #GUI

        #GUIDialog
        self.box = groupBox(self.GUIDialog, _("R Executor Advanced"))
        self.infob = widgetLabel(self.box, "")

        self.infoa = widgetLabel(self.box, "")
        # grid
        area = widgetBox(self.controlArea, orientation='horizontal')
        area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        leftArea = widgetBox(self.box)
        leftArea.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Expanding)
        rightArea = widgetBox(area)

        runbox = groupBox(rightArea,
                          label=_("Command Edit:"),
                          orientation='horizontal')
        runbox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)
        #self.command = lineEdit(runbox, "", orientation=QHBoxLayout(), callback = self.runR, width = -1)
        self.command = textEdit(runbox, label=_('Command Edit:'))
        #self.command.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        processbutton = button(runbox,
                               label=_("&Run"),
                               callback=self.runR,
                               width=100)
        statusBox = groupBox(rightArea, label=_("Status"))
        self.sendStatus = widgetLabel(statusBox, _('Nothing Sent'))
        self.dataBox = groupBox(leftArea, label=_("Input Infromation"))
        self.mystatus = widgetLabel(self.dataBox, _("No Input"))

        # self.metadataBox = widgetBox(leftArea, _("Metadata"))
        # self.infoM = widgetLabel(self.metadataBox, _("No Meta Data"))
        # self.metadataLB = listBox(self.metadataBox, callback = self.insertMetaDataVar)
        varbutton = button(leftArea,
                           _("Recieved"),
                           callback=self.putrecieved,
                           width=150)
        history = button(leftArea,
                         _("RHistory"),
                         callback=self.putRHistory,
                         width=150)
        button(leftArea, _("Clear Output"), callback=self.clearOutput)

        self.lsList = listBox(self.box,
                              label=_('Available R Items'),
                              items=self.R('ls()', wantType='list'),
                              callback=self.addlsList)
        button(self.box, 'Refresh List', callback=self.refreshLsList)

        self.thistext = textEdit(rightArea,
                                 label=_('Output'),
                                 displayLabel=False)

        sendbutton = button(
            runbox,
            label=_("&Send"),
            toolTip=_(
                'Send the data in the command line into the Red-R schema.'),
            callback=self.sendThis,
            width=100)