Skip to content

Commit

Permalink
minor formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xgi committed Feb 22, 2020
1 parent f7f9528 commit d5e467a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
8 changes: 4 additions & 4 deletions castero/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from castero.config import Config
from castero.database import Database
from castero.display import Display
from castero.feed import Feed, FeedDownloadError
from castero.feed import Feed
from castero.subscriptions import Subscriptions


Expand All @@ -32,8 +32,8 @@ def import_subscriptions(path: str, database: Database) -> None:
database.replace_episodes(feed, episodes)
print("Added \"%s\" with %d episodes" % (str(feed), len(episodes)))
else:
print("ERROR: Failed to download %s -- %s" %
(str(generated[0]), str(generated[1])))
print("ERROR: Failed to download %s -- %s" %
(str(generated[0]), str(generated[1])))

print("Imported %d feeds" % len(subscriptions.feeds))

Expand Down Expand Up @@ -124,7 +124,7 @@ def main():
castero.__help__.replace(field, adjusted)

# instantiate display
temp_file = redirect_stderr()
redirect_stderr()
stdscr = curses.initscr()
display = Display(stdscr, database)
display.clear()
Expand Down
2 changes: 1 addition & 1 deletion castero/datafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def download_to_file(url, file, name, download_queue, display=None):
)
if download_queue.length > 1:
status_str += " (+%d downloads in queue)" % \
(download_queue.length - 1)
(download_queue.length - 1)

display.change_status(status_str)
if chunk:
Expand Down
3 changes: 1 addition & 2 deletions castero/menus/downloadedmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from castero.config import Config
from castero.datafile import DataFile
from castero.episode import Episode
from castero.feed import Feed
from castero.menu import Menu


Expand Down Expand Up @@ -107,7 +106,7 @@ def _find_downloaded_episodes(self):
episode = self._source.episode(int(ep_id))
if episode is not None:
self._episodes.append(episode)

if self._inverted:
self._episodes.reverse()
self._sanitize()
Expand Down
35 changes: 19 additions & 16 deletions castero/perspectives/downloadedperspective.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def create_windows(self) -> None:
parent_y = self._display.parent_y
third_x = helpers.third(parent_x)
self._downloaded_window = curses.newwin(parent_y - 2, third_x * 2,
2, 0)
2, 0)
metadata_width = parent_x - ((third_x * 2) - 1)
self._metadata_window = curses.newwin(parent_y - 3, metadata_width,
2, 2 * third_x)
Expand Down Expand Up @@ -75,24 +75,27 @@ def display(self) -> None:
0, 0, " " * self._downloaded_window.getmaxyx()[1])

# add window headers
self._downloaded_window.addstr(0, 0, self._downloaded_menu.title,
curses.color_pair(7) | curses.A_BOLD)
self._metadata_window.addstr(0, 0, "Metadata",
curses.color_pair(7) | curses.A_BOLD)
self._downloaded_window.addstr(
0, 0, self._downloaded_menu.title,
curses.color_pair(7) | curses.A_BOLD)
self._metadata_window.addstr(
0, 0, "Metadata",
curses.color_pair(7) | curses.A_BOLD)

# add window borders
self._downloaded_window.hline(1, 0,
0, self._downloaded_window.getmaxyx()[1],
curses.ACS_HLINE | curses.color_pair(8))
self._metadata_window.hline(1, 0,
0, self._metadata_window.getmaxyx()[1] - 1,
curses.ACS_HLINE | curses.color_pair(8))
self._downloaded_window.hline(
1, 0,
0, self._downloaded_window.getmaxyx()[1],
curses.ACS_HLINE | curses.color_pair(8))
self._metadata_window.hline(
1, 0,
0, self._metadata_window.getmaxyx()[1] - 1,
curses.ACS_HLINE | curses.color_pair(8))
if not helpers.is_true(Config["disable_vertical_borders"]):
self._downloaded_window.vline(0,
self._downloaded_window.getmaxyx()[1] - 1,
0,
self._downloaded_window.getmaxyx()[0] - 2,
curses.ACS_VLINE | curses.color_pair(8))
self._downloaded_window.vline(
0, self._downloaded_window.getmaxyx()[1] - 1,
0, self._downloaded_window.getmaxyx()[0] - 2,
curses.ACS_VLINE | curses.color_pair(8))

# display menu content
self._downloaded_menu.display()
Expand Down

0 comments on commit d5e467a

Please sign in to comment.