def copy(string, stdout=sys.stdout, stderr=sys.stderr): try: platform = sys.platform if platform not in ('darwin', 'linux', 'linux2',): copypaste.copy(string) return copy_cmd = os.environ.get(COPY_CMD_ENV_KEY) if not copy_cmd: copypaste.copy(string) return copy_cmd = copy_cmd.split(',') copypaste.copy(string, cmd=copy_cmd) except NotImplementedError: stderr.write('Sorry, copy command not supported for your platform.\n') sys.exit(os.EX_DATAERR) except NoSuchFileOrDirectoryException: stderr.write('Invalid copy command or tool for copy' ' was not installed in your system.\n') sys.exit(os.EX_DATAERR)
def copyPaste(): copy("hi") paste()
def copyToClickboard(): copy(label_show_password['text']) global paste_password paste_password = label_show_password['text']
print("Anlamadım.") except sr.RequestError: print("Bad request") except sr.UnknownValueError: print("Anlamadım.") except sr.RequestError: print("Bad request.") elif music in metin.lower(): t = Thread(target=Cal) t.start() elif "durdur" in metin.lower(): pygame.mixer.init() pygame.mixer.music.stop() print("Şarkı durduruldu.") elif "kopyala" in metin.lower(): print("Neyi kopyalamamı istiyorsun?") audio2 = r.listen(source, timeout=None) try: metin = r.recognize_google(audio2, language="tr-TR") print("Kopyalandı: " + metin) copypaste.copy(metin) except sr.UnknownValueError: print("Anlamadım.") except sr.RequestError: print("Bad Request") except sr.UnknownValueError: print("Anlamadım.") except sr.RequestError: print("Bad Request")
def test_copy_paste_with_unknow_paste_command(): copy(TEST_STRING) with pytest.raises(NoSuchFileOrDirectoryException): paste(cmd=['fake_cmd'])
def test_copy_paste(): copy(TEST_STRING) result = paste() assert TEST_STRING == result
class Arguments: notab = False if "notab" in sys.argv: notab = True nonewline = False if "nonewline" in sys.argv: nonewline = True verbose = False if "verbose" in sys.argv: verbose = True oldinputstr = "" while True: time.sleep(0.1) inputstr = copypaste.paste() if inputstr == "": continue if Arguments.verbose: if oldinputstr != inputstr: print(repr(inputstr), newline) oldinputstr = inputstr inputstr = str(inputstr) if Arguments.nonewline: inputstr = inputstr.replace(newline2, "") inputstr = inputstr.replace(newline, "") if Arguments.notab: inputstr = inputstr.replace("\t", "") copypaste.copy(inputstr)
def copyed(): geted = show_shortened_text_field.get("1.0", END) copyed = copy(geted)
def copy_output(self): cp.copy(self.lab_output.cget('text')) self.lab_status_bar.configure(text="Name copy to clipboard")