Ejemplo n.º 1
0
def show_help_url(url):
    """
	Try at length to display a startup notification for the help browser.

	Return False if there is no handler for the help URL
	"""
    import gio
    ## Check that the system help viewer is Yelp,
    ## and if it is, launch its startup notification.
    scheme = gio.File(url).get_uri_scheme()
    default = gio.app_info_get_default_for_uri_scheme(scheme)
    help_viewer_id = "yelp.desktop"
    if not default:
        return False
    try:
        yelp = gio.unix.DesktopAppInfo(help_viewer_id)
    except RuntimeError:
        return show_url(url)
    cmd_path = lookup_exec_path(default.get_executable())
    yelp_path = lookup_exec_path(yelp.get_executable())
    if cmd_path and yelp_path and os.path.samefile(cmd_path, yelp_path):
        try:
            spawn_async_notify_as(help_viewer_id, [cmd_path, url])
            return True
        except SpawnError:
            pass
    return show_url(url)
Ejemplo n.º 2
0
def show_help_url(url):
	"""
	Try at length to display a startup notification for the help browser.

	Return False if there is no handler for the help URL
	"""
	import gio
	## Check that the system help viewer is Yelp,
	## and if it is, launch its startup notification.
	scheme = gio.File(url).get_uri_scheme()
	default = gio.app_info_get_default_for_uri_scheme(scheme)
	help_viewer_id = "yelp.desktop"
	if not default:
		return False
	try:
		yelp = gio.unix.DesktopAppInfo(help_viewer_id)
	except RuntimeError:
		return show_url(url)
	cmd_path = lookup_exec_path(default.get_executable())
	yelp_path = lookup_exec_path(yelp.get_executable())
	if cmd_path and yelp_path and os.path.samefile(cmd_path, yelp_path):
		try:
			spawn_async_notify_as(help_viewer_id, [cmd_path, url])
			return True
		except SpawnError:
			pass
	return show_url(url)
Ejemplo n.º 3
0
    def onTbTaskButton(self, widget, plugin_api):
        """
        When the user presses the button.
        """
        task = plugin_api.get_ui().get_task()

        # Body contains Status Tags, Subtasks and Content.
        body = _("Status: %s") % (task.get_status()) + \
        _("\nTags: %s") % (", ".join(task.get_tags_name())) + \
        _("\nSubtasks:\n%s") % (
        "\n - ".join([i.get_title() for i in task.get_subtasks()])) + \
        _("\nTask content:\n%s") % (task.get_excerpt())

        # Title contains the title and the start and due dates.
        title = _("Task: %(task_title)s") % {'task_title': task.get_title()}

        parameters = urllib.urlencode({'subject': title, 'body': body})
        parameters = parameters.replace('+', '%20')

        gio.app_info_get_default_for_uri_scheme('mailto').launch_uris( \
                ['mailto:' + '[email protected]?' + parameters])
Ejemplo n.º 4
0
    def onTbTaskButton(self, widget, plugin_api):
        """
        When the user presses the button.
        """
        task = plugin_api.get_ui().get_task()

        # Body contains Status Tags, Subtasks and Content.
        body = _("Status: %s") % (task.get_status()) + \
            _("\nTags: %s") % (", ".join(task.get_tags_name())) + \
            _("\nSubtasks:\n%s") % (
                "\n - ".join([i.get_title() for i in task.get_subtasks()])) + \
            _("\nTask content:\n%s") % (task.get_excerpt())

        # Title contains the title and the start and due dates.
        title = _("Task: %(task_title)s") % {'task_title': task.get_title()}

        parameters = urllib.urlencode({'subject': title, 'body': body})
        parameters = parameters.replace('+', '%20')

        gio.app_info_get_default_for_uri_scheme('mailto').launch_uris(
            ['mailto:' + '[email protected]?' + parameters])
Ejemplo n.º 5
0
 def handle_url(self, url):
     scheme = url.split(':')[0]
     app_info = gio.app_info_get_default_for_uri_scheme(scheme)
     app_info.launch_uris([url], None)
Ejemplo n.º 6
0
 def handle_url(self, url):
     scheme = url.split(':')[0]
     app_info = gio.app_info_get_default_for_uri_scheme(scheme)
     app_info.launch_uris([url], None)
Ejemplo n.º 7
0
 def run(self):
     structure = self.params['structure']
     gio.app_info_get_default_for_uri_scheme('http').launch_uris([self.url + structure.id])
Ejemplo n.º 8
0
 def run(self):
     gio.app_info_get_default_for_uri_scheme('http').launch_uris([self.url + self.params['name']])
Ejemplo n.º 9
0
 def run(self):
     sequence_index = self.coord.sequence
     entry = get_id_entry_for_sequence(self.target, sequence_index)
     gio.app_info_get_default_for_uri_scheme('http').launch_uris([self.url + entry.sequence_id])