Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | WIP! Start using Class for emails, drawing/layout broken
* Have started developing a class for the emails |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | master |
Files: | files | file ages | folders |
SHA3-256: |
c732c2af6cecd208761731581f7425b2 |
User & Date: | i5ivem@gmail.com 2010-04-29 16:13:05 |
2010-05-26
| ||
13:02 |
Not working - further attempts to get Class approach working
* Can't get the message list to draw properly using this class approach. | |
2010-04-29
| ||
16:13 |
WIP! Start using Class for emails, drawing/layout broken
* Have started developing a class for the emails | |
2010-04-23
| ||
13:50 | Fix layout again Leaf check-in: 87dd659f52 user: i5ivem@gmail.com tags: trunk, v0.0.1 | |
Changes to shoefiti.rb.
1 2 3 4 5 6 7 8 9 10 11 12 | 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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | require 'rubygems' require 'date' require 'json' Shoes.app :title => "Shoefiti - Librelist Browser", :height => 700, :scroll => false do class Email #What about what class retains in memory? Do I need to flush the class? #Perhaps need to hand list, month, day, year attributes. #don't need to rely on time in email. Just set an index based on order that librelist presents them?? attr_accessor :date, :from, :subject, :body def initialize(date, from, subject, body) @date = date @from = from @subject = subject @body = body #@thread = subject.strip of RE, FW, etc. #Want to set thread. Based on subject? end =begin def self.sort_by_thread(thread) ??? #! ObjectSpace.each_object(Email) do |e| e.thread == end =end def self.draw_all ObjectSpace.each_object(Email) do |e| #@messagelist.append{ stack :margin => 30, :width => 550 do #Is this understood here? Some of this is not working. border black, :strokewidth => 2 inscription e.date inscription e.from inscription e.subject para e.body.to_s end #} end end end #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 |
︙ | ︙ | |||
98 99 100 101 102 103 104 | else day = day.to_s end url = "http://librelist.com/archives/"+list+"/"+year.to_s+"/"+month.to_s+"/"+day.to_s+"/json/" #debug(url) download(url) do |data| emails = eval(data.response.body)[1] | | > | | | | < < | | | | < | | > < > > | | | > | 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 179 180 | else day = day.to_s end url = "http://librelist.com/archives/"+list+"/"+year.to_s+"/"+month.to_s+"/"+day.to_s+"/json/" #debug(url) download(url) do |data| emails = eval(data.response.body)[1] @messagelist.clear{ stack do emails.each do |message| download(url+message) do |data| js = JSON.parse(data.response.body) Email.new( js["headers"]["Date"], js["headers"]["From"], js["headers"]["Subject"], if js["body"] para js["body"] else para js["parts"][0]["body"] end ) end #Ah but need to be sure thread finished! Could still draw one at a time. #Assuming finished: Email.draw_all #list, date? end end } end end #Actual app stuff URL = "http://librelist.com/archives/" |
︙ | ︙ | |||
171 172 173 174 175 176 177 | para " " end end @messagelist = stack :height => 425, :scroll => true init end | > > > > > > > > > | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | para " " end end @messagelist = stack :height => 425, :scroll => true init end #What would make this useful?? #Grouping by thread/subject - collapsible sections. # #For now really have to keep everything to "one day" # #How to do this ? Could set up a class! for messages |