27
27
import tkFont
28
28
import threading
29
29
30
- BGCOLOR = "#f0f0f0"
31
- ACTIVECOLOR = "#55E7FF"
32
- TEXTCOLOR = "#999999"
33
- PROGRESSBG = "#909090"
34
-
30
+ WINWIDTH = 776
31
+ WINHEIGHT = 390
32
+ BGCOLOR = "#3BD7EA"
33
+ ACTIVECOLOR = "#3BD7EA"
34
+ TEXTCOLOR = "#FFFFFF"
35
+ PROGRESSBG = "#FFFFFF"
36
+ BTNTEXT = "#2AD4E7"
37
+ BTNCOLOR = "#FFFFFF"
35
38
36
39
class Application (Frame ):
37
40
41
+ def createStartButton (self , master , onclick ):
42
+ b = Label ( master )
43
+ b .config ( text = "START" , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , background = BTNCOLOR , foreground = BTNTEXT , width = 12 , height = 3 )
44
+ b .bind ("<Button-1>" , onclick )
45
+ b .place ( x = 336 , y = 80 , anchor = NW )
46
+ return b
47
+
38
48
def createNextButton (self , master , onclick ):
39
49
b = Label ( master )
40
- b .config ( text = "NEXT" , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , width = 10 , height = 3 , foreground = TEXTCOLOR )
50
+ b .config ( text = "NEXT" , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , background = BTNCOLOR , foreground = BTNTEXT , width = 12 , height = 3 )
41
51
b .bind ("<Button-1>" , onclick )
42
- b .place ( x = 900 , y = 230 , anchor = NW )
52
+ b .place ( x = 336 , y = 80 , anchor = NW )
43
53
return b
44
54
45
55
def createDoneButton (self , master , onclick ):
46
56
b = Label ( master )
47
- b .config ( text = "DONE " , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , width = 10 , height = 3 , foreground = TEXTCOLOR )
57
+ b .config ( text = "OK " , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , background = BTNCOLOR , foreground = BTNTEXT , width = 12 , height = 3 )
48
58
b .bind ("<Button-1>" , onclick )
49
- b .place ( x = 900 , y = 230 , anchor = NW )
59
+ b .place ( x = 336 , y = 80 , anchor = NW )
50
60
return b
51
61
52
62
def createStartOverButton (self , master , onclick ):
53
63
b = Label ( master )
54
- b .config ( text = "START OVER" , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , width = 15 , height = 3 , foreground = TEXTCOLOR )
64
+ b .config ( text = "START OVER" , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , background = BTNCOLOR , foreground = BTNTEXT , width = 12 , height = 3 )
55
65
b .bind ("<Button-1>" , onclick )
56
- b .place ( x = 860 , y = 230 , anchor = NW )
66
+ b .place ( x = 336 , y = 80 , anchor = NW )
57
67
return b
58
68
59
69
def createFormatButton (self , master , onclick ):
60
70
b = Label ( master )
61
- b .config ( text = "FORMAT " , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , width = 15 , height = 3 , foreground = TEXTCOLOR )
71
+ b .config ( text = "INSTALL " , highlightthickness = 1 , highlightbackground = ACTIVECOLOR , background = BTNCOLOR , foreground = BTNTEXT , width = 12 , height = 3 )
62
72
b .bind ("<Button-1>" , onclick )
63
- b .place ( x = 860 , y = 230 , anchor = NW )
73
+ b .place ( x = 336 , y = 80 , anchor = NW )
64
74
return b
65
75
66
76
def createInstructionTxt (self , master , text ):
67
- instructionFont = tkFont .Font (family = "Helvetica" , size = 20 )
77
+ instructionFont = tkFont .Font (family = "Helvetica" , size = 18 )
68
78
instruction = Label ( master , background = BGCOLOR , foreground = TEXTCOLOR , font = instructionFont )
69
79
instruction ["text" ] = text
70
- instruction .place ( relx = 0.5 , y = 50 , anchor = N )
80
+ instruction .place ( relx = 0.5 , y = 14 , anchor = N )
71
81
return instruction
72
82
73
83
@@ -79,35 +89,36 @@ def createWidgets(self):
79
89
#self.QUIT.place( relx=0, rely=1, anchor=SW )
80
90
81
91
82
- self .step1Frame = Frame ( width = 1000 , height = 300 , background = BGCOLOR )
92
+ self .step1Frame = Frame ( width = WINWIDTH , height = 190 , background = BGCOLOR )
83
93
84
- self .step1Frame .instruction = self .createInstructionTxt ( self .step1Frame , "Remove any SD Cards from your computer and click Next ." )
85
- self .step1Frame .nextButton = self .createNextButton ( self .step1Frame , self .preStep2 )
94
+ self .step1Frame .instruction = self .createInstructionTxt ( self .step1Frame , "Remove any SD Cards from your computer and click Start ." )
95
+ self .step1Frame .nextButton = self .createStartButton ( self .step1Frame , self .preStep2 )
86
96
87
97
88
- self .step2Frame = Frame ( width = 1000 , height = 300 , background = BGCOLOR )
98
+ self .step2Frame = Frame ( width = WINWIDTH , height = 190 , background = BGCOLOR )
89
99
self .step2Frame .nextButton = self .createNextButton ( self .step2Frame , self .preStep3 )
90
- self .step2Frame .instruction = self .createInstructionTxt ( self .step2Frame , "Now insert the SD Card you wish to format with Coder." )
100
+ self .step2Frame .instruction = self .createInstructionTxt ( self .step2Frame , "Insert an SD Card you wish to format with Coder." )
91
101
92
102
93
- self .step3Frame = Frame ( width = 1000 , height = 300 , background = BGCOLOR )
103
+ self .step3Frame = Frame ( width = WINWIDTH , height = 190 , background = BGCOLOR )
94
104
self .step3Frame .nextButton = self .createFormatButton ( self .step3Frame , self .preStep4 )
95
- self .step3Frame .instruction = self .createInstructionTxt ( self .step3Frame , "Click Format to completely erase this SD Card and install Coder." )
96
- self .step3Frame .progress = Meter ( self .step3Frame , width = 800 , height = 2 , bg = PROGRESSBG , progcolor = ACTIVECOLOR )
105
+ self .step3Frame .instruction = self .createInstructionTxt ( self .step3Frame , "Click Install to format this SD Card and install Coder." )
106
+ self .step3Frame .progress = Meter ( self .step3Frame , width = 600 , height = 6 , bg = PROGRESSBG , progcolor = ACTIVECOLOR )
97
107
98
108
99
- self .step4Frame = Frame ( width = 1000 , height = 300 , background = BGCOLOR )
109
+ self .step4Frame = Frame ( width = WINWIDTH , height = 190 , background = BGCOLOR )
100
110
self .step4Frame .instruction = Label ( self .step4Frame )
101
- self .step4Frame .instruction = self .createInstructionTxt ( self .step4Frame , "You can now use this card in Raspberry Pi to run Coder." )
111
+ self .step4Frame .instruction = self .createInstructionTxt ( self .step4Frame , "Coder has been successfully installed. You may now remove your SD Card.\n Follow instructions at goo.gl/coder to get started." )
112
+ self .step4Frame .instruction .place ( relx = 0.5 , y = 8 , anchor = N )
102
113
self .step4Frame .doneButton = self .createDoneButton ( self .step4Frame , self .doneClick )
103
114
104
- self .errorFrame = Frame ( width = 1000 , height = 300 , background = BGCOLOR )
115
+ self .errorFrame = Frame ( width = WINWIDTH , height = 190 , background = BGCOLOR )
105
116
self .errorFrame .soButton = self .createStartOverButton ( self .errorFrame , self .step1 )
106
117
self .errorFrame .instruction = Label ( self .errorFrame )
107
118
self .errorFrame .instruction = self .createInstructionTxt ( self .errorFrame , "Error" )
108
119
109
120
110
- self .workingFrame = Frame ( width = 1000 , height = 300 , background = BGCOLOR )
121
+ self .workingFrame = Frame ( width = WINWIDTH , height = 190 , background = BGCOLOR )
111
122
self .workingFrame .instruction = Label ( self .workingFrame )
112
123
self .workingFrame .instruction = self .createInstructionTxt ( self .workingFrame , "Thinking..." )
113
124
@@ -117,7 +128,7 @@ def createWidgets(self):
117
128
self .logo .config ( background = BGCOLOR , image = self .logoimg )
118
129
119
130
120
- self .logo .place ( x = 340 , y = 100 , anchor = NW )
131
+ self .logo .place ( x = 170 , y = 55 , anchor = NW )
121
132
#self.logo.config( image = self.logoimg )
122
133
#self.logo.geometry("+%d+%d" % (self.winfo_rootx()+50,
123
134
# self.winfo_rooty()+50))
@@ -189,16 +200,16 @@ def preStep3( self, event=None ):
189
200
self .errorRetry ( "Your card wasn't correctly detected. Let's try again." )
190
201
#self.errorRetry( "Error: found " + str( len( self.newDrives ) ) + " new disks inserted but expected 1" )
191
202
else :
192
- self .showWorking ( "Device found." )
203
+ self .showWorking ( "SD Card found." )
193
204
self .update ()
194
205
time .sleep (2 )
195
206
self .step3 ()
196
207
197
208
def step3 ( self , event = None ):
198
209
self .unPlace ()
199
210
self .step3Frame .progress .place_forget ()
200
- self .step3Frame .nextButton .place ( x = 860 , y = 230 , anchor = NW )
201
- self .step3Frame .instruction ['text' ] = "Click Format to completely erase this SD Card and install Coder."
211
+ self .step3Frame .nextButton .place ( x = 336 , y = 80 , anchor = NW )
212
+ self .step3Frame .instruction ['text' ] = "Click Install to format this SD Card and install Coder."
202
213
self .step3Frame .place ( relx = 0 , rely = 1 , anchor = SW )
203
214
204
215
@@ -207,8 +218,8 @@ def preStep4( self, event=None ):
207
218
208
219
self .update_idletasks ();
209
220
self .step3Frame .nextButton .place_forget ()
210
- self .step3Frame .progress .place ( relx = 0.5 , y = 100 , anchor = N )
211
- self .step3Frame .instruction ['text' ] = "Writing to SD Card.. ."
221
+ self .step3Frame .progress .place ( relx = 0.5 , y = 85 , anchor = N )
222
+ self .step3Frame .instruction ['text' ] = "Installing Coder on your SD Card."
212
223
self .update_idletasks ();
213
224
214
225
formatProgress = 0.0
@@ -251,7 +262,7 @@ def errorRetry( self, message ):
251
262
252
263
def __init__ (self , master = None ):
253
264
Frame .__init__ (self , master )
254
- self .config (width = 1000 , height = 500 , background = "#f0f0f0" )
265
+ self .config (width = WINWIDTH , height = WINHEIGHT , background = BGCOLOR )
255
266
self .createMenu ()
256
267
self .pack_propagate (0 )
257
268
self .pack ()
@@ -364,7 +375,7 @@ def formatSDDevice():
364
375
root = Tk ()
365
376
screen_width = root .winfo_screenwidth ()
366
377
screen_height = root .winfo_screenheight ()
367
- root .geometry ("1000x500 +%d+%d" % (screen_width / 2 - 500 , screen_height / 2 - 250 ))
378
+ root .geometry ("%dx%d +%d+%d" % (WINWIDTH , WINHEIGHT , screen_width / 2 - 500 , screen_height / 2 - 250 ))
368
379
root .wm_title ("Coder for Pi" )
369
380
root .wm_client ("Coder for Pi" )
370
381
root .lift ()
0 commit comments