Beispiel #1
0
 def __onChangeEvent(self, event_data):
     attr_cfg_future = self.device.get_attribute_config(self.name)
     if event_data.err:
         log.error("error change event")
     else:
         attr_value = attr_value_t2q(attr_cfg_future.result(),
                                     event_data.attr_value)
         self.device._set_attribute_value_cache(self.name, attr_value)
         self.valueChanged.emit()
Beispiel #2
0
 def __onConfigEvent(self, event_data):
     if event_data.err:
         log.error("error config event")
     else:
         attr_value_future = self.device.get_attribute_value(self.name)
         attr_config = attr_config_t2q(event_data.attr_conf)
         self.device._set_attribute_config_cache(self.name, attr_config)
         attr_value_future.result().config = attr_config
         self.valueChanged.emit()
Beispiel #3
0
 def createWidget(self, parent):
     try:
         w = self.getWidgetClass()(parent=parent)
     except Exception:
         log.error("Designer plugin error creating %s " \
                   "(see debug stream for details)", self.name())
         log.debug("Details:", exc_info=1)
         w = None
     return w
Beispiel #4
0
 def __onConfigEvent(self, event_data):
     if event_data.err:
         log.error("error config event")
     else:
         attr_value_future = self.device.get_attribute_value(self.name)
         attr_config = attr_config_t2q(event_data.attr_conf)
         self.device._set_attribute_config_cache(self.name, attr_config)
         attr_value_future.result().config = attr_config
         self.valueChanged.emit()
Beispiel #5
0
 def __onChangeEvent(self, event_data):
     attr_cfg_future = self.device.get_attribute_config(self.name)
     if event_data.err:
         log.error("error change event")
     else:
         attr_value = attr_value_t2q(attr_cfg_future.result(),
                                     event_data.attr_value)
         self.device._set_attribute_value_cache(self.name, attr_value)
         self.valueChanged.emit()
Beispiel #6
0
        def load(self, fileOrName, parentWidget=None):
            if self._rootWidget is not None:
                raise Exception("UiLoader is already started loading UI!")

            widget = super(UiLoader, self).load(fileOrName, parentWidget)

            if widget != self._rootWidget:
                log.error("Qt: Returned widget isn't the root widget... ")

            self._rootWidget = None
            return widget
Beispiel #7
0
    def loadUI(uiFilename, parent=None):
        global __uiLoader
        if __uiLoader is None:
            __uiLoader = UiLoader()

        uiFile = __QtCore.QFile(uiFilename, parent)
        if not uiFile.open(__QtCore.QIODevice.ReadOnly):
            log.error("Qt: Couldn't open file %r!", uiFilename)
            return None

        try:
            return __uiLoader.load(uiFile, parent)

        except:
            log.exception("Exception loading UI from %r!", uiFilename)

        finally:
            uiFile.close()
            uiFile.deleteLater()

        return None
Beispiel #8
0
        def createWidget(self, className, parent=None, name=''):
            widget = super(UiLoader, self).createWidget(
                    className, parent, name)

            if name:
                if self._rootWidget is None:
                    self._rootWidget = widget
                elif not hasattr(self._rootWidget, name):
                    setattr(self._rootWidget, name, widget)
                else:
                    log.error("Qt: Name collision! Ignoring second "
                              "occurrance of %r.", name)

                if parent is not None:
                    setattr(parent, name, widget)
                else:
                    # Sadly, we can't reparent it to self, since QUiLoader
                    # isn't a QWidget.
                    log.error("Qt: No parent specified! This will probably "
                              "crash due to C++ object deletion.")

            return widget
Beispiel #9
0
def _getQObjectStr(qobject, representation):
    if qobject is None:
        return 'Null'

    if representation == QObjectRepresentation.ClassName:
        return qobject.__class__.__name__

    try:
        objectName = qobject.objectName()
    except RuntimeError:
        log.error("error accessing object %s", qobject)
        log.debug("details: ", exc_info=1)
        if representation == QObjectRepresentation.ClassName:
            return qobject.__class__.__name__
        else:
            return "> ERROR! <"

    if representation == QObjectRepresentation.ObjectName:
        return objectName
    elif representation == QObjectRepresentation.FullName:
        className = qobject.metaObject().className()
        return '{0}("{1}")'.format(className, objectName)
    return str(qobject)
Beispiel #10
0
 def __onError(self, error):
     log.error("XEmbedContainer: Error")
Beispiel #11
0
 def __onError(self, error):
     log.error("XEmbedContainer: Error")