示例#1
0
文件: core.py 项目: tazjel/turses
    def open_urls_in_browser(self, urls):
        """
        Open `urls` in $BROWSER if the environment variable is set.
        """
        command = self.configuration.browser
        if not command:
            message = _('You have to set the BROWSER environment variable'
                        ' to open URLs')
            self.error_message(message)
            return

        try:
            spawn_process(command, urls)
        except:
            self.error_message(_('Unable to launch the browser'))
示例#2
0
文件: core.py 项目: gigigi/turses
    def open_urls(self):
        """
        Open the URLs contained on the focused tweets in a browser.
        """
        status = self.timelines.get_active_status()
        if status is None:
            return
        urls = get_urls(status.text)

        if not urls:
            self.info_message(_('No URLs found on this tweet'))
            return

        args = ' '.join(urls)

        command = self.configuration.browser
        if not command:
            self.error_message(_('You have to set the BROWSER environment variable to open URLs'))
            return

        try:
            spawn_process(command, args)
        except:
            self.error_message(_('Unable to launch the browser'))