Exemplo n.º 1
0
	def testOpenUrl(self):
		from zim.gui.applications import open_url

		widget = tests.MockObject()

		with self.assertRaises(ValueError):
			open_url(widget, '/test/some/file.txt')

		for uri in (
			'file://test/some/file.txt',
			'http://example.com',
			'mailto:[email protected]',
			'smb://host/share/file.txt',
		):
			open_url(widget, uri)
			self.assertEqual(self.calls[-1][2], uri)

		open_url(widget, '\\\\host\\share\\file.txt')
		self.assertEqual(self.calls[-1][2], 'smb://host/share/file.txt')
Exemplo n.º 2
0
 def on_print_tasklist(self, o):
     html = self.dialog.task_list.get_visible_data_as_html()
     file = TmpFile('print-to-browser.html', persistent=True, unique=False)
     file.write(html)
     open_url(self.dialog, 'file://%s' % file)  # XXX
Exemplo n.º 3
0
 def do_activate_link(self, uri):
     open_url(self, uri)
Exemplo n.º 4
0
 def print_to_browser(self, page=None):
     notebook = self.pageview.notebook
     page = page or self.pageview.page
     file = self.plugin.print_to_file(notebook, page)
     open_url(self.pageview, 'file://%s' % file)  # XXX