Example #1
0
 def __init__(self, widget, label=None, displayLabel=True, value=None, orientation='horizontal', decimals=0, max = None, min = None, callback=None, *args, **kwargs):
     kwargs.setdefault('includeInReports', True)
     kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
     self.widget = widget
     
     widgetState.__init__(self,widget,label,**kwargs)
     QDoubleSpinBox.__init__(self)
     self.setDecimals(decimals)
     self.label = label
     if displayLabel:
         self.hb = widgetBox(self.controlArea,orientation=orientation)
         
         widgetLabel(self.hb, label,sizePolicy=QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Minimum))
         
         self.hb.layout().addWidget(self)
     else:
         self.controlArea.layout().addWidget(self)
     
     if max:
         self.setMaximum(int(max))
     if min:
         self.setMinimum(int(min))
     self.setWrapping(True) # we always allow the spin box to wrap around
     if value:
         self.setValue(value)
     if callback:
         QObject.connect(self, SIGNAL('valueChanged(double)'), callback)
    def __init__(self, widget, label = _('Formula Entry'), displayLabel=True, **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
Example #3
0
    def loadCustomSettings(self, settings):
        # import pprint
        # pp = pprint.PrettyPrinter(indent=4)
        # pp.pprint(settings)
        # print settings['colClasses']['pythonObject']
        # self.colClasses = settings['colClasses']['pythonObject']
        # self.colNames = settings['colNames']['pythonObject']
        # self.myColClasses = settings['myColClasses']['list']
        if not self.filecombo.getCurrentFile():
            widgetLabel(
                self.browseBox,
                label=
                _('The loaded file is not found on your computer.\nBut the data saved in the Red-R session is still available.'
                  ))
        # print '#############################', self.colClasses
        # print '#############################', self.colNames
        # print '#############################', self.myColClasses #, settings['myColClasses']['list']
        for i in range(len(self.colClasses)):
            s = radioButtons(self.columnTypes,
                             label=self.colNames[i],
                             displayLabel=False,
                             buttons=[
                                 'factor', 'numeric', 'character', 'integer',
                                 'logical'
                             ],
                             orientation='horizontal',
                             callback=self.updateColClasses)

            s.setChecked(self.myColClasses[i])
            if not self.filecombo.getCurrentFile():
                s.setEnabled(False)
            q = widgetLabel(self.columnTypes, label=self.colNames[i])
            self.columnTypes.layout().addWidget(s.controlArea, i, 1)
            self.columnTypes.layout().addWidget(q.controlArea, i, 0)
Example #4
0
 def __init__(self, widget, label=None, displayLabel=True, includeInReports=True, value=None, 
 orientation='horizontal', decimals=0, max = None, min = None, callback=None, toolTip = None, *args):
     
     self.widget = widget
     
     widgetState.__init__(self,widget,label,includeInReports)
     QDoubleSpinBox.__init__(self)
     self.setDecimals(decimals)
     self.label = label
     if displayLabel:
         self.hb = widgetBox(self.controlArea,orientation=orientation)
         widgetLabel(self.hb, label)
         self.hb.layout().addWidget(self)
     else:
         self.controlArea.layout().addWidget(self)
     
     if max:
         self.setMaximum(int(max))
     if min:
         self.setMinimum(int(min))
     if toolTip:
         self.setToolTip(unicode(toolTip))
     self.setWrapping(True) # we always allow the spin box to wrap around
     if value:
         self.setValue(value)
     if callback:
         QObject.connect(self, SIGNAL('valueChanged(double)'), callback)
Example #5
0
    def __init__(self,
                 widget,
                 label=None,
                 displayLabel=True,
                 includeInReports=True,
                 items=None,
                 editable=False,
                 orientation='horizontal',
                 callback=None):

        widgetState.__init__(self, widget, label, includeInReports)
        QComboBox.__init__(self, self.controlArea)

        if displayLabel:
            self.hb = widgetBox(self.controlArea, orientation=orientation)
            widgetLabel(self.hb, label)
            self.hb.layout().addWidget(self)
            self.hasLabel = True
        else:
            self.controlArea.layout().addWidget(self)
            self.hasLabel = False
        self.label = label

        self.items = OrderedDict()
        self.setEditable(editable)

        if items:
            self.addItems(items)

        if callback:
            QObject.connect(self, SIGNAL('activated(int)'), callback)
Example #6
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
Example #7
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 forceInSignals=None,
                 forceOutSignals=None):
        OWRpy.__init__(self)
        print unicode(forceInSignals) + ' and ' + unicode(
            forceOutSignals) + ' appending to dummy'
        if forceInSignals:
            import signals
            for (a, b) in [signal for signal in forceInSignals]:
                print 'Appending ' + unicode(
                    a) + ' in dummy to the ' + unicode(b) + ' signal'
                self.inputs.addInput((a, a, b, None))
        if forceOutSignals:
            import signals
            for (a, b) in [signal for signal in forceOutSignals]:
                print 'Appending ' + unicode(
                    a) + ' in dummy using the ' + unicode(b) + ' signal'
                self.outputs.addOutput((a, a, b))
        print self.inputs
        print self.outputs

        box = groupBox(self.controlArea, label=_("Info"))
        self.infoa = widgetLabel(
            box, _("A widget failed to load this was put in it's place."))
        self.infob = widgetLabel(
            box,
            _("The variables that were saved with this widget are %s .\n You can use R Executor to retrieve these variables and incorporate them into your schema."
              ) % str(self.linksOut))
Example #8
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.outputs.addOutput('id0', _('R Session'), redRREnvironment)

        # print os.path.abspath('/')
        self.path = os.path.abspath('/')
        self.setRvariableNames(['sessionEnviron'])

        gbox = groupBox(self.controlArea,
                        orientation='vertical',
                        label=_('Select R session'))

        box = widgetBox(gbox, orientation='horizontal')
        self.filecombo = fileNamesComboBox(box,
                                           label=_('Session File'),
                                           displayLabel=False,
                                           orientation='vertical')
        self.filecombo.setSizePolicy(QSizePolicy.MinimumExpanding,
                                     QSizePolicy.Maximum)

        button(box, label=_('Browse'), callback=self.browseFile)
        self.commit = commitButton(gbox,
                                   label=_('Load Session'),
                                   callback=self.loadSession,
                                   alignment=Qt.AlignRight)
        #gbox.layout().setAlignment(self.commit,Qt.AlignRight)

        self.infoa = widgetLabel(self.controlArea, '')
        self.varBox = listBox(self.controlArea, label=_('Variables'))
        self.varBox.hide()
        self.infob = widgetLabel(self.controlArea, '')
Example #9
0
    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)
Example #10
0
 def __init__(self, widget, label = None, displayLabel = True, startColor = '#000000', callback = None, width = 15, height = 15,**kwargs):
     """Constructor, typically called with label, startColor, callback, and toolTip
     
     """
     kwargs.setdefault('includeInReports', True)
     kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
     widgetState.__init__(self,widget, label, **kwargs)
     
     QToolButton.__init__(self, self.controlArea)
     
     
     if label and displayLabel:
         self.hb = redRWidgetBox(self.controlArea,orientation='horizontal')
         lb = widgetLabel(self.hb, label)
         self.hb.layout().addWidget(self)
         self.hasLabel = True
         self.hb.layout().setAlignment(lb,Qt.AlignRight)
         lb.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
     else:
         self.controlArea.layout().addWidget(self)
         self.hasLabel = False
         
     self.label = label
     self.w = width
     self.h = height
     self.setMinimumSize(width, height)
     self.callback = callback
     self.color = startColor
     self.setMaximumSize(self.w + 5, self.h + 5)
     self.connect(self, SIGNAL("clicked()"), self.showColorDialog)
     self.updateColor()
Example #11
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        #self.selection = 0
        self.setRvariableNames(['listelement'])
        self.data = None

        self.inputs.addInput('id0', _('R List'),
                             [redRRList, redRRArbitraryList], self.process)

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

        #GUI
        #box = groupBox(self.controlArea, "List Data")

        self.names = listBox(self.controlArea,
                             label=_("List of Data"),
                             displayLabel=True,
                             callback=self.selectionChanged)
        self.infoa = widgetLabel(self.controlArea, '')

        self.commit = redRCommitButton(self.bottomAreaRight,
                                       _("Commit"),
                                       callback=self.sendSelection,
                                       processOnChange=True,
                                       processOnInput=True)
Example #12
0
    def __init__(self,widget,label=None, displayLabel=True, 
    items=None, editable=False, orientation='horizontal',callback = None,**kwargs):
        kwargs.setdefault('includeInReports', True)
        kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        widgetState.__init__(self,widget,label,**kwargs)
        QComboBox.__init__(self,self.controlArea)
        
        if displayLabel:
            self.hb = widgetBox(self.controlArea,orientation=orientation)
            lb = widgetLabel(self.hb, label)
            self.hb.layout().addWidget(self)
            self.hasLabel = True
            self.hb.layout().setAlignment(lb,Qt.AlignRight)
            lb.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        else:
            self.controlArea.layout().addWidget(self)
            self.hasLabel = False
        self.label = label
        
        self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
        
        self.items = OrderedDict()
        self.setEditable(editable)

        if items:
            self.addItems(items)

        if callback:
            QObject.connect(self, SIGNAL('activated(int)'), callback)
Example #13
0
    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')])
Example #14
0
 def __init__(self,widget,label=None, displayLabel=True,includeInReports=True, 
 url=None,orientation='vertical', followHere = False):
     widgetState.__init__(self,widget,label,includeInReports)
     QtWebKit.QWebView.__init__(self,self.controlArea)
     
     if displayLabel:
         hb = widgetBox(self.controlArea,orientation=orientation)
         widgetLabel(hb, label)
         hb.layout().addWidget(self)
     else:
         self.controlArea.layout().addWidget(self)
 
     self.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
     if not followHere:
         self.connect(self, SIGNAL('linkClicked(QUrl)'), self.followLink)
     if url:
         try:
             self.load(QUrl(url))
         except: pass 
Example #15
0
    def __init__(self, widget, label = None, displayLabel=False, sortable=True,
    orientation='vertical', callback = None, **kwargs):
        kwargs.setdefault('includeInReports', True)
        kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        widgetState.__init__(self,widget,label,**kwargs)

        QTreeWidget.__init__(self, self.controlArea)
        self.setSortingEnabled(sortable)
        if displayLabel:
            self.hb = widgetBox(self.controlArea,orientation=orientation)
            widgetLabel(self.hb, label)
            if width != -1:
                sb = widgetBox(self.hb)
                sb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.hb.layout().addWidget(self)
        else:
            self.controlArea.layout().addWidget(self)
        if callback:
            QObject.connect(self, SIGNAL('currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)'), callback)
Example #16
0
    def __init__(self, widget, label = None, displayLabel=False, includeInReports=True, 
    orientation='vertical', toolTip = None, callback = None):
        
        widgetState.__init__(self,widget,label,includeInReports)

        QTreeWidget.__init__(self, self.controlArea)
        
        if displayLabel:
            self.hb = widgetBox(self.controlArea,orientation=orientation)
            widgetLabel(self.hb, label)
            if width != -1:
                sb = widgetBox(self.hb)
                sb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.hb.layout().addWidget(self)
        else:
            self.controlArea.layout().addWidget(self)

        if toolTip: self.setToolTip(toolTip)
        if callback:
            QObject.connect(self, SIGNAL('currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)'), callback)
Example #17
0
 def __init__(self, parent, label):
     box = widgetBox(parent,orientation='horizontal')       
     a = widgetLabel(box,label=label)
     QToolButton.__init__(self, box)
     box.layout().addWidget(self)
     # if not color:
     self.color = '#000000'
     # else:
         # self.color = color
         
     self.setMaximumSize(20,20)
     self.connect(self, SIGNAL("clicked()"), self.showColorDialog)
Example #18
0
 def __init__(self, parent, label):
     box = widgetBox(parent,orientation='horizontal')       
     a = widgetLabel(box,label=label)
     QToolButton.__init__(self, box)
     box.layout().addWidget(self)
     # if not color:
     self.color = '#000000'
     # else:
         # self.color = color
         
     self.setMaximumSize(20,20)
     self.connect(self, SIGNAL("clicked()"), self.showColorDialog)
Example #19
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'))
Example #20
0
 def __init__(self,widget,label=None, displayLabel=True, url=None,orientation='vertical', followHere = False, **kwargs):
     kwargs.setdefault('includeInReports', True)
     kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
     widgetState.__init__(self,widget,label, **kwargs)
     QtWebKit.QWebView.__init__(self,self.controlArea)
     # factory = QtWebKit.QWebPluginFactory()
     # self.page().setPluginFactory(factory)
     self.controlArea.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding))
     self.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding))
     if displayLabel:
         hb = widgetBox(self.controlArea,orientation=orientation)
         widgetLabel(hb, label)
         hb.layout().addWidget(self)
     else:
         self.controlArea.layout().addWidget(self)
 
     self.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
     if not followHere:
         self.connect(self, SIGNAL('linkClicked(QUrl)'), self.followLink)
     if url:
         try:
             self.load(QUrl(url))
         except: pass 
Example #21
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)
Example #22
0
    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)
Example #23
0
    def __init__(self,widget,text='', label=None, displayLabel=True, includeInReports=True,
    id=None, orientation='horizontal', toolTip = None,  width = 0, callback = None, textChangedCallBack=None,
    sp='shrinking', **args):

        widgetState.__init__(self,widget,label,includeInReports)
        QLineEdit.__init__(self,widget)
        
        if displayLabel:
            self.hb = widgetBox(self.controlArea,orientation=orientation, spacing=2)
            if sp == 'shrinking':
                self.hb.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
            lb = widgetLabel(self.hb, label)
            if width != -1:
                sb = widgetBox(self.hb)
                sb.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
            self.hb.layout().addWidget(self)
            self.hb.layout().setAlignment(lb,Qt.AlignRight)
        else:
            self.controlArea.layout().addWidget(self)
        
        if toolTip and displayLabel: 
            self.hb.setToolTip(toolTip)
        elif toolTip:
            self.setToolTip(toolTip)
            
        if width == 0:
            self.setMaximumWidth(175)
            self.setMinimumWidth(175)
        elif width == -1:
            pass
        else:
            self.setMaximumWidth(width)
            self.setMinimumWidth(width)
        self.setText(text)
        self.id = id
        self.label = label
        # self.setText('asdf')
        if callback:
            QObject.connect(self, SIGNAL('returnPressed()'), callback)
        
        if textChangedCallBack:
            QObject.connect(self, SIGNAL('textEdited(QString)'), textChangedCallBack)
Example #24
0
    def __init__(self,widget,text='', label=None, displayLabel=True, id=None, orientation='horizontal', width = 0, callback = None, textChangedCallBack=None, sp='shrinking', **kwargs):
        kwargs.setdefault('includeInReports', True)
        kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        widgetState.__init__(self,widget,label,**kwargs)
        QLineEdit.__init__(self,widget)
        
        if displayLabel:
            self.hb = widgetBox(self.controlArea,orientation=orientation, spacing=2)
            if sp == 'shrinking':
                self.hb.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
            lb = widgetLabel(self.hb, label)
            if width != -1:
                sb = widgetBox(self.hb)
                sb.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred)
            self.hb.layout().addWidget(self)
            self.hb.layout().setAlignment(lb,Qt.AlignRight)
        else:
            self.controlArea.layout().addWidget(self)

        if width == 0:
            self.setMaximumWidth(175)
            self.setMinimumWidth(175)
        elif width == -1:
            pass
        else:
            self.setMaximumWidth(width)
            self.setMinimumWidth(width)
        self.setText(text)
        self.id = id
        self.label = label
        # self.setText('asdf')
        if callback:
            QObject.connect(self, SIGNAL('returnPressed()'), callback)
        
        if textChangedCallBack:
            QObject.connect(self, SIGNAL('textEdited(QString)'), textChangedCallBack)
Example #25
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()
Example #26
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)  #initialize the widget
        self.dataClass = None
        self.dataParent = None
        self.setRvariableNames(['rowcolSelector', 'rowcolSelectorNot'])
        self.SubsetByAttached = 0

        self.inputs.addInput('id0', _('Data Table'), redRRDataFrame,
                             self.setWidget)
        self.inputs.addInput('id1', _('Subsetting Vector'), redRRList,
                             self.setSubsettingVector)

        self.outputs.addOutput('id0', _('Selected Items'), redRRDataFrame)
        self.outputs.addOutput('id1', _('Non-selected Items'), redRRDataFrame)

        #set the gui

        area = widgetBox(self.controlArea, orientation='horizontal')
        options = widgetBox(area, orientation='vertical')

        self.rowcolBox = radioButtons(options,
                                      label=_('Select On'),
                                      buttons=[_('Column'),
                                               _('Row')],
                                      setChecked=_('Column'),
                                      callback=self.rowcolButtonSelected,
                                      orientation='horizontal')

        self.sendSection = checkBox(options,
                                    label=_('Create subset from:'),
                                    displayLabel=True,
                                    buttons=[_('Selected'),
                                             _('Not Selected')],
                                    setChecked=[_('Selected')],
                                    orientation='horizontal')

        # toolTips = [_("Select True to send data from the Data slot where the selections that you made are True."),
        # _("Select False to send data from the Not Data slot that are not the selections you made.")])

        self.invertButton = button(options,
                                   _("Invert Selection"),
                                   callback=self.invertSelection)

        separator(options, height=15)

        self.subsetBox = groupBox(options, label=_('Subset by'))
        self.subsetColumn = comboBox(self.subsetBox,
                                     label=_("Column:"),
                                     orientation='vertical',
                                     items=[_('Select')])
        self.subOnAttachedButton = button(self.subsetBox,
                                          _("Subset by column"),
                                          callback=self.subOnAttached)
        self.subsetBox.setDisabled(True)

        separator(options, height=20)

        info = widgetBox(options)
        options.layout().setAlignment(info, Qt.AlignBottom)
        self.infoBox = widgetLabel(info)
        separator(info, height=15)
        self.selectionInfoBox = widgetLabel(info)
        mainArea = widgetBox(area, orientation='vertical')
        self.attributes = listBox(mainArea,
                                  label=_('Select'),
                                  callback=self.onSelect)
        self.attributes.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.subsetButton = commitButton(mainArea,
                                         _("Subset on Selection"),
                                         callback=self.subset,
                                         processOnChange=True,
                                         processOnInput=True,
                                         alignment=Qt.AlignRight)
Example #27
0
    def __init__(self,widget,label=None, displayLabel=True, Rdata=None, 
    editable=False, sortable=True, filterable=False,
    selectionBehavior=QAbstractItemView.SelectRows, 
    selectionMode = QAbstractItemView.ExtendedSelection, 
    showResizeButtons = True,
    onFilterCallback = None,
    callback=None,
    selectionCallback=None,**kwargs):
        kwargs.setdefault('includeInReports', True)
        kwargs.setdefault('sizePolicy', QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        widgetState.__init__(self,widget,label,**kwargs)
        
        if displayLabel:
            mainBox = groupBox(self.controlArea,label=label, orientation='vertical')
        else:
            mainBox = widgetBox(self.controlArea,orientation='vertical')
        self.label = label
        
        QTableView.__init__(self,self.controlArea)
        mainBox.layout().addWidget(self)
        box = widgetBox(mainBox,orientation='horizontal')
        leftBox = widgetBox(box,orientation='horizontal')
        if filterable:
            self.clearButton = button(leftBox,label=_('Clear All Filtering'), callback=self.clearFiltering)
        self.dataInfo = widgetLabel(leftBox,label='',wordWrap=False) 
        box.layout().setAlignment(leftBox, Qt.AlignLeft)

        
        if showResizeButtons:
            resizeColsBox = widgetBox(box, orientation="horizontal")
            resizeColsBox.layout().setAlignment(Qt.AlignRight)
            box.layout().setAlignment(resizeColsBox, Qt.AlignRight)
            widgetLabel(resizeColsBox, label = _("Resize columns: "))
            button(resizeColsBox, label = "+", callback=self.increaseColWidth, 
            toolTip = _("Increase the width of the columns"), width=30)
            button(resizeColsBox, label = "-", callback=self.decreaseColWidth, 
            toolTip = _("Decrease the width of the columns"), width=30)
            button(resizeColsBox, label = _("Resize To Content"), callback=self.resizeColumnsToContents, 
            toolTip = _("Set width based on content size"))

        
        self.R = Rcommand
        self.Rdata = None
        self.filteredData = None
        self.sortIndex = None
        self.criteriaList = {}
        self.parent = widget
        self.tm=None
        self.sortable=sortable
        self.editable=editable
        self.filterable=filterable
        self.onFilterCallback = onFilterCallback
        self.selectionCallback = selectionCallback
        # self.selections = QItemSelection()
        self.working = False

        self.setHorizontalHeader(myHeaderView(self))
        self.setSelectionBehavior(selectionBehavior)
        self.setAlternatingRowColors(True)
        
        # self.horizontalHeader().setMovable(True)
        
        if selectionMode != -1:
            self.setSelectionMode(selectionMode)
    
        if Rdata:
            self.setRTable(Rdata)

        if editable:
            self.horizontalHeader().hide()
            self.verticalHeader().hide()
            
        if sortable:
            self.horizontalHeader().setSortIndicatorShown(True)
            self.horizontalHeader().setSortIndicator(-1,0)
        if filterable or sortable:
            self.horizontalHeader().setClickable(True)
            self.horizontalHeader().setContextMenuPolicy(Qt.CustomContextMenu)
            self.horizontalHeader().customContextMenuRequested.connect(self.headerClicked)

            
        if callback:
            QObject.connect(self, SIGNAL('clicked (QModelIndex)'), callback)
Example #28
0
    def createMenu(self, selectedCol):
        #print selectedCol, pos
        # print _('in createMenu'), self.criteriaList

        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'))
            # qmenu = QMenu(self.menu)
            # self.menu.layout().addWidget(qmenu)
            # a = QAction('A->Z',self.menu)
            # qmenu.addAction(a)
            # self.menu.addAction(a)

        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)

        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()
Example #29
0
    def __init__(self,
                 widget,
                 label=None,
                 displayLabel=True,
                 includeInReports=True,
                 Rdata=None,
                 editable=False,
                 sortable=True,
                 filterable=False,
                 selectionBehavior=QAbstractItemView.SelectRows,
                 selectionMode=QAbstractItemView.ExtendedSelection,
                 showResizeButtons=True,
                 onFilterCallback=None,
                 callback=None,
                 selectionCallback=None):

        widgetState.__init__(self, widget, label, includeInReports)

        if displayLabel:
            mainBox = groupBox(self.controlArea,
                               label=label,
                               orientation='vertical')
        else:
            mainBox = widgetBox(self.controlArea, orientation='vertical')
        self.label = label

        QTableView.__init__(self, self.controlArea)
        mainBox.layout().addWidget(self)
        box = widgetBox(mainBox, orientation='horizontal')
        leftBox = widgetBox(box, orientation='horizontal')
        if filterable:
            self.clearButton = button(leftBox,
                                      label=_('Clear All Filtering'),
                                      callback=self.clearFiltering)
        self.dataInfo = widgetLabel(leftBox, label='', wordWrap=False)
        box.layout().setAlignment(leftBox, Qt.AlignLeft)

        if showResizeButtons:
            resizeColsBox = widgetBox(box, orientation="horizontal")
            resizeColsBox.layout().setAlignment(Qt.AlignRight)
            box.layout().setAlignment(resizeColsBox, Qt.AlignRight)
            widgetLabel(resizeColsBox, label=_("Resize columns: "))
            button(resizeColsBox,
                   label="+",
                   callback=self.increaseColWidth,
                   toolTip=_("Increase the width of the columns"),
                   width=30)
            button(resizeColsBox,
                   label="-",
                   callback=self.decreaseColWidth,
                   toolTip=_("Decrease the width of the columns"),
                   width=30)
            button(resizeColsBox,
                   label=_("Resize To Content"),
                   callback=self.resizeColumnsToContents,
                   toolTip=_("Set width based on content size"))

        self.R = Rcommand
        self.Rdata = None
        self.filteredData = None
        self.sortIndex = None
        self.criteriaList = {}
        self.parent = widget
        self.tm = None
        self.sortable = sortable
        self.editable = editable
        self.filterable = filterable
        self.onFilterCallback = onFilterCallback
        self.selectionCallback = selectionCallback
        self.selections = QItemSelection()
        self.working = False

        self.setHorizontalHeader(myHeaderView(self))
        self.setSelectionBehavior(selectionBehavior)
        self.setAlternatingRowColors(True)

        if selectionMode != -1:
            self.setSelectionMode(selectionMode)

        if Rdata:
            self.setRTable(Rdata)

        if editable:
            self.horizontalHeader().hide()
            self.verticalHeader().hide()

        # if sortable:
        # self.horizontalHeader().setSortIndicatorShown(True)
        # self.horizontalHeader().setSortIndicator(-1,0)
        if filterable or sortable:
            self.horizontalHeader().setClickable(True)
            # QObject.connect(self.horizontalHeader(), SIGNAL('sectionClicked (int)'), self.selectColumn)
            self.horizontalHeader().setContextMenuPolicy(Qt.CustomContextMenu)
            self.horizontalHeader().customContextMenuRequested.connect(
                self.headerClicked)

        if callback:
            QObject.connect(self, SIGNAL('clicked (QModelIndex)'), callback)
Example #30
0
 def setSettings(self,settings, globalSettings = False):
     redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, 'Loading settings')
     #settings = self.sqlite.setObject(settingsID)
     # import pprint
     # pp = pprint.PrettyPrinter(indent=4)
     # pp.pprint(settings)
     for k,v in settings.iteritems():
         try:
             #redRLog.log(redRLog.REDRCORE, redRLog.ERROR, 'Loading %s' % k)
             if k in ['inputs', 'outputs']: continue
             if v == None:
                 continue
             elif 'pythonObject' in v.keys():
                 #print '|#| Setting pythonObject %s to %s' % (k,unicode(v['pythonObject']))
                 self.__setattr__(k, v['pythonObject'])
             elif 'signalsObject' in v.keys():
                 #print '|#| Setting signalsObject'
                 varClass = self.setSignalClass(v['signalsObject'])
                 self.__setattr__(k, varClass)
             elif 'sentItemsList' in v.keys():
                 #print '|#| settingItemsList'
                 # print v['sentItemsList']
                 #self.setSentItemsList(v['sentItemsList'])        
                 for (sentItemName, sentItemDict) in v['sentItemsList']:
                     #print '|#| setting sent items %s to %s' % (sentItemName, unicode(sentItemDict))
                     #for kk,vv in sentItemDict.items():
                     var = self.setSignalClass(sentItemDict)
                     ## add compatibility layer for the case that the sent item name is not longer in existance or has changed
                     if sentItemName in self.outputs.outputIDs():
                         self.send(sentItemName, var)
                     else:
                         signalItemNames = [name for (key, name) in self.outputs.outputNames().items()]
                         if sentItemName in signalItemNames:
                             signalID = self.outputs.getSignalByName(sentItemName)
                             self.send(signalID, var)
                         else:
                             #print 'Error in matching item name'
                             from libraries.base.qtWidgets.dialog import dialog
                             tempDialog = dialog(None)
                             from libraries.base.qtWidgets.widgetLabel import widgetLabel
                             from libraries.base.qtWidgets.listBox import listBox
                             from libraries.base.qtWidgets.button import button
                             widgetLabel(tempDialog, 'Error occured in matching the loaded signal (Name:%s, Value:%s) to the appropriate signal name.\nPlease select the signal that matches the desired output,\n or press cancel to abandon the signal.' % (sentItemName, unicode(var)))
                             
                             #print self.outputs.outputSignals
                             itemListBox = listBox(tempDialog, items = signalItemNames)
                             button(tempDialog, label = 'Done', callback = tempDialog.accept)
                             button(tempDialog, label = 'Cancel', callback = tempDialog.reject)
                             res = tempDialog.exec_()
                             if res != QDialog.rejected:
                                 signalName = unicode(itemListBox.selectedItems()[0].text())
                                 signalID = self.outputs.getSignalByName(signalName)
                                 self.send(signalID, var)
 #############################################
             elif not hasattr(self,k):
                 continue
             elif 'redRGUIObject' in v.keys():
                 #print getattr(self, k)
                 try:
                     getattr(self, k).loadSettings(v['redRGUIObject'])
                     getattr(self, k).setDefaultState(v['redRGUIObject'])
                 except Exception as inst:
                     #print 'Exception occured during loading of settings.  These settings may not be the same as when the widget was closed.'
                     redRLog.log(redRLog.REDRCORE, redRLog.ERROR,redRLog.formatException())
             elif 'dict' in v.keys():
                 var = getattr(self, k)
                 #print 'dict',len(var),len(v['dict'])
                 if len(var) != len(v['dict']): continue
                 self.recursiveSetSetting(var,v['dict'])
             elif 'list' in v.keys():
                 var = getattr(self, k)
                 # print 'list',len(var),len(v['list'])
                 if len(var) != len(v['list']): continue
                 self.recursiveSetSetting(var,v['list'])
         except:
             redRLog.log(redRLog.REDRCORE, redRLog.ERROR, 'Exception occured during loading. The Error will be ignored.')
             redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, redRLog.formatException())
Example #31
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        self.setRvariableNames(['math'])

        self.counter = 1
        self.functionsList = [
            'log2', 'log10', 'add', 'subtract', 'multiply', 'divide', 'match',
            'as.numeric', 'as.character', 'exp', 'logicAND', 'logicOR',
            'toDateTime (MDY)', 'toDateTime (DMY)', 'toDateTime (YMD)'
        ]

        self.inputs.addInput('id0', _('Data Frame'), redRRDataFrame,
                             self.gotData)

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

        #GUI#

        mainArea = widgetBox(self.controlArea, orientation='horizontal')
        leftArea = groupBox(mainArea, label=_('Table View'))
        rightArea = groupBox(mainArea, label=_('Math Box'))

        self.table = redRfilterTable(leftArea,
                                     label=_('Data Table'),
                                     displayLabel=False,
                                     filterable=False,
                                     sortable=False)

        self.functionLineEdit = lineEdit(rightArea,
                                         label=_('Function Search or Run'),
                                         callback=self.functionDone)
        QObject.connect(self.functionLineEdit,
                        SIGNAL('textChanged(const QString&)'),
                        lambda s: self.textChanged(s))

        self.functionListBox = listBox(rightArea,
                                       label=_('List of Functions'),
                                       displayLabel=False,
                                       includeInReports=False,
                                       items=self.functionsList,
                                       callback=self.funcionPressed)

        #self.helpButton = button(rightArea, label = 'Help') #, toolTip = 'Press this then select a function from the list for help.')
        self.dialog = dialog(self)
        self.dialogTopArea = groupBox(self.dialog, label=_('Left Side'))
        self.dialogTopLineEdit = lineEdit(self.dialogTopArea,
                                          label=_('Constant'),
                                          toolTip=_('Must be a number'))
        self.dialogTopListBox = listBox(self.dialogTopArea,
                                        label=_('Columns'),
                                        toolTip=_('Select one of the columns'),
                                        callback=self.dialogTopLineEdit.clear)

        self.dialogLabel = widgetLabel(self.dialog)

        self.dialogBottomArea = groupBox(self.dialog, label=_('Right Side'))
        self.dialogBottomLineEdit = lineEdit(self.dialogBottomArea,
                                             label=_('Constant'),
                                             toolTip=_('Must be a number'))
        self.dialogBottomListBox = listBox(
            self.dialogBottomArea,
            label=_('Columns'),
            toolTip=_('Select one of the columns'),
            callback=self.dialogBottomLineEdit.clear)
        redRCommitButton(self.dialog,
                         label=_('Done'),
                         callback=self.functionCommit)
        self.dialog.hide()
Example #32
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)

        self.setRvariableNames(['heatsubset', 'hclust', 'heatvect'])
        self.plotOnConnect = 0
        self.plotdata = ''
        self.rowvChoice = None
        self.colvChoice = None
        self.listOfColors = ['"red"', '"white"', '"blue"']

        self.inputs.addInput('id0', 'Expression Matrix', redRRDataFrame,
                             self.processMatrix)
        self.inputs.addInput('id1', 'Classes Data', redRRVector,
                             self.processClasses)

        #self.outputs.addOutput('id0', 'Cluster Subset List', redRRVector)
        self.outputs.addOutput('id1', 'Cluster Classes', redRRVector)

        #GUI
        infobox = groupBox(self.controlArea, label="Options")

        self.commit = redRCommitButton(self.bottomAreaRight,
                                       label="Replot",
                                       callback=self.makePlot,
                                       width=200,
                                       processOnInput=True)

        button(infobox, label='Identify', callback=self.identify, width=200)
        self.groupOrHeight = radioButtons(infobox,
                                          label='Identify by:',
                                          buttons=['Groups', 'Height'],
                                          setChecked='Groups',
                                          orientation='horizontal')
        self.groupOrHeightSpin = spinBox(infobox,
                                         label='Identify Value:',
                                         min=1,
                                         value=5)
        self.startSaturation = spinBox(infobox,
                                       label='Starting Saturation:',
                                       min=0,
                                       max=100)
        self.endSaturation = spinBox(infobox,
                                     label='Ending Saturation:',
                                     min=0,
                                     max=100)
        self.endSaturation.setValue(30)
        redRButton(self.controlArea,
                   label='Reset Colors',
                   callback=self.resetColors)
        #self.classesDropdown = comboBox(infobox, label = 'Classes:', toolTip = 'If classes data is connected you may select columns in the data to represent classes of your columns in the plotted data')

        self.rowDendrogram = checkBox(
            infobox,
            label='Dendrogram Options',
            displayLabel=False,
            buttons=['Plot Row Dendrogram', 'Plot Column Dendrogram'],
            setChecked=['Plot Row Dendrogram', 'Plot Column Dendrogram'])

        self.showClasses = checkBox(infobox,
                                    label='Show Classes',
                                    displayLabel=False,
                                    buttons=['Show Classes'])
        self.showClasses.setEnabled(False)
        #OWGUI.checkBox(infobox, self, )
        self.infoa = widgetLabel(infobox, label="Nothing to report")
        self.gview1 = graphicsView(self.controlArea,
                                   label='Heatmap',
                                   displayLabel=False)
        self.gview1.image = 'heatmap1_' + self.widgetID
Example #33
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)
Example #34
0
    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)
Example #35
0
    def updateScan(self):
        if self.rowNamesCombo.count() == 0:
            self.colNames = self.R('colnames(' +
                                   self.Rvariables['dataframe_org'] + ')',
                                   wantType='list')
            self.rowNamesCombo.clear()
            self.rowNamesCombo.addItem('NULL', 'NULL')
            for x in self.colNames:
                self.rowNamesCombo.addItem(x, x)
        self.scanarea.clear()
        # print self.R(self.Rvariables['dataframe_org'])
        # return

        data = self.R('rbind(colnames(' + self.Rvariables['dataframe_org'] +
                      '), as.matrix(' + self.Rvariables['dataframe_org'] +
                      '))',
                      wantType='list')
        rownames = self.R('rownames(' + self.Rvariables['dataframe_org'] + ')',
                          wantType='list')
        #print data
        txt = self.html_table(data, rownames)
        # print 'paste(capture.output(' + self.Rvariables['dataframe_org'] +'),collapse="\n")'
        # try:
        #txt = self.R('paste(capture.output(' + self.Rvariables['dataframe_org'] +'),collapse="\n")',processingNotice=True, showException=False)
        # txt = self.R(self.Rvariables['dataframe_org'],processingNotice=True, showException=False)

        self.scanarea.setText(txt)
        # except:
        # QMessageBox.information(self,'R Error', _("Try selected a different Column Seperator."),
        # QMessageBox.Ok + QMessageBox.Default)
        # return

        try:
            if len(self.colClasses) == 0:
                self.colClasses = self.R('as.vector(sapply(' +
                                         self.Rvariables['dataframe_org'] +
                                         ',class))',
                                         wantType='list')
                self.myColClasses = self.colClasses
                # print '@@@@@@@@@@@@@@@@@@@@@@@@@', self.myColClasses
            if len(self.dataTypes) == 0:
                types = [
                    'factor', 'numeric', 'character', 'integer', 'logical'
                ]
                self.dataTypes = []

                for k, i, v in zip(range(len(self.colNames)), self.colNames,
                                   self.myColClasses):
                    s = radioButtons(self.columnTypes,
                                     label=i,
                                     displayLabel=False,
                                     buttons=types,
                                     orientation='horizontal',
                                     callback=self.updateColClasses)

                    # print k,i,unicode(v)
                    if unicode(v) in types:
                        s.setChecked(unicode(v))
                    else:
                        s.addButton(unicode(v))
                        s.setChecked(unicode(v))
                    label = widgetLabel(None, label=i)
                    self.columnTypes.layout().addWidget(
                        label.controlArea, k, 0)
                    self.columnTypes.layout().addWidget(s.controlArea, k, 1)

                    self.dataTypes.append([i, s])
        except:
            import redRLog
            redRLog.log(redRLog.REDRCORE, redRLog.ERROR,
                        redRLog.formatException())
            self.scanarea.clear()
            self.scanarea.setText(
                _('Problem reading or scanning the file.  Please check the file integrity and try again.'
                  ))
Example #36
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()