class TestNoClipboard(unittest.TestCase): copy, paste = init_no_clipboard() def test_copy(self): with self.assertRaises(RuntimeError): self.copy("foo") def test_paste(self): with self.assertRaises(RuntimeError): self.paste()
def alternative_to_gtk_clipboard(): """ This is an ugly fix for pyperclip to stop using gtk for unknown reason Gtk clipboard cause PyIDM to freeze system task bar in Manjaro kde, if we use is_solo() """ def executable_exists(name): return subprocess.call(['which', name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 if executable_exists("xsel"): return clipboard.init_xsel_clipboard() if executable_exists("xclip"): return clipboard.init_xclip_clipboard() if executable_exists("klipper") and executable_exists("qdbus"): return clipboard.init_klipper_clipboard() else: log('clipboard needs "xsel", or "xclip" installed to run properly') return clipboard.init_no_clipboard()