Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Not working - further attempts to get Class approach working
* Can't get the message list to draw properly using this class approach. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | master |
Files: | files | file ages | folders |
SHA3-256: |
1a9d98c8526ac7084ba34f0cab097953 |
User & Date: | i5ivem@gmail.com 2010-05-26 13:02:39 |
2010-05-26
| ||
13:33 | Adding README and screenshot check-in: 8a0c949b73 user: i5ivem@gmail.com tags: master, trunk | |
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 | |
Changes to shoefiti.rb.
1 2 3 4 5 6 | require 'rubygems' require 'date' require 'json' Shoes.app :title => "Shoefiti - Librelist Browser", :height => 700, :scroll => false 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 | 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? Is that even possible? #Perhaps need to hand list, month, day, year attributes to draw_all. #Perhaps using a class is not the best way... Use hash or array. 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{ $app.stack :margin => 30, :width => 550 do #Is this understood here? Some of this is not working. $app.border black, :strokewidth => 2 $app.inscription e.date $app.inscription e.from $app.inscription e.subject $app.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 @month = 12 |
︙ | ︙ | |||
143 144 145 146 147 148 149 | 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] | < < < < | | | | | | | | | | | | | | < > | > | | < | 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 | 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] 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 end @messagelist.clear{ #stack do Email.draw_all #list, date? #end } end end #Actual app stuff URL = "http://librelist.com/archives/" |
︙ | ︙ | |||
220 221 222 223 224 225 226 | @messagelist = stack :height => 425, :scroll => true init end #What would make this useful?? #Grouping by thread/subject - collapsible sections. | < | < < | 213 214 215 216 217 218 219 220 221 222 | @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" |