-
Notifications
You must be signed in to change notification settings - Fork 2
/
#retReqToken_dsktp.py#
executable file
·76 lines (56 loc) · 2.04 KB
/
#retReqToken_dsktp.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
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
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
from nose.tools import *
from dropbox import auth
from helpers import login_and_authorize
CALLBACK_URL = 'http://printer.example.com/request_token_ready'
RESOURCE_URL = 'http://www.dropbox.com/0/oauth/echo'
class WriteOperation:
# This function writes the data entered in the text box to
# the file in Dropbox folder used for writing
def writetofile(self, widget, data):
print "Send button is clicked..."
# text = self.entry.get_text()
# This location of file is to be taken from the user's laptop
# A script which finds the location of the Dropbox folder
# needs to be run
config = auth.Authenticator.load_config("testing.ini")
dba = auth.Authenticator(config)
#print "auth server="+auth.client
token = dba.obtain_request_token()
text.set_text(token)
#assert dba.oauth_request
#return token
# Causing the close button to close the window
def delete_event(self, widget, event, data=None):
gtk.mainquit()
return gtk.FALSE
# The GUI Description of the Window
def __init__(self):
# Create a new window
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_title("Our App")
self.window.connect("delete_event", self.delete_event)
self.window.set_border_width(10)
# Horizontal box to pack widgets
self.box1 = gtk.HBox(gtk.FALSE, 0)
self.window.add(self.box1)
# Text Box for text input
self.entry = gtk.Entry()
self.box1.pack_start(self.entry, gtk.TRUE, gtk.TRUE, 0)
self.entry.show()
# Send button. Works on Click event
self.button2 = gtk.Button("Get")
self.button2.connect("clicked", self.writetofile, "button 2")
self.box1.pack_start(self.button2, gtk.TRUE, gtk.TRUE, 0)
# Show Widgets
self.button2.show()
self.box1.show()
self.window.show()
def main():
gtk.mainloop()
if __name__ == "__main__":
wriop = WriteOperation()
main()