Open webbrowser in subprocess to redirect stdout.

This commit is contained in:
Michael Lazar
2015-03-09 20:47:07 -07:00
parent 04f3a5b7b6
commit a6300b494a
3 changed files with 20 additions and 10 deletions

View File

@@ -1,6 +1,5 @@
import curses
import sys
import webbrowser
from requests.exceptions import HTTPError
@@ -8,7 +7,8 @@ from .errors import SubredditNameError
from .page import BasePage
from .submission import SubmissionPage
from .content import SubredditContent
from .utils import LoadScreen, Color, text_input, display_message, display_help
from .utils import (LoadScreen, Color, text_input, display_message,
display_help, open_new_tab)
# Used to keep track of browsing history across the current session
@@ -109,11 +109,11 @@ class SubredditPage(BasePage):
def open_link(self):
url_full = self.content.get(self.nav.absolute_index)['url_full']
webbrowser.open_new_tab(url_full)
url = self.content.get(self.nav.absolute_index)['url_full']
open_new_tab(url)
global _opened_links
_opened_links.add(url_full)
_opened_links.add(url)
@staticmethod
def draw_item(win, data, inverted=False):