Combine subproj w/ project man.

This commit is contained in:
Jayvant Javier Pujara 2012-12-02 05:50:34 -05:00
parent 048df09ec5
commit 693650a4b5
9 changed files with 93 additions and 24 deletions

View File

@ -16,7 +16,7 @@ SiteUrl := "http://www.reddit.com/r/LifeRPG/"
Gui, AboutBox:Add, Picture, w32 h-1, res/WP_RPG_VG.ico
Gui, AboutBox:Font, bold
Gui, AboutBox:Add, Text, x+10, LifeRPG r2
Gui, AboutBox:Add, Text, x+10, LifeRPG 3
Gui, AboutBox:Font
Gui, AboutBox:Add, Text, y+1, by Jayvant Javier Pujara

View File

@ -58,8 +58,8 @@ If (SelectedProjectID == "ID")
}
else
{
StringTrimLeft, NewConfidence, A_ThisHotkey, 1
db.Query("UPDATE projects SET confidence = " NewConfidence " WHERE id = " SelectedProjectID )
StringTrimLeft, NewDifficulty, A_ThisHotkey, 1
db.Query("UPDATE projects SET difficulty = " NewDifficulty " WHERE id = " SelectedProjectID )
gosub FilterUpdate
;UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected)
return

View File

@ -30,7 +30,6 @@ SetBatchLines -1
#Include ProjectManage.ahk
#Include ProjectRemove.ahk
#Include ProjectComplete.ahk
#Include SubprojectAdd.ahk
#Include SkillsView.ahk
#Include ProjectLog.ahk
#Include ProfileEdit.ahk

View File

@ -2,6 +2,7 @@
;~ Confirm Project completion:
CompleteProject:
Gui, ListView, MainList
Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, 1)
LV_GetText(ProjectCompletionState, Selection, 2)
@ -46,7 +47,7 @@ return
CompleteProject(SelectedProjectID)
{
global db, Difficulties, Awards
global db, DifficultyLevels, AwardLevels
; Get the difficulty to know how many points to award and the skill to show in notification
CompletedProject := db.OpenRecordSet("SELECT * FROM projects WHERE id = " SelectedProjectID)
while (!CompletedProject.EOF)
@ -58,8 +59,9 @@ CompleteProject(SelectedProjectID)
CompletedProject.Close()
; Mark project as done:
db.Query("UPDATE projects SET difficulty = 'Done', importance = '', dateDone = " . A_Now . ", levelDone = " . LevelGet() . " WHERE id = " SelectedProjectID)
db.Query("UPDATE projects SET difficulty = 0, importance = '', dateDone = " . A_Now . ", levelDone = " . LevelGet() . " WHERE id = " SelectedProjectID)
/*
; Get the level count for the skill if the project has one:
if (SkillToIncrease)
{
@ -71,18 +73,19 @@ CompleteProject(SelectedProjectID)
SkillLevel := row[A_index]
}
}
*/
; Get the amount of points to award for the chosen level
for Num, Difficulty in Difficulties
for Num, Difficulty in DifficultyLevels
{
if (DifficultyToAward = Difficulty)
for Key, Award in Awards
if (DifficultyToAward = Num)
for Key, Award in AwardLevels
{
if (Num = Key)
AwardGiven := Award
}
}
UpdateProgress(DifficultyToAward . " Achievement", AwardGiven)
UpdateProgress(DifficultyLevels[DifficultyToAward] . " Achievement", AwardGiven)
if (SkillToIncrease)
Notification("SKILL INCREASED", SkillToIncrease . " increased to " . SkillLevel)
}

View File

@ -19,6 +19,12 @@ Action := "Add"
ProjectManage(Action)
return
; Add a new subproject:
AddSubproject:
Action := "Subproject"
ProjectManage(Action)
return
; Edit a selected project:
EditProject:
Action := "Edit"
@ -116,13 +122,17 @@ if (ProjectSkillEdit = "All" || ProjectSkillEdit = "None") ; Sort this out durin
MsgBox, 8192, Error, "All" and "None" can't be used as skill names!
return
}
if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd")
if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "Subproject")
{
Record := {}
Record.Project := ProjectNameEdit
Record.Difficulty := KeyGet(DifficultyLevels, ProjectDifficultyEdit)
Record.Importance := KeyGet(ImportanceLevels, ProjectImportanceEdit)
Record.dateEntered := A_Now
if (Action = "Subproject")
{
Record.Parent := SelectedProjectID
}
db.Insert(Record, "projects")
@ -174,7 +184,6 @@ else if (Action = "QuickAdd" || Action = "QuickDone")
}
gosub FilterUpdate
RefreshSkillsList(FilterSkillSelected)
return
; Fall through below to close window.
ProjectManagerGuiEscape:
@ -185,7 +194,7 @@ try
for k, v in SkillACStopKeys
Hotkey, %v%, Off
}
if (Action = "Add" || Action = "Edit")
if (Action = "Add" || Action = "Edit" || Action = "Subproject")
{
GuiChildClose("ProjectManager")
}
@ -228,13 +237,14 @@ DBGetVal(Query, Val)
ProjectManage(Action)
{
global
Gui, ListView, MainList
ProjectNameEdit =
ProjectDifficultyEdit =
ProjectSkillEdit =
; Get the row number of the selected project from the main project ListView:
Selection := LV_GetNext("","F")
; If editing, get the ID number of that project:
if (Action = "Edit")
; If editing or adding subproject, get the ID number of that project:
if (Action = "Edit" || Action = "Subproject")
{
LV_GetText(SelectedProjectID, Selection, 1) ; Get project ID number from hidden column of ListView
; If no row is selected and edit is called, do nothing and go back:
@ -275,9 +285,17 @@ ProjectManage(Action)
ProjectSkill =
ProjectImportance =
}
if (Action = "Subproject")
{
; Temporary, working on where (if) to include parent project name in subproject-add box):
ProjectName =
ProjectDifficulty =
ProjectSkill =
ProjectImportance =
}
; Build the GUI window to either add or edit a project:
; Initiate a modal child window owned by the main window (by default):
if (Action = "Add" || Action = "Edit")
if (Action = "Add" || Action = "Edit" || Action = "Subproject")
GuiChildInit("ProjectManager")
else if (Action = "QuickDone" || Action = "QuickAdd")
{
@ -322,6 +340,15 @@ ProjectManage(Action)
StringReplace, PMTitle, Action, add, Add
else
PMTitle := Action
Gui, ProjectManager:Show, w%Width% h%Height% x%xc% y%yc%, %PMTitle% Project
if (Action = "QuickAdd" || Action = "QuickDone")
Gui, ProjectManager:Show, w%Width% h%Height%, %PMTitle% Project
else
Gui, ProjectManager:Show, w%Width% h%Height% x%xc% y%yc%, %PMTitle% Project
; Remove the skill auto-complete tooltip if LifeRPG window loses focus:
SetTimer, ACWinWatch, 300
return
ACWinWatch:
if !WinActive("ahk_class AutoHotkeyGUI")
SkillACShutOff()
return
}

View File

@ -2,6 +2,7 @@
;~ Confirm project deletion/removal:
RemoveProject:
Gui, ListView, MainList
Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, IDCol)
If (SelectedProjectID == "ID")

View File

@ -36,14 +36,20 @@ GuiControl, , FilterSkill, % ListSkills()
Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne
; Sidelist:
SideListWidth = 200
Gui, Add, ListView, x0 y+15 r20 AltSubmit -Multi vSideList -Hdr, ID|Diff|Parent
;~ ListView:
Gui, Add, ListView, x0 y+15 r20 Grid AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|DifficultyID|ImportanceID|ParentID|ColorID|Difficulty|Project|Importance|Parent
Gui, Add, ListView, x+1 r20 AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|DifficultyID|ImportanceID|ParentID|ColorID|Difficulty|Project|Importance|Parent
}
Colored_LV_1_BG = 5 ;ColorIDCol
GuiControl, Focus, SearchQuery ; Focus on search bar by default
Gui, Show, w827 h600, %AppTitle% ; Show the GUI we've created
UpdateList() ; Show all projects
Gui, +Resize +MinSize621x ; Make GUI resizable
return
;~ ===============================================================================
@ -53,7 +59,8 @@ GuiSize:
if A_EventInfo = 1 ; The window has been minimized. No action needed.
return
; Otherwise, the window has been resized or maximized. Resize the controls to match.
GuiControl, Move, Mainlist, % "H" . (A_GuiHeight - 55) . " W" . (A_GuiWidth)
GuiControl, Move, Sidelist, % "H" . (A_GuiHeight - 55) . " W" . (SideListWidth := A_GuiWidth * .35)
GuiControl, Move, Mainlist, % "H" . (A_GuiHeight - 55) . " W" . (A_GuiWidth - (SideListWidth + 5)) . " X" . (SideListWidth+5)
; Resize search bar to fit dropdown filter controls:
if (A_GuiWidth > 811) ;827)
{
@ -200,6 +207,7 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
Critical
Gui, 1:Default
Gui, ListView, MainList
GuiControlGet, SearchString, , SearchQuery
GuiControl, -ReDraw, MainList
LV_Delete()
@ -225,7 +233,7 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
if (FilterShowDone = 1)
Filter .= "Difficulty = 0 or Difficulty is null "
else
Filter .= "Difficulty is not null "
Filter .= "difficulty <> 0 "
; Difficulty level
if (DifficultySelected <> "All")
@ -330,5 +338,37 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
; Enable ListView coloring:
OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" )
GuiControl, +ReDraw, MainList
UpdateSideList()
return
}
UpdateSidelist()
{
global
ParentIDCol = 1
ParentDiffCol = 2
ParentNameCol = 3
Gui, 1:Default
Gui, ListView, SideList
GuiControl, -ReDraw, SideList
LV_Delete()
ParentProjectList := db.OpenRecordSet("SELECT * FROM projects WHERE id IN (SELECT parent FROM projects WHERE difficulty <> 0)")
while (!ParentProjectList.EOF)
{
ParentID := ParentProjectList["id"]
ParentDiff := ParentProjectList["difficulty"]
ParentName := ParentProjectList["project"]
LV_Add("", ParentID, ParentDiff, ParentName)
ParentProjectList.MoveNext()
}
ParentProjectList.Close()
LV_ModifyCol(ParentNameCol, "sort")
LV_Insert(1, "", 0, 0, "All") ; To show all projects, ID shall be 0 (zero)
LV_ModifyCol()
Loop % LV_GetCount("Col")
LV_Modify(A_Index, "AutoHDR")
LV_ModifyCol(ParentIDCol, 0)
LV_ModifyCol(ParentDiffCol, 0)
GuiControl, +ReDraw, SideList
}

View File

@ -19,7 +19,7 @@ AwardLevels := [5, 10, 25]
Colors := [BGR("ADFF2F"), BGR("FFD700"), BGR("FF6347")]
;~ Priorities:
ImportanceLevels := ["High", "Medium", "Low"]
ImportanceLevels := ["Very High", "High", "Medium", "Low"]
BGR(RGB)
{

View File

@ -14,16 +14,15 @@ SVy := CenterY(SVh)
; Populate the Skill Stats ListView with skills and stats:
; 1. Get the skills count for all done items from the projects table
; First we need to add all skills to the LV
; SELECT DISTINCT skill FROM projects WHERE difficulty <> 'Done' ORDER BY skill
; 2. Add to ListView
SkillsList := db.OpenRecordSet("SELECT DISTINCT skill FROM projects WHERE skill IS NOT NULL AND skill <> '' ORDER BY skill")
SkillsList := db.OpenRecordSet("SELECT DISTINCT skill FROM skills ORDER BY skill")
while (!SkillsList.EOF)
{
SkillListName := SkillsList["skill"]
LV_Add("", SkillListName)
RowNum := A_Index
Table := db.Query("SELECT COUNT(skill) FROM projects WHERE skill = '" . SkillListName . "' AND confidence is null")
Table := db.Query("SELECT COUNT(id) FROM projects WHERE id IN (SELECT projectID FROM skills WHERE skill = '" . SkillListName . "') AND difficulty = 0")
columnCount := Table.Columns.Count()
for each, row in Table.Rows
{