Created
October 3, 2018 23:29
-
-
Save maphew/3bbdb407382c72d878dbefb9dcd8cbc7 to your computer and use it in GitHub Desktop.
There is a screenshots plugin, but the following @button script seems more useful
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This script must be bound to a keystroke so that it can run without disturbing Leo's present state. | |
Rev 9cce9a in devel is required to make everything work smoothly when gathering arguments, but this | |
rev breaks other features. Back to the drawing board. | |
-- @edreamleo, https://groups.google.com/d/msg/leo-editor/Serzpyzrylg/B63pKXFNCwAJ | |
''' | |
@button screen-shot @key=ctrl-1 | |
''' | |
Create a screenshot of the present Leo outline and | |
save it to .leo/screen_captures. | |
''' | |
# --window-size=682x1264 is recommended. | |
from leo.core.leoQt import isQt5, QtGui | |
import time | |
base = r'C:\Users\edreamleo\.leo\screen_captures' | |
assert g.os_path_exists(base), repr(base) | |
window = g.app.gui.qtApp.activeWindow() | |
w = window.grab() if isQt5 else QtGui.QPixmap.grabWindow(window.winID()) | |
fn = '%s.png' % time.strftime('%Y-%m-%d-%H-%M-%S') | |
path = g.os_path_finalize_join(base, fn) | |
w.save(path, 'png') | |
g.es_print('saved: %s' % path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment