Hopefully reduces flashes
"""Get total number of starred cards"""
return [card for card in self.stack if card.starred]
"""Get total number of starred cards"""
return [card for card in self.stack if card.starred]
- def disp_bar(self):
- """
- Display the statusbar at the bottom of the screen with progress, star
- status, and card side.
- """
(mlines, mcols) = self.win.getmaxyx()
(mlines, mcols) = self.win.getmaxyx()
- self.win.hline(mlines - 3, 0, 0, mcols)
# Calculate percent done
if len(self.stack) <= 1:
# Calculate percent done
if len(self.stack) <= 1:
# Print yellow if starred
if self.current_card().starred:
# Print yellow if starred
if self.current_card().starred:
- star_color = curses.color_pair(3)
+ self.star_color = curses.color_pair(3)
- star_color = curses.color_pair(1)
+ self.star_color = curses.color_pair(1)
- bar_start = "["
- bar_middle = self.current_card().printStar()
- bar_end = f"] [{len(self.nstarred())}/{str(len(self.stack))} starred] "
+ self.bar_start = "["
+ self.bar_middle = self.current_card().printStar()
+ self.bar_end = (
+ f"] [{len(self.nstarred())}/{str(len(self.stack))} starred] "
+ )
f" [{self.get_side()} ("
f"{str(int(self.current_card().side) + 1)})]"
)
f" [{self.get_side()} ("
f"{str(int(self.current_card().side) + 1)})]"
)
- bar_end += f" [View {str(self.view)}]"
+ self.bar_end += f" [View {str(self.view)}]"
+ self.progress = (
+ f"[{percent}% ("
+ f"{str(self.obj.index + 1).zfill(len(str(len(self.stack))))}"
+ f"/{str(len(self.stack))})] "
+ )
+
+ def disp_bar(self):
+ """
+ Display the statusbar at the bottom of the screen with progress, star
+ status, and card side.
+ """
+ (mlines, mcols) = self.win.getmaxyx()
- self.win.addstr(height, 0, bar_start, curses.color_pair(1))
- self.win.addstr(height, len(bar_start), bar_middle, star_color)
+ self.win.addstr(height, 0, self.bar_start, curses.color_pair(1))
+ self.win.addstr(
+ height, len(self.bar_start), self.bar_middle, self.star_color
+ )
- len(bar_start + bar_middle),
- textwrap.shorten(bar_end, width=mcols - 20, placeholder="…"),
+ len(self.bar_start + self.bar_middle),
+ textwrap.shorten(self.bar_end, width=mcols - 20, placeholder="…"),
- progress = (
- f"[{percent}% ("
- f"{str(self.obj.index + 1).zfill(len(str(len(self.stack))))}"
- f"/{str(len(self.stack))})] "
- )
-
self.win.addstr(
height + 1,
0,
self.win.addstr(
height + 1,
0,
int(
self.obj.index
/ (len(self.stack) - 1)
int(
self.obj.index
/ (len(self.stack) - 1)
- * (mcols - len(progress))
+ * (mcols - len(self.progress))
- 1
)
):
self.win.addch(
height + 1,
- 1
)
):
self.win.addch(
height + 1,
+ i + len(self.progress),
self.config["progress_char"],
curses.color_pair(1),
)
self.config["progress_char"],
curses.color_pair(1),
)
+ self.win.hline(mlines - 3, 0, 0, mcols)
+
def wrap_width(self):
"""Calculate the width at which the body text should wrap"""
(_, mcols) = self.win.getmaxyx()
def wrap_width(self):
"""Calculate the width at which the body text should wrap"""
(_, mcols) = self.win.getmaxyx()
def disp_card(self):
(_, mcols) = self.win.getmaxyx()
self.main_panel.bottom()
def disp_card(self):
(_, mcols) = self.win.getmaxyx()
self.main_panel.bottom()
num_done = str(self.obj.index + 1).zfill(len(str(len(self.stack))))
if self.view in [1, 2, 4]:
num_done = str(self.obj.index + 1).zfill(len(str(len(self.stack))))
if self.view in [1, 2, 4]:
"""
Display the contents of the card with both the front and back sides.
"""
"""
Display the contents of the card with both the front and back sides.
"""
- (_, mcols) = self.win.getmaxyx()
- self.main_panel.bottom()