shoefiti

Check-in [6475c16072]
Login

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

Overview
Comment:Playing about with re-using list drop downs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6475c160723be0a8ae07054dd1b6d17bfde80bc7055fe281daf2b51d4613e82c
User & Date: i5ivem@gmail.com 2010-04-06 15:17:23
Context
2010-04-06
16:16
Started making less-clever, but more usuable lists check-in: c2b66f1570 user: i5ivem@gmail.com tags: trunk
15:17
Playing about with re-using list drop downs check-in: 6475c16072 user: i5ivem@gmail.com tags: trunk
2010-04-04
22:37
Fix message pane displaying only latest message check-in: 9971bce308 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
require 'rubygems'
require 'date'
require 'json'

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










	def getlist
		download(URL+@listurl) do |list|
			@lists = eval(list.response.body)[1]
			@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 /




					list_box :items => @lists do |list|

						@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












	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}
		days.each do |column|






>
>
>
>
>
>
>
>
>
>











>
>
>
>
|
>
|
|
|










>
>
>
>
>
>
>
>
>
>







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
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?
		#
	

	def getlist
		download(URL+@listurl) do |list|
			@lists = eval(list.response.body)[1]
			@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


	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}
		days.each do |column|