You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(39) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
(31) |
Jul
(12) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Hans F. <ha...@fu...> - 2004-05-04 03:56:07
|
Ok, I'm graduated. Now I'll finally have time to work on Neelix. I'm
hoping to get some momentum, please feel free to jump on at any time and
help in any way.
This is the time when we see how maintainable our code is. :-) I suspect
there will be some refactoring, but hopefully I can restrain the desire
to refactor everything in sight and only refactor what needs
refactoring. I've been reading "The Art of UNIX Programming" by ESR and
it's a great book with some very pragmatic perspectives and opinions.
ESR isn't a big fan of OO it seems, and prefers simplicity and a
well-defined interface over OO for OO sake. A lot of things got me
thinking and I was afraid I might want to refactor everything. But as I
thought it through from the ground up I think we're not far from the
best approach, so I'm confident we can keep using the codebase we have.
Let me review the MVP (model-view-presenter) approach we were taking,
and which I think is still a good approach. The model is the data, the
presenter operates on the data ("business logic"), and the view is the
UI. I propose the following simple rules as to what goes where: the
model is attribute readers/writers and observable. The presenter is
everything more complex than read/write to the model, that is logically
separate from the UI. Traditionally the view only reads from the model
and does writes through the presenter, but in the case that you're just
setting a value in an object it seems a waste to have all that framework
code. On the converse, when something does become more complex we must
remember to move it to the presenter so that it can be reused by other
views. There may be views (e.g. nontraditional views that we haven't yet
considered) that need their own presenters because they don't fit well
with the first presenter, but nobody should have to rewrite the model or
a piece of it (if so we have a design flaw). Any thoughts on the overall
design, then?
Given that design, I see the following action items:
- sweep through the code; document it and clean up any messes
(refactoring as necessary) I want especially good documentation on the
model.
- Polish the model (I think it's mostly done, IIRC)
- Get a complete GUI skeleton (e.g. not attached to the model or perhaps
initialized from the model but unconcerned about changing things)
- Identify presenter items and code them. I think the presenter will
grow organically but we should knock off anything big and obvious up
front.
- glue
As far as functionality,
0.1.0 - target: Independence Day 2004
Recipe management.
- organized into categories in cookbooks
- partial ingredient implementation (e.g. to the degree needed for
receipe management)
Please give me your thoughts, now that you've lent me your brains for a
moment. Then take up an action item and run, walk, or crawl with it. If
not, I'll chip away at them myself. I believe the best impetus for an
open source project is someone(s) spewing code (or some kind of tangible
work).
--
.O. Hans Fugal | De gustibus non disputandum est.
..O http://hans.fugal.net | Debian, vim, mutt, ruby, text, gpg
OOO | WindowMaker, gaim, UTF-8, RISC, JS Bach
---------------------------------------------------------------------
GnuPG Fingerprint: 6940 87C5 6610 567F 1E95 CB5E FC98 E8CD E0AA D460
|
|
From: <fu...@us...> - 2003-12-23 14:59:16
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv18551/view
Modified Files:
fox.rb
Log Message:
presenter - only whitespace.
model - mucked around with Replicator
view - Added a menu. The Add Cookbook option in the Action menu works, the other Action menu items need to be done. Then we need to add delete cookbook/category/recipe menu items.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- fox.rb 23 Dec 2003 02:45:53 -0000 1.15
+++ fox.rb 23 Dec 2003 14:59:13 -0000 1.16
@@ -112,7 +112,7 @@
end
@ingredientList.connect(SEL_SELECTED) do |sender,sel,data|
- @up.enabled = data unless data == 0
+ @up.enabled = (data != 0)
@delete.enabled = true
@ingredientList.setCurrentItem(data)
end
@@ -257,9 +257,34 @@
def initialize(app)
super(app, 'Neelix')
resize(800,600)
+
+ # Menu
+ menubar = FXMenubar.new(self)
+ filemenu = FXMenuPane.new(self)
+ FXMenuCommand.new(filemenu, "&Exit", nil, getApp(), FXApp::ID_QUIT)
+ FXMenuTitle.new(menubar,"&File",nil,filemenu)
+
+ actionmenu = FXMenuPane.new(self)
+ actions={}
+ actions['add_cookbook'] = FXMenuCommand.new(actionmenu, "Add Cook&book", nil)
+ actions['add_cookbook'].enable
+ actions['add_category'] = FXMenuCommand.new(actionmenu, "Add &Category", nil)
+ actions['add_category'].disable
+ actions['add_recipe'] = FXMenuCommand.new(actionmenu, "Add &Recipe", nil)
+ actions['add_recipe'].disable
+ FXMenuTitle.new(menubar,"&Action",nil,actionmenu)
+
+ helpmenu = FXMenuPane.new(self)
+ FXMenuCommand.new(helpmenu, "&About Neelix...").connect(SEL_COMMAND) {
+ FXMessageBox.information(self, MBOX_OK, "About Neelix",
+ "Neelix is cool.\nhttp://sf.net/projects/neelix\n\nDedicated to Erin Fugal")
+ }
+ FXMenuTitle.new(menubar, "&Help", nil, helpmenu, LAYOUT_RIGHT)
+
frame = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
splitter = FXSplitter.new(frame,SPLITTER_HORIZONTAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
+ # Splitter
shelf = FXGroupBox.new(splitter,"Shelf",FRAME_GROOVE)
shelf.width=200
counter = FXGroupBox.new(splitter,"Counter",FRAME_GROOVE)
@@ -269,9 +294,10 @@
CategoryForm.new(counterSwitcher,nil)
RecipeForm.new(counterSwitcher,nil)
+ # Shelf
frame = FXVerticalFrame.new(shelf, FRAME_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0)
shelfTree = FXTreeList.new(frame,0,nil,0,TREELIST_SINGLESELECT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y)
- $replicator.shelf.each do |cookbook|
+ $replicator.cookbooks.each do |cookbook|
cookbook_item = shelfTree.addItemLast(nil, FXTreeItem.new(cookbook.name))
cookbook_item.data = cookbook
cookbook.add_observer { cookbook_item.text = cookbook.name; shelfTree.update }
@@ -292,18 +318,75 @@
when Cookbook
counterSwitcher.children[1].cookbook = ptr.data
counterSwitcher.current = 1
+ actions['add_cookbook'].enable
+ actions['add_category'].enable
+ actions['add_recipe'].disable
when Category
counterSwitcher.children[2].category = ptr.data
counterSwitcher.current = 2
+ actions['add_cookbook'].enable
+ actions['add_category'].disable
+ actions['add_recipe'].enable
when Recipe
counterSwitcher.children[3].recipe = ptr.data
counterSwitcher.current = 3
+ actions['add_cookbook'].enable
+ actions['add_category'].disable
+ actions['add_recipe'].disable
+ else
+ counterSwitcher.current = 0
+ actions['add_cookbook'].enable
+ actions['add_category'].disable
+ actions['add_recipe'].disable
end
end
shelfTree.expandTree(shelfTree.firstItem)
shelfTree.expandTree(shelfTree.firstItem.first)
shelfTree.makeItemVisible(shelfTree.firstItem.first.first)
+
+ # shelf observers
+ $replicator.cookbooks.add_observer {
+ ary = $replicator.cookbooks.to_a
+ data = ary.shift
+ shelfTree.each do |item|
+ if data == item.data
+ data = ary.shift
+ next
+ end
+
+ while data != nil and item.data != data
+ newitem = FXTreeItem.new(data.name)
+ newitem.data = data
+ data.add_observer {
+ newitem.text = data.name
+ }
+ shelfTree.addItemBefore(item,newitem)
+ shelfTree.selectItem(newitem,true)
+ data = ary.shift
+ end
+
+ shelfTree.removeItem(item) if data.nil?
+ end
+ ary << data
+ ary.each { |data|
+ newitem = FXTreeItem.new(data.name)
+ newitem.data = data
+ data.add_observer {
+ newitem.text = data.name
+ }
+ shelfTree.addItemLast(nil,newitem)
+ shelfTree.selectItem(newitem,true)
+ }
+ }
+ # TODO categories and recipes observers
+
+ # actions menu connections
+ actions['add_cookbook'].connect(SEL_COMMAND) {
+ c = $replicator.create('cookbook',{'name'=>"New Cookbook"})
+ }
+ actions['add_category'].connect(SEL_COMMAND) { puts "TODO: Add Category proc" }
+ actions['add_recipe'].connect(SEL_COMMAND) { puts "TODO: Add Recipe proc" }
end
end
|
|
From: <fu...@us...> - 2003-12-23 14:59:16
|
Update of /cvsroot/neelix/neelix/presenter In directory sc8-pr-cvs1:/tmp/cvs-serv18551/presenter Modified Files: presenter.rb Log Message: presenter - only whitespace. model - mucked around with Replicator view - Added a menu. The Add Cookbook option in the Action menu works, the other Action menu items need to be done. Then we need to add delete cookbook/category/recipe menu items. Index: presenter.rb =================================================================== RCS file: /cvsroot/neelix/neelix/presenter/presenter.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- presenter.rb 23 Dec 2003 02:45:53 -0000 1.2 +++ presenter.rb 23 Dec 2003 14:59:13 -0000 1.3 @@ -1,20 +1,21 @@ module Presenter - def Presenter::promoteIngredient(recipe, i) - raise "Can't promote first ingredient" unless i > 0 - sorted_ingredients = recipe.ingredients.sort - sorted_ingredients[i].position, sorted_ingredients[i - 1].position = sorted_ingredients[i - 1].position, sorted_ingredients[i].position - end - def Presenter::demoteIngredient(recipe, i) - raise "Can't demote last ingredient" unless i < recipe.ingredients.length - 1 - sorted_ingredients = recipe.ingredients.sort - sorted_ingredients[i].position, sorted_ingredients[i + 1].position = sorted_ingredients[i + 1].position, sorted_ingredients[i].position - end - def Presenter::deleteIngredient(recipe, i) - sorted_ingredients = recipe.ingredients.sort - ingredient = sorted_ingredients[i] - recipe.ingredients.delete(ingredient) - end - def Presenter::addIngredient(recipe, ingredient) - recipe.ingredients << ingredient - end + def Presenter::promoteIngredient(recipe, i) + raise "Can't promote first ingredient" unless i > 0 + sorted_ingredients = recipe.ingredients.sort + sorted_ingredients[i].position, sorted_ingredients[i - 1].position = sorted_ingredients[i - 1].position, sorted_ingredients[i].position + end + def Presenter::demoteIngredient(recipe, i) + raise "Can't demote last ingredient" unless i < recipe.ingredients.length - 1 + sorted_ingredients = recipe.ingredients.sort + sorted_ingredients[i].position, sorted_ingredients[i + 1].position = sorted_ingredients[i + 1].position, sorted_ingredients[i].position + end + def Presenter::deleteIngredient(recipe, i) + sorted_ingredients = recipe.ingredients.sort + ingredient = sorted_ingredients[i] + recipe.ingredients.delete(ingredient) + end + def Presenter::addIngredient(recipe, ingredient) + recipe.ingredients << ingredient + end end +#vim:ts=8:sw=4:nowrap |
|
From: <fu...@us...> - 2003-12-23 14:59:16
|
Update of /cvsroot/neelix/neelix/model
In directory sc8-pr-cvs1:/tmp/cvs-serv18551/model
Modified Files:
model.rb
Log Message:
presenter - only whitespace.
model - mucked around with Replicator
view - Added a menu. The Add Cookbook option in the Action menu works, the other Action menu items need to be done. Then we need to add delete cookbook/category/recipe menu items.
Index: model.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/model/model.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- model.rb 23 Dec 2003 02:45:53 -0000 1.8
+++ model.rb 23 Dec 2003 14:59:12 -0000 1.9
@@ -388,12 +388,12 @@
class Replicator
include Singleton
- attr_accessor :shelf
+ attr_reader :cookbooks, :measures, :foods
def initialize()
@dbh = nil
@hash = Hash.new
- @shelf = Array.new
+
end
def check_dbh
@@ -403,6 +403,21 @@
def attach(dbh)
@dbh = dbh
@hash = Hash.new
+
+ @cookbooks = ObservableArray.new
+ @dbh.select_all('select cookbook_id from cookbook').each do |row|
+ @cookbooks << get('cookbook', row['cookbook_id'])
+ end
+
+ @measures = ObservableArray.new
+ @dbh.select_all("select measure_id from measure").each do |row|
+ @measures << get('measure', row['measure_id'])
+ end
+
+ @foods = ObservableArray.new
+ @dbh.select_all("select food_id from food").each do |row|
+ @foods << get('food', row['food_id'])
+ end
end
def get(type,id)
@@ -449,53 +464,42 @@
end
end
- def measure_list
- measures = Array.new
- @dbh.select_all("select measure_id from measure").each do |row|
- measures << get('measure', row['measure_id'])
- end
- measures
- end
-
+ # should this be a presenter function? If it were, we couldn't make use of SQL...
def find_food(name)
row = @dbh.select_one("select food_id from food where name=?", name)
return get('food', row['food_id']) unless row.nil?
nil
end
- def shelf
- check_dbh
-
- cookbooks = Array.new
- @dbh.select_all('select cookbook_id from cookbook').each do |row|
- cookbooks << get('cookbook', row['cookbook_id'])
- end
- return cookbooks
- end
-
def create(type,values)
check_dbh
case type
when 'cookbook'
- @dbh.do('insert into cookbook (cookbook_id) values (NULL)')
+ @dbh.do('insert into cookbook (cookbook_id,name) values (NULL,?)',
+ values['name'])
@dbh.commit
id = @dbh.select_one('select max(cookbook_id) from cookbook')[0].to_i
@hash['cookbook'] = Hash.new if @hash['cookbook'].nil?
- return @hash['cookbook'][id] = Cookbook.new(@dbh, id)
+ @hash['cookbook'][id] = Cookbook.new(@dbh, id)
+ @cookbooks << @hash['cookbook'][id]
+ return @hash['cookbook'][id]
when 'category'
- @dbh.do('insert into category (cookbook_id) values (?)',
- values['cookbook_id'])
+ @dbh.do('insert into category (cookbook_id,name) values (?,?)',
+ values['cookbook_id'], values['name'])
@dbh.commit
id = @dbh.select_one('select max(category_id) from category')[0].to_i
@hash['category'] = Hash.new if @hash['category'].nil?
- return @hash['category'][id] = Category.new(@dbh, id)
+ c = @hash['category'][id] = Category.new(@dbh, id)
+ @hash['cookbook'][values['cookbook_id']].categories << c
+ return c
when 'recipe'
- @dbh.do('insert into recipe (recipe_id) values (NULL)')
+ @dbh.do('insert into recipe (recipe_id,name) values (NULL,?)',
+ values['name'])
@dbh.commit
id = @dbh.select_one('select max(recipe_id) from recipe')[0].to_i
@@ -517,7 +521,9 @@
id = @dbh.select_one('select max(ingredient_id) from ingredient')[0].to_i
@hash['ingredient'] = Hash.new if @hash['ingredient'].nil?
- return @hash['ingredient'][id] = Ingredient.new(@dbh, id)
+ i = @hash['ingredient'][id] = Ingredient.new(@dbh, id)
+ @hash['recipe'][values['recipe_id']].ingredients << i
+ return i
when 'food'
@dbh.do('insert into food (name) values (?)', values['name'])
@@ -525,7 +531,9 @@
id = @dbh.select_one('select max(food_id) from food')[0].to_i
@hash['food'] = Hash.new if @hash['food'].nil?
- return @hash['food'][id] = Food.new(@dbh, id)
+ f = @hash['food'][id] = Food.new(@dbh, id)
+ @foods << f
+ return f
when 'measure'
@dbh.do('insert into measure (measure_id) values (NULL)')
@@ -533,7 +541,9 @@
id = @dbh.select_one('select max(measure_id) from measure')[0].to_i
@hash['measure'] = Hash.new if @hash['measure'].nil?
- return @hash['measure'][id] = Measure.new(@dbh, id)
+ m = @hash['measure'][id] = Measure.new(@dbh, id)
+ @measures << m
+ return m
else raise "Invalid Record Type"
end
|
|
From: <lu...@us...> - 2003-12-23 02:45:57
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv5237/view
Modified Files:
fox.rb
Log Message:
Adding/editing ingredients works (rudimentary). Edit an ingredient by double
clicking on it.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- fox.rb 22 Dec 2003 23:44:48 -0000 1.14
+++ fox.rb 23 Dec 2003 02:45:53 -0000 1.15
@@ -74,7 +74,7 @@
@ingredientList = FXList.new(ingredientFrame,5,nil,0,LAYOUT_FILL_X|LIST_SINGLESELECT)
frame = FXVerticalFrame.new(frame)
- FXButton.new(frame,"Add Ingredient")
+ @add = FXButton.new(frame,"Add Ingredient")
@up = FXButton.new(frame,"Move Up")
@delete = FXButton.new(frame,"Delete")
@up.enabled = false
@@ -119,6 +119,81 @@
@ingredientList.connect(SEL_COMMAND) do |snd,sel,data|
@ingredientList.selectItem(data)
+ end
+
+ @ingredientList.connect(SEL_DOUBLECLICKED) do |sender,sel,data|
+ ingredient = @recipe.ingredients.sort[data]
+
+ ingredientDialog = FXDialogBox.new(self,"Edit Ingredient")
+
+ FXLabel.new(ingredientDialog,"Quantity")
+ quantity = FXTextField.new(ingredientDialog, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
+ quantity.text = ingredient.quantity.to_s
+
+ FXLabel.new(ingredientDialog,"Measure")
+ measures = FXListBox.new(ingredientDialog, 5, nil, 0, FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL|LAYOUT_FILL_X)
+ $replicator.measure_list.each do |measure|
+ measures << measure.name
+ measures.currentItem = measures.numItems - 1 if measure === ingredient.measure
+ end
+
+ FXLabel.new(ingredientDialog,"Food")
+ food = FXTextField.new(ingredientDialog, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
+ food.text = ingredient.food.name
+
+ FXLabel.new(ingredientDialog,"Modifier")
+ modifier = FXTextField.new(ingredientDialog, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
+ modifier.text = ingredient.modifier
+
+ FXButton.new(ingredientDialog,"Accept",nil,ingredientDialog,FXDialogBox::ID_ACCEPT)
+ FXButton.new(ingredientDialog,"Cancel",nil,ingredientDialog,FXDialogBox::ID_CANCEL)
+ if ingredientDialog.execute == 1 then
+ ingredient.quantity = quantity.text
+ ingredient.measure = $replicator.measure_list[measures.currentItem]
+ ingredient.modifier = (modifier.text == '' ? nil : modifier.text)
+
+ new_food = food.text
+ food = $replicator.find_food(new_food)
+ food = $replicator.create('food', {'name' => new_food}) if food.nil?
+ ingredient.food = food
+ end
+ end
+
+ @add.connect(SEL_COMMAND) do |sender,sel,data|
+ ingredientDialog = FXDialogBox.new(self,"Add Ingredient")
+
+ FXLabel.new(ingredientDialog,"Quantity")
+ quantity = FXTextField.new(ingredientDialog, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
+ quantity.text = '0.0'
+
+ FXLabel.new(ingredientDialog,"Measure")
+ measures = FXListBox.new(ingredientDialog, 5, nil, 0, FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL|LAYOUT_FILL_X)
+ $replicator.measure_list.each { |measure| measures << measure.name }
+
+ FXLabel.new(ingredientDialog,"Food")
+ food = FXTextField.new(ingredientDialog, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
+
+ FXLabel.new(ingredientDialog,"Modifier")
+ modifier = FXTextField.new(ingredientDialog, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
+
+ FXButton.new(ingredientDialog,"Accept",nil,ingredientDialog,FXDialogBox::ID_ACCEPT)
+ FXButton.new(ingredientDialog,"Cancel",nil,ingredientDialog,FXDialogBox::ID_CANCEL)
+ if ingredientDialog.execute == 1 then
+ quantity = quantity.text
+ measure = $replicator.measure_list[measures.currentItem]
+ modifier = (modifier.text == '' ? nil : modifier.text)
+
+ new_food = food.text
+ food = $replicator.find_food(new_food)
+ food = $replicator.create('food', {'name' => new_food}) if food.nil?
+
+ Presenter::addIngredient(@recipe, $replicator.create('ingredient',{
+ 'recipe_id' => @recipe.id,
+ 'measure_id' => measure.id,
+ 'quantity' => quantity,
+ 'food_id' => food.id,
+ 'modifier' => modifier}))
+ end
end
@up.connect(SEL_COMMAND) do |sender,sel,data|
|
|
From: <lu...@us...> - 2003-12-23 02:45:57
|
Update of /cvsroot/neelix/neelix/presenter In directory sc8-pr-cvs1:/tmp/cvs-serv5237/presenter Modified Files: presenter.rb Log Message: Adding/editing ingredients works (rudimentary). Edit an ingredient by double clicking on it. Index: presenter.rb =================================================================== RCS file: /cvsroot/neelix/neelix/presenter/presenter.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- presenter.rb 22 Dec 2003 23:37:57 -0000 1.1 +++ presenter.rb 23 Dec 2003 02:45:53 -0000 1.2 @@ -14,4 +14,7 @@ ingredient = sorted_ingredients[i] recipe.ingredients.delete(ingredient) end + def Presenter::addIngredient(recipe, ingredient) + recipe.ingredients << ingredient + end end |
|
From: <lu...@us...> - 2003-12-23 02:45:56
|
Update of /cvsroot/neelix/neelix/model
In directory sc8-pr-cvs1:/tmp/cvs-serv5237/model
Modified Files:
model.rb
Log Message:
Adding/editing ingredients works (rudimentary). Edit an ingredient by double
clicking on it.
Index: model.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/model/model.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- model.rb 22 Dec 2003 23:44:48 -0000 1.7
+++ model.rb 23 Dec 2003 02:45:53 -0000 1.8
@@ -129,6 +129,10 @@
@id = ingredient_id
end
+ def recipe
+ $replication.get('recipe',@dbh.select_one("select recipe_id from ingredient where ingredient_id=?",@id)['recipe_id'])
+ end
+
def measure
$replicator.get('measure',@dbh.select_one("select measure_id from ingredient where ingredient_id=?",@id)['measure_id'])
end
@@ -445,6 +449,20 @@
end
end
+ def measure_list
+ measures = Array.new
+ @dbh.select_all("select measure_id from measure").each do |row|
+ measures << get('measure', row['measure_id'])
+ end
+ measures
+ end
+
+ def find_food(name)
+ row = @dbh.select_one("select food_id from food where name=?", name)
+ return get('food', row['food_id']) unless row.nil?
+ nil
+ end
+
def shelf
check_dbh
@@ -485,10 +503,16 @@
return @hash['recipe'][id] = Recipe.new(@dbh, id)
when 'ingredient'
- @dbh.do('insert into ingredient (recipe_id,measure_id,food_id) values (?,?,?)',
+ row = @dbh.select_one('select max(position) from ingredient where recipe_id=?',values['recipe_id'])
+ position = (row ? row[0].to_i + 1 : 1)
+
+ @dbh.do('insert into ingredient (recipe_id,measure_id,quantity,food_id,modifier,position) values (?,?,?,?,?,?)',
values['recipe_id'],
values['measure_id'],
- values['food_id'])
+ values['quantity'],
+ values['food_id'],
+ values['modifier'],
+ position)
@dbh.commit
id = @dbh.select_one('select max(ingredient_id) from ingredient')[0].to_i
@@ -496,7 +520,7 @@
return @hash['ingredient'][id] = Ingredient.new(@dbh, id)
when 'food'
- @dbh.do('insert into food (food_id) values (NULL)')
+ @dbh.do('insert into food (name) values (?)', values['name'])
@dbh.commit
id = @dbh.select_one('select max(food_id) from food')[0].to_i
|
|
From: <fu...@us...> - 2003-12-22 23:44:52
|
Update of /cvsroot/neelix/neelix/view In directory sc8-pr-cvs1:/tmp/cvs-serv8196/view Modified Files: fox.rb Log Message: nicer selection code Index: fox.rb =================================================================== RCS file: /cvsroot/neelix/neelix/view/fox.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- fox.rb 22 Dec 2003 23:37:58 -0000 1.13 +++ fox.rb 22 Dec 2003 23:44:48 -0000 1.14 @@ -112,18 +112,20 @@ end @ingredientList.connect(SEL_SELECTED) do |sender,sel,data| - @up.enabled = (data != 0) + @up.enabled = data unless data == 0 @delete.enabled = true + @ingredientList.setCurrentItem(data) + end + + @ingredientList.connect(SEL_COMMAND) do |snd,sel,data| + @ingredientList.selectItem(data) end @up.connect(SEL_COMMAND) do |sender,sel,data| - selectedIndices = (0 .. @ingredientList.numItems-1).select do |i| - @ingredientList.itemSelected?(i) - end - if not selectedIndices.empty? then - index = selectedIndices.first + index = @ingredientList.currentItem + if index > 0 Presenter::promoteIngredient(@recipe, index) - @ingredientList.selectItem(index - 1, true) + @ingredientList.selectItem(index - 1,true) end end |
|
From: <fu...@us...> - 2003-12-22 23:44:52
|
Update of /cvsroot/neelix/neelix/model
In directory sc8-pr-cvs1:/tmp/cvs-serv8196/model
Modified Files:
model.rb
Log Message:
nicer selection code
Index: model.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/model/model.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- model.rb 22 Dec 2003 23:37:57 -0000 1.6
+++ model.rb 22 Dec 2003 23:44:48 -0000 1.7
@@ -37,7 +37,7 @@
end
wrap_method :<<, :[]=, :clear, :collect!, :compact!, :delete, :delete_at, :delete_if, :flatten!, :map!, :pop, :push, :reject!, :replace, :reverse!, :shift, :slice!, :sort!, :uniq!, :unshift
- wrap_method :assoc, :collect, :compact, :concat, :flatten, :rassoc, :reverse, :slice, :uniq#, :sort
+ #wrap_method :assoc, :collect, :compact, :concat, :flatten, :rassoc, :reverse, :slice, :sort, :uniq
end
class Food
@@ -519,3 +519,4 @@
end
$replicator = Replicator.instance
+# vim:ts=8:sw=4:nowrap
|
|
From: <lu...@us...> - 2003-12-22 23:38:01
|
Update of /cvsroot/neelix/neelix/presenter In directory sc8-pr-cvs1:/tmp/cvs-serv6968/presenter Added Files: presenter.rb Log Message: refactored the promote/demote/delete ingredient functionality into presenter methods --- NEW FILE: presenter.rb --- module Presenter def Presenter::promoteIngredient(recipe, i) raise "Can't promote first ingredient" unless i > 0 sorted_ingredients = recipe.ingredients.sort sorted_ingredients[i].position, sorted_ingredients[i - 1].position = sorted_ingredients[i - 1].position, sorted_ingredients[i].position end def Presenter::demoteIngredient(recipe, i) raise "Can't demote last ingredient" unless i < recipe.ingredients.length - 1 sorted_ingredients = recipe.ingredients.sort sorted_ingredients[i].position, sorted_ingredients[i + 1].position = sorted_ingredients[i + 1].position, sorted_ingredients[i].position end def Presenter::deleteIngredient(recipe, i) sorted_ingredients = recipe.ingredients.sort ingredient = sorted_ingredients[i] recipe.ingredients.delete(ingredient) end end |
|
From: <lu...@us...> - 2003-12-22 23:38:01
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv6968/view
Modified Files:
fox.rb
Log Message:
refactored the promote/demote/delete ingredient functionality into presenter
methods
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- fox.rb 20 Dec 2003 19:00:15 -0000 1.12
+++ fox.rb 22 Dec 2003 23:37:58 -0000 1.13
@@ -1,5 +1,6 @@
require 'fox'
include Fox
+require 'presenter/presenter'
class CookbookForm < FXVerticalFrame
def initialize(parent,o)
@@ -121,7 +122,7 @@
end
if not selectedIndices.empty? then
index = selectedIndices.first
- @recipe.ingredients.promote(@recipe.ingredients[index])
+ Presenter::promoteIngredient(@recipe, index)
@ingredientList.selectItem(index - 1, true)
end
end
@@ -131,7 +132,7 @@
@ingredientList.itemSelected?(i)
end
selectedIndices.each do |index|
- @recipe.ingredients.delete_at(index)
+ Presenter::deleteIngredient(@recipe, index)
end
end
@@ -163,7 +164,7 @@
def refreshIngredients
@ingredientList.clearItems
- @recipe.ingredients.each do |ingredient|
+ @recipe.ingredients.sort.each do |ingredient|
@ingredientList.appendItem(ingredient.to_s)
end
end
|
|
From: <lu...@us...> - 2003-12-22 23:38:01
|
Update of /cvsroot/neelix/neelix/model
In directory sc8-pr-cvs1:/tmp/cvs-serv6968/model
Modified Files:
model.rb
Log Message:
refactored the promote/demote/delete ingredient functionality into presenter
methods
Index: model.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/model/model.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- model.rb 20 Dec 2003 06:38:35 -0000 1.5
+++ model.rb 22 Dec 2003 23:37:57 -0000 1.6
@@ -37,28 +37,7 @@
end
wrap_method :<<, :[]=, :clear, :collect!, :compact!, :delete, :delete_at, :delete_if, :flatten!, :map!, :pop, :push, :reject!, :replace, :reverse!, :shift, :slice!, :sort!, :uniq!, :unshift
- wrap_method :assoc, :collect, :compact, :concat, :flatten, :rassoc, :reverse, :slice, :sort, :uniq
-end
-
-class ObservableArray
- # should these instead be in a subclass of ObservableArray?
- def promote(obj)
- i = self.index(obj)
- return if i.nil? or i == 0
-
- tmp = self[i]
- send("__old_[]=", i, self[i - 1]);
- send("__old_[]=", i - 1, tmp);
- end
- def demote(obj)
- i = self.index(obj)
- return if i.nil? or i == self.length - 1
-
- tmp = self[i]
- send("__old_[]=", i, self[i + 1]);
- send("__old_[]=", i + 1, tmp);
- end
- wrap_method :promote, :demote
+ wrap_method :assoc, :collect, :compact, :concat, :flatten, :rassoc, :reverse, :slice, :uniq#, :sort
end
class Food
@@ -204,6 +183,9 @@
s += " (#{m})" if m
return s
end
+ def <=>(other)
+ self.position <=> other.position
+ end
end
class Recipe
@@ -237,14 +219,8 @@
(old_ingredients - @ingredients).each do |ingredient|
@dbh.do("delete from ingredient where ingredient_id=?",ingredient.id)
end
-
- # reorder the rows in the database
- position = 1
- @ingredients.each do |ingredient|
- ingredient.position = position
- position += 1
- end
}
+ @ingredients.each { |i| i.add_observer { @ingredients.notify_observers } }
end
def name
|
|
From: Hans F. <ha...@fu...> - 2003-12-22 23:33:21
|
/* Quoth Jacob Fugal <ja...@fu...> on Mon, 22 Dec 2003 at 15:46 -0700 in <3FE...@fu...> */ > Hans Fugal wrote: > | I have an idea for the ordering stuff. Position is stored in the > | ingredient itself; why not make the ingredients array a set? Then the > | array only ever changes when the set changes (addition or deletion) but > | not when the ordering changes. To get the items in order, just do > | recipe.ingredients.sort. (we need to def <=3D> for Ingredient, of cours= e) > | To change orders, just twiddle the position numbers - no array > | notification since the array itself doesn't change, just the items. > | Move the repositioning (promote/demote) into the presenter. When the > | presenter has done its thing, it can call ingredientList.update. >=20 > Ok, I added some separate presenter logic to take care of the > promotion/demotion/deletion. Pretty slick, a lot less confusing than > what I did at first. I did still run into one problem though: >=20 > Hans, why did you wrap the non-in-place array operations in > ObservableArray? Specifically, sort (not sort!, just sort). > > I added a sort to the ingredients display code block in view/fox.rb and > found myself in an infinite loop. sort notifies the ingredients > observers, of which the method calling sort is one. Taking :sort out of > the wrap_methods list fixed it. Is there a reason it needs to be in there? Hmm, I claim the fifth. I think I had a reason, but I think it was probably a poor reason, not well thought out. > Second, rather than having the presenter function call notify_observers > on the ingredients array|set, I just added an observer to the ingredient > itself that tell the ingredients set(s) it belongs to to > notfiy_observers. That way if the ingredient is somehow changed > somewhere else (think maybe concurrent editing), any changes are > instantly transmitted to all ingredient lists, not just the one that > requested the change. Capiche? Is there any reason not to do it this way? That is about what I had envisioned. I'm still not clear on how you're doing it but when I see the code I will be more so. > I'll commit the changes (the 'structure' in the presenter isn't very > refined, but it's rudimentary and it works -- we can refactor it as we > add more stuff) once you confirm this approach. Go ahead. --=20 Hans Fugal | De gustibus non disputandum est. http://hans.fugal.net/ | Debian, vim, mutt, ruby, text, gpg http://gdmxml.fugal.net/ | WindowMaker, gaim, UTF-8, RISC, JS Bach --------------------------------------------------------------------- GnuPG Fingerprint: 6940 87C5 6610 567F 1E95 CB5E FC98 E8CD E0AA D460 |
|
From: <lu...@us...> - 2003-12-20 19:00:30
|
Update of /cvsroot/neelix/neelix/view In directory sc8-pr-cvs1:/tmp/cvs-serv3274/view Modified Files: fox.rb Log Message: Activated the delete button for ingredients. Index: fox.rb =================================================================== RCS file: /cvsroot/neelix/neelix/view/fox.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- fox.rb 20 Dec 2003 06:38:35 -0000 1.11 +++ fox.rb 20 Dec 2003 19:00:15 -0000 1.12 @@ -126,6 +126,15 @@ end end + @delete.connect(SEL_COMMAND) do |sender,sel,data| + selectedIndices = (0 .. @ingredientList.numItems-1).select do |i| + @ingredientList.itemSelected?(i) + end + selectedIndices.each do |index| + @recipe.ingredients.delete_at(index) + end + end + @directions.connect(SEL_CHANGED) do |sender,sel,data| @recipe.directions = @directions.text end |
|
From: Hans F. <ha...@fu...> - 2003-12-20 16:30:11
|
I have an idea for the ordering stuff. Position is stored in the
ingredient itself; why not make the ingredients array a set? Then the
array only ever changes when the set changes (addition or deletion) but
not when the ordering changes. To get the items in order, just do
recipe.ingredients.sort. (we need to def <=3D> for Ingredient, of course)
To change orders, just twiddle the position numbers - no array
notification since the array itself doesn't change, just the items.
Move the repositioning (promote/demote) into the presenter. When the
presenter has done its thing, it can call ingredientList.update.
/* Quoth lu...@us...
on Fri, 19 Dec 2003 at 22:38 -0800
in <E1A...@sc...> */
> Update of /cvsroot/neelix/neelix/model
> In directory sc8-pr-cvs1:/tmp/cvs-serv27370/model
>=20
> Modified Files:
> model.rb=20
> Log Message:
> "Move Up" works! We may want to find some nicer way of doing the
> promote/demote, but this was the only way I could get around the notify c=
all
> halfway through the swap (which is a Bad Thing [tm], since one of the
> ingredients is just plain deleted if the notification happens too soon).
>=20
>=20
> Index: model.rb
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/neelix/neelix/model/model.rb,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -C2 -d -r1.4 -r1.5
> *** model.rb 15 Dec 2003 20:11:54 -0000 1.4
> --- model.rb 20 Dec 2003 06:38:35 -0000 1.5
> ***************
> *** 41,44 ****
> --- 41,65 ----
> end
> =20
> + class ObservableArray
> + # should these instead be in a subclass of ObservableArray?
> + def promote(obj)
> + i =3D self.index(obj)
> + return if i.nil? or i =3D=3D 0
> +=20
> + tmp =3D self[i]
> + send("__old_[]=3D", i, self[i - 1]);
> + send("__old_[]=3D", i - 1, tmp);
> + end
> + def demote(obj)
> + i =3D self.index(obj)
> + return if i.nil? or i =3D=3D self.length - 1
> +=20
> + tmp =3D self[i]
> + send("__old_[]=3D", i, self[i + 1]);
> + send("__old_[]=3D", i + 1, tmp);
> + end
> + wrap_method :promote, :demote
> + end
> +=20
> class Food
> include Observable
> ***************
> *** 166,169 ****
> --- 187,202 ----
> end
> =20
> + def position
> + @dbh.select_one("select position from ingredient where ingredient_id=
=3D?",@id)['position']
> + end
> + def position=3D(p)
> + p2 =3D position
> + if p2 !=3D p then
> + @dbh.do("update ingredient set position=3D? where ingredient_id=3D=
?", p, @id)
> + notify_observers
> + end
> + p
> + end
> +=20
> def to_s
> s =3D "#{quantity} #{measure} #{food}"
> ***************
> *** 186,190 ****
> @id =3D recipe_id
> @ingredients =3D ObservableArray.new
> ! @dbh.select_all("select ingredient_id from ingredient where recipe_id=
=3D?", @id).each do |row|
> @ingredients << $replicator.get('ingredient', row['ingredient_id'])
> end
> --- 219,223 ----
> @id =3D recipe_id
> @ingredients =3D ObservableArray.new
> ! @dbh.select_all("select ingredient_id from ingredient where recipe_id=
=3D? order by position", @id).each do |row|
> @ingredients << $replicator.get('ingredient', row['ingredient_id'])
> end
> ***************
> *** 192,196 ****
> # which ingredients were previously in the DB?
> old_ingredients =3D Array.new
> ! @dbh.select_all("select ingredient_id from ingredient where recipe=
_id=3D?",@id).each do |row|
> old_ingredients << $replicator.get('ingredient', row['ingredient_id'])
> end
> --- 225,229 ----
> # which ingredients were previously in the DB?
> old_ingredients =3D Array.new
> ! @dbh.select_all("select ingredient_id from ingredient where recipe=
_id=3D? order by position",@id).each do |row|
> old_ingredients << $replicator.get('ingredient', row['ingredient_id'])
> end
> ***************
> *** 204,207 ****
> --- 237,247 ----
> (old_ingredients - @ingredients).each do |ingredient|
> @dbh.do("delete from ingredient where ingredient_id=3D?",ingredient.i=
d)
> + end
> +=20
> + # reorder the rows in the database
> + position =3D 1
> + @ingredients.each do |ingredient|
> + ingredient.position =3D position
> + position +=3D 1
> end
> }
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
> Free Linux Tutorials. Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclick
> _______________________________________________
> neelix-devel mailing list
> nee...@li...
> https://lists.sourceforge.net/lists/listinfo/neelix-devel
>=20
--=20
Hans Fugal | De gustibus non disputandum est.
http://hans.fugal.net/ | Debian, vim, mutt, ruby, text, gpg
http://gdmxml.fugal.net/ | WindowMaker, gaim, UTF-8, RISC, JS Bach
---------------------------------------------------------------------
GnuPG Fingerprint: 6940 87C5 6610 567F 1E95 CB5E FC98 E8CD E0AA D460
|
|
From: <lu...@us...> - 2003-12-20 06:38:39
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv27370/view
Modified Files:
fox.rb
Log Message:
"Move Up" works! We may want to find some nicer way of doing the
promote/demote, but this was the only way I could get around the notify call
halfway through the swap (which is a Bad Thing [tm], since one of the
ingredients is just plain deleted if the notification happens too soon).
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** fox.rb 20 Dec 2003 03:57:44 -0000 1.10
--- fox.rb 20 Dec 2003 06:38:35 -0000 1.11
***************
*** 71,75 ****
frame = FXHorizontalFrame.new(self,LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
ingredientFrame = FXVerticalFrame.new(frame, FRAME_NORMAL|LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
! @ingredientList = FXList.new(ingredientFrame,5,nil,0,LAYOUT_FILL_X)
frame = FXVerticalFrame.new(frame)
--- 71,75 ----
frame = FXHorizontalFrame.new(self,LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
ingredientFrame = FXVerticalFrame.new(frame, FRAME_NORMAL|LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
! @ingredientList = FXList.new(ingredientFrame,5,nil,0,LAYOUT_FILL_X|LIST_SINGLESELECT)
frame = FXVerticalFrame.new(frame)
***************
*** 111,114 ****
--- 111,130 ----
end
+ @ingredientList.connect(SEL_SELECTED) do |sender,sel,data|
+ @up.enabled = (data != 0)
+ @delete.enabled = true
+ end
+
+ @up.connect(SEL_COMMAND) do |sender,sel,data|
+ selectedIndices = (0 .. @ingredientList.numItems-1).select do |i|
+ @ingredientList.itemSelected?(i)
+ end
+ if not selectedIndices.empty? then
+ index = selectedIndices.first
+ @recipe.ingredients.promote(@recipe.ingredients[index])
+ @ingredientList.selectItem(index - 1, true)
+ end
+ end
+
@directions.connect(SEL_CHANGED) do |sender,sel,data|
@recipe.directions = @directions.text
***************
*** 129,138 ****
@tottime.text = @recipe.tottime
@yields.text = @recipe.yields
@ingredientList.clearItems
@recipe.ingredients.each do |ingredient|
@ingredientList.appendItem(ingredient.to_s)
end
- @directions.text = @recipe.directions
- @notes.text = @recipe.note
end
--- 145,161 ----
@tottime.text = @recipe.tottime
@yields.text = @recipe.yields
+
+ refreshIngredients
+ @recipe.ingredients.add_observer { refreshIngredients }
+
+ @directions.text = @recipe.directions
+ @notes.text = @recipe.note
+ end
+
+ def refreshIngredients
@ingredientList.clearItems
@recipe.ingredients.each do |ingredient|
@ingredientList.appendItem(ingredient.to_s)
end
end
|
|
From: <lu...@us...> - 2003-12-20 06:38:38
|
Update of /cvsroot/neelix/neelix/model
In directory sc8-pr-cvs1:/tmp/cvs-serv27370/model
Modified Files:
model.rb
Log Message:
"Move Up" works! We may want to find some nicer way of doing the
promote/demote, but this was the only way I could get around the notify call
halfway through the swap (which is a Bad Thing [tm], since one of the
ingredients is just plain deleted if the notification happens too soon).
Index: model.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/model/model.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** model.rb 15 Dec 2003 20:11:54 -0000 1.4
--- model.rb 20 Dec 2003 06:38:35 -0000 1.5
***************
*** 41,44 ****
--- 41,65 ----
end
+ class ObservableArray
+ # should these instead be in a subclass of ObservableArray?
+ def promote(obj)
+ i = self.index(obj)
+ return if i.nil? or i == 0
+
+ tmp = self[i]
+ send("__old_[]=", i, self[i - 1]);
+ send("__old_[]=", i - 1, tmp);
+ end
+ def demote(obj)
+ i = self.index(obj)
+ return if i.nil? or i == self.length - 1
+
+ tmp = self[i]
+ send("__old_[]=", i, self[i + 1]);
+ send("__old_[]=", i + 1, tmp);
+ end
+ wrap_method :promote, :demote
+ end
+
class Food
include Observable
***************
*** 166,169 ****
--- 187,202 ----
end
+ def position
+ @dbh.select_one("select position from ingredient where ingredient_id=?",@id)['position']
+ end
+ def position=(p)
+ p2 = position
+ if p2 != p then
+ @dbh.do("update ingredient set position=? where ingredient_id=?", p, @id)
+ notify_observers
+ end
+ p
+ end
+
def to_s
s = "#{quantity} #{measure} #{food}"
***************
*** 186,190 ****
@id = recipe_id
@ingredients = ObservableArray.new
! @dbh.select_all("select ingredient_id from ingredient where recipe_id=?", @id).each do |row|
@ingredients << $replicator.get('ingredient', row['ingredient_id'])
end
--- 219,223 ----
@id = recipe_id
@ingredients = ObservableArray.new
! @dbh.select_all("select ingredient_id from ingredient where recipe_id=? order by position", @id).each do |row|
@ingredients << $replicator.get('ingredient', row['ingredient_id'])
end
***************
*** 192,196 ****
# which ingredients were previously in the DB?
old_ingredients = Array.new
! @dbh.select_all("select ingredient_id from ingredient where recipe_id=?",@id).each do |row|
old_ingredients << $replicator.get('ingredient', row['ingredient_id'])
end
--- 225,229 ----
# which ingredients were previously in the DB?
old_ingredients = Array.new
! @dbh.select_all("select ingredient_id from ingredient where recipe_id=? order by position",@id).each do |row|
old_ingredients << $replicator.get('ingredient', row['ingredient_id'])
end
***************
*** 204,207 ****
--- 237,247 ----
(old_ingredients - @ingredients).each do |ingredient|
@dbh.do("delete from ingredient where ingredient_id=?",ingredient.id)
+ end
+
+ # reorder the rows in the database
+ position = 1
+ @ingredients.each do |ingredient|
+ ingredient.position = position
+ position += 1
end
}
|
|
From: <lu...@us...> - 2003-12-20 06:38:38
|
Update of /cvsroot/neelix/neelix/db
In directory sc8-pr-cvs1:/tmp/cvs-serv27370/db
Modified Files:
db.xml hans.sql
Log Message:
"Move Up" works! We may want to find some nicer way of doing the
promote/demote, but this was the only way I could get around the notify call
halfway through the swap (which is a Bad Thing [tm], since one of the
ingredients is just plain deleted if the notification happens too soon).
Index: db.xml
===================================================================
RCS file: /cvsroot/neelix/neelix/db/db.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** db.xml 12 Dec 2003 22:47:05 -0000 1.1
--- db.xml 20 Dec 2003 06:38:35 -0000 1.2
***************
*** 59,63 ****
food_id int NOT NULL,
quantity float NOT NULL,
! modifier varchar(80)
);
-->
--- 59,64 ----
food_id int NOT NULL,
quantity float NOT NULL,
! modifier varchar(80),
! position int NOT NULL
);
-->
***************
*** 68,71 ****
--- 69,73 ----
<col name="quantity" type="float"/>
<col name="modifier" type="varchar(80)"/>
+ <col name="position" type="int"/>
</table>
<table name="measure">
Index: hans.sql
===================================================================
RCS file: /cvsroot/neelix/neelix/db/hans.sql,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** hans.sql 14 Dec 2003 04:52:46 -0000 1.2
--- hans.sql 20 Dec 2003 06:38:35 -0000 1.3
***************
*** 36,53 ****
-- food_id INTEGER NOT NULL,
-- quantity float,
! -- modifier varchar(80)
-- );
! INSERT INTO ingredient VALUES(1,1,1,5,720,'Active, 100% Hydration');
! INSERT INTO ingredient VALUES(2,1,1,1,540,NULL);
! INSERT INTO ingredient VALUES(3,1,1,2,295,NULL);
! INSERT INTO ingredient VALUES(4,1,2,4,2,NULL);
! INSERT INTO ingredient VALUES(5,2,2,3,2,NULL);
! INSERT INTO ingredient VALUES(6,2,4,2,120,'warm');
! INSERT INTO ingredient VALUES(7,2,1,1,900,NULL);
! INSERT INTO ingredient VALUES(8,2,2,4,2.5,NULL);
! INSERT INTO ingredient VALUES(9,2,4,2,535,'lukewarm');
! INSERT INTO ingredient VALUES(10,2,3,6,2,NULL);
! INSERT INTO ingredient VALUES(11,2,3,7,2,NULL);
-- CREATE TABLE measure (
-- measure_id INTEGER NOT NULL PRIMARY KEY,
--- 36,54 ----
-- food_id INTEGER NOT NULL,
-- quantity float,
! -- modifier varchar(80),
! -- position INTEGER NOT NULL
-- );
! INSERT INTO ingredient VALUES(1,1,1,5,720,'Active, 100% Hydration',1);
! INSERT INTO ingredient VALUES(2,1,1,1,540,NULL,2);
! INSERT INTO ingredient VALUES(3,1,1,2,295,NULL,3);
! INSERT INTO ingredient VALUES(4,1,2,4,2,NULL,4);
! INSERT INTO ingredient VALUES(5,2,2,3,2,NULL,1);
! INSERT INTO ingredient VALUES(6,2,4,2,120,'warm',2);
! INSERT INTO ingredient VALUES(7,2,1,1,900,NULL,3);
! INSERT INTO ingredient VALUES(8,2,2,4,2.5,NULL,4);
! INSERT INTO ingredient VALUES(9,2,4,2,535,'lukewarm',5);
! INSERT INTO ingredient VALUES(10,2,3,6,2,NULL,6);
! INSERT INTO ingredient VALUES(11,2,3,7,2,NULL,7);
-- CREATE TABLE measure (
-- measure_id INTEGER NOT NULL PRIMARY KEY,
|
|
From: <lu...@us...> - 2003-12-20 03:57:47
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv8002/view
Modified Files:
fox.rb
Log Message:
Oops, this bit doesn't do anything and wasn't supposed to be committed
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** fox.rb 20 Dec 2003 03:52:40 -0000 1.9
--- fox.rb 20 Dec 2003 03:57:44 -0000 1.10
***************
*** 147,151 ****
def initialize(app)
super(app, 'Neelix')
! old_resize(800,600)
frame = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
splitter = FXSplitter.new(frame,SPLITTER_HORIZONTAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
--- 147,151 ----
def initialize(app)
super(app, 'Neelix')
! resize(800,600)
frame = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
splitter = FXSplitter.new(frame,SPLITTER_HORIZONTAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
***************
*** 196,203 ****
shelfTree.makeItemVisible(shelfTree.firstItem.first.first)
- end
- alias :old_resize :resize
- def resize(w, h)
- old_resize([ w, 400 ].max, [ h, 200 ].max)
end
end
--- 196,199 ----
|
|
From: <lu...@us...> - 2003-12-20 03:52:43
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv7374/view
Modified Files:
fox.rb
Log Message:
Some minor display layout changes to give it borders where previously lacking
and fill out (LAYOUT_FILL_X) nicely.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** fox.rb 20 Dec 2003 03:30:02 -0000 1.8
--- fox.rb 20 Dec 2003 03:52:40 -0000 1.9
***************
*** 54,70 ****
FXLabel.new(self,"Name")
! @name = FXTextField.new(self, 80)
FXLabel.new(self,"Author")
! @author = FXTextField.new(self, 80)
FXLabel.new(self,"Oven Temp.")
! @temp = FXTextField.new(self, 80)
FXLabel.new(self,"Total Time")
! @tottime = FXTextField.new(self, 80)
FXLabel.new(self,"Yields")
! @yields = FXTextField.new(self, 80)
FXLabel.new(self,"Ingredients")
! frame = FXHorizontalFrame.new(self,LAYOUT_FILL_X)
! @ingredientList = FXList.new(frame,5,nil,0,LAYOUT_FILL_X)
frame = FXVerticalFrame.new(frame)
FXButton.new(frame,"Add Ingredient")
--- 54,76 ----
FXLabel.new(self,"Name")
! @name = FXTextField.new(self, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
!
FXLabel.new(self,"Author")
! @author = FXTextField.new(self, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
!
FXLabel.new(self,"Oven Temp.")
! @temp = FXTextField.new(self, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
!
FXLabel.new(self,"Total Time")
! @tottime = FXTextField.new(self, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
!
FXLabel.new(self,"Yields")
! @yields = FXTextField.new(self, 80, nil, 0, LAYOUT_FILL_X|TEXTFIELD_NORMAL)
FXLabel.new(self,"Ingredients")
! frame = FXHorizontalFrame.new(self,LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
! ingredientFrame = FXVerticalFrame.new(frame, FRAME_NORMAL|LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
! @ingredientList = FXList.new(ingredientFrame,5,nil,0,LAYOUT_FILL_X)
!
frame = FXVerticalFrame.new(frame)
FXButton.new(frame,"Add Ingredient")
***************
*** 75,83 ****
FXLabel.new(self,"Directions")
! @directions = FXText.new(self)
@directions.visCols=80
FXLabel.new(self,"Notes")
! @notes = FXText.new(self)
@notes.visCols=80
--- 81,91 ----
FXLabel.new(self,"Directions")
! frame = FXVerticalFrame.new(self, FRAME_NORMAL|LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
! @directions = FXText.new(frame, nil, 0, LAYOUT_FILL_X)
@directions.visCols=80
FXLabel.new(self,"Notes")
! frame = FXVerticalFrame.new(self, FRAME_NORMAL|LAYOUT_FILL_X, 0,0,0,0, 0,0,0,0)
! @notes = FXText.new(frame, nil, 0, LAYOUT_FILL_X)
@notes.visCols=80
***************
*** 139,143 ****
def initialize(app)
super(app, 'Neelix')
! resize(800,600)
frame = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
splitter = FXSplitter.new(frame,SPLITTER_HORIZONTAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
--- 147,151 ----
def initialize(app)
super(app, 'Neelix')
! old_resize(800,600)
frame = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
splitter = FXSplitter.new(frame,SPLITTER_HORIZONTAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
***************
*** 152,156 ****
RecipeForm.new(counterSwitcher,nil)
! shelfTree = FXTreeList.new(shelf,0,nil,0,TREELIST_SINGLESELECT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y)
$replicator.shelf.each do |cookbook|
cookbook_item = shelfTree.addItemLast(nil, FXTreeItem.new(cookbook.name))
--- 160,165 ----
RecipeForm.new(counterSwitcher,nil)
! frame = FXVerticalFrame.new(shelf, FRAME_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0)
! shelfTree = FXTreeList.new(frame,0,nil,0,TREELIST_SINGLESELECT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y)
$replicator.shelf.each do |cookbook|
cookbook_item = shelfTree.addItemLast(nil, FXTreeItem.new(cookbook.name))
***************
*** 187,190 ****
--- 196,203 ----
shelfTree.makeItemVisible(shelfTree.firstItem.first.first)
+ end
+ alias :old_resize :resize
+ def resize(w, h)
+ old_resize([ w, 400 ].max, [ h, 200 ].max)
end
end
|
|
From: <fu...@us...> - 2003-12-20 03:30:05
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv4311/view
Modified Files:
fox.rb
Log Message:
modifying cookbooks and categories and recipes. how nice. Now need to add/del/order them.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** fox.rb 20 Dec 2003 03:18:17 -0000 1.7
--- fox.rb 20 Dec 2003 03:30:02 -0000 1.8
***************
*** 2,5 ****
--- 2,51 ----
include Fox
+ class CookbookForm < FXVerticalFrame
+ def initialize(parent,o)
+ super(parent)
+ @cookbook = o
+
+ FXLabel.new(self,"Name")
+ @name = FXTextField.new(self, 80)
+
+ @name.connect(SEL_COMMAND) do |sender,sel,data|
+ @cookbook.name = data
+ end
+
+ populate
+ end
+ def populate
+ return if not @cookbook
+ @name.text = @cookbook.name
+ end
+ def cookbook=(o)
+ @cookbook = o
+ populate
+ end
+ end
+ class CategoryForm < FXVerticalFrame
+ def initialize(parent,o)
+ super(parent)
+ @category = o
+
+ FXLabel.new(self,"Name")
+ @name = FXTextField.new(self,80)
+
+ @name.connect(SEL_COMMAND) do |sender,sel,data|
+ @category.name = data
+ end
+
+ populate
+ end
+ def populate
+ return if not @category
+ @name.text = @category.name
+ end
+ def category=(o)
+ @category = o
+ populate
+ end
+ end
class RecipeForm < FXVerticalFrame
def initialize(parent,r)
***************
*** 65,72 ****
end
! populate if @recipe
end
def populate
@name.text = @recipe.name
@author.text = @recipe.author
--- 111,119 ----
end
! populate
end
def populate
+ return if not @recipe
@name.text = @recipe.name
@author.text = @recipe.author
***************
*** 101,104 ****
--- 148,153 ----
counterSwitcher = FXSwitcher.new(counter,LAYOUT_FILL_X|LAYOUT_FILL_Y)
FXWindow.new(counterSwitcher)
+ CookbookForm.new(counterSwitcher,nil)
+ CategoryForm.new(counterSwitcher,nil)
RecipeForm.new(counterSwitcher,nil)
***************
*** 106,111 ****
--- 155,164 ----
$replicator.shelf.each do |cookbook|
cookbook_item = shelfTree.addItemLast(nil, FXTreeItem.new(cookbook.name))
+ cookbook_item.data = cookbook
+ cookbook.add_observer { cookbook_item.text = cookbook.name; shelfTree.update }
cookbook.categories.each do |category|
category_item = shelfTree.addItemLast(cookbook_item, FXTreeItem.new(category.name))
+ category_item.data = category
+ category.add_observer { category_item.text = category.name; shelfTree.update }
category.recipes.each do |recipe|
item = FXTreeItem.new(recipe.name)
***************
*** 117,123 ****
end
shelfTree.connect(SEL_SELECTED) do |sender,sel,ptr|
! if Recipe === ptr.data
! counterSwitcher.children[1].recipe = ptr.data
counterSwitcher.current = 1
end
end
--- 170,183 ----
end
shelfTree.connect(SEL_SELECTED) do |sender,sel,ptr|
! case ptr.data
! when Cookbook
! counterSwitcher.children[1].cookbook = ptr.data
counterSwitcher.current = 1
+ when Category
+ counterSwitcher.children[2].category = ptr.data
+ counterSwitcher.current = 2
+ when Recipe
+ counterSwitcher.children[3].recipe = ptr.data
+ counterSwitcher.current = 3
end
end
|
|
From: <fu...@us...> - 2003-12-20 03:18:20
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv2867/view
Modified Files:
fox.rb
Log Message:
Refactored RecipeForm and the way the counter works in NeelixMainWindow.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** fox.rb 20 Dec 2003 02:03:00 -0000 1.6
--- fox.rb 20 Dec 2003 03:18:17 -0000 1.7
***************
*** 3,72 ****
class RecipeForm < FXVerticalFrame
! def initialize(parent,recipe)
super(parent)
FXLabel.new(self,"Name")
! name = FXTextField.new(self, 80)
! name.text = recipe.name
! name.connect(SEL_COMMAND) do |sender,sel,data|
! recipe.name = data
end
! FXLabel.new(self,"Author")
! author = FXTextField.new(self, 80)
! author.text = recipe.author
! author.connect(SEL_COMMAND) do |sender,sel,data|
! recipe.author = data
end
! FXLabel.new(self,"Oven Temp.")
! temp = FXTextField.new(self, 80)
! temp.text = recipe.temp
! temp.connect(SEL_COMMAND) do |sender,sel,data|
! recipe.temp = data
end
! FXLabel.new(self,"Total Time")
! tottime = FXTextField.new(self, 80)
! tottime.text = recipe.tottime
! tottime.connect(SEL_COMMAND) do |sender,sel,data|
! recipe.tottime = data
end
! FXLabel.new(self,"Yields")
! yields = FXTextField.new(self, 80)
! yields.text = recipe.yields
! yields.connect(SEL_COMMAND) do |sender,sel,data|
! recipe.yields = data
end
! FXLabel.new(self,"Ingredients")
! frame = FXHorizontalFrame.new(self,LAYOUT_FILL_X)
! ingredientList = FXList.new(frame,recipe.ingredients.size,nil,0,LAYOUT_FILL_X)
! frame = FXVerticalFrame.new(frame)
! FXButton.new(frame,"Add Ingredient")
! up = FXButton.new(frame,"Move Up")
! delete = FXButton.new(frame,"Delete")
! up.enabled = false
! delete.enabled = false
! recipe.ingredients.each do |ingredient|
! ingredientList.appendItem(ingredient.to_s)
end
!
! FXLabel.new(self,"Directions")
! directions = FXText.new(self)
! directions.visCols=80
! directions.text = recipe.directions
! directions.connect(SEL_CHANGED) do |sender,sel,data|
! recipe.directions = directions.text
end
! FXLabel.new(self,"Notes")
! notes = FXText.new(self)
! notes.visCols=80
! notes.text = recipe.note
! notes.connect(SEL_CHANGED) do |sender,sel,data|
! recipe.note = notes.text
end
end
end
--- 3,89 ----
class RecipeForm < FXVerticalFrame
! def initialize(parent,r)
super(parent)
+ @recipe = r
FXLabel.new(self,"Name")
! @name = FXTextField.new(self, 80)
! FXLabel.new(self,"Author")
! @author = FXTextField.new(self, 80)
! FXLabel.new(self,"Oven Temp.")
! @temp = FXTextField.new(self, 80)
! FXLabel.new(self,"Total Time")
! @tottime = FXTextField.new(self, 80)
! FXLabel.new(self,"Yields")
! @yields = FXTextField.new(self, 80)
!
! FXLabel.new(self,"Ingredients")
! frame = FXHorizontalFrame.new(self,LAYOUT_FILL_X)
! @ingredientList = FXList.new(frame,5,nil,0,LAYOUT_FILL_X)
! frame = FXVerticalFrame.new(frame)
! FXButton.new(frame,"Add Ingredient")
! @up = FXButton.new(frame,"Move Up")
! @delete = FXButton.new(frame,"Delete")
! @up.enabled = false
! @delete.enabled = false
!
! FXLabel.new(self,"Directions")
! @directions = FXText.new(self)
! @directions.visCols=80
!
! FXLabel.new(self,"Notes")
! @notes = FXText.new(self)
! @notes.visCols=80
!
! # connections
! @name.connect(SEL_COMMAND) do |sender,sel,data|
! @recipe.name = data
end
! @author.connect(SEL_COMMAND) do |sender,sel,data|
! @recipe.author = data
end
! @temp.connect(SEL_COMMAND) do |sender,sel,data|
! @recipe.temp = data
end
! @tottime.connect(SEL_COMMAND) do |sender,sel,data|
! @recipe.tottime = data
end
! @yields.connect(SEL_COMMAND) do |sender,sel,data|
! @recipe.yields = data
end
! @directions.connect(SEL_CHANGED) do |sender,sel,data|
! @recipe.directions = @directions.text
end
!
! @notes.connect(SEL_CHANGED) do |sender,sel,data|
! @recipe.note = @notes.text
end
! populate if @recipe
! end
!
! def populate
! @name.text = @recipe.name
! @author.text = @recipe.author
! @temp.text = @recipe.temp
! @tottime.text = @recipe.tottime
! @yields.text = @recipe.yields
! @ingredientList.clearItems
! @recipe.ingredients.each do |ingredient|
! @ingredientList.appendItem(ingredient.to_s)
end
+ @directions.text = @recipe.directions
+ @notes.text = @recipe.note
+ end
+
+ def recipe=(r)
+ @recipe = r
+ populate
+ update
end
end
***************
*** 82,85 ****
--- 99,105 ----
shelf.width=200
counter = FXGroupBox.new(splitter,"Counter",FRAME_GROOVE)
+ counterSwitcher = FXSwitcher.new(counter,LAYOUT_FILL_X|LAYOUT_FILL_Y)
+ FXWindow.new(counterSwitcher)
+ RecipeForm.new(counterSwitcher,nil)
shelfTree = FXTreeList.new(shelf,0,nil,0,TREELIST_SINGLESELECT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y)
***************
*** 98,103 ****
shelfTree.connect(SEL_SELECTED) do |sender,sel,ptr|
if Recipe === ptr.data
! counter.children.each { |child| counter.removeChild(child) }
! RecipeForm.new(counter,ptr.data).create
end
end
--- 118,123 ----
shelfTree.connect(SEL_SELECTED) do |sender,sel,ptr|
if Recipe === ptr.data
! counterSwitcher.children[1].recipe = ptr.data
! counterSwitcher.current = 1
end
end
***************
*** 118,120 ****
app.run
! # vim:nowrap
--- 138,140 ----
app.run
! # vim:nowrap:ts=8:sw=4
|
|
From: <fu...@us...> - 2003-12-20 02:03:03
|
Update of /cvsroot/neelix/neelix/view In directory sc8-pr-cvs1:/tmp/cvs-serv25302/view Modified Files: fox.rb Log Message: minor gui changes Index: fox.rb =================================================================== RCS file: /cvsroot/neelix/neelix/view/fox.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** fox.rb 19 Dec 2003 16:56:39 -0000 1.5 --- fox.rb 20 Dec 2003 02:03:00 -0000 1.6 *************** *** 10,14 **** name.text = recipe.name name.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.name = name.text end --- 10,14 ---- name.text = recipe.name name.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.name = data end *************** *** 17,21 **** author.text = recipe.author author.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.author = author.text end --- 17,21 ---- author.text = recipe.author author.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.author = data end *************** *** 24,28 **** temp.text = recipe.temp temp.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.temp = temp.text end --- 24,28 ---- temp.text = recipe.temp temp.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.temp = data end *************** *** 31,35 **** tottime.text = recipe.tottime tottime.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.tottime = tottime.text end --- 31,35 ---- tottime.text = recipe.tottime tottime.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.tottime = data end *************** *** 38,42 **** yields.text = recipe.yields yields.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.yields = yields.text end --- 38,42 ---- yields.text = recipe.yields yields.connect(SEL_COMMAND) do |sender,sel,data| ! recipe.yields = data end *************** *** 47,53 **** FXButton.new(frame,"Add Ingredient") up = FXButton.new(frame,"Move Up") ! down = FXButton.new(frame,"Move Down") up.enabled = false ! down.enabled = false recipe.ingredients.each do |ingredient| ingredientList.appendItem(ingredient.to_s) --- 47,53 ---- FXButton.new(frame,"Add Ingredient") up = FXButton.new(frame,"Move Up") ! delete = FXButton.new(frame,"Delete") up.enabled = false ! delete.enabled = false recipe.ingredients.each do |ingredient| ingredientList.appendItem(ingredient.to_s) |
|
From: <fu...@us...> - 2003-12-19 16:56:42
|
Update of /cvsroot/neelix/neelix/view
In directory sc8-pr-cvs1:/tmp/cvs-serv21078/view
Modified Files:
fox.rb
Log Message:
All recipe form fields are active now. See TODO changes.
Index: fox.rb
===================================================================
RCS file: /cvsroot/neelix/neelix/view/fox.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fox.rb 15 Dec 2003 20:11:54 -0000 1.4
--- fox.rb 19 Dec 2003 16:56:39 -0000 1.5
***************
*** 16,31 ****
--- 16,43 ----
author = FXTextField.new(self, 80)
author.text = recipe.author
+ author.connect(SEL_COMMAND) do |sender,sel,data|
+ recipe.author = author.text
+ end
FXLabel.new(self,"Oven Temp.")
temp = FXTextField.new(self, 80)
temp.text = recipe.temp
+ temp.connect(SEL_COMMAND) do |sender,sel,data|
+ recipe.temp = temp.text
+ end
FXLabel.new(self,"Total Time")
tottime = FXTextField.new(self, 80)
tottime.text = recipe.tottime
+ tottime.connect(SEL_COMMAND) do |sender,sel,data|
+ recipe.tottime = tottime.text
+ end
FXLabel.new(self,"Yields")
yields = FXTextField.new(self, 80)
yields.text = recipe.yields
+ yields.connect(SEL_COMMAND) do |sender,sel,data|
+ recipe.yields = yields.text
+ end
FXLabel.new(self,"Ingredients")
***************
*** 46,49 ****
--- 58,64 ----
directions.visCols=80
directions.text = recipe.directions
+ directions.connect(SEL_CHANGED) do |sender,sel,data|
+ recipe.directions = directions.text
+ end
FXLabel.new(self,"Notes")
***************
*** 51,54 ****
--- 66,72 ----
notes.visCols=80
notes.text = recipe.note
+ notes.connect(SEL_CHANGED) do |sender,sel,data|
+ recipe.note = notes.text
+ end
end
end
***************
*** 99,100 ****
--- 117,120 ----
neelix.show
app.run
+
+ # vim:nowrap
|
|
From: <fu...@us...> - 2003-12-19 16:56:42
|
Update of /cvsroot/neelix/neelix In directory sc8-pr-cvs1:/tmp/cvs-serv21078 Modified Files: TODO neelix.rb Added Files: Makefile Log Message: All recipe form fields are active now. See TODO changes. Index: TODO =================================================================== RCS file: /cvsroot/neelix/neelix/TODO,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TODO 4 Nov 2003 18:51:38 -0000 1.1 --- TODO 19 Dec 2003 16:56:39 -0000 1.2 *************** *** 1,8 **** ! - finish gui ! - finish cookbook gui elements ! - finish category gui elements ! - finish recipe form (see eg http://falcon.fugal.net/~fugalh/neelix/recipe.jpg for a general idea of at least the content) - meal plans - shopping lists - xml import/export --- 1,13 ---- ! 0.1.0 - target: Christmas 2003 ! Ingredient dialog ! Ingredient management (ordering, addition, deletion) ! Recipe management (within categories) (add/del/sort/move) ! Category management (add/del/sort/move) ! Cookbook mgmt (add/del/sort) + 0.2.0 - meal plans - shopping lists + + 0.3.0 - xml import/export Index: neelix.rb =================================================================== RCS file: /cvsroot/neelix/neelix/neelix.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** neelix.rb 13 Dec 2003 17:56:48 -0000 1.4 --- neelix.rb 19 Dec 2003 16:56:39 -0000 1.5 *************** *** 17,19 **** --- 17,20 ---- require 'view/fox' + dbh.commit # vim:ts=4:sw=4 |