1
0
mirror of https://github.com/ihabunek/toot.git synced 2024-09-22 04:25:55 -04:00

Fix Windows compatibility

Don't load curses until required. Since it's not available on windows,
importing the module early broke the whole app.

issue #18
This commit is contained in:
Ivan Habunek 2017-09-09 09:54:13 +02:00
parent 9097623535
commit 007d5539fa
3 changed files with 9 additions and 3 deletions

View File

@ -2,13 +2,19 @@
from __future__ import unicode_literals
from __future__ import print_function
import curses
import webbrowser
from textwrap import wrap
from toot import ConsoleError
from toot.utils import format_content
# Attempt to load curses, which is not available on windows
try:
import curses
except ImportError as e:
raise ConsoleError("Curses is not available on this platform")
class Color:
@staticmethod

View File

@ -16,7 +16,6 @@ from textwrap import TextWrapper, wrap
from toot import api, config, DEFAULT_INSTANCE, User, App, ConsoleError
from toot.output import print_out
from toot.app import TimelineApp
def register_app(instance):
@ -177,6 +176,7 @@ def timeline(app, user, args):
def curses(app, user, args):
from toot.app import TimelineApp
generator = api.timeline_generator(app, user)
TimelineApp(generator).run()

View File

@ -127,7 +127,7 @@ READ_COMMANDS = [
),
Command(
name="curses",
description="An experimental timeline app.",
description="An experimental timeline app (doesn't work on Windows)",
arguments=[],
require_auth=True,
),