本文整理汇总了Python中redRLog.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: instances
def instances(wantType = 'list'):
global _widgetInstances
if wantType == 'list':## return all of the instances in a list
redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, _('Widget instances are %s') % unicode(_widgetInstances.values()))
return _widgetInstances.values()
else:
return _widgetInstances
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:7,代码来源:redRObjects.py
示例2: isPickleable
def isPickleable(self,d): # check to see if the object can be included in the pickle file
# try:
# cPickle.dumps(d)
# return True
# except:
# return False
import re
if re.search('PyQt4|OWGUIEx|OWToolbars',unicode(type(d))) or d.__class__.__name__ in redRGUI.qtWidgets:
return False
elif type(d) in [list, dict, tuple]:
if type(d) in [list, tuple]:
for i in d:
if self.isPickleable(i) == False:
return False
return True
elif type(d) in [dict]:
for k in d.keys():
if self.isPickleable(d[k]) == False:
#ok = False
return False
return True
elif type(d) in [type(None), str,unicode, int, float, bool, numpy.float64]: # list of allowed save types, may epand in the future considerably
return True
elif isinstance(d, signals.BaseRedRVariable):
return True
else:
redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, 'Type ' + unicode(d) + ' is not supported at the moment..') # notify the developer that the class that they are using is not saveable
return False
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:30,代码来源:widgetSession.py
示例3: getWidgetInstanceByID
def getWidgetInstanceByID(wid):
global _widgetInstances
#redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, 'Loading widget %s keys are %s' % (id, _widgetInstances.keys()))
try:
return _widgetInstances[wid]
except Exception as inst:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, _('Error in locating widget %s, available widget ID\'s are %s' % (wid, _widgetInstances.keys())))
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:7,代码来源:redRObjects.py
示例4: restartRedR
def restartRedR(self):
print 'in restartRedR'
#os specific function to start a new red-R instance
try:
if sys.platform =='win32':
if redREnviron.version['TYPE']=='compiled':
cmd = '"%s"' % os.path.join(redREnviron.directoryNames['redRDir'],'bin','red-RCanvas.exe')
else:
cmd = 'pythonw "%s"' % os.path.join(redREnviron.directoryNames['redRDir'],'canvas','red-RCanvas.pyw')
elif sys.platform == 'linux2':
cmd = 'python "%s"' % os.path.join(redREnviron.directoryNames['redRDir'],'canvas','red-RCanvas.pyw')
elif sys.platform =='darwin':
cmd = 'open -Wn /Applications/Red-R.app'
else:
raise Exception('Your os is not supported for restart')
print cmd
r = QProcess.startDetached(cmd)
print 'on open', r
if r:
self.canvas.close()
return
else:
raise Exception('Problem restarting Red-R.')
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR,'Red-R could not be restarted. Please restart manually.')
redRLog.log(redRLog.REDRCORE, redRLog.DEBUG,redRLog.formatException())
mb = QMessageBox(_("Error"), _("Please restart Red-R."),
QMessageBox.Information, QMessageBox.Ok | QMessageBox.Default,
QMessageBox.NoButton, QMessageBox.NoButton, self.canvas)
mb.exec_()
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:33,代码来源:redRCanvasToolbar.py
示例5: eventFilter
def eventFilter(self, object, ev):
try: # a wrapper that prevents problems for the listbox debigging should remove this
if object != self.listWidget and object != self:
return 0
if ev.type() == QEvent.MouseButtonPress:
self.listWidget.hide()
return 1
consumed = 0
if ev.type() == QEvent.KeyPress:
consumed = 1
if ev.key() in [Qt.Key_Enter, Qt.Key_Return]:
#print _('Return pressed')
self.doneCompletion()
elif ev.key() == Qt.Key_Escape:
self.listWidget.hide()
#self.setFocus()
elif ev.key() in [Qt.Key_Up, Qt.Key_Down, Qt.Key_Home, Qt.Key_End, Qt.Key_PageUp, Qt.Key_PageDown]:
self.listWidget.setFocus()
self.listWidget.event(ev)
else:
#self.setFocus()
self.event(ev)
return consumed
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
return 0
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:28,代码来源:orngTabs.py
示例6: removeWidgetIcon
def removeWidgetIcon(icon):
global _widgetIcons
for t in _widgetIcons.values():
redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, _('widget icon values %s') % str(t))
while icon in t:
redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, _('removing widget icon instance %s') % icon)
t.remove(icon)
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:7,代码来源:redRObjects.py
示例7: getSettings
def getSettings(self):
"""collects settings for the save function, these will be included in the output file. Called in orngDoc during save."""
redRLog.log(redRLog.REDRCORE, redRLog.DEBUG, 'moving to save'+unicode(self.captionTitle))
import re
settings = {}
if self.saveSettingsList: ## if there is a saveSettingsList then we just append the required elements to it.
allAtts = self.saveSettingsList + self.requiredAtts
else:
allAtts = self.__dict__
self.progressBarInit()
i = 0
for att in allAtts:
try:
if att in self.dontSaveList or re.search('^_', att): continue
i += 1
self.progressBarAdvance(i)
var = getattr(self, att)
settings[att] = self.returnSettings(var)
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR,redRLog.formatException())
#print 'saving custom settings'
settings['_customSettings'] = self.saveCustomSettings()
#print 'processing sent items'
tempSentItems = self.processSentItems()
#print 'appending sent items'
settings['sentItems'] = {'sentItemsList':tempSentItems}
self.progressBarFinished()
return settings
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:28,代码来源:widgetSession.py
示例8: createFavoriteWidgetTabs
def createFavoriteWidgetTabs(self, widgetRegistry, widgetDir, picsDir, defaultPic):
# populate the favorites widget, we will want to repopulate this when a widget is added
try:
ffile = os.path.abspath(redREnviron.directoryNames['redRDir'] + '/tagsSystem/favorites.xml')
f = open(ffile, 'r')
except: # there was an exception, the user might not have the favorites file, we need to make one and set a default settings
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
self.insertFavoriteWidgetTab(_('Favorites'), 1) # make a favorites tab
return
favTabs = xml.dom.minidom.parse(f)
f.close()
treeXML = favTabs.childNodes[0] # everything is contained within the Favorites
#print _('Favorites') + unicode(treeXML.childNodes)
#loop to make the catagories
for node in treeXML.childNodes: # put the child nodes into the widgets
if node.nodeName == 'group':
tab = self.insertFavoriteWidgetTab(unicode(node.getAttribute('name')), 1)
self.insertFavoriteChildTabs(node, tab, widgetRegistry)
self.insertFavoriteWidgets(node, tab, widgetRegistry)
if hasattr(tab, "adjustSize"):
tab.adjustSize()
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:26,代码来源:orngTabs.py
示例9: saveWidgetObjects
def saveWidgetObjects(widgetID):
global _rObjects
if widgetID not in _rObjects:
return
if _rObjects[widgetID]["state"]:
_rObjects[widgetID]["timer"].stop()
redRLog.log(redRLog.REDRCORE, redRLog.DEVEL, _("R objects from widgetID %s were collapsed (saved)") % widgetID)
if RSession.mutex.tryLock(): # means the mutex is locked
RSession.mutex.unlock()
R(
'save(%s, file = "%s")'
% (
",".join(_rObjects[widgetID]["vars"]),
os.path.join(redREnviron.directoryNames["tempDir"], widgetID).replace("\\", "/"),
),
wantType="NoConversion",
silent=True,
)
_rObjects[widgetID]["state"] = 0
redRObjects.getWidgetInstanceByID(widgetID).setDataCollapsed(True)
for v in _rObjects[widgetID]["vars"]:
R('if(exists("%s")){rm("%s")}' % (v, v), wantType="NoConversion", silent=True)
setTotalMemory()
else: # the session is locked so the data wasn't really saved. We add time to the timer and try next time.
# RSession.mutex.unlock()
extendTimer(widgetID)
开发者ID:ncdingari,项目名称:r-orange,代码行数:26,代码来源:redRRObjects.py
示例10: loadRequiredPackages
def loadRequiredPackages(required, loadingProgressBar):
try: # protect the required functions in a try statement, we want to load these things and they should be there but we can't force it to exist in older schemas, so this is in a try.
required = cPickle.loads(required)
if len(required) > 0:
if 'CRANrepos' in redREnviron.settings.keys():
repo = redREnviron.settings['CRANrepos']
else:
repo = None
loadingProgressBar.setLabelText(_('Loading required R Packages. If not found they will be downloaded.\n This may take a while...'))
RSession.require_librarys(required['R'], repository=repo)
installedPackages = redRPackageManager.getInstalledPackages()
downloadList = {}
print type(required['RedR'])
#print required['RedR']
for name,package in required['RedR'].items():
#print package
if (package['Name'] not in installedPackages.keys()) or (float(package['Version']['Number']) > float(installedPackages[package['Name']]['Version']['Number'])):
print 'my package number %s' % str(float(installedPackages[package['Name']]['Version']['Number'])), 'their package number %s' % str(float(package['Version']['Number']))
downloadList[package['Name']] = {'Version':unicode(package['Version']['Number']), 'installed':False}
if len(downloadList.keys()) > 0:
pm = redRPackageManager.packageManager(canvasDlg)
pm.show()
pm.askToInstall(downloadList, _('The following packages need to be installed before the session can be loaded.'))
except Exception as inst:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, _('redRSaveLoad loadRequiredPackages; error loading package %s') % inst)
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:28,代码来源:redRSaveLoad.py
示例11: insertWidgets
def insertWidgets(self, itab, tab, widgetRegistry):
"""Inserts widgt icons into the named tab"""
try:
addingWidgets = []
for widgetInfo in widgetRegistry['widgets'].values():
for t in widgetInfo.tags:
if type(t) == tuple:
if t[0] == unicode(itab):
addingWidgets.append((widgetInfo, t[1]))
else:
# debugging print t
if t == unicode(itab):
addingWidgets.append((widgetInfo, 0))
# debugging print addingWidgets
addingWidget = sorted(addingWidgets, key = lambda info: info[1]) ## now things are sorted on the widget values.
for widgetInfo, val in addingWidget:
try:
button = WidgetTreeItem(tab, widgetInfo.name, widgetInfo, self, self.canvasDlg)
if button not in tab.widgets:
tab.widgets.append(button)
self.allWidgets.append(button)
except Exception as inst:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
# debugging print inst
pass
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
pass
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:30,代码来源:redRWidgetsTree.py
示例12: eventFilter
def eventFilter(self, object, ev):
try: # a wrapper that prevents problems for the listbox debigging should remove this
#print type(self)
try: # apparently calls are sent to this widget without the listWidget existing. Still don't know why but this catches the error.
if object != self.listWidget and object != self:
return 0
if ev.type() == QEvent.MouseButtonPress:
self.listWidget.hide()
return 1
except: return 0
consumed = 0
if ev.type() == QEvent.KeyPress:
consumed = 1
if ev.key() in [Qt.Key_Enter, Qt.Key_Return]:
self.doneCompletion()
elif ev.key() == Qt.Key_Escape:
self.listWidget.hide()
# self.setFocus()
elif ev.key() in [Qt.Key_Up, Qt.Key_Down, Qt.Key_Home, Qt.Key_End, Qt.Key_PageUp, Qt.Key_PageDown]:
self.listWidget.setFocus()
self.listWidget.event(ev)
else:
# self.setFocus()
self.event(ev)
return consumed
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
return 0
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:29,代码来源:redRCanvasToolbar.py
示例13: boundingRect
def boundingRect(self):
# get the width of the widget's caption
pixmap = QPixmap(200,40)
painter = QPainter()
painter.begin(pixmap)
width = max(0, painter.boundingRect(QRectF(0,0,200,40), Qt.AlignLeft, self.caption).width() - 60) / 2
painter.end()
#rect = QRectF(-10-width, -4, +10+width, +25)
rect = QRectF(QPointF(0, 0), self.widgetSize).adjusted(-10-width, -4, +10+width, +25)
if not self.ghost:
try:
if self.progressBarShown:
rect.setTop(rect.top()-20)
inst = self.instance()
if inst != None:
widgetState = inst.widgetState
if widgetState.get("Info", {}).values() + widgetState.get("Warning", {}).values() + widgetState.get("Error", {}).values() != []:
rect.setTop(rect.top()-21)
else:
## remove self.
self.remove()
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
return rect
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:25,代码来源:orngCanvasItems.py
示例14: log
def log(self, comment, level = redRLog.DEVEL):
"""Class implemnetation of logging
Passes parameters to the :mod:`redRLog` module.
"""
#if not self.widgetID: self.widgetID = 1
redRLog.log(redRLog.REDRWIDGET,level,comment)
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:7,代码来源:OWRpy.py
示例15: updateListBoxItems
def updateListBoxItems(self, callCallback = 1):
if not self.listbox: return
last = self.getText()
tuples = self.listboxItems
if not self.caseSensitive:
tuples = [(text.lower(), item) for (text, item) in tuples]
last = last.lower()
if self.useRE:
try:
pattern = re.compile(last)
tuples = [(text, QListWidgetItem(item)) for (text, item) in tuples if pattern.match(text)]
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
tuples = [(t, QListWidgetItem(i)) for (t,i) in self.listboxItems] # in case we make regular expressions crash we show all items
else:
if self.matchAnywhere: tuples = [(text, QListWidgetItem(item)) for (text, item) in tuples if last in text]
else: tuples = [(text, QListWidgetItem(item)) for (text, item) in tuples if text.startswith(last)]
self.listbox.clear()
for (t, item) in tuples:
self.listbox.addItem(item)
if self.callback and callCallback:
self.callback()
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:26,代码来源:OWGUIEx.py
示例16: execUpdate
def execUpdate(self,file):
installDir = os.path.split(os.path.abspath(redREnviron.directoryNames['redRDir']))[0]
######## WINDOWS ##############
if sys.platform =='win32':
cmd = "%s /D=%s" % (file,installDir)
try:
shell.ShellExecuteEx(shellcon.SEE_MASK_NOCLOSEPROCESS,0,'open',file,"/D=%s" % installDir,
redREnviron.directoryNames['downloadsDir'],0)
# win32process.CreateProcess('Red-R update',cmd,'','','','','','','')
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR,redRLog.formatException())
mb = QMessageBox(_("Error"), _("There was an Error in updating Red-R."),
QMessageBox.Information, QMessageBox.Ok | QMessageBox.Default,
QMessageBox.NoButton, QMessageBox.NoButton, self.schema)
mb.exec_()
######## MAC ##############
elif sys.platform =='darwin':
cmd = '%s %s %s %s' % (os.path.join(redREnviron.directoryNames['redRDir'],'MacOS','python'),
os.path.join(redREnviron.directoryNames['redRDir'],'redRMacUpdater.py'), file, installDir)
print cmd
r = QProcess.startDetached(cmd)
######## Linux ############
elif sys.platform == 'linux2':
cmd = 'python %s %s %s' % (os.path.join(redREnviron.directoryNames['redRDir'], 'redRLinuxUpdater.py'), file, installDir)
print cmd
r = QProcess.startDetached(cmd)
else:
raise Exception('Update instructions are not present for the %s platform' % sys.platform)
self.app.exit(1)
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:33,代码来源:redRUpdateManager.py
示例17: parseUpdatesXML
def parseUpdatesXML(self,fileName):
try:
f = open(fileName, 'r')
updatesXML = xml.dom.minidom.parse(f)
f.close()
update = {}
update['redRVersion'] = self.getXMLText(updatesXML.getElementsByTagName('redRVersion')[0].childNodes)
if sys.platform=="win32":
updatesNode = updatesXML.getElementsByTagName('win32')[0]
elif sys.platform=="darwin":
updatesNode = updatesXML.getElementsByTagName('mac')[0]
elif sys.platform == 'linux2':
updatesNode = updatesXML.getElementsByTagName('linux')[0]
if updatesNode and updatesNode != None:
if redREnviron.version['TYPE'] =='compiled':
update['url'] = self.getXMLText(updatesNode.getElementsByTagName('compiled')[0].childNodes)
elif redREnviron.version['TYPE'] =='src':
update['url'] = self.getXMLText(updatesNode.getElementsByTagName('src')[0].childNodes)
else:
raise Exception('Unknown type')
return False
update['SVNVersion'] = self.getXMLText(updatesNode.getElementsByTagName('SVNVersion')[0].childNodes)
update['date'] = self.getXMLText(updatesNode.getElementsByTagName('date')[0].childNodes)
update['changeLog'] = self.getXMLText(updatesNode.getElementsByTagName('changeLog')[0].childNodes)
return update
except:
redRLog.log(redRLog.REDRCORE,redRLog.ERROR,'Red-R update information cannot be downloaded.')
redRLog.log(redRLog.REDRCORE,redRLog.DEBUG,redRLog.formatException())
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:32,代码来源:redRUpdateManager.py
示例18: closeEvent
def closeEvent(self, ce, postCloseFun=None):
# save the current width of the toolbox, if we are using it
# if isinstance(self.widgetsToolBar, orngTabs.WidgetToolBox):
# redREnviron.settings["toolboxWidth"] = self.widgetsToolBar.toolbox.width()
# redREnviron.settings["showWidgetToolbar"] = self.widgetsToolBar.isVisible()
# redREnviron.settings["showToolbar"] = self.toolbar.isVisible()
# qtsettings = QSettings("Red-R", "Red-R")
# qtsettings.setValue("geometry", saveGeometry())
# qtsettings.setValue("windowState", saveState())
try:
#ce.accept()
redREnviron.settings["geometry"] = self.saveGeometry()
redREnviron.settings["windowState"] = self.saveState()
redREnviron.settings['pos'] = self.pos()
redREnviron.settings['size'] = self.size()
redREnviron.saveSettings()
# closed = self.schema.close()
if redREnviron.settings['dontAskBeforeClose']:
res = QMessageBox.No
else:
res = QMessageBox.question(self, _('Red-R Canvas'),_('Do you wish to save the schema?'), QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel)
if res == QMessageBox.Yes:
self.RVariableRemoveSupress = 1
#saveComplete =
closed=redRSaveLoad.saveDocument()
elif res == QMessageBox.No:
closed=True
else:
closed=False
if closed:
if postCloseFun:
print 'asdfasdfasfd'
r = postCloseFun()
print 'a', r
self.canvasIsClosing = 1 # output window (and possibly report window also) will check this variable before it will close the window
redRObjects.closeAllWidgets() # close all the widget first so their global data is saved
import shutil
shutil.rmtree(redREnviron.directoryNames['tempDir'], True) # remove the tempdir, better hope we saved everything we wanted.
# close the entire session dropping anything that was open in case it was left by something else,
# makes the closing much cleaner than just loosing the session.
redRHistory.saveConnectionHistory()
redRLog.fileLogger.closeLogFile()
#redRLog.closeLogger()
ce.accept()
QMainWindow.closeEvent(self,ce)
else:
ce.ignore()
except Exception as inst:
redRLog.log(redRLog.REDRCORE, redRLog.CRITICAL, 'Error closing session: %s' % unicode(inst))
ce.ignore()
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:59,代码来源:redRApplication.py
示例19: copy
def copy():
## copy the selected files and reload them as templates in the schema
activeIcons = collectIcons()
if len(activeIcons) == 0: return
redRLog.log(redRLog.REDRCORE, redRLog.INFO, _('Making a copy with widgets %s') % _tempWidgets)
makeTemplate(filename = redREnviron.directoryNames['tempDir']+'/copy.rrts', copy=True)
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:8,代码来源:redRSaveLoad.py
示例20: assign
def assign(name, object):
try:
rpy.r.assign(name, object)
redRLog.log(redRLog.R, redRLog.DEBUG, _('Assigned object to %s') % name)
return True
except:
redRLog.log(redRLog.REDRCORE, redRLog.ERROR, redRLog.formatException())
return False
开发者ID:MatthewASimonson,项目名称:r-orange,代码行数:8,代码来源:RSession.py
注:本文中的redRLog.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论