Example #1
0
	def open_markdown(self, md, icon=u'dialog-information',
		title=u'Attention!', url=None, tmpl=None):

		"""
		desc:
			Opens a Markdown-formatted tab.

		arguments:
			md:
				desc:	If it ends with `.md`, this is interpreted as a file
						name. Otherwise, it is interpreted as markdown text.
				type:	str

		keywords:
			icon:
				desc:	The name of the tab icon.
				type:	str
			title:
				desc:	The tab title.
				type:	str
			url:
				desc:	A url to identify the page. This only applies when the
						markdown is provided as text; otherwise the markdown
						filename is used.
				type:	str
		"""

		from libqtopensesame.widgets.webbrowser import webbrowser
		wb = webbrowser(self.main_window)
		if md.endswith(u'.md'):
			wb.load(md, tmpl=tmpl)
		else:
			wb.load_markdown(md, url=url, tmpl=tmpl)
		self.main_window.tabwidget.add(wb, icon, title)
Example #2
0
    def open_markdown(self,
                      md,
                      icon=u'dialog-information',
                      title=u'Attention!'):
        """
		desc:
			Opens a Markdown-formatted tab.

		arguments:
			md:
				desc:	If it ends with `.md`, this is interpreted as a file
						name. Otherwise, it is interpreted as markdown text.
				type:	str

		keywords:
			icon:
				desc:	The name of the tab icon.
				type:	str
			title:
				desc:	The tab title.
				type:	str
		"""

        from libqtopensesame.widgets.webbrowser import webbrowser
        wb = webbrowser(self.main_window)
        if md.endswith(u'.md'):
            wb.load(md)
        else:
            wb.load_markdown(md)
        self.main_window.tabwidget.add(wb, icon, _(title))
Example #3
0
	def open_markdown(self, md, icon=u'dialog-information',
		title=u'Attention!', url=None, tmpl=None):

		"""
		desc:
			Opens a Markdown-formatted tab.

		arguments:
			md:
				desc:	If it ends with `.md`, this is interpreted as a file
						name. Otherwise, it is interpreted as markdown text.
				type:	str

		keywords:
			icon:
				desc:	The name of the tab icon.
				type:	str
			title:
				desc:	The tab title.
				type:	str
			url:
				desc:	A url to identify the page. This only applies when the
						markdown is provided as text; otherwise the markdown
						filename is used.
				type:	str
		"""

		from libqtopensesame.widgets.webbrowser import webbrowser
		wb = webbrowser(self.main_window)
		if md.endswith(u'.md'):
			wb.load(md, tmpl=tmpl)
		else:
			wb.load_markdown(md, url=url, tmpl=tmpl)
		self.main_window.tabwidget.add(wb, icon, title)
Example #4
0
	def open_markdown(self, md, icon=u'dialog-information',
		title=u'Attention!'):

		"""
		desc:
			Opens a Markdown-formatted tab.

		arguments:
			md:
				desc:	If it ends with `.md`, this is interpreted as a file
						name. Otherwise, it is interpreted as markdown text.
				type:	str

		keywords:
			icon:
				desc:	The name of the tab icon.
				type:	str
			title:
				desc:	The tab title.
				type:	str
		"""

		from libqtopensesame.widgets.webbrowser import webbrowser
		wb = webbrowser(self.main_window)
		if md.endswith(u'.md'):
			wb.load(md)
		else:
			wb.load_markdown(md)
		self.main_window.tabwidget.add(wb, icon, title)