Quote:
Originally Posted by MandyBrigwell
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())