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

36 lines
965 B
Python

# Python imports
import threading, subprocess, os
# Gtk imports
# Application imports
from .mixins import *
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
return wrapper
class Signals(DummyMixin):
def __init__(self, settings):
self.settings = settings
self.builder = self.settings.returnBuilder()
hello_world() # A global method from the __builtins__ file that added it
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()