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:Add, Picture, w32 h-1, res/WP_RPG_VG.ico
Gui, AboutBox:Font, bold 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:Font
Gui, AboutBox:Add, Text, y+1, by Jayvant Javier Pujara Gui, AboutBox:Add, Text, y+1, by Jayvant Javier Pujara

View File

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

View File

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

View File

@ -2,6 +2,7 @@
;~ Confirm Project completion: ;~ Confirm Project completion:
CompleteProject: CompleteProject:
Gui, ListView, MainList
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, 1) LV_GetText(SelectedProjectID, Selection, 1)
LV_GetText(ProjectCompletionState, Selection, 2) LV_GetText(ProjectCompletionState, Selection, 2)
@ -46,7 +47,7 @@ return
CompleteProject(SelectedProjectID) 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 ; 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) CompletedProject := db.OpenRecordSet("SELECT * FROM projects WHERE id = " SelectedProjectID)
while (!CompletedProject.EOF) while (!CompletedProject.EOF)
@ -58,8 +59,9 @@ CompleteProject(SelectedProjectID)
CompletedProject.Close() CompletedProject.Close()
; Mark project as done: ; 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: ; Get the level count for the skill if the project has one:
if (SkillToIncrease) if (SkillToIncrease)
{ {
@ -71,18 +73,19 @@ CompleteProject(SelectedProjectID)
SkillLevel := row[A_index] SkillLevel := row[A_index]
} }
} }
*/
; Get the amount of points to award for the chosen level ; Get the amount of points to award for the chosen level
for Num, Difficulty in Difficulties for Num, Difficulty in DifficultyLevels
{ {
if (DifficultyToAward = Difficulty) if (DifficultyToAward = Num)
for Key, Award in Awards for Key, Award in AwardLevels
{ {
if (Num = Key) if (Num = Key)
AwardGiven := Award AwardGiven := Award
} }
} }
UpdateProgress(DifficultyToAward . " Achievement", AwardGiven) UpdateProgress(DifficultyLevels[DifficultyToAward] . " Achievement", AwardGiven)
if (SkillToIncrease) if (SkillToIncrease)
Notification("SKILL INCREASED", SkillToIncrease . " increased to " . SkillLevel) Notification("SKILL INCREASED", SkillToIncrease . " increased to " . SkillLevel)
} }

View File

@ -19,6 +19,12 @@ Action := "Add"
ProjectManage(Action) ProjectManage(Action)
return return
; Add a new subproject:
AddSubproject:
Action := "Subproject"
ProjectManage(Action)
return
; Edit a selected project: ; Edit a selected project:
EditProject: EditProject:
Action := "Edit" 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! MsgBox, 8192, Error, "All" and "None" can't be used as skill names!
return return
} }
if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd") if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd" || Action = "Subproject")
{ {
Record := {} Record := {}
Record.Project := ProjectNameEdit Record.Project := ProjectNameEdit
Record.Difficulty := KeyGet(DifficultyLevels, ProjectDifficultyEdit) Record.Difficulty := KeyGet(DifficultyLevels, ProjectDifficultyEdit)
Record.Importance := KeyGet(ImportanceLevels, ProjectImportanceEdit) Record.Importance := KeyGet(ImportanceLevels, ProjectImportanceEdit)
Record.dateEntered := A_Now Record.dateEntered := A_Now
if (Action = "Subproject")
{
Record.Parent := SelectedProjectID
}
db.Insert(Record, "projects") db.Insert(Record, "projects")
@ -174,7 +184,6 @@ else if (Action = "QuickAdd" || Action = "QuickDone")
} }
gosub FilterUpdate gosub FilterUpdate
RefreshSkillsList(FilterSkillSelected) RefreshSkillsList(FilterSkillSelected)
return
; Fall through below to close window. ; Fall through below to close window.
ProjectManagerGuiEscape: ProjectManagerGuiEscape:
@ -185,7 +194,7 @@ try
for k, v in SkillACStopKeys for k, v in SkillACStopKeys
Hotkey, %v%, Off Hotkey, %v%, Off
} }
if (Action = "Add" || Action = "Edit") if (Action = "Add" || Action = "Edit" || Action = "Subproject")
{ {
GuiChildClose("ProjectManager") GuiChildClose("ProjectManager")
} }
@ -228,13 +237,14 @@ DBGetVal(Query, Val)
ProjectManage(Action) ProjectManage(Action)
{ {
global global
Gui, ListView, MainList
ProjectNameEdit = ProjectNameEdit =
ProjectDifficultyEdit = ProjectDifficultyEdit =
ProjectSkillEdit = ProjectSkillEdit =
; Get the row number of the selected project from the main project ListView: ; Get the row number of the selected project from the main project ListView:
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
; If editing, get the ID number of that project: ; If editing or adding subproject, get the ID number of that project:
if (Action = "Edit") if (Action = "Edit" || Action = "Subproject")
{ {
LV_GetText(SelectedProjectID, Selection, 1) ; Get project ID number from hidden column of ListView 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: ; If no row is selected and edit is called, do nothing and go back:
@ -275,9 +285,17 @@ ProjectManage(Action)
ProjectSkill = ProjectSkill =
ProjectImportance = 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: ; Build the GUI window to either add or edit a project:
; Initiate a modal child window owned by the main window (by default): ; 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") GuiChildInit("ProjectManager")
else if (Action = "QuickDone" || Action = "QuickAdd") else if (Action = "QuickDone" || Action = "QuickAdd")
{ {
@ -322,6 +340,15 @@ ProjectManage(Action)
StringReplace, PMTitle, Action, add, Add StringReplace, PMTitle, Action, add, Add
else else
PMTitle := Action PMTitle := Action
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 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 return
} }

View File

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

View File

@ -36,14 +36,20 @@ GuiControl, , FilterSkill, % ListSkills()
Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne 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: ;~ 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 Colored_LV_1_BG = 5 ;ColorIDCol
GuiControl, Focus, SearchQuery ; Focus on search bar by default GuiControl, Focus, SearchQuery ; Focus on search bar by default
Gui, Show, w827 h600, %AppTitle% ; Show the GUI we've created Gui, Show, w827 h600, %AppTitle% ; Show the GUI we've created
UpdateList() ; Show all projects UpdateList() ; Show all projects
Gui, +Resize +MinSize621x ; Make GUI resizable Gui, +Resize +MinSize621x ; Make GUI resizable
return return
;~ =============================================================================== ;~ ===============================================================================
@ -53,7 +59,8 @@ GuiSize:
if A_EventInfo = 1 ; The window has been minimized. No action needed. if A_EventInfo = 1 ; The window has been minimized. No action needed.
return return
; Otherwise, the window has been resized or maximized. Resize the controls to match. ; 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: ; Resize search bar to fit dropdown filter controls:
if (A_GuiWidth > 811) ;827) if (A_GuiWidth > 811) ;827)
{ {
@ -200,6 +207,7 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
Critical Critical
Gui, 1:Default Gui, 1:Default
Gui, ListView, MainList
GuiControlGet, SearchString, , SearchQuery GuiControlGet, SearchString, , SearchQuery
GuiControl, -ReDraw, MainList GuiControl, -ReDraw, MainList
LV_Delete() LV_Delete()
@ -225,7 +233,7 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
if (FilterShowDone = 1) if (FilterShowDone = 1)
Filter .= "Difficulty = 0 or Difficulty is null " Filter .= "Difficulty = 0 or Difficulty is null "
else else
Filter .= "Difficulty is not null " Filter .= "difficulty <> 0 "
; Difficulty level ; Difficulty level
if (DifficultySelected <> "All") if (DifficultySelected <> "All")
@ -330,5 +338,37 @@ UpdateList(NextSelection="", DifficultySelected="All", Skill="All")
; Enable ListView coloring: ; Enable ListView coloring:
OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" ) OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" )
GuiControl, +ReDraw, MainList GuiControl, +ReDraw, MainList
UpdateSideList()
return 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")] Colors := [BGR("ADFF2F"), BGR("FFD700"), BGR("FF6347")]
;~ Priorities: ;~ Priorities:
ImportanceLevels := ["High", "Medium", "Low"] ImportanceLevels := ["Very High", "High", "Medium", "Low"]
BGR(RGB) BGR(RGB)
{ {

View File

@ -14,16 +14,15 @@ SVy := CenterY(SVh)
; Populate the Skill Stats ListView with skills and stats: ; Populate the Skill Stats ListView with skills and stats:
; 1. Get the skills count for all done items from the projects table ; 1. Get the skills count for all done items from the projects table
; First we need to add all skills to the LV ; 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 ; 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) while (!SkillsList.EOF)
{ {
SkillListName := SkillsList["skill"] SkillListName := SkillsList["skill"]
LV_Add("", SkillListName) LV_Add("", SkillListName)
RowNum := A_Index 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() columnCount := Table.Columns.Count()
for each, row in Table.Rows for each, row in Table.Rows
{ {