Python-With-Gtk-Template/src/signal_classes/Signals.py

36 lines
965 B
Python
Raw Normal View History

2020-05-08 00:07:33 +00:00
# Python imports
import threading, subprocess, os
# Gtk imports
# Application imports
2020-05-08 00:38:06 +00:00
from .mixins import *
2020-05-08 00:07:33 +00:00
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
return wrapper
2020-05-08 00:38:06 +00:00
class Signals(DummyMixin):
2020-05-08 00:07:33 +00:00
def __init__(self, settings):
self.settings = settings
self.builder = self.settings.returnBuilder()
2021-10-11 04:28:19 +00:00
hello_world() # A global method from the __builtins__ file that added it
2020-05-08 00:07:33 +00:00
def getClipboardData(self):
proc = subprocess.Popen(['xclip','-selection', 'clipboard', '-o'], stdout=subprocess.PIPE)
retcode = proc.wait()
data = proc.stdout.read()
return data.decode("utf-8").strip()
def setClipboardData(self, data):
proc = subprocess.Popen(['xclip','-selection','clipboard'], stdin=subprocess.PIPE)
proc.stdin.write(data)
proc.stdin.close()
retcode = proc.wait()