Permalink
Browse files

added gtk-checklist program

  • Loading branch information...
1 parent 9357eac commit ccdb3befd0977806fd2cd926588334b511c10b40 @woodenbrick committed Jun 12, 2009
Showing with 385 additions and 0 deletions.
  1. BIN atom/__init__.pyc
  2. BIN atom/service.pyc
  3. 0 { → blog}/BeautifulSoup.py
  4. 0 { → blog}/__init__.py
  5. 0 { → blog}/admin.py
  6. 0 { → blog}/album.py
  7. 0 { → blog}/app.yaml
  8. 0 { → blog}/atom/__init__.py
  9. 0 { → blog}/atom/service.py
  10. 0 { → blog}/authorized.py
  11. 0 { → blog}/blog.py
  12. 0 { → blog}/cpedia/__init__.py
  13. 0 { → blog}/cpedia/filter/__init__.py
  14. 0 { → blog}/cpedia/filter/gravatar.py
  15. 0 { → blog}/cpedia/filter/replace.py
  16. 0 { → blog}/cpedia/pagination/GqlQueryPaginator.py
  17. 0 { → blog}/cpedia/pagination/__init__.py
  18. 0 { → blog}/cpedia/pagination/paginator.py
  19. 0 { → blog}/cpedia/util/__init__.py
  20. 0 { → blog}/cpedia/util/translate.py
  21. 0 { → blog}/docs.py
  22. 0 { → blog}/gdata/__init__.py
  23. 0 { → blog}/gdata/apps/__init__.py
  24. 0 { → blog}/gdata/apps/service.py
  25. 0 { → blog}/gdata/auth.py
  26. 0 { → blog}/gdata/base/__init__.py
  27. 0 { → blog}/gdata/base/service.py
  28. 0 { → blog}/gdata/blogger/__init__.py
  29. 0 { → blog}/gdata/blogger/service.py
  30. 0 { → blog}/gdata/calendar/__init__.py
  31. 0 { → blog}/gdata/calendar/service.py
  32. 0 { → blog}/gdata/codesearch/__init__.py
  33. 0 { → blog}/gdata/codesearch/service.py
  34. 0 { → blog}/gdata/contacts/__init__.py
  35. 0 { → blog}/gdata/contacts/service.py
  36. 0 { → blog}/gdata/docs/__init__.py
  37. 0 { → blog}/gdata/docs/service.py
  38. 0 { → blog}/gdata/exif/__init__.py
  39. 0 { → blog}/gdata/geo/__init__.py
  40. 0 { → blog}/gdata/media/__init__.py
  41. 0 { → blog}/gdata/photos/__init__.py
  42. 0 { → blog}/gdata/photos/service.py
  43. 0 { → blog}/gdata/service.py
  44. 0 { → blog}/gdata/spreadsheet/__init__.py
  45. 0 { → blog}/gdata/spreadsheet/service.py
  46. 0 { → blog}/gdata/spreadsheet/text_db.py
  47. 0 { → blog}/gdata/test_data.py
  48. 0 { → blog}/gdata/urlfetch.py
  49. 0 { → blog}/gdata/youtube/__init__.py
  50. 0 { → blog}/gdata/youtube/service.py
  51. BIN { → blog}/img/Thumbs.db
  52. BIN { → blog}/img/album_background.gif
  53. BIN { → blog}/img/anonymous-16.jpg
  54. BIN { → blog}/img/anonymous.jpg
  55. BIN { → blog}/img/appengine-silver-120x30.gif
  56. BIN { → blog}/img/bullet.gif
  57. BIN { → blog}/img/bullet_current.gif
  58. BIN { → blog}/img/comment_add.png
  59. BIN { → blog}/img/cpedia_zone.gif
  60. BIN { → blog}/img/delete.gif
  61. BIN { → blog}/img/diamond-black.gif
  62. BIN { → blog}/img/diamond-gray.gif
  63. BIN { → blog}/img/doc.gif
  64. BIN { → blog}/img/favicon.ico
  65. BIN { → blog}/img/feed-icon-16x16.png
  66. BIN { → blog}/img/html_editor.gif
  67. BIN { → blog}/img/icon_4_doc.gif
  68. BIN { → blog}/img/icon_4_pdf.gif
  69. BIN { → blog}/img/icon_4_pres.gif
  70. BIN { → blog}/img/icon_4_spread.gif
  71. BIN { → blog}/img/insert.png
  72. BIN { → blog}/img/logo/Thumbs.db
  73. BIN { → blog}/img/logo/logo1.gif
  74. BIN { → blog}/img/logo/logo2.gif
  75. BIN { → blog}/img/logo/wedding-banner.png
  76. BIN { → blog}/img/logo/weddingheader2.png
  77. BIN { → blog}/img/navbarlinkbg.gif
  78. BIN { → blog}/img/pdf.gif
  79. BIN { → blog}/img/ppt.gif
  80. BIN { → blog}/img/quote_wh.gif
  81. BIN { → blog}/img/refresh.png
  82. BIN { → blog}/img/rss.gif
  83. BIN { → blog}/img/threecolbg.gif
  84. BIN { → blog}/img/weddingheader.png
  85. BIN { → blog}/img/xml.gif
  86. BIN { → blog}/img/youtube.gif
  87. BIN { → blog}/img/zip.gif
  88. 0 { → blog}/index.yaml
  89. 0 { → blog}/jscripts/albumlist.grid.js
  90. 0 { → blog}/jscripts/archivelist.grid.js
  91. 0 { → blog}/jscripts/feedlist.grid.js
  92. 0 { → blog}/jscripts/imagelist.grid.js
  93. 0 { → blog}/jscripts/lightbox2.04/css/lightbox.css
  94. BIN { → blog}/jscripts/lightbox2.04/images/bullet.gif
  95. BIN { → blog}/jscripts/lightbox2.04/images/close.gif
  96. BIN { → blog}/jscripts/lightbox2.04/images/closelabel.gif
  97. BIN { → blog}/jscripts/lightbox2.04/images/download-icon.gif
  98. BIN { → blog}/jscripts/lightbox2.04/images/loading.gif
  99. BIN { → blog}/jscripts/lightbox2.04/images/nextlabel.gif
  100. BIN { → blog}/jscripts/lightbox2.04/images/prevlabel.gif
  101. 0 { → blog}/jscripts/lightbox2.04/js/builder.js
  102. 0 { → blog}/jscripts/lightbox2.04/js/effects.js
  103. 0 { → blog}/jscripts/lightbox2.04/js/lightbox.js
  104. 0 { → blog}/jscripts/lightbox2.04/js/prototype.js
  105. 0 { → blog}/jscripts/lightbox2.04/js/scriptaculous.js
  106. 0 { → blog}/jscripts/menulist.grid.js
  107. 0 { → blog}/jscripts/taglist.grid.js
  108. 0 { → blog}/jscripts/update.prototype.grid.js
  109. 0 { → blog}/jscripts/yui-image-uploader.js
  110. 0 { → blog}/jscripts/yui-plugin-dispatcher-min.js
  111. 0 { → blog}/lastfm/__init__.py
  112. 0 { → blog}/lastfm/lastfmstats.py
  113. 0 { → blog}/lastfm/xmlparser.py
  114. 0 { → blog}/main.py
  115. 0 { → blog}/model.py
  116. 0 { → blog}/readme.txt
  117. 0 { → blog}/recaptcha/__init__.py
  118. 0 { → blog}/recaptcha/client/__init__.py
  119. 0 { → blog}/recaptcha/client/captcha.py
  120. 0 { → blog}/rpc.py
  121. 0 { → blog}/simplejson/__init__.py
  122. 0 { → blog}/simplejson/decoder.py
  123. 0 { → blog}/simplejson/encoder.py
  124. 0 { → blog}/simplejson/scanner.py
  125. 0 { → blog}/simplejson/tool.py
  126. 0 { → blog}/stylesheets/blog.css
  127. 0 { → blog}/stylesheets/weblog.css
  128. 0 { → blog}/templates/admin/admin_albums.html
  129. 0 { → blog}/templates/admin/admin_archives.html
  130. 0 { → blog}/templates/admin/admin_authsub.html
  131. 0 { → blog}/templates/admin/admin_cache.html
  132. 0 { → blog}/templates/admin/admin_feeds.html
  133. 0 { → blog}/templates/admin/admin_images.html
  134. 0 { → blog}/templates/admin/admin_pages.html
  135. 0 { → blog}/templates/admin/admin_system.html
  136. 0 { → blog}/templates/admin/admin_tags.html
  137. 0 { → blog}/templates/admin_main.html
  138. 0 { → blog}/templates/admin_upload_dress.html
  139. 0 { → blog}/templates/album_main.html
  140. 0 { → blog}/templates/album_photo_view.html
  141. 0 { → blog}/templates/album_view.html
  142. 0 { → blog}/templates/atom.xml
  143. 0 { → blog}/templates/blog_add.html
  144. 0 { → blog}/templates/blog_delete.html
  145. 0 { → blog}/templates/blog_main.html
  146. 0 { → blog}/templates/blog_main_month.html
  147. 0 { → blog}/templates/blog_view.html
  148. 0 { → blog}/templates/footer.html
  149. 0 { → blog}/templates/full_music_list.html
  150. 0 { → blog}/templates/google_ad.html
  151. 0 { → blog}/templates/google_ajax_feed.html
  152. 0 { → blog}/templates/main.html
  153. 0 { → blog}/templates/main_top.html
  154. 0 { → blog}/templates/menu_right.html
  155. 0 { → blog}/templates/menu_right_right.html
  156. 0 { → blog}/templates/module_plugin/.svn/all-wcprops
  157. 0 { → blog}/templates/module_plugin/.svn/entries
  158. 0 { → blog}/templates/module_plugin/.svn/format
  159. 0 { → blog}/templates/module_plugin/.svn/text-base/album_comment.html.svn-base
  160. 0 { → blog}/templates/module_plugin/.svn/text-base/docs.html.svn-base
  161. 0 { → blog}/templates/module_plugin/.svn/text-base/greeting.html.svn-base
  162. 0 { → blog}/templates/module_plugin/album_comment.html
  163. 0 { → blog}/templates/module_plugin/docs.html
  164. 0 { → blog}/templates/module_plugin/greeting.html
  165. 0 { → blog}/templates/music.html
  166. 0 { → blog}/templates/paginator.html
  167. 0 { → blog}/templates/recentrequests.html
  168. 0 { → blog}/templates/site_map.html
  169. 0 { → blog}/templates/tag.html
  170. 0 { → blog}/templates/tag_delicious.html
  171. 0 { → blog}/templates/tagclound.html
  172. 0 { → blog}/templates/upload_dress.html
  173. 0 { → blog}/util.py
  174. 0 { → blog}/view.py
  175. 0 { → blog}/wedding.kpf
  176. 0 { → blog}/xmlblogloader.py
  177. 0 { → blog}/xmldoc
  178. 0 { → blog}/xmlparser.py
  179. +2 −0 checklist/README
  180. BIN checklist/checklist.sqlite
  181. +14 −0 checklist/installer.iss
  182. BIN checklist/logo.png
  183. +30 −0 checklist/setup.py
  184. +127 −0 checklist/ui.glade
  185. BIN checklist/wedding-banner.png
  186. +212 −0 checklist/wedding_checklist.py
  187. BIN cpedia/__init__.pyc
  188. BIN cpedia/filter/__init__.pyc
  189. BIN cpedia/filter/gravatar.pyc
  190. BIN cpedia/filter/replace.pyc
  191. BIN cpedia/pagination/GqlQueryPaginator.pyc
  192. BIN cpedia/pagination/__init__.pyc
  193. BIN cpedia/pagination/paginator.pyc
  194. BIN cpedia/util/__init__.pyc
  195. BIN cpedia/util/translate.pyc
  196. BIN gdata/__init__.pyc
  197. BIN gdata/auth.pyc
  198. BIN gdata/exif/__init__.pyc
  199. BIN gdata/geo/__init__.pyc
  200. BIN gdata/media/__init__.pyc
  201. BIN gdata/photos/__init__.pyc
  202. BIN gdata/photos/service.pyc
  203. BIN gdata/service.pyc
  204. BIN gdata/urlfetch.pyc
  205. BIN recaptcha/__init__.pyc
  206. BIN recaptcha/client/__init__.pyc
  207. BIN recaptcha/client/captcha.pyc
  208. BIN simplejson/__init__.pyc
  209. BIN simplejson/decoder.pyc
  210. BIN simplejson/encoder.pyc
  211. BIN simplejson/scanner.pyc
View
Binary file not shown.
View
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
View
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,2 @@
+The setup.py is for windows, to build a py2exe
+
View
Binary file not shown.
View
@@ -0,0 +1,14 @@
+[Setup]
+AppName=Wedding Checklist
+AppVerName=Wedding Checklist 0.1
+AppVersion=0.1
+AppPublisher=Daniel Woodhouse
+AppPublisherUrl=http://github.com/woodenbrick
+DefaultDirName={pf}\WeddingChecklist
+
+[Files]
+Source: "dist\*"; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
+
+[Icons]
+Name: "{commonprograms}\WeddingChecklist"; Filename: "{app}\weddingchecklist.exe"
+Name: "{commondesktop}\WeddingChecklist"; Filename: "{app}\weddingchecklist.exe"
View
Diff not rendered.
View
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+from distutils.core import setup
+import py2exe
+import os
+
+
+setup(
+name='weddingchecklist',
+version='0.1',
+
+windows=[{
+ 'script': 'wedding_checklist',
+ 'icon_resources': [(1, 'logo.png')]
+ }],
+
+data_files=[
+("ui.glade", "wedding-banner.png", "checklist.sqlite")],
+
+options = {
+'py2exe' : {
+ 'packages': 'encodings',
+ 'includes': 'cairo, pango, pangocairo, atk, gobject',
+ 'excludes' : ['_ssl', 'inspect', 'pdb', 'difflib', 'doctest', 'locale', 'calendar']
+},
+#'sdist': {
+# 'formats': 'zip',
+#}
+
+}
+)
View
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.4.5 on Thu Jun 11 22:59:17 2009 -->
+<glade-interface>
+ <widget class="GtkWindow" id="window1">
+ <property name="height_request">500</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Wedding Checklist</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="icon">logo.png</property>
+ <signal name="destroy" handler="gtk_main_quit"/>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="pixbuf">wedding-banner.png</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Show</property>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkProgressBar" id="progress_bar">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">2</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="wedding_timer">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">5</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <child>
+ <widget class="GtkTreeView" id="checklist_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="reorderable">True</property>
+ <property name="rules_hint">True</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkEntry" id="new_item">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="is_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <signal name="key_press_event" handler="on_new_item_key_press_event"/>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkButton" id="add_item">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_add_item"/>
+ </widget>
+ <packing>
+ <property name="pack_type">GTK_PACK_END</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">5</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
Diff not rendered.
@@ -0,0 +1,212 @@
+import time
+import gtk
+import gtk.glade
+import pygtk
+pygtk.require("2.0")
+import sqlite3
+import gobject
+import datetime
+import sys
+import pango
+
+def timer(future_time, end_string="until this timer runs out!", full=False):
+ """future_time is a datetime object"""
+ current_time = datetime.datetime.now()
+ timedelta = future_time - current_time
+ if full is False:
+ day_str = "days" if timedelta.days > 1 else "day"
+ return "%s %s %s" % (timedelta.days, day_str, end_string)
+ #convert seconds into hours, mins
+ time_list = []
+ time_names = ["day", "hour", "minute", "second"]
+ time_list.append(timedelta.days)
+ minutes = timedelta.seconds / 60 % 60
+ time_list.append(timedelta.seconds / 60 / 24 )
+ time_list.append(minutes)
+ time_list.append(timedelta.seconds)
+ #create string
+ string = []
+ for i in range(0, len(time_names)):
+ pl = "s" if time_list[i] > 1 else ""
+ if time_list[i] > 0:
+ string.append(str(time_list[i]) + " " + time_names[i] + pl)
+ return ", ".join(string) + " " + end_string
+
+
+
+WEDDING_TIME = datetime.datetime(2009, 8, 15, 12, 0, 0)
+
+class WeddingChecklist(object):
+
+ def __init__(self):
+ self.wTree = gtk.glade.XML("ui.glade")
+ self.wTree.signal_autoconnect(self)
+ self.db = sqlite3.Connection("checklist.sqlite")
+ self.cursor = self.db.cursor()
+ self.create_sql_tables()
+ self.treeview = self.wTree.get_widget("checklist_treeview")
+ self.liststore = gtk.ListStore(int, str, str, str, gobject.TYPE_BOOLEAN)
+ items = self.cursor.execute("""select * from checklist""").fetchall()
+ self.is_done = 0.0
+ for item in items:
+ self.liststore.append(item)
+ if item[4] == True:
+ self.is_done += 1
+ self.selection_filter = self.liststore.filter_new()
+ self.treeview.set_model(self.selection_filter)
+ self.selection_filter.set_visible_func(self.check_selection_visibility)
+ str_cols = ["id", "Item", "Category", "Sub Category"]
+ for i, col_name in enumerate(str_cols):
+ col = gtk.TreeViewColumn(col_name)
+ cell = gtk.CellRendererText()
+ col.pack_start(cell, False)
+ if col_name == "Item":
+ col.set_min_width(200)
+ col.set_max_width(300)
+ else:
+ col.set_min_width(100)
+ col.set_max_width(250)
+ col.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
+ cell.props.wrap_mode = pango.WRAP_WORD_CHAR
+ cell.props.wrap_width = 270
+ col.set_attributes(cell, text=i)
+ cell.set_property('editable', True)
+ cell.connect('edited', self.edited, i)
+
+ self.treeview.append_column(col)
+ if col_name == "id":
+ col.set_visible(False)
+
+ col = gtk.TreeViewColumn("Done?")
+ cell = gtk.CellRendererToggle()
+ col.pack_start(cell, False)
+ cell.set_property('activatable', True)
+ cell.connect( 'toggled', self.on_item_checked, self.selection_filter)
+ col.add_attribute(cell, "active", 4)
+ self.treeview.append_column(col)
+
+ self.change_view = gtk.combo_box_new_text()
+ self.change_view.show()
+ self.change_view.connect("changed", self.on_change_view, None)
+ self.wTree.get_widget("hbox1").pack_start(self.change_view)
+ items = ["All", "Not Done", "Done"]
+ for item in items:
+ self.change_view.append_text(item)
+ self.change_view.set_active(0)
+
+ self.new_category = gtk.combo_box_new_text()
+ self.wTree.get_widget("hbox2").pack_start(self.new_category)
+ items = ["Ceremony", "Reception", "Pinkies"]
+
+ for item in items:
+ self.new_category.append_text(item)
+
+ sub_cat = ["Documents",
+ "Location",
+ "Decoration",
+ "Music",
+ "Food & Drink",
+ "Rituals/Traditions",
+ "Cars",
+ "Photos",
+ "Bride/Bridesmaids/Groom/Best man"]
+ self.sub_categories = gtk.combo_box_new_text()
+ self.wTree.get_widget("hbox2").pack_start(self.sub_categories)
+ for cat in sub_cat:
+ self.sub_categories.append_text(cat)
+ self.sub_categories.show()
+ self.sub_categories.set_active(0)
+
+ self.new_category.show()
+ self.new_category.set_active(0)
+
+ self.timer = gobject.timeout_add(600000, self.update_wedding_timer)
+ self.update_wedding_timer()
+ self.counter = self.cursor.execute("""SELECT count(*) FROM checklist""").fetchone()[0]
+ self.update_progress_bar()
+
+ def on_change_view(self, widget, *args):
+ """Filter out results based on the contents of change_view"""
+ self.show = self.change_view.get_active_text()
+ self.selection_filter.refilter()
+
+
+ def check_selection_visibility(self, model, iter):
+ if self.show == "All":
+ return True
+ if self.show == "Not Done":
+ return not model.get_value(iter, 4)
+ if self.show == "Done":
+ return model.get_value(iter, 4)
+
+ def update_wedding_timer(self):
+ self.wTree.get_widget("wedding_timer").set_text(timer(WEDDING_TIME, "to go!"))
+
+ def update_progress_bar(self):
+ try:
+ fraction = (self.is_done / self.counter)
+ except ZeroDivisionError:
+ fraction = 0
+ self.wTree.get_widget("progress_bar").set_text("%s out of %s items complete." % (int(self.is_done), self.counter))
+ self.wTree.get_widget("progress_bar").set_fraction(fraction)
+
+
+ def on_item_checked(self, cell, path, model):
+ path = model.convert_path_to_child_path(path)
+ self.liststore[path][4] = not self.liststore[path][4]
+ if self.liststore[path][4] == True:
+ self.is_done += 1
+ else:
+ self.is_done -= 1
+ self.cursor.execute("""update checklist set is_done=? WHERE id=?""", (
+ self.liststore[path][4], self.liststore[path][0]))
+ self.db.commit()
+ self.update_progress_bar()
+
+ def edited(self, cell, path, new_text, column):
+ path = self.selection_filter.convert_path_to_child_path(path)
+ items = ["id", "item", "category", "sub_category"]
+ query = """update checklist set %s='%s' WHERE id=%s""" % (items[column],
+ new_text,
+ self.liststore[path][0])
+ self.cursor.execute(query)
+ self.db.commit()
+ self.liststore[path][column] = new_text
+
+ def on_new_item_key_press_event(self, widget, key):
+ if key.keyval == 65293:
+ self.on_add_item()
+
+
+ def on_add_item(self, *args):
+ new_item = self.wTree.get_widget("new_item").get_text()
+ new_category = self.new_category.get_active_text()
+ sub_category = self.sub_categories.get_active_text()
+ self.cursor.execute("""INSERT INTO checklist (item,
+ category, sub_category) VALUES (?, ?, ?)""", (
+ new_item, new_category, sub_category)
+ )
+ self.db.commit()
+ self.liststore.append([self.cursor.lastrowid, new_item, new_category, sub_category, 0])
+ self.counter += 1
+ self.update_progress_bar()
+ self.wTree.get_widget("new_item").set_text("")
+ vadj = self.wTree.get_widget("scrolledwindow1").get_vadjustment()
+ vadj.value = -1 #vadj.upper
+
+ def create_sql_tables(self):
+ query = """create table if not exists checklist (
+ `id` integer PRIMARY KEY,
+ `item` text,
+ `category` varchar(50),
+ `sub_category` varchar(50),
+ `is_done` boolean default 0
+ )"""
+ self.cursor.execute(query)
+ self.db.commit()
+
+ def gtk_main_quit(self, *args):
+ gtk.main_quit()
+
+WeddingChecklist()
+gtk.main()
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.

0 comments on commit ccdb3be

Please sign in to comment.