def data_tree_copy_url(self): url_list = [] for index in self.treeViewSelectionModel.selectedRows(): curUrl = interface.index_to_url(self.dataModel, index) if curUrl: url_list.append('%s' % (str(curUrl))) QApplication.clipboard().setText('\n'.join(url_list))
def open_response_url_in_browser(self): url_list = [] for index in self.treeViewSelectionModel.selectedRows(): url = interface.index_to_url(self.dataModel, index) if url and url not in url_list: url_list.append(url) if 1 == len(url_list): self.framework.open_url_in_browser(url_list[0]) else: # TODO: support this via multiple tables pass
def save_response_to_file(self): index = self.treeView.currentIndex() Id = interface.index_to_id(self.dataModel, index) curUrl = interface.index_to_url(self.dataModel, index) if Id and curUrl: splitted = urlparse.urlsplit(curUrl) pos = splitted.path.rindex('/') filename = '' if pos > -1: filename = splitted.path[pos+1:] file = QFileDialog.getSaveFileName(None, "Save to file", filename, "") if file: filename = str(file) fh = open(filename, 'wb') try: rr = self.framework.get_request_response(Id) fh.write(rr.responseBody) finally: fh.close()
def save_response_to_file(self): index = self.treeView.currentIndex() Id = interface.index_to_id(self.dataModel, index) curUrl = interface.index_to_url(self.dataModel, index) if Id and curUrl: splitted = urlparse.urlsplit(curUrl) pos = splitted.path.rindex('/') filename = '' if pos > -1: filename = splitted.path[pos + 1:] file = QFileDialog.getSaveFileName(None, "Save to file", filename, "") if file: filename = str(file) fh = open(filename, 'wb') try: rr = self.framework.get_request_response(Id) fh.write(rr.responseBody) finally: fh.close()