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)
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])
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])
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)
def run(self): structure = self.params['structure'] gio.app_info_get_default_for_uri_scheme('http').launch_uris([self.url + structure.id])
def run(self): gio.app_info_get_default_for_uri_scheme('http').launch_uris([self.url + self.params['name']])
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])