swat 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -6,13 +6,23 @@ Features:
6
6
  - Manage your todos, add them according to priority and category.
7
7
  - Move your todos to wish list, when not feeling like working on them.
8
8
  - libtomboy bindings for global shortcut(Alt-F11).
9
- - Nice stats for your number of tasks finished and added.
9
+ - Nice stats for number of tasks finished and added.
10
10
  - All your todos are in a .org file and hence can be managed from
11
11
  Emacs as well.
12
+ - System tray integration.
12
13
 
13
14
  KeyBindings:
14
15
  - Alt-F11 : from anywhere, brings the todo window to front.
15
- - Esc : do dismiss todo window.
16
+ - Esc : to dismiss todo window.
16
17
  - Control-N : to add a todo.
17
18
 
19
+ Installation :
20
+ - sudo gem install swat
21
+
22
+ Code:
23
+ - http://packet.googlecode.com/svn/branches/swat/
24
+
25
+ Mailing List and Forums :
26
+ - Ahem
27
+
18
28
 
data/bin/swat CHANGED
@@ -6,6 +6,7 @@ require "erb"
6
6
  require "yaml"
7
7
  require "ostruct"
8
8
  require "enumerator"
9
+ require "fileutils"
9
10
  SWAT_APP = File.expand_path(File.dirname(__FILE__)+"/..")
10
11
  ["lib","ext"].each { |x| $LOAD_PATH.unshift("#{SWAT_APP}/#{x}"); }
11
12
 
@@ -18,6 +19,7 @@ require "keybinder"
18
19
  require "todo_data"
19
20
  require "add_todo_dialog"
20
21
  require "wish_list"
22
+ require "completed_view"
21
23
  require "swat"
22
24
 
23
25
  Swat::SwatMain.new
@@ -0,0 +1,22 @@
1
+ module Swat
2
+ class CompletedView
3
+ include Swat::ListHelper
4
+ attr_accessor :todo_data,:parent_view,:list_view
5
+ def initialize(done_view,parent_view)
6
+ @todo_data = parent_view.todo_data
7
+ @list_view = done_view
8
+ @parent_view = parent_view
9
+ @model = create_model(false)
10
+ load_available_lists
11
+ add_columns
12
+ @list_view.expand_all
13
+ end
14
+
15
+ def reload_view
16
+ @todo_data = parent_view.todo_data
17
+ @model = create_model(false)
18
+ load_available_lists
19
+ @list_view.expand_all
20
+ end
21
+ end
22
+ end
Binary file
@@ -22,10 +22,9 @@ module Swat
22
22
  @list_view.expander_column = column
23
23
  end
24
24
 
25
- def create_model
25
+ def create_model(open_task = true)
26
26
  model = Gtk::TreeStore.new(String,String,Fixnum,Fixnum)
27
-
28
- todo_data.open_tasks do |key,value|
27
+ populate_model = lambda do |key,value|
29
28
  iter = model.append(nil)
30
29
  iter[0] = key
31
30
  iter[1] = "white"
@@ -39,6 +38,12 @@ module Swat
39
38
  child_iter[3] = todo_item.index
40
39
  end
41
40
  end
41
+
42
+ if(open_task)
43
+ todo_data.open_tasks(&populate_model)
44
+ else
45
+ todo_data.close_tasks(&populate_model)
46
+ end
42
47
  return model
43
48
  end
44
49
 
@@ -24,7 +24,7 @@ module Swat
24
24
  @meta_data = p_meta_data if p_meta_data
25
25
  today_heading = Gtk::Label.new
26
26
  today_heading.xalign = 0.02
27
- today_heading.set_markup("<span foreground='#6d0835' style='oblique' size='smaller'> Today </span>")
27
+ today_heading.set_markup("<span foreground='#6d0835' style='oblique' > Today </span>")
28
28
  @vbox_container.pack_start(today_heading,false,false)
29
29
 
30
30
  @today_label = Gtk::Label.new
@@ -54,7 +54,7 @@ module Swat
54
54
  def set_yesterday_label
55
55
  yesterday_heading = Gtk::Label.new
56
56
  yesterday_heading.xalign = 0.02
57
- yesterday_heading.set_markup("<span foreground='#6d0835' style='oblique' size='smaller'> Yesterday </span>")
57
+ yesterday_heading.set_markup("<span foreground='#6d0835' style='oblique'> Yesterday </span>")
58
58
  @vbox_container.pack_start(yesterday_heading,false,false)
59
59
 
60
60
  @yesterday_label = Gtk::Label.new
@@ -68,7 +68,7 @@ module Swat
68
68
  def set_lastweek_label
69
69
  lastweek_heading = Gtk::Label.new
70
70
  lastweek_heading.xalign = 0.02
71
- lastweek_heading.set_markup("<span foreground='#6d0835' style='oblique' size='smaller'> Lastweek </span>")
71
+ lastweek_heading.set_markup("<span foreground='#6d0835' style='oblique'> Lastweek </span>")
72
72
  @vbox_container.pack_start(lastweek_heading,false,false)
73
73
 
74
74
  @lastweek_label = Gtk::Label.new
@@ -1,17 +1,22 @@
1
1
  module Swat
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  class SwatMain
4
4
  attr_accessor :todo_window
5
5
  attr_accessor :status_icon
6
6
  attr_accessor :key_binder
7
-
7
+ attr_accessor :config_dir
8
8
  def initialize
9
+ @config_dir = File.join(ENV['HOME'] + '/snippets')
10
+ create_config_directory
11
+
9
12
  @status_icon = Gtk::StatusIcon.new
10
13
  icon_file = Gdk::Pixbuf.new("#{SWAT_APP}/resources/todo.png")
11
14
  @status_icon.pixbuf = icon_file
12
- TodoWindow.todo_file_location = File.join(ENV['HOME'], 'snippets/todo.org')
13
- TodoWindow.wishlist = File.join(ENV['HOME'], 'snippets/wishlist.org')
14
- TodoWindow.meta_data_file = File.join(ENV['HOME'], 'snippets/meta_data.yml')
15
+
16
+
17
+ TodoWindow.todo_file_location = File.join(ENV['HOME'], '/snippets/todo.org')
18
+ TodoWindow.wishlist = File.join(ENV['HOME'], '/snippets/wishlist.org')
19
+ TodoWindow.meta_data_file = File.join(ENV['HOME'], '/snippets/meta_data.yml')
15
20
  @todo_window = TodoWindow.new("#{SWAT_APP}/resources/todo_window.glade")
16
21
 
17
22
  @status_icon.set_tooltip("Your Task List")
@@ -28,6 +33,16 @@ module Swat
28
33
  @todo_window.show_window
29
34
  end
30
35
 
36
+ # creates configuration files if they don't exist
37
+ def create_config_directory
38
+ if File.exist?(@config_dir) && !File.directory?(@config_dir)
39
+ raise "A file with same name as configuration directory #{@config_dir} exists in home directory"
40
+ end
41
+ unless File.exist?(@config_dir)
42
+ FileUtils.mkdir(@config_dir)
43
+ end
44
+ end
45
+
31
46
  def display_context_menu(*args)
32
47
  w,button,activate_time = *args
33
48
  menu = Gtk::Menu.new
@@ -29,7 +29,7 @@ module Swat
29
29
  priority = $1.size
30
30
  item = OpenStruct.new(:priority => priority, :flag => false, :text => $2,:index => line_count )
31
31
  line_count += 1
32
- @todo_container[current_category] << item
32
+ @todo_container[current_category].push(item)
33
33
  end
34
34
  end
35
35
  end
@@ -37,17 +37,20 @@ module Swat
37
37
  def open_tasks
38
38
  @todo_container.each do |category,todo_array|
39
39
  next if todo_array.empty?
40
- todo_array.sort! { |x,y| x.priority <=> y.priority }
41
- todo_array.reject! { |x| !x.flag }
42
- yield(category,todo_array)
40
+ sorted_array = todo_array.sort { |x,y| x.priority <=> y.priority }
41
+ open_task_array = sorted_array.reject { |x| !x.flag }
42
+ next if open_task_array.empty?
43
+ yield(category,open_task_array)
43
44
  end
44
45
  end
45
46
 
46
- def open_tasks_with_index
47
- @todo_container.each_with_index do |category,todo_array,index|
48
- todo_array.sort! { |x,y| x.priority <=> y.priority }
49
- todo_array.reject! { |x| !x.flag }
50
- yield(category,todo_array,index)
47
+ def close_tasks
48
+ @todo_container.each do |category,todo_array|
49
+ next if todo_array.empty?
50
+ sorted_array = todo_array.sort! { |x,y| x.priority <=> y.priority }
51
+ done_task_array = sorted_array.reject { |x| x.flag }
52
+ next if done_task_array.empty?
53
+ yield(category,done_task_array)
51
54
  end
52
55
  end
53
56
 
@@ -76,6 +76,7 @@ module Swat
76
76
  add_columns
77
77
  connect_custom_signals
78
78
  layout_wishlist
79
+ layout_done_view
79
80
  @list_view.expand_all
80
81
  @todo_window.hide
81
82
  end
@@ -97,6 +98,11 @@ module Swat
97
98
  @wish_list_tab = WishList.new(@@wishlist,wish_list_view,self)
98
99
  end
99
100
 
101
+ def layout_done_view
102
+ done_view = @glade.get_widget("done_view")
103
+ @done_tab = CompletedView.new(done_view,self)
104
+ end
105
+
100
106
  def connect_custom_signals
101
107
  @todo_context_menu = TodoContextMenu.new
102
108
  @todo_context_menu.append(" Mark As Done ") { mark_as_done }
@@ -134,6 +140,7 @@ module Swat
134
140
  @meta_data.todo_done
135
141
  @meta_data.dump
136
142
  @stat_vbox.update_today_label(@meta_data)
143
+ @done_tab.reload_view
137
144
  end
138
145
  end
139
146
 
@@ -153,6 +160,7 @@ module Swat
153
160
 
154
161
  def show_window
155
162
  @todo_window = @glade.get_widget("todo_window")
163
+ @todo_window.present
156
164
  @todo_window.show
157
165
  end
158
166
 
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
  <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
3
- <!--Generated with glade3 3.4.0 on Thu Dec 13 09:50:49 2007 -->
3
+ <!--Generated with glade3 3.4.0 on Sat Dec 15 12:51:59 2007 -->
4
4
  <glade-interface>
5
5
  <widget class="GtkWindow" id="todo_window">
6
6
  <property name="visible">True</property>
@@ -163,6 +163,38 @@
163
163
  <property name="tab_fill">False</property>
164
164
  </packing>
165
165
  </child>
166
+ <child>
167
+ <widget class="GtkScrolledWindow" id="scrolledwindow3">
168
+ <property name="visible">True</property>
169
+ <property name="can_focus">True</property>
170
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
171
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
172
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
173
+ <child>
174
+ <widget class="GtkTreeView" id="done_view">
175
+ <property name="visible">True</property>
176
+ <property name="can_focus">True</property>
177
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
178
+ <property name="headers_clickable">True</property>
179
+ </widget>
180
+ </child>
181
+ </widget>
182
+ <packing>
183
+ <property name="position">2</property>
184
+ </packing>
185
+ </child>
186
+ <child>
187
+ <widget class="GtkLabel" id="done_task_label">
188
+ <property name="visible">True</property>
189
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
190
+ <property name="label" translatable="yes">Completed Tasks</property>
191
+ </widget>
192
+ <packing>
193
+ <property name="type">tab</property>
194
+ <property name="position">2</property>
195
+ <property name="tab_fill">False</property>
196
+ </packing>
197
+ </child>
166
198
  </widget>
167
199
  <packing>
168
200
  <property name="position">1</property>
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: swat
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2007-12-13 00:00:00 +05:30
6
+ version: 1.0.2
7
+ date: 2008-01-02 00:00:00 +05:30
8
8
  summary: Swat, A application for managing your todos
9
9
  require_paths:
10
10
  - libext
@@ -35,36 +35,37 @@ files:
35
35
  - bin/swat
36
36
  - tests/test_todo_data.rb
37
37
  - tests/test_helper.rb
38
- - lib/swat_meta_data.rb
39
- - lib/wish_list.rb
38
+ - lib/add_todo_dialog.rb
39
+ - lib/todo_window.rb
40
+ - lib/todo_context_menu.rb
40
41
  - lib/stat_box.rb
41
- - lib/todo_data.rb
42
+ - lib/wish_list.rb
43
+ - lib/swat_meta_data.rb
42
44
  - lib/swat.rb
45
+ - lib/completed_view.rb
43
46
  - lib/list_helper.rb
44
- - lib/todo_context_menu.rb
45
- - lib/todo_window.rb
46
- - lib/add_todo_dialog.rb
47
- - ext/mkmf-gnome2.rb
47
+ - lib/todo_data.rb
48
+ - lib/keybinder
49
+ - lib/keybinder/tomboykeybinder.o
50
+ - lib/keybinder/eggaccelerators.o
51
+ - lib/keybinder/keybinder.o
52
+ - ext/extconf.rb
53
+ - ext/eggaccelerators.c
54
+ - ext/tomboykeybinder.h
48
55
  - ext/Makefile
56
+ - ext/tomboykeybinder.c
49
57
  - ext/keybinder.so
58
+ - ext/mkmf-gnome2.rb
50
59
  - ext/keybinder.c
51
- - ext/tomboykeybinder.c
52
- - ext/eggaccelerators.o
53
60
  - ext/eggaccelerators.h
54
- - ext/tomboykeybinder.h
55
- - ext/eggaccelerators.c
56
- - ext/tomboykeybinder.o
57
- - ext/keybinder.o
58
- - ext/extconf.rb
59
- - resources/add_todo.glade
60
- - resources/working_window.glade
61
+ - resources/toggle_icon.png
61
62
  - resources/todo.png
63
+ - resources/add_todo.glade
62
64
  - resources/todo_window.glade
65
+ - resources/control_rewind_blue.png
66
+ - resources/todo.org
63
67
  - resources/gedit-icon.png
64
68
  - resources/control_end_blue.png
65
- - resources/todo.org
66
- - resources/control_rewind_blue.png
67
- - resources/toggle_icon.png
68
69
  test_files: []
69
70
 
70
71
  rdoc_options: []
Binary file
Binary file
Binary file
@@ -1,127 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
3
- <!--Generated with glade3 3.4.0 on Thu Dec 13 00:02:46 2007 -->
4
- <glade-interface>
5
- <widget class="GtkWindow" id="todo_window">
6
- <property name="visible">True</property>
7
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
8
- <property name="default_width">800</property>
9
- <property name="default_height">700</property>
10
- <property name="opacity">0.52999997138977051</property>
11
- <signal name="key_press_event" handler="on_todo_window_key_press_event"/>
12
- <signal name="delete_event" handler="on_todo_window_delete_event"/>
13
- <signal name="destroy_event" handler="on_todo_window_destroy_event"/>
14
- <child>
15
- <widget class="GtkVBox" id="vbox1">
16
- <property name="visible">True</property>
17
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
18
- <child>
19
- <widget class="GtkToolbar" id="todo_toolbar">
20
- <property name="visible">True</property>
21
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
22
- <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
23
- <property name="icon_size">GTK_ICON_SIZE_BUTTON</property>
24
- <property name="icon_size_set">True</property>
25
- <child>
26
- <widget class="GtkToolButton" id="sync_button">
27
- <property name="visible">True</property>
28
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
29
- <property name="label" translatable="yes">Sync</property>
30
- <property name="use_underline">True</property>
31
- <property name="stock_id">gtk-apply</property>
32
- <signal name="clicked" handler="on_sync_button_clicked"/>
33
- <accelerator key="s" modifiers="GDK_MOD1_MASK" signal="clicked"/>
34
- </widget>
35
- <packing>
36
- <property name="expand">False</property>
37
- </packing>
38
- </child>
39
- <child>
40
- <widget class="GtkToolButton" id="reload_button">
41
- <property name="visible">True</property>
42
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
43
- <property name="label" translatable="yes">Reload</property>
44
- <property name="stock_id">gtk-refresh</property>
45
- <signal name="clicked" handler="on_reload_button_clicked"/>
46
- <accelerator key="r" modifiers="GDK_MOD1_MASK" signal="clicked"/>
47
- </widget>
48
- <packing>
49
- <property name="expand">False</property>
50
- </packing>
51
- </child>
52
- <child>
53
- <widget class="GtkToolButton" id="add_todo_button">
54
- <property name="visible">True</property>
55
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
56
- <property name="label" translatable="yes">Add</property>
57
- <property name="stock_id">gtk-add</property>
58
- <signal name="clicked" handler="on_add_todo_button_clicked"/>
59
- <accelerator key="n" modifiers="GDK_CONTROL_MASK" signal="clicked"/>
60
- </widget>
61
- <packing>
62
- <property name="expand">False</property>
63
- </packing>
64
- </child>
65
- </widget>
66
- <packing>
67
- <property name="expand">False</property>
68
- </packing>
69
- </child>
70
- <child>
71
- <widget class="GtkHBox" id="hbox1">
72
- <property name="visible">True</property>
73
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
74
- <child>
75
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
76
- <property name="visible">True</property>
77
- <property name="can_focus">True</property>
78
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
79
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
80
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
81
- <child>
82
- <widget class="GtkTreeView" id="todo_view">
83
- <property name="visible">True</property>
84
- <property name="can_focus">True</property>
85
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
86
- <property name="headers_clickable">True</property>
87
- </widget>
88
- </child>
89
- </widget>
90
- </child>
91
- <child>
92
- <widget class="GtkHBox" id="stat_box">
93
- <property name="visible">True</property>
94
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
95
- <child>
96
- <widget class="GtkButton" id="toggle_stat_button">
97
- <property name="visible">True</property>
98
- <property name="can_focus">True</property>
99
- <property name="receives_default">True</property>
100
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
101
- <property name="use_stock">True</property>
102
- <property name="response_id">0</property>
103
- <signal name="clicked" handler="on_toggle_stat_button_clicked"/>
104
- </widget>
105
- <packing>
106
- <property name="expand">False</property>
107
- </packing>
108
- </child>
109
- <child>
110
- <placeholder/>
111
- </child>
112
- </widget>
113
- <packing>
114
- <property name="expand">False</property>
115
- <property name="fill">False</property>
116
- <property name="position">1</property>
117
- </packing>
118
- </child>
119
- </widget>
120
- <packing>
121
- <property name="position">1</property>
122
- </packing>
123
- </child>
124
- </widget>
125
- </child>
126
- </widget>
127
- </glade-interface>