Beispiel #1
0
    def __init__(self, parent=None, signalManager=None):
        OWRpy.__init__(self)
        self.setRvariableNames(["aov"])
        self.data = {}
        self.RFunctionParam_data = ''
        self.saveSettingsList.extend(['data', 'RFunctionParam_data'])
        self.inputs.addInput('id0', 'data', redRRDataFrame, self.processdata)

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

        box = tabWidget(self.controlArea)
        self.standardTab = box.createTabPage(name="Standard")
        self.advancedTab = box.createTabPage(name="Advanced")
        self.RFunctionParamcontrasts_lineEdit = lineEdit(self.advancedTab,
                                                         label="contrasts:",
                                                         text='NULL')
        self.RFunctionParamformula_formulaEntry = RFormulaEntry(
            self.standardTab)
        self.RFunctionParamqr_lineEdit = lineEdit(self.advancedTab,
                                                  label="qr:",
                                                  text='TRUE')
        self.RFunctionParamprojections_lineEdit = lineEdit(
            self.advancedTab, label="projections:", text='FALSE')
        redRCommitButton(self.bottomAreaRight,
                         "Commit",
                         callback=self.commitFunction)
        self.RoutputWindow = textEdit(self.controlArea,
                                      label="R Output Window")
    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)
Beispiel #3
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)
Beispiel #4
0
    def __init__(self, parent,label=None, displayLabel=True,includeInReports=True, name = '', data = None):
        ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget.
        widgetState.__init__(self,parent,label,includeInReports)
        
        QGraphicsView.__init__(self, self.controlArea)
        # if displayLabel:
            # self.controlArea = groupBox(parent,label=label, orientation='vertical')
        # else:
            # self.controlArea = widgetBox(parent,orientation='vertical')
        
        #self.controlArea = widgetBox(parent)
        self.topArea = widgetBox(self.controlArea,
        sizePolicy = QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Maximum),includeInReports=False)
        self.middleArea = widgetBox(self.controlArea)
        self.bottomArea = widgetBox(self.controlArea,includeInReports=False)
        
        self.middleArea.layout().addWidget(self)  # place the widget into the parent widget
        scene = QGraphicsScene()
        self.setScene(scene)
        self.parent = parent
        self.data = data
        
        self.widgetSelectionRect = None
        self.mainItem = None
        self.query = ''
        self.function = 'plot'
        self.layers = []
        self.image = 'plot'+unicode(time.time()) # the base file name without an extension
        self.imageFileName = ''
        self.currentScale = 1

    ################################
    ####   Themes              #####
    ################################
        
        
        self.options = {
            'device': {
                'Rcall': 'Cairo',
                'parameters': {
                    'type':{
                            'default':'svg',
                            'qtWidget': 'imageType'
                        }
                    ,'dpi':{
                            'default':'75',
                            'qtWidget': 'dpi'
                        }
                    ,'bg': {
                            'default':'#FFFFFF', 
                            'color': '#FFFFFF',
                            'qtWidget':'bgColor'
                            
                            }
                    ,'height': {
                            'default':400, 
                            'qtWidget': 'dheight'
                            }
                    ,'width': {
                            'default':400, 
                            'qtWidget': 'dwidth'
                            }
                    ,'units': {
                            'default':'px', 
                            'qtWidget': 'units'
                            }
                    }
                }
            ,'main': {
                'Rcall': 'plot',
                'parameters': {
                    'col': {
                        'default':None, 
                        'qtWidget':'colorSeries',
                        'series': '',
                        'seriesLen': 0,
                        'getFunction': self.getColorSeries,
                        'setFunction': self.setColorSeries,
                        }
                    ,'lty': {
                        'default':None, 
                        'qtWidget':'linesListBox',
                        'getFunction': self.getLineTypes,
                        'setFunction': self.setLineTypes,
                        }
                    ,'lwd': {
                        'default':None, 
                        'qtWidget':'lineWidth'
                        }
                    ,'pch': {
                        'default':None, 
                        'qtWidget':'pointListBox',
                        'getFunction': self.getLineTypes,
                        'setFunction': self.setLineTypes,
                        }
                }
            },
            'title': {
                'Rcall': 'title',
                'parameters': {
                    'main': {
                          'default':"Title", 
                          'qtWidget':'mainTitle' 
                          }
                    ,'xlab': {
                        'default':"XLab", 
                        'qtWidget':'xLab'
                        }
                    ,'ylab': {
                        'default':"YLab", 
                        'qtWidget':'yLab'
                        }   
                    ,'col.main': {
                          'default':'#000000', 
                          'qtWidget':'titleColor' 
                          }
                    ,'col.sub': {
                          'default':'#000000', 
                          'qtWidget':'subColor' 
                          }
                    ,'col.lab': {
                          'default':'#000000', 
                          'qtWidget':'labColor' 
                          }                        
                }
            },
            'par': {
                'Rcall':'par',
                'parameters': {
                    'cex.axis': {
                          'default':1, 
                          'qtWidget':'axisFont' 
                          }
                    ,'cex.lab': {
                          'default':1, 
                          'qtWidget':'labFont' 
                          }
                    ,'cex': {
                          'default':1, 
                          'qtWidget':'plotFont' 
                          }
                    ,'cex.main': {
                          'default':1, 
                          'qtWidget':'mainFont' 
                          }
                    ,'cex.sub': {
                          'default':1, 
                          'qtWidget':'subFont' 
                          }
                    ,'col.axis': {
                          'default':'#000000', 
                          'qtWidget':'axisColor' 
                          }
                    # ,'family': {
                          # 'default':'serif', 
                          # 'qtWidget':'fontCombo' 
                          # }
                }
            }
        }
        # ,'fg' : None
        # ,'legendNames' : None
        # ,'legendLocation' : "'bottomleft'"
        # }
        
        self.optionWidgets = {}
        self.colorList = ['#000000', '#ff0000', '#00ff00', '#0000ff']       


    ################################
    ####   Setup Tabs          #####
    ################################
        self.graphicOptionsButton = button(self.topArea,label='Graphic Options',
        toggleButton = True,callback=self.displayGraphicOptions)
        self.graphicOptionsWidget = widgetBox(self.topArea)
        self.graphicOptions = tabWidget(self.graphicOptionsWidget)
        self.graphicOptions.setFixedHeight(180)
        hbox = widgetBox(self.graphicOptionsWidget,orientation='horizontal',alignment= Qt.AlignLeft)
        self.resizeCheck = checkBox(hbox,label='resize',displayLabel=False,buttons={'true':'Resize Image'},setChecked='true')
        button(hbox,label='Update Graphic', alignment=Qt.AlignLeft, callback=self.plotMultiple)
        

        self.labels = self.graphicOptions.createTabPage('Main')
        self.points = self.graphicOptions.createTabPage('Points/Lines')
        self.advanced = self.graphicOptions.createTabPage('Advanced')
        #self.graphicOptions.hide()
        
        firstTab = widgetBox(self.labels,orientation='horizontal',alignment=Qt.AlignLeft | Qt.AlignTop)
        secondTab = widgetBox(self.points,orientation='horizontal',alignment=Qt.AlignLeft | Qt.AlignTop)
        advancedTab = widgetBox(self.advanced,orientation='vertical',alignment=Qt.AlignLeft | Qt.AlignTop)
    ################################
    ####   Advanced Tabs       #####
    ################################
        
        self.optionWidgets['extrasLineEdit'] = lineEdit(advancedTab, label = 'Advanced plotting parameters', 
        toolTip = 'Add extra parameters to the main plot.\nPlease see documentation for more details about parameters.')
        
        self.optionWidgets['onlyAdvanced'] = checkBox(advancedTab,
        buttons=['Only use the advanced options here'],
        label='advancedOnly',displayLabel=False)

    ################################
    ####   First Tabs          #####
    ################################
        imageBox = groupBox(firstTab,label='Image Properties', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        self.optionWidgets['imageType'] = comboBox(imageBox,label='Image Type',items=['svg','png'])
        self.optionWidgets['imageType'].setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Minimum)
        
        hbox = widgetBox(imageBox,orientation='horizontal')
        self.optionWidgets['dheight'] = spinBox(hbox, label = 'Height', min = 1, max = 5000, value = 400)
        self.optionWidgets['dwidth'] = spinBox(hbox, label = 'Width', min = 1, max = 5000, value = 400)
        hbox = widgetBox(imageBox,orientation='horizontal')
        self.optionWidgets['units'] = comboBox(hbox,label='units',items=[('px','Pixel'),('in','Inches')])
        self.optionWidgets['dpi'] = comboBox(hbox,label='DPI',items=['75','100','150','auto'],editable=True)
        
        
        labelBox = groupBox(firstTab,label='Labels', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        self.optionWidgets['mainTitle'] = lineEdit(labelBox,label='Main Title')
        self.optionWidgets['xLab'] = lineEdit(labelBox,label='X Axis Label')        
        self.optionWidgets['yLab'] = lineEdit(labelBox,label='Y Axis Label')

        
        fontBox = groupBox(firstTab,label='Sizes', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        fontColumnBox = widgetBox(fontBox,orientation='horizontal')
        fontColumn1 = widgetBox(fontColumnBox,orientation='vertical')
        fontColumn2 = widgetBox(fontColumnBox,orientation='vertical')
        
        #self.optionWidgets['fontCombo'] = comboBox(fontColumn1, items = ['serif', 'sans', 'mono'], label='Font Family')
        
        self.optionWidgets['lineWidth'] = spinBox(fontColumn1,label='Point/Line Size',decimals=2,min=1,max=50)
        self.optionWidgets['plotFont'] = spinBox(fontColumn1, label = 'Plot Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['axisFont'] = spinBox(fontColumn1, label = 'Axis Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['mainFont'] = spinBox(fontColumn2, label = 'Title Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['subFont'] = spinBox(fontColumn2, label = 'Subtitle Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['labFont'] = spinBox(fontColumn2, label = ' XY Label Text Size',decimals=2, min = 1, max = 50)
        
        colorBox = groupBox(firstTab,label='Colors', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        hbox = widgetBox(colorBox,orientation='horizontal')

        self.optionWidgets['colorSeries'] = comboBox(hbox,label='Generate Colors Series',orientation='vertical',
        items = ['select','rainbow','heat.colors','terrain.colors','topo.colors','cm.colors'])
        self.optionWidgets['colorSeriesLen'] = spinBox(hbox,label='Length of Series',displayLabel=False, min=0, max=500)
        hbox.layout().setAlignment(self.optionWidgets['colorSeriesLen'].controlArea, Qt.AlignBottom)
        
        self.optionWidgets['bgColor'] = ColorIcon(colorBox,label='Background')

        #self.optionWidgets['customColors'] = button(colorBox,label='Custom Plot Colors',callback=self.setPlotColors)

    
    ################################
    ####   Second Tabs         #####
    ################################
        colorBox2 = groupBox(secondTab,label='Colors', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        # colorColumnBox = widgetBox(colorBox2,orientation='horizontal')
        # colorColumn1 = widgetBox(colorColumnBox,orientation='vertical')
        # colorColumn2 = widgetBox(colorColumnBox,orientation='vertical')
      
         
        self.optionWidgets['titleColor'] = ColorIcon(colorBox2,label='Title')
        self.optionWidgets['subColor'] = ColorIcon(colorBox2,label='Subtitle')
        self.optionWidgets['labColor'] = ColorIcon(colorBox2,label='Subtitle')
        self.optionWidgets['axisColor'] = ColorIcon(colorBox2,label='Axis')
        
        lineBox = groupBox(secondTab,label='Lines', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
       
        self.optionWidgets['linesListBox'] = listBox(lineBox, label = 'Line types', displayLabel=False,
        selectionMode = QAbstractItemView.ExtendedSelection,
        items = [(1,'________'), (2,'- - - -'), (3,'........'), (4,'_._._._.'), 
        (5,'__ __ __'), (6,'__.__.__.')])
        
        
        
        pointBox = groupBox(secondTab,label='Points', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        items = []
        for i in range(1,26):
            items.append((i-1,QListWidgetItem(QIcon(os.path.join(redREnviron.directoryNames['picsDir'],
            'R icon (%d).png' %i)),'')))
        
        for i in range(32,128):
            items.append((i-1,'%s' % (chr(i))))
            
        self.optionWidgets['pointListBox'] = listBox(pointBox, label = 'Line types', displayLabel=False,
        selectionMode = QAbstractItemView.ExtendedSelection, items = items)
        


        self.setTheme(self.options)
    ################################
    ### right click menu     #######
    ################################
        self.menu = QMenu(self)
        save = self.menu.addMenu('Save As')
        save.addAction('Bitmap')
        save.addAction('PDF')
        save.addAction('Post Script')
        save.addAction('JPEG')
        self.menu.addAction('Copy')
        self.menu.addAction('Fit In Window')
        self.menu.addAction('Zoom Out')
        self.menu.addAction('Zoom In')
        self.menu.addAction('Undock')
        self.menu.addAction('Redock')
        
        self.dialog = QDialog()
        self.dialog.setWindowTitle('Red-R Graphics View' + name)
        self.dialog.setLayout(QHBoxLayout())
        
        self.standardImageType = 'svg'
        QObject.connect(self.dialog, SIGNAL('finished(int)'), self.dialogClosed)
    def __init__(self, parent,label=None, displayLabel=True,includeInReports=True, name = '', data = None):
        ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget.
        widgetState.__init__(self,parent,label,includeInReports)
        
        QGraphicsView.__init__(self, self.controlArea)
        self.topArea = widgetBox(self.controlArea,
        sizePolicy = QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum),includeInReports=False, orientation = 'horizontal')
        self.middleArea = widgetBox(self.controlArea)
        self.bottomArea = widgetBox(self.controlArea,includeInReports=False)  #, sizePolicy = QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
        
        self.middleArea.layout().addWidget(self)  # place the widget into the parent widget
        scene = QGraphicsScene()
        self.setScene(scene)
        self.parent = parent
        self.data = data
        self.printQuery = ''
        self.widgetSelectionRect = None
        self.mainItem = None
        self.query = ''
        self.function = 'plot'
        self.layers = []
        self.image = 'plot'+unicode(time.time()) # the base file name without an extension
        self.imageFileName = ''
        self.currentScale = 1

    ################################
    ####   Themes              #####
    ################################
        
        
        self.options = {
            'device': {
                'Rcall': 'Cairo',
                'parameters': {
                    'type':{
                            'default':'svg',
                            'qtWidget': 'imageType'
                        }
                    ,'dpi':{
                            'default':'75',
                            'qtWidget': 'dpi'
                        }
                    ,'bg': {
                            'default':'#FFFFFF', 
                            'color': '#FFFFFF',
                            'qtWidget':'bgColor'
                            
                            }
                    ,'height': {
                            'default':400, 
                            'qtWidget': 'dheight'
                            }
                    ,'width': {
                            'default':400, 
                            'qtWidget': 'dwidth'
                            }
                    ,'units': {
                            'default':'px', 
                            'qtWidget': 'units'
                            }
                    }
                }
            ,'main': {
                'Rcall': 'plot',
                'parameters': {
                    'col': {
                        'default':None, 
                        'qtWidget':'colorSeries',
                        'series': '',
                        'seriesLen': 0,
                        'getFunction': self.getColorSeries,
                        'setFunction': self.setColorSeries,
                        }
                    ,'lty': {
                        'default':None, 
                        'qtWidget':'linesListBox',
                        'getFunction': self.getLineTypes,
                        'setFunction': self.setLineTypes,
                        }
                    ,'lwd': {
                        'default':None, 
                        'qtWidget':'lineWidth'
                        }
                    ,'pch': {
                        'default':None, 
                        'qtWidget':'pointListBox',
                        'getFunction': self.getLineTypes,
                        'setFunction': self.setLineTypes,
                        }
                }
            },
            'title': {
                'Rcall': 'title',
                'parameters': {
                    'main': {
                          'default':"Title", 
                          'qtWidget':'mainTitle' 
                          }
                    ,'xlab': {
                        'default':"XLab", 
                        'qtWidget':'xLab'
                        }
                    ,'ylab': {
                        'default':"YLab", 
                        'qtWidget':'yLab'
                        }   
                    ,'col.main': {
                          'default':'#000000', 
                          'qtWidget':'titleColor' 
                          }
                    ,'col.sub': {
                          'default':'#000000', 
                          'qtWidget':'subColor' 
                          }
                    ,'col.lab': {
                          'default':'#000000', 
                          'qtWidget':'labColor' 
                          }                        
                }
            },
            'par': {
                'Rcall':'par',
                'parameters': {
                    'cex.axis': {
                          'default':1, 
                          'qtWidget':'axisFont' 
                          }
                    ,'cex.lab': {
                          'default':1, 
                          'qtWidget':'labFont' 
                          }
                    ,'cex': {
                          'default':1, 
                          'qtWidget':'plotFont' 
                          }
                    ,'cex.main': {
                          'default':1, 
                          'qtWidget':'mainFont' 
                          }
                    ,'cex.sub': {
                          'default':1, 
                          'qtWidget':'subFont' 
                          }
                    ,'col.axis': {
                          'default':'#000000', 
                          'qtWidget':'axisColor' 
                          }
                    # ,'family': {
                          # 'default':'serif', 
                          # 'qtWidget':'fontCombo' 
                          # }
                }
            }
        }
        
        
        ### ggplot options
        self.optionsDialog = dialog(self.controlArea)
        self.optionsTab = tabWidget(self.optionsDialog)
        
        plotGridTab = self.optionsTab.createTabPage("Plot Grid Area", orientation = 'vertical')
        
        self.panelGridMajorTheme = comboBox(plotGridTab, label = 'Major Grid General Theme', toolTip = 'If Ignore, no options are set for this.  If not None overrides all other options set and sets the theme specified.', items = [('ignore', 'Ignore'), ('none', 'None'), ('theme_bw()', 'Black and White'), ('theme_blank()', 'Blank Theme')])
        self.panelGridMajorColour = colorButton(plotGridTab, label = "Major Grid Color")
        self.panelGridMajorSize = spinBox(plotGridTab, label = "Major Grid Size")
        self.panelGridMajorLineType = comboBox(plotGridTab, label = "Major Grid Line Type", items = [('solid', 'Solid'), ('dotted', 'Dotted'), ('dashed', 'Dashed')])
        
        self.panelGridMinorTheme = comboBox(plotGridTab, label = 'Minor Grid General Theme', toolTip = 'If Ignore, no options are set for this.  If not None overrides all other options set and sets the theme specified.', items = [('ignore', 'Ignore'), ('none', 'None'), ('theme_bw()', 'Black and White'), ('theme_blank()', 'Blank Theme')])
        self.panelGridMinorColour = colorButton(plotGridTab, label = "Minor Grid Color")
        self.panelGridMinorSize = spinBox(plotGridTab, label = "Minor Grid Size")
        self.panelGridMinorLineType = comboBox(plotGridTab, label = "Minor Grid Line Type", items = [('solid', 'Solid'), ('dotted', 'Dotted'), ('dashed', 'Dashed')])
        
        panelTab = self.optionsTab.createTabPage("panel Background Options", orientation = 'vertical')
        
        self.panelBackgroundTheme = comboBox(panelTab, label = 'panel Background Theme', toolTip = 'If Ignore, no options are set for this.  If not None overrides all other options set and sets the theme specified.', items = [('ignore', 'Ignore'), ('none', 'None'), ('theme_bw()', 'Black and White'), ('theme_blank()', 'Blank Theme')])
        
        textTab = self.optionsTab.createTabPage("Text Options", orientation = 'vertical')
        
        self.useTextOptions = comboBox(textTab, label = 'Use Text Options', items = [('ignore', 'No'), ('yes', 'Yes')])
        self.plotTitle = lineEdit(textTab, label = 'Plot Title')
        self.plotTitleSize = spinBox(textTab, label = 'Title Font Size', min = 1, value = 20)
        self.plotTitleAngle = spinBox(textTab, label = 'Title Angle', min = 0, max = 360, value = 0)
        self.plotTitleFontFace = comboBox(textTab, label = 'Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTitleX = lineEdit(textTab, label = 'X Axis Title')
        self.axisTitleXColor = colorButton(textTab, label = 'X Axis Color')
        self.axisTitleXSize = spinBox(textTab, label = 'X Axis Title Size', min = 1, value = 14)
        self.axisTitleXAngle = spinBox(textTab, label = 'X Axis Title Angle', min = 0, max = 360, value = 0)
        self.axisTitleXFontFace = comboBox(textTab, label = 'X Axis Title Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTextXSize = spinBox(textTab, label = 'X Axis Text Size', min = 1, value = 14)
        self.axisTextXColor = colorButton(textTab, label = 'X Axis Text Color')
        self.axisTextXAngle = spinBox(textTab, label = 'X Axis Text Angle', min = 0, max = 360, value = 0)
        self.axisTextXFontFace = comboBox(textTab, label = 'X Axis Text Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTitleY = lineEdit(textTab, label = 'Y Axis Title')
        self.axisTitleYColor = colorButton(textTab, label = 'Y Axis Color')
        self.axisTitleYSize = spinBox(textTab, label = 'Y Axis Title Size', min = 1, value = 14)
        self.axisTitleYAngle = spinBox(textTab, label = 'Y Axis Title Angle', min = 0, max = 360, value = 0)
        self.axisTitleYFontFace = comboBox(textTab, label = 'Y Axis Title Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.axisTextYSize = spinBox(textTab, label = 'Y Axis Text Size', min = 1, value = 14)
        self.axisTextYColor = colorButton(textTab, label = 'Y Axis Text Color')
        self.axisTextYAngle = spinBox(textTab, label = 'Y Axis Text Angle', min = 0, max = 360, value = 0)
        self.axisTextYFontFace = comboBox(textTab, label = 'Y Axis Text Font Face', items = [('none', 'None'), ('bold', 'Bold')])
        
        self.optionsDialog.hide()
        
        self.optionWidgets = {}
        self.colorList = ['#000000', '#ff0000', '#00ff00', '#0000ff']       

        self.extraOptionsLineEdit = lineEdit(self.topArea, label = 'Extra Options', toolTip = 'These options will be appended to the plotting call, remember that these are ggplot options that will be added to the plot object')
        self.extraOptionsLineEdit.controlArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        
        self.heightSpinBox = spinBox(self.topArea, label = 'Height', min = 0, value = 7, decimals = 3)
        self.widthSpinBox = spinBox(self.topArea, label = 'Width', min = 0, value = 7, decimals = 3)
        button(self.topArea, label = 'Show Options', callback = self.optionsDialog.show)
        
    
    ################################
    ### right click menu     #######
    ################################
        self.menu = QMenu(self)
        save = self.menu.addMenu('Save As')
        save.addAction('Bitmap')
        save.addAction('PDF')
        save.addAction('Post Script')
        save.addAction('JPEG')
        save.addAction('SVG')
        self.menu.addAction('Copy')
        self.menu.addAction('Fit In Window')
        self.menu.addAction('Zoom Out')
        self.menu.addAction('Zoom In')
        self.menu.addAction('R Graphics Device')
        #self.menu.addAction('Undock')
        #self.menu.addAction('Redock')
        
        self.dialog = QDialog()
        self.dialog.setWindowTitle('Red-R Graphics View' + name)
        self.dialog.setLayout(QHBoxLayout())
        
        self.standardImageType = 'svg'
        self.imageType = 'svg'
        QObject.connect(self.dialog, SIGNAL('finished(int)'), self.dialogClosed)
Beispiel #6
0
    def __init__(self, parent,label=None, displayLabel=True,includeInReports=True, name = '', data = None):
        ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget.
        widgetState.__init__(self,parent,label,includeInReports)
        
        QGraphicsView.__init__(self, self.controlArea)
        # if displayLabel:
            # self.controlArea = groupBox(parent,label=label, orientation='vertical')
        # else:
            # self.controlArea = widgetBox(parent,orientation='vertical')
        
        #self.controlArea = widgetBox(parent)
        self.topArea = widgetBox(self.controlArea,
        sizePolicy = QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Maximum),includeInReports=False)
        self.middleArea = widgetBox(self.controlArea)
        self.bottomArea = widgetBox(self.controlArea,includeInReports=False)
        
        self.middleArea.layout().addWidget(self)  # place the widget into the parent widget
        scene = QGraphicsScene()
        self.setScene(scene)
        self.parent = parent
        self.data = data
        
        self.widgetSelectionRect = None
        self.mainItem = None
        self.query = ''
        self.function = 'plot'
        self.layers = []
        self.image = 'plot'+unicode(time.time()) # the base file name without an extension
        self.imageFileName = ''
        self.currentScale = 1
        self.customPlotFunction = None
        self.controlGroups = {}
        self.tabs = {}
    ################################
    ####   Themes              #####
    ################################
        
        
        self.options = {
            'device': {
                'Rcall': 'Cairo',
                'parameters': {
                    'type':{
                            'default':'svg',
                            'qtWidget': 'imageType'
                        }
                    ,'dpi':{
                            'default':'75',
                            'qtWidget': 'dpi'
                        }
                    ,'bg': {
                            'default':'#FFFFFF', 
                            'color': '#FFFFFF',
                            'qtWidget':'bgColor'
                            
                            }
                    ,'height': {
                            'default':400, 
                            'qtWidget': 'dheight'
                            }
                    ,'width': {
                            'default':400, 
                            'qtWidget': 'dwidth'
                            }
                    ,'units': {
                            'default':'px', 
                            'qtWidget': 'units'
                            }
                    }
                }
            ,'main': {
                'Rcall': 'plot',
                'parameters': {
                    'col': {
                        'default':None, 
                        'qtWidget':'colorSeries',
                        'series': '',
                        'seriesLen': 0,
                        'getFunction': self.getColorSeries,
                        'setFunction': self.setColorSeries,
                        }
                    ,'lty': {
                        'default':None, 
                        'qtWidget':'linesListBox',
                        'getFunction': self.getLineTypes,
                        'setFunction': self.setLineTypes,
                        }
                    ,'lwd': {
                        'default':None, 
                        'qtWidget':'lineWidth'
                        }
                    ,'pch': {
                        'default':None, 
                        'qtWidget':'pointListBox',
                        'getFunction': self.getLineTypes,
                        'setFunction': self.setLineTypes,
                        }
                    ,'xlim': {
                        'default':None, 
                        'qtWidget':['xstart','xend'],
                        'getFunction': self.getLimits,
                        'setFunction': self.setLimits,                    
                    }
                    ,'ylim': {
                        'default':None, 
                        'qtWidget':['ystart','yend'],
                        'getFunction': self.getLimits,
                        'setFunction': self.setLimits,                    
                    }
                }
            },
            'title': {
                'Rcall': 'title',
                'parameters': {
                    'main': {
                          'default':"Title", 
                          'qtWidget':'mainTitle' 
                          }
                    ,'xlab': {
                        'default':"XLab", 
                        'qtWidget':'xLab'
                        }
                    ,'ylab': {
                        'default':"YLab", 
                        'qtWidget':'yLab'
                        }   
                    ,'col.main': {
                          'default':'#000000', 
                          'qtWidget':'titleColor' 
                          }
                    ,'col.sub': {
                          'default':'#000000', 
                          'qtWidget':'subColor' 
                          }
                    ,'col.lab': {
                          'default':'#000000', 
                          'qtWidget':'labColor' 
                          }                        
                }
            },
            'par': {
                'Rcall':'par',
                'parameters': {
                    'cex.axis': {
                          'default':1, 
                          'qtWidget':'axisFont' 
                          }
                    ,'cex.lab': {
                          'default':1, 
                          'qtWidget':'labFont' 
                          }
                    ,'cex': {
                          'default':1, 
                          'qtWidget':'plotFont' 
                          }
                    ,'cex.main': {
                          'default':1, 
                          'qtWidget':'mainFont' 
                          }
                    ,'cex.sub': {
                          'default':1, 
                          'qtWidget':'subFont' 
                          }
                    ,'col.axis': {
                          'default':'#000000', 
                          'qtWidget':'axisColor' 
                          }
                    # ,'family': {
                          # 'default':'serif', 
                          # 'qtWidget':'fontCombo' 
                          # }
                }
            }
        }
        # ,'fg' : None
        # ,'legendNames' : None
        # ,'legendLocation' : "'bottomleft'"
        # }
        
        self.optionWidgets = {}
        self.colorList = ['#000000', '#ff0000', '#00ff00', '#0000ff']       


    ################################
    ####   Setup Tabs          #####
    ################################
        self.graphicOptionsButton = button(self.topArea,label='Graphic Options',
        toggleButton = True,callback=self.displayGraphicOptions)
        self.graphicOptionsWidget = widgetBox(self.topArea)
        self.tabWidget = tabWidget(self.graphicOptionsWidget)
        self.tabWidget.setFixedHeight(180)
        hbox = widgetBox(self.graphicOptionsWidget,orientation='horizontal',alignment= Qt.AlignLeft)
        self.resizeCheck = checkBox(hbox,label='resize',displayLabel=False,buttons={'true':'Resize Image'},setChecked='true')
        button(hbox,label='Update Graphic', alignment=Qt.AlignLeft, callback=self.updatePlot)
        
        self.createTab('General')
        self.createTab('Points/Lines')
        self.createTab('Advanced')

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

    ################################
    ####   First Tabs          #####
    ################################
        imageBox = self.createControlGroup('General',label='Image Properties')
        # imageBox = groupBox(firstTab,label='Image Properties', orientation='vertical',
        # sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        self.optionWidgets['imageType'] = comboBox(imageBox,label='Image Type',items=['svg','png'])
        self.optionWidgets['imageType'].setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Minimum)
        
        hbox = widgetBox(imageBox,orientation='horizontal')
        self.optionWidgets['dheight'] = spinBox(hbox, label = 'Height', min = 1, max = 5000, value = 400)
        self.optionWidgets['dwidth'] = spinBox(hbox, label = 'Width', min = 1, max = 5000, value = 400)
        hbox = widgetBox(imageBox,orientation='horizontal')
        self.optionWidgets['units'] = comboBox(hbox,label='units',items=[('px','Pixel'),('in','Inches')])
        self.optionWidgets['dpi'] = comboBox(hbox,label='DPI',items=['75','100','150','auto'],editable=True)
        
        
        labelBox = self.createControlGroup('General',label='Labels')
        
        self.optionWidgets['mainTitle'] = lineEdit(labelBox,label='Main Title')
        self.optionWidgets['xLab'] = lineEdit(labelBox,label='X Axis Label')        
        self.optionWidgets['yLab'] = lineEdit(labelBox,label='Y Axis Label')

        
        fontBox = self.createControlGroup('General',label='Sizes')
        fontColumnBox = widgetBox(fontBox,orientation='horizontal')
        fontColumn1 = widgetBox(fontColumnBox,orientation='vertical')
        fontColumn2 = widgetBox(fontColumnBox,orientation='vertical')
        
        #self.optionWidgets['fontCombo'] = comboBox(fontColumn1, items = ['serif', 'sans', 'mono'], label='Font Family')
        
        self.optionWidgets['lineWidth'] = spinBox(fontColumn1,label='Point/Line Size',decimals=2,min=1,max=50)
        self.optionWidgets['plotFont'] = spinBox(fontColumn1, label = 'Plot Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['axisFont'] = spinBox(fontColumn1, label = 'Axis Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['mainFont'] = spinBox(fontColumn2, label = 'Title Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['subFont'] = spinBox(fontColumn2, label = 'Subtitle Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['labFont'] = spinBox(fontColumn2, label = ' XY Label Text Size',decimals=2, min = 1, max = 50)
        
        limitBox = self.createControlGroup('General',label='Limits')
        col2Box = widgetBox(limitBox,orientation='horizontal')
        column1 = widgetBox(col2Box,orientation='vertical')
        column2 = widgetBox(col2Box,orientation='vertical')

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

    
    ################################
    ####   Second Tabs         #####
    ################################
        colorBox = self.createControlGroup('Points/Lines',label='Colors')
        hbox = widgetBox(colorBox,orientation='horizontal')

        self.optionWidgets['colorSeries'] = comboBox(hbox,label='Generate Colors Series',orientation='vertical',
        items = ['select','rainbow','heat.colors','terrain.colors','topo.colors','cm.colors'])
        self.optionWidgets['colorSeriesLen'] = spinBox(hbox,label='Length of Series',displayLabel=False, min=0, max=500)
        hbox.layout().setAlignment(self.optionWidgets['colorSeriesLen'].controlArea, Qt.AlignBottom)
        
        self.optionWidgets['bgColor'] = ColorIcon(colorBox,label='Background')

        #self.optionWidgets['customColors'] = button(colorBox,label='Custom Plot Colors',callback=self.setPlotColors)
        colorBox2 = self.createControlGroup('Points/Lines',label='More Colors')
        
        # colorColumnBox = widgetBox(colorBox2,orientation='horizontal')
        # colorColumn1 = widgetBox(colorColumnBox,orientation='vertical')
        # colorColumn2 = widgetBox(colorColumnBox,orientation='vertical')
      
         
        self.optionWidgets['titleColor'] = ColorIcon(colorBox2,label='Title')
        self.optionWidgets['subColor'] = ColorIcon(colorBox2,label='Subtitle')
        self.optionWidgets['labColor'] = ColorIcon(colorBox2,label='Subtitle')
        self.optionWidgets['axisColor'] = ColorIcon(colorBox2,label='Axis')
        
        lineBox = self.createControlGroup('Points/Lines',label='Lines')
       
        self.optionWidgets['linesListBox'] = listBox(lineBox, label = 'Line types', displayLabel=False,
        selectionMode = QAbstractItemView.ExtendedSelection,
        items = [(1,'________'), (2,'- - - -'), (3,'........'), (4,'_._._._.'), 
        (5,'__ __ __'), (6,'__.__.__.')])
        
        
        
        pointBox = self.createControlGroup('Points/Lines',label='Points')
        
        items = []
        for i in range(1,26):
            items.append((i-1,QListWidgetItem(QIcon(os.path.join(redREnviron.directoryNames['picsDir'],
            'R icon (%d).png' %i)),'')))
        
        for i in range(32,128):
            items.append((i-1,'%s' % (chr(i))))
            
        self.optionWidgets['pointListBox'] = listBox(pointBox, label = 'Line types', displayLabel=False,
        selectionMode = QAbstractItemView.ExtendedSelection, items = items)
        


        self.setTheme(self.options)
    ################################
    ### right click menu     #######
    ################################
        self.menu = QMenu(self)
        save = self.menu.addMenu('Save As')
        save.addAction('Bitmap')
        save.addAction('PDF')
        save.addAction('Post Script')
        save.addAction('JPEG')
        self.menu.addAction('Copy')
        self.menu.addAction('Fit In Window')
        self.menu.addAction('Zoom Out')
        self.menu.addAction('Zoom In')
        self.menu.addAction('Undock')
        self.menu.addAction('Redock')
        
        self.dialog = QDialog()
        self.dialog.setWindowTitle('Red-R Graphics View' + name)
        self.dialog.setLayout(QHBoxLayout())
        
        self.standardImageType = 'svg'
        QObject.connect(self.dialog, SIGNAL('finished(int)'), self.dialogClosed)
Beispiel #7
0
    def __init__(self, parent,label=None, displayLabel=True,includeInReports=True, name = '', data = None, prePlottingCallback = None):
        ## want to init a graphics view with a new graphics scene, the scene will be accessable through the widget.
        graphicsView.__init__(self, parent, label = label, displayLabel = displayLabel, includeInReports = includeInReports,
            name = name, data = data)
        ## __init__(self, parent,label=_('Graph'), displayLabel=True,includeInReports=True, name = '', data = None)
        
    ################################
    ####   Themes              #####
    ################################
        
        self.prePlottingCallback = prePlottingCallback
        self.options = {
            'device': {
                'imageType':'svg',
                'dpi':'75',
                'bgColor':'#FFFFFF',
                'dheight':400,
                'dwidth':400,
                'units':'px'},
            'main':{
                'col':None,
                'lty':None,
                'lwd':None,
                'pch':None,},
            'title':{
                'main':'',
                'xlab':'',
                'ylab':'',
                'col.main':'#000000',
                'col.sub':'#000000',
                'col.lab':'#000000'},
            'par':{
                'cex.axis':1,
                'cex.lab':1,
                'cex.main':1,
                'cex.sub':1,
                'cex':1,
                'col.axis':'#000000'}
            }
        
        
        self.optionWidgets = {}
        self.colorList = ['#000000', '#ff0000', '#00ff00', '#0000ff']       


    ################################
    ####   Setup Tabs          #####
    ################################
        self.graphicOptionsButton = button(self.topArea,label='Graphic Options',
        toggleButton = True,callback=self.displayGraphicOptions)
        self.graphicOptionsWidget = widgetBox(self.topArea)
        self.graphicOptions = tabWidget(self.graphicOptionsWidget)
        self.graphicOptions.setFixedHeight(180)
        hbox = widgetBox(self.graphicOptionsWidget,orientation='horizontal',alignment= Qt.AlignLeft)
        self.resizeCheck = checkBox(hbox,label='resize',displayLabel=False,buttons={'true':'Resize Image'},setChecked='true')
        self.monkey = checkBox(hbox, label='useopts', displayLabel = False, buttons={'true':'Use Custom Plot Options'}, callback = self.enablePlotOptions)
        button(hbox,label='Update Graphic', alignment=Qt.AlignLeft, callback=self.plotMultiple)
        

        self.labels = self.graphicOptions.createTabPage('Main')
        self.points = self.graphicOptions.createTabPage('Points/Lines')
        self.advanced = self.graphicOptions.createTabPage('Advanced')
        #self.graphicOptions.hide()
        
        firstTab = widgetBox(self.labels,orientation='horizontal',alignment=Qt.AlignLeft | Qt.AlignTop)
        secondTab = widgetBox(self.points,orientation='horizontal',alignment=Qt.AlignLeft | Qt.AlignTop)
        advancedTab = widgetBox(self.advanced,orientation='vertical',alignment=Qt.AlignLeft | Qt.AlignTop)
    ################################
    ####   Advanced Tabs       #####
    ################################
        
        self.optionWidgets['extrasLineEdit'] = lineEdit(advancedTab, label = 'Advanced plotting parameters', 
        toolTip = 'Add extra parameters to the main plot.\nPlease see documentation for more details about parameters.')
        
        self.optionWidgets['onlyAdvanced'] = checkBox(advancedTab,
        buttons=[(1, 'Only use the advanced options here')],
        label='advancedOnly',displayLabel=False)

    ################################
    ####   First Tabs          #####
    ################################
        imageBox = groupBox(firstTab,label='Image Properties', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        self.optionWidgets['imageType'] = comboBox(imageBox,label='Image Type',items=['svg', 'cairo' ,'png'])
        self.optionWidgets['imageType'].setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Minimum)
        
        hbox = widgetBox(imageBox,orientation='horizontal')
        self.optionWidgets['dheight'] = spinBox(hbox, label = 'Height', min = 1, max = 5000, value = 400)
        self.optionWidgets['dwidth'] = spinBox(hbox, label = 'Width', min = 1, max = 5000, value = 400)
        hbox = widgetBox(imageBox,orientation='horizontal')
        self.optionWidgets['units'] = comboBox(hbox,label='units',items=[('px','Pixel'),('in','Inches')])
        self.optionWidgets['dpi'] = comboBox(hbox,label='DPI',items=['75','100','150','auto'],editable=True)
        
        
        labelBox = groupBox(firstTab,label='Labels', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        self.optionWidgets['mainTitle'] = lineEdit(labelBox,label='Main Title')
        self.optionWidgets['xLab'] = lineEdit(labelBox,label='X Axis Label')        
        self.optionWidgets['yLab'] = lineEdit(labelBox,label='Y Axis Label')

        
        fontBox = groupBox(firstTab,label='Sizes', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        fontColumnBox = widgetBox(fontBox,orientation='horizontal')
        fontColumn1 = widgetBox(fontColumnBox,orientation='vertical')
        fontColumn2 = widgetBox(fontColumnBox,orientation='vertical')
        
        #self.optionWidgets['fontCombo'] = comboBox(fontColumn1, items = ['serif', 'sans', 'mono'], label='Font Family')
        
        self.optionWidgets['lineWidth'] = spinBox(fontColumn1,label='Point/Line Size',decimals=2,min=1,max=50)
        self.optionWidgets['plotFont'] = spinBox(fontColumn1, label = 'Plot Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['axisFont'] = spinBox(fontColumn1, label = 'Axis Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['mainFont'] = spinBox(fontColumn2, label = 'Title Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['subFont'] = spinBox(fontColumn2, label = 'Subtitle Text Size',decimals=2, min = 1, max = 50)
        self.optionWidgets['labFont'] = spinBox(fontColumn2, label = ' XY Label Text Size',decimals=2, min = 1, max = 50)
        
        colorBox = groupBox(firstTab,label='Colors', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        hbox = widgetBox(colorBox,orientation='horizontal')

        self.optionWidgets['colorSeries'] = comboBox(hbox,label='Generate Colors Series',orientation='vertical',
        items = ['select','rainbow','heat.colors','terrain.colors','topo.colors','cm.colors'])
        self.optionWidgets['colorSeriesLen'] = spinBox(hbox,label='Length of Series',displayLabel=False, min=0, max=500)
        hbox.layout().setAlignment(self.optionWidgets['colorSeriesLen'].controlArea, Qt.AlignBottom)
        
        self.optionWidgets['bgColor'] = ColorIcon(colorBox,label='Background')

        #self.optionWidgets['customColors'] = button(colorBox,label='Custom Plot Colors',callback=self.setPlotColors)

    
    ################################
    ####   Second Tabs         #####
    ################################
        colorBox2 = groupBox(secondTab,label='Colors', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        # colorColumnBox = widgetBox(colorBox2,orientation='horizontal')
        # colorColumn1 = widgetBox(colorColumnBox,orientation='vertical')
        # colorColumn2 = widgetBox(colorColumnBox,orientation='vertical')
      
         
        self.optionWidgets['titleColor'] = ColorIcon(colorBox2,label='Title')
        self.optionWidgets['subColor'] = ColorIcon(colorBox2,label='Subtitle')
        self.optionWidgets['labColor'] = ColorIcon(colorBox2,label='Subtitle')
        self.optionWidgets['axisColor'] = ColorIcon(colorBox2,label='Axis')
        
        lineBox = groupBox(secondTab,label='Lines', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
       
        self.optionWidgets['linesListBox'] = listBox(lineBox, label = 'Line types', displayLabel=False,
        selectionMode = QAbstractItemView.ExtendedSelection,
        items = [(1,'________'), (2,'- - - -'), (3,'........'), (4,'_._._._.'), 
        (5,'__ __ __'), (6,'__.__.__.')])
        
        
        
        pointBox = groupBox(secondTab,label='Points', orientation='vertical',
        sizePolicy = QSizePolicy(QSizePolicy.Maximum ,QSizePolicy.Minimum))
        
        items = []
        for i in range(1,26):
            items.append((i-1,QListWidgetItem(QIcon(os.path.join(redREnviron.directoryNames['picsDir'],
            'R icon (%d).png' %i)),'')))
        
        for i in range(32,128):
            items.append((i-1,'%s' % (chr(i))))
            
        self.optionWidgets['pointListBox'] = listBox(pointBox, label = 'Line types', displayLabel=False,
        selectionMode = QAbstractItemView.ExtendedSelection, items = items)
        


        self.setTheme(self.options)
    ################################
    ### right click menu     #######
    ################################
        self.menu = QMenu(self)
        save = self.menu.addMenu('Save As')
        save.addAction('Bitmap')
        save.addAction('PDF')
        save.addAction('PDF (LATEX)')
        save.addAction('Post Script')
        save.addAction('JPEG')
        if sys.platform == 'win32':
            save.addAction('WMF')
        self.menu.addAction('Copy')
        self.menu.addAction('Fit In Window')
        self.menu.addAction('Zoom Out')
        self.menu.addAction('Zoom In')
        #self.menu.addAction('Undock')
        #self.menu.addAction('Redock')
        
        self.dialog = QDialog()
        self.dialog.setWindowTitle('Red-R Graphics View' + name)
        self.dialog.setLayout(QHBoxLayout())
        
        self.standardImageType = 'svg'
        QObject.connect(self.dialog, SIGNAL('finished(int)'), self.dialogClosed)

        
        self.graphicOptionsWidget.hide()