-
Notifications
You must be signed in to change notification settings - Fork 2
/
interclip.py
48 lines (35 loc) · 1.32 KB
/
interclip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import dropbox
from helpers import ClipBoard
class InterClip:
def __init__(self, token):
try:
self.client = dropbox.Dropbox(token)
except:
##user interface in place of print promt
print("no internet acess")
self.clipped_text = ClipBoard()
def temporary_copy(self):
content = self.clipped_text.pull_text()
try:
self.client.files_upload(content.encode(),
'/testing/cpy.txt',
mode=dropbox.files.WriteMode('overwrite', None))
except:
##user interface in place of print promt
print("no internet acess")
def longterm_copy(self):
content = self.clipped_text.pull_text()
try:
self.client.files_upload(content.encode(),
'/testing/multiple/cpy.txt',
autorename=True)
except:
##user interface in place of print promt
print("no internet acess")
def temporary_paste(self):
try:
metadata,response = self.client.files_download('/testing/cpy.txt')
self.clipped_text.push_text(response.text)
except:
##user interface in place of print promt
print("no internet acess")