1
0
mirror of https://github.com/HorlogeSkynet/archey4 synced 2025-05-03 04:00:15 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Samuel FORESTIER
a575f3b80a [SCREENSHOT] Keeps quiet when everything went well 2020-05-31 22:14:05 +02:00
Samuel FORESTIER
b16e8c4186 [SCREENSHOT] More (rough) modularity in line-cleaning 2020-05-31 22:11:03 +02:00
Michael Bromilow
ccdafef9e7 [SCREENSHOT] Add delay before screenshot is taken.
Rationale: Before, sometimes the screenshot would be taken before
Archey's output was visible in the terminal. This delay ensures that
the terminal has had the chance to display the output before we take any
screenshot.

Additionally, this commit adds a success message detailing the
screenshot program used.
2020-05-31 13:07:35 +01:00

@ -2,6 +2,7 @@
import os
import sys
import time
from contextlib import ExitStack
from datetime import datetime
@ -49,6 +50,15 @@ def take_screenshot(output_file=None):
screenshot_tools['KDE-Spectacle'] = ['spectacle', '-b', '-o', output_file]
screenshot_tools['Xfce4-Screenshooter'] = ['xfce4-screenshooter', '-f', '-s', output_dir]
# This part purposefully blocks so we wait a little bit before taking the screenshot.
# It prevents taking a screenshot before Archey's output has appeared.
taking_sc_fstring = '\rTaking screenshot in {:1d}...'
for time_remaining in range(3, 0, -1):
print(taking_sc_fstring.format(time_remaining), end='', flush=True)
time.sleep(1)
print('\r' + ' ' * len(taking_sc_fstring), end='\r', flush=True)
time.sleep(0.5)
with ExitStack() as defer_stack:
for screenshot_tool, screenshot_cmd in screenshot_tools.items():
try: