def _set_title(webview): try: webview.set_title('New title') q.put(0) except Exception as e: q.put(1) pytest.fail('Exception occured:\n{0}'.format( traceback.format_exc())) destroy_event.set()
def save_calc_file(self, args): if self.calc_file == self.default_calc_file or args['saveas']: selected = webview.create_file_dialog(webview.SAVE_DIALOG, save_filename=self.calc_file, file_types=self.calc_types) if selected: self.calc_file = selected else: return path.basename(self.calc_file) chunks = args['calc'] attrib = {'in': args['in'], 'out': args['out'], 'level': args['level']} document = ET.Element('document', attrib) for typ, content in chunks: child = ET.SubElement(document, typ) child.text = self.data_convert(content) tree = ET.ElementTree(document) tree.write(self.calc_file, 'utf-8') webview.set_title('docal - ' + self.calc_file)
def open_calc_file(self, arg): selected = [self.calc_file ] if arg == 1 else webview.create_file_dialog( file_types=self.calc_types) if selected: with open(selected[0]) as file: content = file.read() tree = ET.fromstring(content) # change to the list with elements having assigns as last line chunks = [] for child in tree: chunks.append( [child.tag, self.data_convert(child.text, child.tag)]) self.calc_file = selected[0] webview.set_title('docal - ' + selected[0]) return { 'in': tree.attrib['in'], 'out': tree.attrib['out'], 'level': tree.attrib['level'], 'calc': chunks, }
def set_title(): webview.set_title('New title')
def change_title(): """changes title every 3 seconds""" for i in range(1, 100): time.sleep(3) webview.set_title("New Title #{}".format(i))
def new_calc_file(self, arg): webview.set_title('docal')
def change_url(): webview.set_title('New title')