Ejemplo n.º 1
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self, wantGUIDialog = 1)

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

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

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

        #self.R(self.Rvariables['table'] + '<- matrix("",nrow=10,ncol=10)', wantType = 'NoConversion')
        self.dataTable = table(box, label = 'Data Table', rows = 10, columns = 10)
        # if self.dataTable.columnCount() < 1:
            # self.dataTable.setColumnCount(1)
            # self.dataTable.setHorizontalHeaderLabels(['Rownames'])
        # if self.dataTable.rowCount() < 1:
            # self.dataTable.setRowCount(1)
        # self.dataTable.setHorizontalHeaderLabels(['Rownames'])
        
        self.connect(self.dataTable, SIGNAL("cellClicked(int, int)"), self.cellClicked) # works OK
        self.connect(self.dataTable, SIGNAL("cellChanged(int, int)"), self.itemChanged)
        self.window = QDialog(self)
        self.window.setLayout(QVBoxLayout())
        self.classTable = table(self.window, label = 'Data Table', rows = self.maxCol, columns = 2)
        self.resize(700,500)
        self.move(300, 25)
Ejemplo n.º 3
0
 def setCustomClasses(self):
     self.classTable = table(self.window, rows = self.maxCol, columns = 2)
     for j in range(1, self.colCount+1):
         cb = QComboBox()
         item = self.dataTable.item(0, j)
         if item == None:
             newitem = QTableWidgetItem(unicode('NA'))
         else:
             newitem = QTableWidgetItem(unicode(item.text()))
         cb.addItems(['Default', 'Factor', 'Numeric', 'Character'])
         self.classTable.setCellWidget(j-1, 1, cb)
         newitem.setToolTip(unicode('Set the data type for column '+unicode(newitem.text())))
         self.classTable.setItem(j-1, 0, newitem)
         
     button(self.window, 'Set Classes', callback = self.setClasses)
     button(self.window, 'Clear Classes', callback = self.clearClasses)
     self.window.show()
Ejemplo n.º 4
0
 def setCustomClasses(self):
     self.classTable = table(self.window, rows = self.maxCol, columns = 2)
     for j in range(1, self.colCount+1):
         cb = QComboBox()
         item = self.dataTable.item(0, j)
         if item == None:
             newitem = QTableWidgetItem(unicode('NA'))
         else:
             newitem = QTableWidgetItem(unicode(item.text()))
         cb.addItems(['Default', 'Factor', 'Numeric', 'Character'])
         self.classTable.setCellWidget(j-1, 1, cb)
         newitem.setToolTip(unicode('Set the data type for column '+unicode(newitem.text())))
         self.classTable.setItem(j-1, 0, newitem)
         
     button(self.window, 'Set Classes', callback = self.setClasses)
     button(self.window, 'Clear Classes', callback = self.clearClasses)
     self.window.show()