Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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,
         }
Exemplo n.º 4
0
def set_title():
    webview.set_title('New title')
Exemplo n.º 5
0
def change_title():
    """changes title every 3 seconds"""
    for i in range(1, 100):
        time.sleep(3)
        webview.set_title("New Title #{}".format(i))
Exemplo n.º 6
0
 def new_calc_file(self, arg):
     webview.set_title('docal')
Exemplo n.º 7
0
def change_url():
    webview.set_title('New title')
Exemplo n.º 8
0
def change_title():
    """changes title every 3 seconds"""
    for i in range(1, 100):
        time.sleep(3)
        webview.set_title("New Title #{}".format(i))
Exemplo n.º 9
0
def set_title():
    webview.set_title('New title')