Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self._data = data
for d in data:
self._dtm.addRow(d)
self._pane = JScrollPane(self._table)
self.this.add(self._pane)
self._empty = empty
self.this.addWindowListener(self)
self._dtm.addTableModelListener(lambda _: self._update_model())
self.this.setLocation(PropertyEditor.NEW_WINDOW_OFFSET, PropertyEditor.NEW_WINDOW_OFFSET)
if add_actions:
self._popup = JPopupMenu()
self._pane.setComponentPopupMenu(self._popup)
inherits_popup_menu(self._pane)
self._actions = actions
self._actions.append(ExecutorAction('Remove Selected Rows', action=lambda e: self._remove_row()))
self._actions.append(ExecutorAction('Add New Row', action=lambda e: self._add_row()))
for action in self._actions:
self._popup.add(action.menuitem)
self.this.setForeground(Color.black)
self.this.setBackground(Color.lightGray)
self.this.pack()
self.this.setVisible(True)
self.this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE)
return self
def refresh(self, payload):
"""
Refresh the textarea content with a new payload, if present
:param payload:
:return: None
"""
self._refresh_queries(payload)
self._refresh_raw(payload)
inherits_popup_menu(self.this)
self._omnibar = Omnibar(
hint=DEFAULT_LOAD_URL,
label="Load",
action=self._loadurl)
self.this.add(BorderLayout.PAGE_START, self._omnibar.this)
self._fileview = FileView(
dir=os.getcwd(),
filetree_label="Queries, Mutations and Subscriptions",
texteditor_factory=texteditor_factory)
self.this.add(BorderLayout.CENTER, self._fileview.this)
self._fileview.addTreeListener(self._tree_listener)
self._fileview.addPayloadListener(self._payload_listener)
self._popup = JPopupMenu()
self.this.setComponentPopupMenu(self._popup)
inherits_popup_menu(self.this)
for action in self._actions:
self._popup.add(action.menuitem)
self._state = {'runs': []}
try:
if restore:
cfg = json.loads(restore)
if 'runs' in cfg:
for target, key, proxy, headers, load_placeholer, generate_html, generate_schema, generate_queries, accept_invalid_certificate, flag in cfg['runs']:
self._run(target=target,
key=key,
proxy=proxy,
headers=headers,
load_placeholer=load_placeholer,
generate_html=generate_html,
def _refresh_raw(self, payload):
"""
Refresh the textarea content with a new payload, if present
:param payload:
:return: None
"""
if payload:
self.this.addTab("Raw", self._create_texteditor(name="raw", label='Raw'))
self._textareas['raw'].setText(payload)
if self._listener:
self.add_listener(self._listener)
inherits_popup_menu(self.this)
self._textareas[vname].setText(json.dumps(queries[query_key]['variables'], indent=4))
else:
this.getBottomComponent().setVisible(False)
self._textareas[vname].setText("{}")
# Remove empty graphql tabs
try:
for tab in graphql_tabs:
for i in range(0, self.this.getTabCount()):
if self.this.getTitleAt(i) == tab:
self.this.remove(i)
except:
# Do nothing if you cannot remove an entry
pass
inherits_popup_menu(self.this)