View Single Post
Old 04-24-2021, 04:47 PM   #5
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,731
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by MandyBrigwell View Post
I'd like to insert the current date and time and a few other bits and pieces, essentially using Sigil as a fancy journal system.
As KevinH has already suggested, having the plugin copy text to the clipboard would be the easiest solution and takes only 3 lines of code. Here's a proof of concept plugin:

Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from datetime import datetime
from PyQt5.Qt import QApplication

# main routine    
def run(bk):
    app = QApplication(sys.argv)
    date_time = str(datetime.now())
    app.clipboard().setText(date_time)
    print('{} copied to the clipboard.'.format(date_time))
    return 0

def main():
    print('I reached main when I should not have\n')
    return -1

if __name__ == "__main__":
    sys.exit(main())

Last edited by Doitsu; 04-24-2021 at 04:52 PM.
Doitsu is offline   Reply With Quote