How to use the inql.widgets.payloadview._PayloadListener function in inql

To help you get started, we’ve selected a few inql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github doyensec / graph-ql / inql / widgets / payloadview.py View on Github external
content['query'] = self._textareas[name].getText()
                    else:
                        content[id]['query'] = self._textareas[name].getText()
                    SwingUtilities.invokeLater(lambda: self._textareas['raw'].setText(json.dumps(content)))
                elif name.startswith('gql_variables#'):
                    id = int(name.split("#")[1])
                    content = json.loads(self._textareas['raw'].getText())
                    if id == 0 and not isinstance(content, list):
                        content['variables'] = json.loads(self._textareas[name].getText())
                    else:
                        content[id]['variables'] = json.loads(self._textareas[name].getText())
                    SwingUtilities.invokeLater(lambda: self._textareas['raw'].setText(json.dumps(content)))
            except ValueError:
                pass # Avoid crashing for JSON not valid incompatibilities

        _textarea.getDocument().addDocumentListener(_PayloadListener(changed_update=on_change))

        return this
github doyensec / graph-ql / inql / widgets / payloadview.py View on Github external
def add_listener(self, listener):
        """
        add a new listener to the textarea

        :param listener: this parameter should be a lambda or a method
        :return: None
        """
        self._listener = listener
        if 'raw' in self._textareas:
            self._textareas['raw'].getDocument().addDocumentListener(_PayloadListener(listener))