shoefiti

Check-in [fb0c7e5ad8]
Login

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

Overview
Comment:Fix rendering of mailpane when new calendar

* Removed commented out old code
* Hide calendar when selecting a new list or year
* Show calendar when selecting month
* Remove drawmailpane function from month listbox block
as don't need a new mailpane each time, just need to clear and
redraw. This was causing a scrollbar to appear in main window and
odd display glitches
* Replace with @messagelist.clear in the calendar function and just
one drawmailpane call at app initialisation
* Still room for improvement

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fb0c7e5ad8bb603ba56283c7f111aff5893b9eae17db6e33154a4fe1d4397ea6
User & Date: i5ivem@gmail.com 2010-04-15 15:59:43
Context
2010-04-22
15:52
One list_box and calendar nav as per website (WIP!)

* Mainly due to the bug in the MinGW version of Shoes, which only
allows one list_box, I've moved to having one list_box for list
selection. The most recent year and month are fetched and the
calendar drawn for that.
* Use forward and back buttons, as per the Librelist website to
move the calendar forward and back.
* Work in progress! check-in: 9bb433e5de user: i5ivem@gmail.com tags: trunk

2010-04-15
15:59
Fix rendering of mailpane when new calendar

* Removed commented out old code
* Hide calendar when selecting a new list or year
* Show calendar when selecting month
* Remove drawmailpane function from month listbox block
as don't need a new mailpane each time, just need to clear and
redraw. This was causing a scrollbar to appear in main window and
odd display glitches
* Replace with @messagelist.clear in the calendar function and just
one drawmailpane call at app initialisation
* Still room for improvement check-in: fb0c7e5ad8 user: i5ivem@gmail.com tags: trunk

2010-04-07
16:12
Redraw calendar each time check-in: d43fb93b4f user: i5ivem@gmail.com tags: trunk
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
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
require 'rubygems'
require 'date'
require 'json'

Shoes.app :title => "Shoefiti - Librelist Browser", :height => 700, :scroll => false do
	
	#Clever, but utimately useless if want to re-select something. I.e. different mailing list.
	#Perhaps mix in with Classes??
	#only works once. 
	
	#class listsel
	#	url
		#extend the list_box method? I.e. what gets executed on selection?
		#
	
#must reset
	
	@stack_list = stack :margin => 10 do
		
		@list_list = list_box do |list| 
			@stack_day.hide

			download(URL+list.text) do |resp|
				@list_year.items = eval(resp.response.body)[1]
				@stack_year.show
			end
		end
	end


	@stack_year = stack :margin => 10 do
		@list_year = list_box do |year|

			download(URL+@list_list.text+year.text) do |resp|
				@list_day.items =  eval(resp.response.body)[1]
				@stack_day.show
			end
		end
	end


	@stack_day = stack :margin => 10 do
		@list_day = list_box do |day|
			download(URL+@list_list.text+@list_year.text+day.text) do |resp|
				@place = eval(resp.response.body)[0].split("/")

				drawcalendar(@place.pop.to_i, @place.pop.to_i, @place.pop.to_s, eval(resp.response.body)[1])
				drawmailpane
			end
		end
	end




	
	def init
		download(URL) do |resp|
			@list_list.items = eval(resp.response.body)[1]
			@stack_list.show
		end
	end

=begin
			@place = eval(list.response.body)[0].split("/")
			#debug(@lists)
			#debug(@place)
			stack :margin => 10 do
				@loading.hide
				@animate.stop
				@loaded.show
				if @place.length < 5 #Need to break out of this once we get to the list of days. Odd array length due to split on /
					
					make_list_box(@lists)

					
					#list_box :items => @lists do |list|
					#	debug(@lists)
					#	@listurl += list.text
					#	getlist
					#end
				else
					#debug("Pop1 "+@place.pop) #Turning on these debugs will break app since popping items from array
					#debug("Pop2 "+@place.pop)
					drawcalendar(@place.pop.to_i, @place.pop.to_i, @place.pop.to_s, @lists)
					drawmailpane #Can't draw mailpane before now, as otherwise threading in getlist downloads results in drop downs appearing below mailpane
				end	
			end		
		end
	end


	#This half works and makes sure lists retain their 'lists'
	def make_list_box(lists)
		list_box :items => lists do |list|
			@listurl += list.text
			debug(lists)
			getlist
		end
	end
=end

	#Need to clear and redraw like mailpane
	def drawcalendar(month, year, list, maildays)
		off=Date.new(year, month, 01).wday-1 #Offset, not sure 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}

		@stack_cal.clear{
		days.each do |column|
			i = days.index(column)
			row = 0
			stack :left => i*40+250, :top => -100 do
				para column
				until row == rows do






<
<
<
|
|
<
<
<
<
<
<




>







|


|






|
>




>

<




|
<
<
<







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







>







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

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



	#Remove clever, but useless way of defining list boxes, and define each separately:	
	#Mailing list






	@stack_list = stack :margin => 10 do
		
		@list_list = list_box do |list| 
			@stack_day.hide
			@stack_cal.hide
			download(URL+list.text) do |resp|
				@list_year.items = eval(resp.response.body)[1]
				@stack_year.show
			end
		end
	end

	#Year
	@stack_year = stack :margin => 10 do
		@list_year = list_box do |year|
			@stack_cal.hide
			download(URL+@list_list.text+year.text) do |resp|
				@list_day.items =  eval(resp.response.body)[1]
				@stack_day.show
			end
		end
	end
	
	#Month
	@stack_day = stack :margin => 10 do
		@list_day = list_box do |day|
			download(URL+@list_list.text+@list_year.text+day.text) do |resp|
				@place = eval(resp.response.body)[0].split("/")
				@stack_cal.show
				drawcalendar(@place.pop.to_i, @place.pop.to_i, @place.pop.to_s, eval(resp.response.body)[1])

			end
		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(month, year, list, maildays)
		off=Date.new(year, month, 01).wday-1 #Offset, not sure 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+250, :top => -100 do
				para column
				until row == rows do
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
	end

	
	def drawmailpane
		@messagelist = stack :height => 425, :scroll => true 
	end

=begin	
	@loading = para "Loading Lists...", :margin => 10
	@animate = animate(5) do |frame|
		weight = ["bold", "normal"]
		@loading.style(:weight => weight[frame&1])	
	end
	@loaded = para "Pick list to browse", :margin => 10
	@loaded.hide
=end


	URL = "http://librelist.com/archives/"
	@listurl = ""
	


	@stack_list.hide
	@stack_year.hide
	@stack_day.hide

	@stack_cal = stack do
	end

	init 		
	

end







<
<
<
<
<
<
<
<
<
|
>


<
<
<



<


<

|


133
134
135
136
137
138
139









140
141
142
143



144
145
146

147
148

149
150
151
152
	end

	
	def drawmailpane
		@messagelist = stack :height => 425, :scroll => true 
	end










	
	#Actual app stuff
	URL = "http://librelist.com/archives/"
	@listurl = ""



	@stack_list.hide
	@stack_year.hide
	@stack_day.hide

	@stack_cal = stack do
	end

	init 		
	drawmailpane #No real need for drawmailpane function, get rid of this

end