def uploadException(self,err): try: import httplib,urllib import sys,pickle,os, re #print redREnviron.settings['askToUploadError'], 'askToUploadError' #print redREnviron.settings['uploadError'], 'uploadError' if not redREnviron.settings['askToUploadError']: res = redREnviron.settings['uploadError'] else: self.msg = redRdialog(parent=self,title='Red-R Error') error = redRwidgetBox(self.msg,orientation='vertical') redRwidgetLabel(error, label='Do you wish to report the Error Log?') buttons = redRwidgetBox(error,orientation='horizontal') redRbutton(buttons, label = _('Yes'), callback = self.uploadYes) redRbutton(buttons, label = _('No'), callback = self.uploadNo) self.checked = False self.remember = redRcheckBox(error,buttons=[_('Remember my Response')],callback=self.rememberResponse) res = self.msg.exec_() redREnviron.settings['uploadError'] = res #print res if res == 1: #print 'in res' err['version'] = redREnviron.version['SVNVERSION'] err['type'] = redREnviron.version['TYPE'] err['redRversion'] = redREnviron.version['REDRVERSION'] #print err['traceback'] ##err['output'] = self.allOutput if os.name == 'nt': err['os'] = 'Windows' # else: # err['os'] = 'Not Specified' if redREnviron.settings['canContact']: err['email'] = redREnviron.settings['email'] # else: # err['email'] = 'None; no contact' #err['id'] = redREnviron.settings['id'] #print err, 'Error' params = urllib.urlencode(err) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn = httplib.HTTPConnection("localhost",80) conn.request("POST", "/errorReport.php", params,headers) else: return except: redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException()) pass
def showNoInternet(self): UpdatePopup = redRdialog(self.schema, title=_('Update Manager')) UpdatePopup.setMinimumWidth(350) UpdatePopup.setMinimumHeight(350) changeLogBox = redRwebViewBox(UpdatePopup) changeLogBox.setHtml(_('No Internet Connection.')) buttonArea2 = redRwidgetBox(UpdatePopup, orientation='horizontal', sizePolicy=QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed), alignment=Qt.AlignRight) redRbutton(buttonArea2, label=_('Done'), callback=UpdatePopup.reject) UpdatePopup.exec_()
def __init__(self,parent, schema): self.schema = schema QWizard.__init__(self, parent) self.setWindowTitle(_('Generate Report')) self.selectElements = QWizardPage() self.selectElements.setLayout(QVBoxLayout()) self.selectElements.setTitle(_('Create A Report')) self.selectElements.setSubTitle(_('Select the widgets to include in this report.')) #mainWidgetBox = redRWidgetBox(self.selectElements) self.topWidgetBox = redRWidgetBox(self.selectElements) #redRwidgetLabel(topWidgetBox,label='Select the widgets to include in the report.') self.widgetList = redRtreeWidget(self.topWidgetBox, label=_('Widget List'), displayLabel=False) self.widgetList.setHeaderLabels([_('Element'), _('Parameters')]) self.widgetList.setSelectionMode(QAbstractItemView.NoSelection) buttonWidgetBox = redRWidgetBox(self.topWidgetBox,orientation='horizontal') acceptButton = redRbutton(buttonWidgetBox, _('Expand/Collapse'),callback=self.expandCollapse) self.expandState=False #acceptButton = redRbutton(buttonWidgetBox, _('Expand'),toggleButton=True) # QObject.connect(acceptButton, SIGNAL("clicked()"), self.accept) QObject.connect(self.widgetList, SIGNAL(" itemClicked (QTreeWidgetItem *,int)"), self.widgetListItemClicked) QObject.connect(self.widgetList, SIGNAL(" itemChanged (QTreeWidgetItem *,int)"), self.widgetListStateChange) self.addPage(self.selectElements)
def createDialog(self, html, avaliable): UpdatePopup = redRdialog(self.schema, title=_('Update Manager')) changeLogBox = redRwebViewBox(UpdatePopup, label=_('Update'), displayLabel=False) changeLogBox.setMinimumWidth(350) changeLogBox.setMinimumHeight(350) changeLogBox.setHtml(html) buttonArea2 = redRwidgetBox(UpdatePopup, orientation='horizontal', sizePolicy=QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed), alignment=Qt.AlignRight) if avaliable: redRbutton(buttonArea2, label=_('Close Red-R and Update'), callback=UpdatePopup.accept) redRbutton(buttonArea2, label=_('Cancel'), callback=UpdatePopup.reject) if UpdatePopup.exec_() == QDialog.Accepted: self.downloadUpdate(update)
def showUpdateAvaliable(self, update): UpdatePopup = redRdialog(self.schema, title=_('Update Manager')) changeLogBox = redRwebViewBox(UpdatePopup) changeLogBox.setMinimumWidth(350) changeLogBox.setMinimumHeight(350) html = _("<h2>Red-R %s</h2><h4>Revision:%s; Date: %s</h4>") % ( update['redRVerion'], update['SVNVersion'], update['date']) changeLogBox.setHtml(html + '<br>' + update['changeLog']) buttonArea2 = redRwidgetBox(UpdatePopup, orientation='horizontal', sizePolicy=QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed), alignment=Qt.AlignRight) redRbutton(buttonArea2, label='Close Red-R and Update', callback=UpdatePopup.accept) redRbutton(buttonArea2, label=_('Cancel'), callback=UpdatePopup.reject) if UpdatePopup.exec_() == QDialog.Accepted: self.downloadUpdate(update)
def __init__(self, *args): apply(QDialog.__init__,(self,) + args) self.topLayout = QVBoxLayout(self) self.setWindowFlags(Qt.Popup) logoImage = QPixmap(os.path.join(redREnviron.directoryNames["canvasDir"], "icons", "splash.png")) logo = redRwidgetLabel(self, "") logo.setPixmap(logoImage) info = redREnviron.version self.about = redRwebViewBox(self,label=_('About Info'),displayLabel=False) self.about.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.about.setMinimumHeight(150) self.about.setHtml('<h2>%(NAME)s %(RVERSION)s</h2>Type: %(TYPE)s; Revision: %(SVNVERSION)s; Build Time: %(DATE)s; Copy Number: %(ID)s<h3>Red-R Core Development Team (<a href="http://www.red-r.org">Red-R.org</a>)</h3>' % {'NAME': info['NAME'], 'RVERSION': info['RVERSION'], 'TYPE':info['TYPE'], 'SVNVERSION':info['SVNVERSION'], 'DATE':info['DATE'], 'ID':unicode(redREnviron.settings['id'])}) self.licenceButton = redRbutton(self, _('Licence'), callback = self.showLicence) b = QDialogButtonBox(self) b.setCenterButtons(1) self.layout().addWidget(b) butt = b.addButton(QDialogButtonBox.Close) self.connect(butt, SIGNAL("clicked()"), self.accept)
def createReportsMenu(self,schemaImage=True): qname = QFileDialog.getSaveFileName(self, _("Write Report to File"), redREnviron.directoryNames['documentsDir'] + "/Report-"+unicode(datetime.date.today())+".odt", "Open Office Text (*.odt);; HTML (*.html);; LaTeX (*.tex)") if qname.isEmpty(): return qname = unicode(qname) name = unicode(qname) # this is the file name of the Report # name = os.path.join(redREnviron.directoryNames['redRDir'],'restr.odt') if os.path.splitext(name)[1].lower() not in [".odt", ".html", ".tex"]: name = name + '.odt' fileDir = os.path.split(name)[0] try: fileDir2 = os.path.join(fileDir, os.path.splitext("Data-"+os.path.split(name)[1])[0]) fileDir2 = fileDir2.replace('\\', '/') fd3 = [] for p in fileDir2.split('/'): if len(p) > 8 and ' ' in p: fd3.append(p.replace(' ', '')[:6]+'~1') else: fd3.append(p) fileDir2 = '/'.join(fd3) if os.path.isdir(fileDir2): shutil.rmtree(fileDir2) # makes a file to place the temp data into. #This will be deleted once the odt file is made. os.mkdir(fileDir2) except Exception as inst: redRLog.log(redRLog.REDRCORE, redRLog.ERROR,redRLog.formatException()) # show the report list and allow the user to select widgets to include in the report. ## get the report info for the included widgets. # reportData = self.getReportData(fileDir2,name) import redRObjects done = self.createReport(fileDir2,name,redRObjects.instances(),schemaImage) if not done: return if os.name =='nt': #os.startfile doneDialog = redRdialog(self.schema,title=_("Report Generated")) redRwidgetLabel(doneDialog,label=_('Your report is ready to view.')) buttonBox = redRWidgetBox(doneDialog,orientation='horizontal') acceptButton = redRbutton(buttonBox,_('View Report')) QObject.connect(acceptButton, SIGNAL("clicked()"), doneDialog.accept) acceptButton = redRbutton(buttonBox,_('Done')) QObject.connect(acceptButton, SIGNAL("clicked()"), doneDialog.reject) if doneDialog.exec_() == QDialog.Accepted: try: os.startfile(name,'open') except: redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException()) mb = QMessageBox(_("Cannot Open File"), _("Red-R cannot open the reports file. Please open the file manually.\nThis is not a problem with Red-R, it is a problem with your document viewer."), QMessageBox.Information, QMessageBox.Ok | QMessageBox.Default, QMessageBox.NoButton, QMessageBox.NoButton,self) mb.exec_() else: QMessageBox.information(self, _("Red-R Canvas"), _("Your report is ready to view."), QMessageBox.Ok + QMessageBox.Default )
def __init__(self, parent=None, signalManager=None, title=_("Generic Red-R Widget"), savePosition=True, wantGUIDialog=0, resizingEnabled=1, **args): """ Initialization Parameters: title - The title of the\ widget, including a "&" (for shortcut in about box) wantGraph - displays a save graph button or not """ # if resizingEnabled: QMainWindow.__init__(self, parent, Qt.Window) # else: #QMainWindow.__init__(self, parent, Qt.Dialog | Qt.MSWindowsFixedSizeDialogHint)# | Qt.WindowMinimizeButtonHint) # directories are better defined this way, otherwise .ini files get written in many places #self.__dict__.update(redREnviron.directoryNames) # self.setCaption(title.replace("&","")) # used for widget caption self.captionTitle = self._widgetInfo.widgetName self.progressBarHandler = None # handler for progress bar events self.processingHandler = None # handler for processing events self.widgetStateHandler = None self.widgetState = {"Info": {}, "Warning": {}, "Error": {}} self.windowState = {} self.savePosition = True self.hasBeenShown = False self.hasAdvancedOptions = wantGUIDialog self.setLayout(QVBoxLayout()) self.layout().setMargin(2) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) topWidgetPart = redRwidgetBox(self, orientation="vertical", margin=0) topWidgetPart.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.setCentralWidget(topWidgetPart) self.controlArea = redRwidgetBox(topWidgetPart, orientation="vertical", margin=4) self.controlArea.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.controlArea.setMinimumWidth(300) # topWidgetPart.layout().setAlignment(self.controlArea,Qt.AlignTop | Qt.AlignLeft) bottomArea = redRwidgetBox(topWidgetPart, orientation="horizontal", margin=4) self.bottomAreaLeft = redRwidgetBox(bottomArea, orientation='horizontal') self.bottomAreaCenter = redRwidgetBox(bottomArea, sizePolicy=QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed), orientation='horizontal') self.bottomAreaRight = redRwidgetBox(bottomArea, orientation='horizontal') #start widget GUI ### status bar ### self.statusBar = QStatusBar() self.statusBar.setLayout(QHBoxLayout()) self.statusBar.setSizeGripEnabled(False) self.setStatusBar(self.statusBar) self.RIndicator = redRwidgetLabel(self.statusBar) self.statusBar.addWidget(self.RIndicator) self.setRIndicator(False) self.status = redRStatusLabel(self.statusBar, '') self.status.setStatus(0) self.status.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) self.statusBar.addPermanentWidget(self.status, 4) #self.statusBar.setStyleSheet("QStatusBar { border-top: 2px solid gray; } ") # self.statusBar.setStyleSheet("QLabel { border-top: 2px solid red; } ") ################ # Notes Dock ### ################ minWidth = 200 self.notesDock = QDockWidget(_('Notes')) self.notesDock.setObjectName('widgetNotes') QObject.connect(self.notesDock, SIGNAL('topLevelChanged(bool)'), self.updateDock) self.notesDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self.notesDock.setMinimumWidth(minWidth) self.notesDock.setAllowedAreas(Qt.RightDockWidgetArea | Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea) self.addDockWidget(Qt.RightDockWidgetArea, self.notesDock) self.notesBox = redRwidgetBox(None, orientation=QVBoxLayout()) self.notesDock.setWidget(self.notesBox) self.notesBox.setMinimumWidth(minWidth) self.notesBox.setMinimumHeight(50) self.notesBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) redRwidgetLabel(self.notesBox, label="Notes:", icon=redRStyle.notesIcon) self.notes = redRtextEdit(self.notesBox, label=_('Notes'), displayLabel=False) self.notes.setMinimumWidth(minWidth) self.notes.setMinimumHeight(50) self.notes.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) ################ # R output ### ################ self.RoutputDock = QDockWidget(_('R Output')) self.RoutputDock.setObjectName('RoutputDock') QObject.connect(self.RoutputDock, SIGNAL('topLevelChanged(bool)'), self.updateDock) self.RoutputDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self.RoutputDock.setMinimumWidth(minWidth) self.RoutputDock.setAllowedAreas(Qt.RightDockWidgetArea | Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea) self.addDockWidget(Qt.RightDockWidgetArea, self.RoutputDock) self.ROutputBox = redRwidgetBox(None, orientation=QVBoxLayout()) self.RoutputDock.setWidget(self.ROutputBox) self.ROutputBox.setMinimumHeight(50) redRwidgetLabel(self.ROutputBox, label=_("R code executed in this widget:"), icon=redRStyle.RIcon) self.ROutput = redRtextEdit(self.ROutputBox, label=_('R Output'), displayLabel=False) self.ROutput.setMinimumWidth(minWidth) self.ROutput.setMinimumHeight(50) self.ROutput.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) redRbutton( self.ROutputBox, label=_('Run Selected Code'), callback=self._runSelectedRCode, toolTip= _('You may select any code to execute in the R session. This will override anything that other widgets have done to this point and will be overriden when this widget executes again. Use this with great caution.' )) ### help #### self.helpFile = None if hasattr(self, '_widgetInfo'): (file, ext) = os.path.basename(self._widgetInfo.fullName).split('.') path = os.path.join(redREnviron.directoryNames['libraryDir'], self._widgetInfo.package['Name'], 'help', file + '.html') if os.path.exists(path): self.helpFile = path if not self.helpFile: self.helpFile = 'http://www.red-r.org/documentation' ################ # Status Bar ### ################ self.windowState['documentationState'] = { 'notesBox': True, 'ROutputBox': False } docBox = redRwidgetBox(self.controlArea, orientation='horizontal', spacing=4) self.showNotesButton = redRbutton( docBox, '', toggleButton=True, icon=os.path.join(redREnviron.directoryNames['picsDir'], 'Notes-icon.png'), toolTip=_('Notes'), callback=self.updateDocumentationDock) self.showROutputButton = redRbutton( docBox, '', toggleButton=True, icon=os.path.join(redREnviron.directoryNames['picsDir'], 'R_icon.png'), toolTip=_('R Code'), callback=self.updateDocumentationDock) self.printButton = redRbutton( docBox, "", icon=os.path.join(redREnviron.directoryNames['picsDir'], 'printer_icon.png'), toolTip=_('Print'), callback=self.createReport) self.showHelpButton = redRbutton( docBox, '', icon=os.path.join(redREnviron.directoryNames['picsDir'], 'help_icon.png'), toolTip=_('Help'), callback=self.showHelp) self.includeInReport = redRbutton( docBox, '', icon=os.path.join(redREnviron.directoryNames['picsDir'], 'report_icon.png'), toolTip=_('Include In Report'), toggleButton=True) self.includeInReport.setChecked(True) ############################################### self.statusBar.addPermanentWidget(docBox) # self.statusBar.addPermanentWidget(self.showNotesButton) # self.statusBar.addPermanentWidget(self.showROutputButton) # self.statusBar.addPermanentWidget(self.showHelpButton) # self.statusBar.addPermanentWidget(self.printButton) # self.statusBar.addPermanentWidget(self.includeInReport) self.GUIDialogDialog = None self.windowState['leftDockState'] = False if self.hasAdvancedOptions: self.leftDock = QDockWidget(_('Advanced Options')) self.leftDock.setObjectName('leftDock') self.connect(self.leftDock, SIGNAL('topLevelChanged(bool)'), self.updateDock) self.leftDock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self.leftDock.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.addDockWidget(Qt.LeftDockWidgetArea, self.leftDock) self.GUIDialog = redRwidgetBox(self.leftDock, orientation='vertical') self.GUIDialog.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.leftDock.setWidget(self.GUIDialog) self.leftDockButton = redRbutton(self.bottomAreaLeft, _('Advanced Options'), toggleButton=True, callback=self.showLeftDock) self.statusBar.insertPermanentWidget(2, self.leftDockButton) self.windowState['leftDockState'] = True
def __init__(self, widget): redRdialog.__init__(self, widget, title=_('Package Manager')) self.setMinimumWidth(650) self.packageManager = packageManager ## GUI ## #### set up a screen that will show a listbox of packages that are on the system that should be updated, self.tabsArea = redRtabWidget(self) self.updatesTab = self.tabsArea.createTabPage(name=_('Updates')) self.installedTab = self.tabsArea.createTabPage( name=_('Installed Packages')) self.availableTab = self.tabsArea.createTabPage( name=_('Available Packages')) #### layout of the tabsArea self.treeViewUpdates = redRtreeWidget( self.updatesTab, label=_('Update List'), displayLabel=False, callback=self.updateItemClicked ) ## holds the tree view of all of the packages that need updating self.treeViewUpdates.setHeaderLabels([ _('Package'), _('Author'), _('Summary'), _('Current Version'), _('Current Version Stability'), _('New Version'), _('New Version Stability') ]) #self.treeViewUpdates.setSelectionModel(QItemSelectModel.Rows) self.treeViewUpdates.setSelectionMode( QAbstractItemView.ExtendedSelection) self.infoViewUpdates = redRtextEdit( self.updatesTab, label=_('Update Info'), displayLabel=False) ## holds the info for a package redRbutton(self.updatesTab, _('Install Updates'), callback=self.installUpdates) self.treeViewInstalled = redRtreeWidget( self.installedTab, label=_('Update List'), displayLabel=False, callback=self.installItemClicked) self.treeViewInstalled.setHeaderLabels([ _('Package'), _('Author'), _('Summary'), _('Version'), _('Stability') ]) #self.treeViewInstalled.setSelectionModel(QItemSelectModel.Rows) self.treeViewInstalled.setSelectionMode( QAbstractItemView.ExtendedSelection) self.infoViewInstalled = redRtextEdit(self.installedTab, label=_('Install Info'), displayLabel=False) redRbutton(self.installedTab, _('Remove Packages'), callback=self.uninstallPackages) self.treeViewAvailable = redRtreeWidget( self.availableTab, label=_('Update List'), displayLabel=False, callback=self.availableItemClicked) self.treeViewAvailable.setHeaderLabels([ _('Package'), _('Author'), _('Summary'), _('Version'), _('Stability') ]) #self.treeViewAvailable.setSelectionModel(QItemSelectModel.Rows) self.treeViewAvailable.setSelectionMode( QAbstractItemView.ExtendedSelection) self.infoViewAvailable = redRtextEdit(self.availableTab, label=_('Avaliable Info'), displayLabel=False) redRbutton(self.availableTab, _('Install Packages'), callback=self.installNewPackage) #### buttons and the like buttonArea2 = redRwidgetBox(self, orientation='horizontal') redRbutton(buttonArea2, label=_('Update from Repository'), callback=self.loadPackagesLists) redRwidgetBox(buttonArea2, sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed), orientation='horizontal') redRbutton(buttonArea2, label=_('Done'), callback=self.accept)
def __init__(self, canvasDlg, *args): apply(QDialog.__init__,(self,) + args) self.canvasDlg = canvasDlg self.settings = dict(redREnviron.settings) # create a copy of the settings dict. in case we accept the dialog, we update the redREnviron.settings with this dict if sys.platform == "darwin": self.setWindowTitle(_("Preferences")) else: self.setWindowTitle(_("Canvas Options")) self.topLayout = QVBoxLayout(self) self.topLayout.setSpacing(0) self.resize(350,300) self.toAdd = [] self.toRemove = [] self.tabs = QTabWidget(self) GeneralTab = OWGUI.widgetBox(self.tabs, margin = 4) GeneralTab.layout().setAlignment(Qt.AlignTop) # lookandFeel = OWGUI.widgetBox(self.tabs, margin = 4) # lookandFeel.layout().setAlignment(Qt.AlignTop) ExceptionsTab = OWGUI.widgetBox(self.tabs, margin = 4) ExceptionsTab.layout().setAlignment(Qt.AlignTop) RSettings = OWGUI.widgetBox(self.tabs, margin = 4) RSettings.layout().setAlignment(Qt.AlignTop) self.tabs.addTab(GeneralTab, "General") # self.tabs.addTab(lookandFeel, "Look and Feel") self.tabs.addTab(ExceptionsTab, "Exceptions & Logging") self.tabs.addTab(RSettings, _('R Settings')) QObject.connect(self.tabs, SIGNAL('currentChanged(int)'), self.onTabChange) #GeneralTab.layout().addStretch(1) # ################################################################# # GENERAL TAB generalBox = OWGUI.widgetBox(GeneralTab, _('General Options')) self.emailEdit = OWGUI.lineEdit(generalBox, self.settings, "email", _("Email Address:"), orientation = 'horizontal') # self.helpModeSelection = OWGUI.checkBox(generalBox,self.settings,'helpMode', # _('Show help icons')) self.dontAskBeforeCloseCB= OWGUI.checkBox(generalBox, self.settings, "dontAskBeforeClose", _("Don't ask to save schema before closing"), debuggingEnabled = 0) # ################################################################# # LOOK AND FEEL TAB # validator = QIntValidator(self) # validator.setRange(0,10000) lookFeelBox = OWGUI.widgetBox(GeneralTab, _("Look and Feel Options")) self.snapToGridCB = OWGUI.checkBox(lookFeelBox, self.settings, "snapToGrid", _("Snap widgets to grid"), debuggingEnabled = 0) self.showSignalNamesCB = OWGUI.checkBox(lookFeelBox, self.settings, "showSignalNames", _("Show signal names between widgets"), debuggingEnabled = 0) self.saveWidgetsPositionCB = OWGUI.checkBox(lookFeelBox, self.settings, "saveWidgetsPosition", _("Save size and position of widgets"), debuggingEnabled = 0) items = ["%d x %d" % (v,v) for v in redRStyle.iconSizeList] # val = min(len(items)-1, self.settings['schemeIconSize']) self.schemeIconSizeCombo = OWGUI.comboBoxWithCaption(lookFeelBox, self.settings, 'schemeIconSize', _("Scheme icon size:"), items = items, tooltip = _("Set the size of the widget icons on the scheme"), debuggingEnabled = 0) # redREnviron.settings["toolbarIconSize"] = min(len(items)-1, redREnviron.settings["toolbarIconSize"]) self.toolbarIconSizeCombo = OWGUI.comboBoxWithCaption(lookFeelBox, self.settings, "toolbarIconSize", _("Widget Tree Icon size:"), items = items, tooltip = _("Set the size of the widget icons in the toolbar, tool box, and tree view area"), debuggingEnabled = 0) # hbox1 = OWGUI.widgetBox(GeneralTab, orientation = "horizontal") # canvasDlgSettings = OWGUI.widgetBox(hbox1, "Canvas Dialog Settings") # schemeSettings = OWGUI.widgetBox(hbox1, "Scheme Settings") # self.widthSlider = OWGUI.qwtHSlider(canvasDlgSettings, self.settings, "canvasWidth", # minValue = 300, maxValue = 1200, label = "Canvas width: ", step = 50, precision = " %.0f px", debuggingEnabled = 0) # self.heightSlider = OWGUI.qwtHSlider(canvasDlgSettings, self.settings, "canvasHeight", # minValue = 300, maxValue = 1200, label = "Canvas height: ", step = 50, precision = " %.0f px", debuggingEnabled = 0) # OWGUI.separator(canvasDlgSettings) OWGUI.comboBox(lookFeelBox, self.settings, "style", label = _("Window style:"), orientation = "horizontal", items = redRStyle.QtStyles, sendSelectedValue = 1, debuggingEnabled = 0) OWGUI.checkBox(lookFeelBox, self.settings, "useDefaultPalette", _("Use style's standard palette"), debuggingEnabled = 0) self.language = comboBox(lookFeelBox, label = _('Language'), items = [u'English', u'Fran\u00E7aise', u'Deutsch']) # selectedWidgetBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal") # self.selectedWidgetIcon = ColorIcon(selectedWidgetBox, redRStyle.widgetSelectedColor) # selectedWidgetBox.layout().addWidget(self.selectedWidgetIcon) # selectedWidgetLabel = OWGUI.widgetLabel(selectedWidgetBox, " Selected widget") # activeWidgetBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal") # self.activeWidgetIcon = ColorIcon(activeWidgetBox, redRStyle.widgetActiveColor) # activeWidgetBox.layout().addWidget(self.activeWidgetIcon) # selectedWidgetLabel = OWGUI.widgetLabel(activeWidgetBox, " Active widget") # activeLineBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal") # self.activeLineIcon = ColorIcon(activeLineBox, redRStyle.lineColor) # activeLineBox.layout().addWidget(self.activeLineIcon) # selectedWidgetLabel = OWGUI.widgetLabel(activeLineBox, " Active Lines") # inactiveLineBox = OWGUI.widgetBox(schemeSettings, orientation = "horizontal") # self.inactiveLineIcon = ColorIcon(inactiveLineBox, redRStyle.lineColor) # inactiveLineBox.layout().addWidget(self.inactiveLineIcon) # selectedWidgetLabel = OWGUI.widgetLabel(inactiveLineBox, " Inactive Lines") # ################################################################# # EXCEPTION TAB debug = OWGUI.widgetBox(ExceptionsTab, _("Debug")) # self.setDebugModeCheckBox = OWGUI.checkBox(debug, self.settings, "debugMode", "Set to debug mode") # sets the debug mode of the canvas. self.verbosityCombo = OWGUI.comboBox(debug, self.settings, "outputVerbosity", label = _("Set level of widget output: "), orientation='horizontal', items=redRLog.logLevelsName) self.displayTraceback = OWGUI.checkBox(debug, self.settings, "displayTraceback", _('Display Traceback')) # self.exceptionLevel = redRSpinBox(debug, label = 'Exception Print Level:', toolTip = 'Select the level of exception that will be printed to the Red-R general output', min = 0, max = 9, value = redREnviron.settings['exceptionLevel']) # self.otherLevel = redRSpinBox(debug, label = 'General Print Level:', toolTip = _('Select the level of general logging that will be output to the general output'), min = 0, max = 9, value = redREnviron.settings['minSeverity']) exceptions = OWGUI.widgetBox(ExceptionsTab, _("Exceptions")) #self.catchExceptionCB = QCheckBox(_('Catch exceptions'), exceptions) self.focusOnCatchExceptionCB = OWGUI.checkBox(exceptions, self.settings, "focusOnCatchException", _('Show output window on exception')) # self.printExceptionInStatusBarCB = OWGUI.checkBox(exceptions, self.settings, "printExceptionInStatusBar", _('Print last exception in status bar')) self.printExceptionInStatusBarCB = OWGUI.checkBox(exceptions, self.settings, "uploadError", _('Submit Error Report')) self.printExceptionInStatusBarCB = OWGUI.checkBox(exceptions, self.settings, "askToUploadError", _('Always ask before submitting error report')) output = OWGUI.widgetBox(ExceptionsTab, _("Log File")) #self.catchOutputCB = QCheckBox(_('Catch system output'), output) self.writeLogFileCB = OWGUI.checkBox(output, self.settings, "writeLogFile", _("Save content of the Output window to a log file")) hbox = OWGUI.widgetBox(output, orientation = "horizontal") self.logFile = OWGUI.lineEdit(hbox, self.settings, "logFile", _("Log File:"), orientation = 'horizontal') self.okButton = OWGUI.button(hbox, self, _("Browse"), callback = self.browseLogFile) self.showOutputLog = redRbutton(output, label = _('Show Log File'), callback = self.showLogFile) self.numberOfDays = redRSpinBox(output, label = 'Keep File for X days:', min = -1, value = self.settings['keepForXDays'], callback = self.numberOfDaysChanged) # self.focusOnCatchOutputCB = OWGUI.checkBox(output, self.settings, "focusOnCatchOutput", _('Focus output window on system output')) # self.printOutputInStatusBarCB = OWGUI.checkBox(output, self.settings, "printOutputInStatusBar", _('Print last system output in status bar')) ExceptionsTab.layout().addStretch(1) ##################################### # R Settings Tab self.rlibrariesBox = OWGUI.widgetBox(RSettings, _('R Libraries')) self.libInfo = redRwidgetLabel(self.rlibrariesBox, label='Repository URL: '+ self.settings['CRANrepos']) ################################ Global buttons ###################### # OK, Cancel buttons hbox = OWGUI.widgetBox(self, orientation = "horizontal", sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)) hbox.layout().addStretch(1) self.okButton = OWGUI.button(hbox, self, _("OK"), callback = self.accept) self.cancelButton = OWGUI.button(hbox, self, _("Cancel"), callback = self.reject) #self.connect(self.tabOrderList, SIGNAL("currentRowChanged(int)"), self.enableDisableButtons) self.topLayout.addWidget(self.tabs) self.topLayout.addWidget(hbox)