-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathsync_clipboard_to_pc_gui.py
More file actions
112 lines (89 loc) · 2.55 KB
/
sync_clipboard_to_pc_gui.py
File metadata and controls
112 lines (89 loc) · 2.55 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#import asyncio
from tkinter.filedialog import askopenfile
from tkinter.filedialog import asksaveasfile
from time import sleep
import tkinter
from tkinter import filedialog
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import os,sys
#import re
from tkinter import *
import subprocess
import threading
from bottle import route, run
import os,subprocess,re
#import pyperclip
def sync():
laable.configure(text="started")
laable.configure(command='')
d=''
if os.name =='linux':
#do
df=subprocess.getoutput('ifconfig')
ip=re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}').findall(df)
for i in ip:
if i.startswith('192'):
d+=i
break
elif os.name =='posix':
df=subprocess.getoutput('ifconfig')
ip=re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}').findall(df)
for i in ip:
if i.startswith('192'):
d+=i
break
elif os.name=='darwin':
#do
df=subprocess.getoutput('ifconfig')
ip=re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}').findall(df)
for i in ip:
if i.startswith('192'):
d+=i
break
elif os.name=='nt':
#do
df=subprocess.getoutput('ipconfig')
ip=re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}').findall(df)
for i in ip:
if i.startswith('192'):
d+=i
break
@route('/')
def hello():
#g=pyperclip.paste()
return '''<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="10">
</head>
<body>
<h1 color='blue'>%s</h1>
</body>
</html>
'''%win.clipboard_get()
#os.system('python -m http.server 8080')
entryText = tkinter.StringVar()
entry.delete(0, tkinter.END)
entry.insert(0, 'running on >> http://%s/8080/'%d)
#entryText.set('running on >> http://%s/8080/'%d)
run(host=d, port=8080, debug=True)
def start_sync(event):
global start_thread
start_thread = threading.Thread(target=sync)
start_thread.deamon=True
start_thread.start()
def exiit():
win.destroy()
win=Tk()
win.geometry("400x200")
laable=ttk.Button(win,text='start syncing',command=lambda :start_sync(None))
laable.pack()
entryText = tkinter.StringVar()
entry = ttk.Entry( win, textvariable=entryText,width=50 ,state="rw")
entry.pack()
button = ttk.Button(text = "Click and Quit", command = exiit)
button.pack()
win.mainloop()
os._exit(0)