Esempio n. 1
0
## redRGUI Graphics View.  A graphics view used for graphing R graphs, this should be as general as possible with an eye to some degree of automation in assignment of items.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from redRGUI import widgetState
import redRi18n
_ = redRi18n.get_(package='base')


class graphicsScene(QGraphicsView, widgetState):
    def __init__(self, parent, image=None):
        ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget.
        QGraphicsView.__init__(self, QGraphicsScene(), parent)
        parent.layout().addWidget(
            self)  # place the widget into the parent widget

        if image:
            ## there is an image and we should set that into the graphics scene
            if self.scene:
                self.scene.addItem(QGraphicsPixmapItem(QPixmap(image)))
            else:
                print _('Error, no scene initialized')
                raise Exception

    def clear(self):
        self.scene.clear()

    def addImage(self, image):
        ## add an image to the view
        self.scene.addItem(QGraphicsPixmapItem(QPixmap(image)))
Esempio n. 2
0
"""Line Edit

Allows user to enter text into a single line.  Really the only functions that should be called are text().
"""

from redRGUI import widgetState
from libraries.base.qtWidgets.widgetBox import widgetBox
from libraries.base.qtWidgets.widgetLabel import widgetLabel
import redREnviron
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import redRi18n
_ = redRi18n.get_(package = 'base')

class lineEdit(QLineEdit,widgetState):
    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)
Esempio n. 3
0
    <author>
        <authorname>Red-R Core Development Team</authorname>
        <authorcontact>www.red-r.org</authorcontact>
    </author>
</widgetXML>
"""

"""
<name>String Split</name>
"""
from OWRpy import *
import redRGUI, signals
import redRGUI
import redRi18n

_ = redRi18n.get_(package="base")


class RedRstrsplit(OWRpy):
    settingsList = []

    def __init__(self, **kwargs):
        OWRpy.__init__(self, **kwargs)
        self.setRvariableNames(["strsplit", "dataframe"])
        self.data = {}
        self.RFunctionParam_x = ""

        """.. rrsignals::"""
        self.inputs.addInput("id0", _("Input Data"), [signals.base.RVector, signals.base.RList], self.processx)

        """.. rrsignals::"""
Esempio n. 4
0
"""
<name>Heatmap</name>
<tags>Plotting</tags>
<icon>heatmap.png</icon>
"""

from OWRpy import *
import redRGUI, signals
import libraries.base.signalClasses.RModelFit as rmf
import redRi18n
_ = redRi18n.get_(package = 'plotting')
class Heatmap(OWRpy):
    globalSettingsList = ['commit']
    def __init__(self, **kwargs):
        OWRpy.__init__(self, **kwargs)
        self.require_librarys(["fBasics", "gplots"])
        self.setRvariableNames(['heatsubset', 'hclust', 'heatvect', 'heatmapList'])
        self.plotOnConnect = 0
        self.plotdata = ''
        self.rowvChoice = None
        self.colvChoice = None
        #self.listOfColors = ['"red"', '"white"', '"blue"']  depricated with heatmap.2 limited to a list of color options.
        
        self.inputs.addInput('id0', 'Expression Matrix', signals.base.RDataFrame, self.processMatrix)
        self.inputs.addInput('id1', 'Classes Data', signals.base.RVector, self.processClasses)

        #self.outputs.addOutput('id0', 'Cluster Subset List', signals.base.RVector)
        self.outputs.addOutput('id1', 'Cluster Classes', signals.base.RVector)
        self.outputs.addOutput('heatmapList', _('Heatmap Parameters (List)'), signals.base.RList)

        #GUI