UI to create Todo and Bonus entries
This commit is contained in:
@@ -123,20 +123,15 @@
|
|||||||
(set entryNameText.hasFocus true)
|
(set entryNameText.hasFocus true)
|
||||||
(add entryNameText))
|
(add entryNameText))
|
||||||
|
|
||||||
(when FlxG.keys.justPressed.ENTER
|
(when (and entryNameText FlxG.keys.justPressed.ENTER)
|
||||||
(cond
|
// addEntry() calls save()
|
||||||
(entryNameText
|
(model.addEntry typeAdding [entryNameText.text])
|
||||||
// addEntry() calls save()
|
(refreshModel)
|
||||||
(model.addEntry typeAdding [entryNameText.text])
|
(entryNameText.kill)
|
||||||
(refreshModel)
|
(set entryNameText null)
|
||||||
(entryNameText.kill)
|
(when entryWindow
|
||||||
(set entryNameText null)
|
(set entryWindow.keyboardEnabled true)
|
||||||
(when entryWindow
|
(entryWindow.show)))
|
||||||
(set entryWindow.keyboardEnabled true)))
|
|
||||||
(true
|
|
||||||
(startAdding Todo))))
|
|
||||||
(when FlxG.keys.justPressed.UP
|
|
||||||
(startAdding Bonus))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -164,12 +159,13 @@
|
|||||||
(prop &mut :SimpleWindow entryWindow null)
|
(prop &mut :SimpleWindow entryWindow null)
|
||||||
(prop &mut :SimpleWindow puzzlePackChoiceWindow null)
|
(prop &mut :SimpleWindow puzzlePackChoiceWindow null)
|
||||||
(prop &mut :SimpleWindow entryDeletionWindow null)
|
(prop &mut :SimpleWindow entryDeletionWindow null)
|
||||||
|
(prop &mut :SimpleWindow entryCreationWindow null)
|
||||||
|
|
||||||
(method windowIsShown []
|
(method windowIsShown []
|
||||||
(or (tempWindowIsShown) (and entryWindow (entryWindow.isShown))))
|
(or (tempWindowIsShown) (and entryWindow (entryWindow.isShown))))
|
||||||
|
|
||||||
(method tempWindowIsShown []
|
(method tempWindowIsShown []
|
||||||
(doFor window [puzzlePackChoiceWindow entryDeletionWindow]
|
(doFor window [puzzlePackChoiceWindow entryDeletionWindow entryCreationWindow]
|
||||||
(when (and window (window.isShown))
|
(when (and window (window.isShown))
|
||||||
(return true)))
|
(return true)))
|
||||||
false)
|
false)
|
||||||
@@ -267,6 +263,28 @@
|
|||||||
(set save.data.backgroundIndex #{(save.data.backgroundIndex + 1) % backgroundOptions.length;}#)
|
(set save.data.backgroundIndex #{(save.data.backgroundIndex + 1) % backgroundOptions.length;}#)
|
||||||
(save.flush)
|
(save.flush)
|
||||||
(refreshModel)))
|
(refreshModel)))
|
||||||
|
(set entryWindow.textColor (FlxColor.LIME.getDarkened))
|
||||||
|
(_makeText "Create a habit or task" 0
|
||||||
|
->_
|
||||||
|
(defAndCall method createHabitOrTask
|
||||||
|
(entryWindow.hide)
|
||||||
|
(set entryCreationWindow (SimpleWindow.promptForChoice "Create which type of habit/task?"
|
||||||
|
[
|
||||||
|
"Daily: every day, or on specific days of the week"
|
||||||
|
"Monthly: on specific days of the month, or specific # of days before the end of the month"
|
||||||
|
"Interval: needs to be done again after specific # of days"
|
||||||
|
"Task: only needs to be done once"
|
||||||
|
"Bonus: can be done to earn points at any time, any number of times"
|
||||||
|
]
|
||||||
|
->:Void [:String choice]
|
||||||
|
(case (.takeUntilAndDrop (kiss.Stream.fromString choice) ":")
|
||||||
|
((Some "Daily") (createDailyEntry))
|
||||||
|
((Some "Monthly") (createMonthlyEntry))
|
||||||
|
((Some "Interval") (createIntervalEntry))
|
||||||
|
((Some "Task") (createTaskEntry))
|
||||||
|
((Some "Bonus") (createBonusEntry))
|
||||||
|
(otherwise (throw "nonexistent choice")))
|
||||||
|
null null FlxColor.LIME 0.9 0.9))))
|
||||||
(set entryWindow.textColor (FlxColor.RED.getDarkened))
|
(set entryWindow.textColor (FlxColor.RED.getDarkened))
|
||||||
(_makeText "Delete a habit or task" 0
|
(_makeText "Delete a habit or task" 0
|
||||||
->_
|
->_
|
||||||
@@ -729,6 +747,12 @@
|
|||||||
(collect (range 1 maxPPP))
|
(collect (range 1 maxPPP))
|
||||||
->:Void [:Int points] (startPuzzle size points)
|
->:Void [:Int points] (startPuzzle size points)
|
||||||
null null FlxColor.LIME null 0.9))))
|
null null FlxColor.LIME null 0.9))))
|
||||||
|
|
||||||
|
(method createDailyEntry [])
|
||||||
|
(method createMonthlyEntry [])
|
||||||
|
(method createIntervalEntry [])
|
||||||
|
(method createTaskEntry [] (startAdding Todo))
|
||||||
|
(method createBonusEntry [] (startAdding Bonus))
|
||||||
|
|
||||||
(function pointsStr [points]
|
(function pointsStr [points]
|
||||||
(let [&mut str "" tallyUnit 5 symbols ["+" "*" "\$"]]
|
(let [&mut str "" tallyUnit 5 symbols ["+" "*" "\$"]]
|
||||||
|
Reference in New Issue
Block a user