shoefiti

Check-in [390ac16b92]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:First tentative steps towards porting to Green Shoes

I.e. doesnt currently work. Launches a brief window
but crashes from view instantly.
Lots of things don't work and will need changing:

* Seems like widths/heights need to be changed from
percentages to decimal
* Threading doesn't seem to work. At least not mine
* Definite issues using clear{...}
* Can't use debug(), just use "puts" instead

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk | origin/green
Files: files | file ages | folders
SHA3-256: 390ac16b92acb8f97957d2f2a0b597023bd9207fc114e390c8996ac184245618
User & Date: i5ivem@gmail.com 2011-08-03 13:11:31
Context
2011-08-03
13:11
First tentative steps towards porting to Green Shoes

I.e. doesnt currently work. Launches a brief window
but crashes from view instantly.
Lots of things don't work and will need changing:

* Seems like widths/heights need to be changed from
percentages to decimal
* Threading doesn't seem to work. At least not mine
* Definite issues using clear{...}
* Can't use debug(), just use "puts" instead Leaf check-in: 390ac16b92 user: i5ivem@gmail.com tags: origin/green, trunk

2010-04-23
13:50
Fix layout again Leaf check-in: 87dd659f52 user: i5ivem@gmail.com tags: trunk, v0.0.1
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to shoefiti.rb.

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
require 'rubygems'
require 'date'
require 'json'

Shoes.app :title => "Shoefiti - Librelist Browser", :height => 700, :scroll => false do
	

	#Need to be careful not to get months that don't exist (think ok back in time, within reason??)
	def changemonth(direction)
		if direction == :backward
			if @month == 1 #tempting to do "12/".next but no corresponding previous
				@year -= 1
				@month = 12
			else
				@month -= 1
			end
		end
		if direction == :forward
			if @month == 12
				@year += 1
				@month = 1
			else
				@month += 1
			end
		end
		debug(@year)
		debug(@month)
		download(URL+@list+@year.to_s+"/"+(0 if @month < 10).to_s+@month.to_s) do |resp|
			@days = eval(resp.response.body)[1]
			debug(@days)
			#@stack_cal.show
			#@stack_cal_nav.show
			@when.replace(@month.to_s, " ", @year.to_s)
			drawcalendar(@list, @year, @month, @days)
		end
	end
	
		
	def init
		download(URL) do |resp|
			@list_list.items = eval(resp.response.body)[1]
			@stack_list.show
		end
	end


	#Need to clear and redraw like mailpane
	def drawcalendar(list, year, month, maildays)
		debug("Where's the calendar?")
		off=Date.new(year, month, 01).wday-1 #Offset, can't remember why I need the -1 here, but I do.
		mdays=(Date.new(year, 12, 31) << (12-month)).day #Days in the month
		rows=((mdays+off+1).to_f/7.0).ceil #Number of rows in calendar, plus 1 to compensate for -1 above. Have confused myself
		days = %w{Su Mo Tu We Th Fr Sa}
		@messagelist.clear
		@stack_cal.clear{
		days.each do |column|
			i = days.index(column)
			row = 0
			stack :left => i*40, :top => 10 do
				para column
				until row == rows do
					calday = i-off+7*row
|



|




















|
|


|


















|





|







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
require 'green_shoes'
require 'date'
require 'json'

Shoes.app :title => "Shoefiti - Librelist Browser", :height => 700 do#, :scroll => false do
	

	#Need to be careful not to get months that don't exist (think ok back in time, within reason??)
	def changemonth(direction)
		if direction == :backward
			if @month == 1 #tempting to do "12/".next but no corresponding previous
				@year -= 1
				@month = 12
			else
				@month -= 1
			end
		end
		if direction == :forward
			if @month == 12
				@year += 1
				@month = 1
			else
				@month += 1
			end
		end
		puts @year
		puts @month
		download(URL+@list+@year.to_s+"/"+(0 if @month < 10).to_s+@month.to_s) do |resp|
			@days = eval(resp.response.body)[1]
			puts @days
			#@stack_cal.show
			#@stack_cal_nav.show
			@when.replace(@month.to_s, " ", @year.to_s)
			drawcalendar(@list, @year, @month, @days)
		end
	end
	
		
	def init
		download(URL) do |resp|
			@list_list.items = eval(resp.response.body)[1]
			@stack_list.show
		end
	end


	#Need to clear and redraw like mailpane
	def drawcalendar(list, year, month, maildays)
		puts "Where's the calendar?"
		off=Date.new(year, month, 01).wday-1 #Offset, can't remember why I need the -1 here, but I do.
		mdays=(Date.new(year, 12, 31) << (12-month)).day #Days in the month
		rows=((mdays+off+1).to_f/7.0).ceil #Number of rows in calendar, plus 1 to compensate for -1 above. Have confused myself
		days = %w{Su Mo Tu We Th Fr Sa}
		@messagelist.clear
		@stack_cal = flow do #{
		days.each do |column|
			i = days.index(column)
			row = 0
			stack :left => i*40, :top => 10 do
				para column
				until row == rows do
					calday = i-off+7*row
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87
						end
					else 
						para ""
					end
					row += 1
				end
			end

		end}
	end


	def make_date_link(list, year, month, day) #http://thread.gmane.org/gmane.comp.lib.shoes/4042/focus=4044
		link(day){getmails(list, year, month, day)}
	end
	







>
|







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
						end
					else 
						para ""
					end
					row += 1
				end
			end
		end#}
		end
	end


	def make_date_link(list, year, month, day) #http://thread.gmane.org/gmane.comp.lib.shoes/4042/focus=4044
		link(day){getmails(list, year, month, day)}
	end
	
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
	
	
	#Actual app stuff
	URL = "http://librelist.com/archives/"

	#Try doing single list box owing to list_box troubles on shoes MinGW
	#More closely mimics the web interface
	flow :width => "100%" do
		stack :width => "40%" do 
			@stack_list = stack :margin => 10 do
				@list_list = list_box do |list| 
					@list = list.text	
					download(URL+@list) do |resp|
						@year = eval(resp.response.body)[1][-1].to_i
						debug(@year)
						download(URL+@list+@year.to_s) do |resp|
							@month = eval(resp.response.body)[1][-1].to_i
							debug(@month)
							download(URL+@list+@year.to_s+"/"+(0 if @month < 10).to_s+@month.to_s) do |resp|
								@days = eval(resp.response.body)[1]
								debug(@days)
								@when.replace(@month.to_s, " ", @year.to_s)
								drawcalendar(@list, @year, @month, @days)
							end
						end
					end
				end
			end
			@listurl = ""
			@stack_cal_nav = stack :margin => 10 do
				button "<" do
					changemonth(:backward)
				end
				@when = para " "
				@when.style :margin => 10
				button ">" do
					changemonth(:forward)
				end
			end
		end
		@stack_cal = stack :width => "60%" do
			para " "
		end
	end
	@messagelist = stack :height => 425, :scroll => true 
	init 	

end







|
|





|


|


|



















|



|



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
	
	
	#Actual app stuff
	URL = "http://librelist.com/archives/"

	#Try doing single list box owing to list_box troubles on shoes MinGW
	#More closely mimics the web interface
	flow :width => 1.0 do
		stack :width => 0.4 do 
			@stack_list = stack :margin => 10 do
				@list_list = list_box do |list| 
					@list = list.text	
					download(URL+@list) do |resp|
						@year = eval(resp.response.body)[1][-1].to_i
						puts @year
						download(URL+@list+@year.to_s) do |resp|
							@month = eval(resp.response.body)[1][-1].to_i
							puts @month
							download(URL+@list+@year.to_s+"/"+(0 if @month < 10).to_s+@month.to_s) do |resp|
								@days = eval(resp.response.body)[1]
								puts @days
								@when.replace(@month.to_s, " ", @year.to_s)
								drawcalendar(@list, @year, @month, @days)
							end
						end
					end
				end
			end
			@listurl = ""
			@stack_cal_nav = stack :margin => 10 do
				button "<" do
					changemonth(:backward)
				end
				@when = para " "
				@when.style :margin => 10
				button ">" do
					changemonth(:forward)
				end
			end
		end
		@stack_cal = stack :width => 0.6 do
			para " "
		end
	end
	@messagelist = stack :height => 425#, :scroll => true 
	init 	

end