本文整理汇总了Python中PyQt4.QtCore.qWarning方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.qWarning方法的具体用法?Python QtCore.qWarning怎么用?Python QtCore.qWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore
的用法示例。
在下文中一共展示了QtCore.qWarning方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_resource
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def new_resource(host, resource):
if resource.dev_type != 'tiqi.devil.channel':
return
# Close all the existing channels, if any.
nid = resource.dev_id
c = channels_for_dev_ids.get(nid, None)
if c:
QtC.qDebug(' :: Ignoring channel {}, already registered'.format(
nid))
return
QtC.qDebug(' :: Discovered new channel: {}'.format(resource))
if resource.version.major != 2:
QtC.qWarning(' :: Ignoring EVIL version {} @ {} ({})'.format(
resource.version, host, resource.display_name))
return
def on_disconnect():
channels_for_dev_ids.pop(nid)
node.broadcast_enumeration_request()
channels_for_dev_ids[nid] = Pusher(db, Evil2Channel(zmq_ctx, host,
resource),
on_disconnect)
示例2: _got_notification
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def _got_notification(self, msg):
try:
msg_type, method, params = msgpack.unpackb(msg, encoding='utf-8')
if msg_type != MSGPACKRPC_NOTIFICATION:
self._rpc_error(
'Expected msgpack-rpc notification, but got: {}'.format(
type))
return
if method == 'registerChanged':
idx, value = params
self._reg_idx_to_object[idx].set_from_remote_notification(value)
return
if method == 'streamAcquisitionConfigChanged':
time_span_seconds, points = params
self._stream_acquisition_config = (time_span_seconds, points)
self.stream_acquisition_config_changed.emit(
*self._stream_acquisition_config)
return
if method == 'shutdown':
self._shutdown()
return
QtC.qWarning(
'Received unknown notification type: {}{}'.format(method,
params))
except Exception as e:
self._rpc_error('Error while handling notification: {} ({})'.format(e, type(e)))
示例3: _channel_connection_failed
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def _channel_connection_failed(self, msg):
QtC.qWarning('[{}] Connection failed: {}'.format(
self.sender().resource.display_name, msg))
# Immediately rescan to swiftly recover from intermittent connection
# problems.
self.force_rescan.emit()
示例4: setRange
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def setRange(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
QtCore.qWarning("LCDRange::setRange(%d, %d)\n"
"\tRange must be 0..99\n"
"\tand minValue must not be greater than maxValue" % (minValue, maxValue))
return
self.slider.setRange(minValue, maxValue)
示例5: importSet
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def importSet (module, name):
""" Import a set of data """
QtCore.qWarning ("Importing %s" % name)
try:
__import__ (module)
except dbapi2.IntegrityError, e:
QtGui.QMessageBox.critical(None, QtGui.qApp.tr("Error importing data"),
QtGui.qApp.tr("Message returned by database is:.\n"
"\"%s\"" % e), QtGui.QMessageBox.Ok)
示例6: update_plot
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def update_plot(self):
try:
dump, value = self._rosdata.next()
if value:
self.value_uncap = round(value.pop(),1)
#print value
if len(value)>0:
self.set_gauge(self.value_uncap)
self.update_plot_timer.start(self.redraw_interval)
except RosPlotException as e:
QtCore.qWarning('PlotWidget.update_plot(): error in rosplot: %s' % e)
示例7: new_resource
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def new_resource(host, resource):
if resource.dev_type != 'tiqi.devil.channel':
return
if resource.dev_id in [c.channel.resource.dev_id for c in
device_list.guichannels]:
# Resource already exists, ignore.
return
if resource.version.major == 2:
device_list.register(Evil2Channel(zmq_ctx, host, resource),
lambda *args: create_evil2_control_panel(VERSION_STRING, *args))
else:
QtC.qWarning('Cannot handle EVIL version {}, ignoring'.format(
resource.version))
示例8: createDatabase
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def createDatabase ():
""" If the database is empty create new tables and populate them with some
data """
def importSet (module, name):
""" Import a set of data """
QtCore.qWarning ("Importing %s" % name)
try:
__import__ (module)
except dbapi2.IntegrityError, e:
QtGui.QMessageBox.critical(None, QtGui.qApp.tr("Error importing data"),
QtGui.qApp.tr("Message returned by database is:.\n"
"\"%s\"" % e), QtGui.QMessageBox.Ok)
else:
QtCore.qWarning ("%s imported sucessfuly" % name )
try:
eyeColor.createTable ()
plumageColor.createTable()
nation.createTable ()
yearColor.createTable()
pigeon.createTable()
pair.createTable()
LANG = locale.getdefaultlocale ()[0][0:2] #Getting the first part of the locale name
if not os.path.isdir (os.path.join ("data", LANG)):
QtCore.qWarning ("There is no data for locale %s" % LANG)
LANG = "es"
QtCore.qWarning ("Using '%s' data" % LANG)
#TODO: if there is not data set for the locale use default ones (spanish?)
示例9: qt_exception_hook
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def qt_exception_hook(ex_type, ex_value, ex_traceback):
QtCore.qWarning('Sorry, an internal error occurred. Could you please send the authors the text below and a brief note about what you were doing? Thanks!\n\n'+
'\n'.join(traceback.format_exception(ex_type, ex_value, ex_traceback)))
示例10: _channel_shutdown
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def _channel_shutdown(self):
QtC.qWarning(' :: Channel "{}" shutting down'.format(
self._channel.resource.display_name))
self._on_disconnect()
示例11: _channel_failed
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def _channel_failed(self, msg):
QtC.qWarning(' :: Channel "{}" failed: {}'.format(
self._channel.resource.display_name, msg))
self._on_disconnect()
示例12: drawComplexControl
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def drawComplexControl(self, cc, option, painter, widget):
if (cc == self.CC_Slider):
painter.setRenderHints(QtGui.QPainter.Antialiasing)
#print(cc, option, painter, widget, type(option), option.Type)
if (not isinstance(option, QtGui.QStyleOptionSlider)):
QtCore.qWarning("SeekStyle: Drawing an unmanaged control")
super(SeekStyle, self).drawComplexControl(cc, option, painter, widget)
return
slider = option
seekSlider = widget if (isinstance(widget, SeekSlider)) else None
sliderPos = -1
#Get the needed subcontrols to draw the slider
groove = self.subControlRect(self.CC_Slider, option, self.SC_SliderGroove)
handle = self.subControlRect(self.CC_Slider, option, self.SC_SliderHandle)
# TODO: better solution! For some reason the height is 0 or -1
handle.setHeight(handle.width())
groove.setHeight(widget.height())
#Adjust the size of the groove so the handle stays centered
groove.adjust(handle.width() / 2, 0, -handle.width() / 2, 0)
#Reduce the height of the groove
# -> see Original code for -1 explanation
groove.adjust(0, groove.height() / 3.7, 0, -groove.height() / 3.7 - 1)
#root_logger.debug("Groove: %i, %i, %i, %i Handle: %i, %i, %i, %i"%(groove.left(), groove.width(), groove.top(), groove.height(),
# handle.left(), handle.width(), handle.top(), handle.height()))
if ((option.subControls & self.SC_SliderGroove) and groove.isValid()):
#root_logger.getChild("SeekStyle").debug("Drawing Groove")
sliderPos = (groove.width() / slider.maximum) * slider.sliderPosition
#Set the background color and gradient
backgroundBase = slider.palette.window().color()
backgroundGradient = QtGui.QLinearGradient(0, 0, 0, slider.rect.height())
backgroundGradient.setColorAt(0.0, backgroundBase.darker(140))
backgroundGradient.setColorAt(1.0, backgroundBase)
#Set the foreground color and gradient
foregroundBase = QtGui.QColor(50, 156, 255)
foregroundGradient = QtGui.QLinearGradient(0, 0, 0, groove.height())
foregroundGradient.setColorAt(0.0, foregroundBase)
foregroundGradient.setColorAt(1.0, foregroundBase.darker(125))
#Draw a slight 3D effect on the bottom
painter.setPen(QtGui.QColor(23, 230, 230))
painter.setBrush(QtCore.Qt.NoBrush)
painter.drawRoundedRect(groove.adjusted(0, 2, 0, 0), SEEK_RADIUS, SEEK_RADIUS)
#Draw background
painter.setPen(QtCore.Qt.NoPen)
painter.setBrush(backgroundGradient)
painter.drawRoundedRect(groove, SEEK_RADIUS, SEEK_RADIUS)
#Adjusted foreground rectangle
valueRect = groove.adjusted(1, 1, -1, 0)
valueRect.setWidth(sliderPos)
#Draw foreground
if (slider.sliderPosition > slider.minimum and slider.sliderPosition <= slider.maximum):
painter.setPen(QtCore.Qt.NoPen)
painter.setBrush(foregroundGradient)
painter.drawRoundedRect(valueRect, SEEK_RADIUS, SEEK_RADIUS)
#Draw buffering overlay
if (seekSlider and seekSlider.f_buffering < 1.0):
innerRect = groove.adjusted(1, 1,
groove.width() * (-1.0 + seekSlider.f_buffering) - 1,
0)
overlayColor = QtGui.QColor("Orange")
overlayColor.setAlpha(128)
painter.setBrush(overlayColor)
painter.drawRoundedRect(innerRect, SEEK_RADIUS, SEEK_RADIUS)
if (option.subControls & self.SC_SliderTickmarks):
tempSlider = QtGui.QStyleOptionSlider(slider)
tempSlider.subControls = self.SC_SliderTickmarks
super(SeekSlider, self).drawComplexControl(cc, tempSlider, painter, widget)
if ((option.subControls & self.SC_SliderHandle) and handle.isValid()):
#Useful for debugging:
#root_logger.getChild("SeekStyle").debug("Drawing Handle")
#painter.setBrush(QtGui.QBrush(QtGui.QColor(0, 0, 255, 150)))
#painter.drawRect(handle)
p = slider.palette
if (option.state & QtGui.QStyle.State_MouseOver or (seekSlider and seekSlider.isAnimationRunning())):
#Draw Chapters Tickpoints
if (seekSlider.chapters and seekSlider.inputLength and groove.width()):
background = p.color(QtGui.QPalette.Active, QtGui.QPalette.Background)
foreground = p.color(QtGui.QPalette.Active, QtGui.QPalette.WindowText)
foreground.setHsv(foreground.hue(),
#.........这里部分代码省略.........
示例13: _invalid_configuration
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import qWarning [as 别名]
def _invalid_configuration(self, message):
# This should be qCritical, but there seems to be a bug
# in that on my version of Qt that makes it show as a debug
# message instead of critical.
QtCore.qWarning(message)
raise InvalidConfiguration(message)