Implementing multiple skills system

This commit is contained in:
Jayvant Javier Pujara 2012-11-15 21:55:25 -05:00
parent 3bde7c3d5f
commit df15f9d1b7
9 changed files with 362 additions and 290 deletions

View File

@ -117,220 +117,6 @@ Capitalize(String)
return String return String
} }
; Call to refresh skills list after adding a new skill:
RefreshSkillsList(SkillChosen="All")
{
global
if (SkillChosen = "All" || SkillChosen = "")
{
GuiControl, , FilterSkill, |All||None|
GuiControl, , FilterSkill, % ListSkills()
}
else if (SkillChosen = "None")
{
GuiControl, , FilterSkill, |All|None||
GuiControl, , FilterSkill, % ListSkills()
}
else
{
PickSkill := ListSkills()
if (InStr(PickSkill, SkillChosen))
{
GuiControl, , FilterSkill, |All|None|
StringReplace, PickedSkill, PickSkill, %SkillChosen%, %SkillChosen%|
GuiControl, , FilterSkill, % PickedSkill
}
else
{
GuiControl, , FilterSkill, |All||None|
GuiControl, , FilterSkill, % ListSkills()
}
}
GuiControlGet, FilterSkillSelected, , FilterSkill
}
ListSkills(Selected="")
{
global db
SkillList := Object()
Skills := db.OpenRecordSet("SELECT DISTINCT skill FROM projects ORDER BY skill")
while(!Skills.EOF)
{
Skill := Skills["skill"]
If (Skill <> "")
SkillList.Insert(Skill)
Skills.MoveNext()
}
Skills.Close()
SkillComboList =
For Num, Skill in SkillList
{
SkillComboList .= Skill . "|"
if (Selected and Skill = Selected)
SkillComboList .= "|"
}
return SkillComboList
}
ListDifficulties(SetDifficulty="")
{
global Difficulties
For k, diff in Difficulties
{
if (diff = SetDifficulty)
diff := diff . "|"
else if (k = 1)
diff := diff . "|"
DifficultyList .= diff . "|"
}
return DifficultyList
}
ListPriorities(SetPriority="")
{
global Priorities
For k, imp in Priorities
{
if (imp = SetPriority)
imp := imp . "|"
else if (k = 1 && SetPriority <> "All")
imp := imp . "|"
PriorityList .= imp . "|"
}
return PriorityList
}
UpdateList(NextSelection="", ImportanceSelected="All", Skill="All")
{
global
IDCol = 1
DifficultyCol = 2
ImportanceCol = 4
ParentCol = 5
Critical
Gui, 1:Default
GuiControlGet, SearchString, , SearchQuery
GuiControl, -ReDraw, MainList
LV_Delete()
Filter=
if (ImportanceSelected <> "" || FilterShowDone <> "" || Skill <> "" || SearchString <> "")
Filter .= "WHERE "
if (SearchString <> "")
Filter .= "project LIKE '%" SafeQuote(SearchString) "%' AND"
if (FilterShowDone <> 1)
Filter .= " difficulty <> 'Done' "
else if (FilterShowDone = 1)
Filter .= " difficulty = 'Done' "
if (ImportanceSelected <> "All")
Filter .= " AND importance = '" SafeQuote(ImportanceSelected) "' "
if (Skill = "None")
filter .= " AND skill = '' "
else if (Skill <> "All")
Filter .= " AND skill = '" SafeQuote(Skill) "' "
;Notification("","Select * from projects " . Filter)
Projects := db.OpenRecordSet("Select * from projects " . Filter)
while (!Projects.EOF)
{
ID := Projects["id"]
Difficulty := Projects["difficulty"]
Project := Projects["project"]
Parent := Projects["parent"]
Importance := Projects["importance"]
for k, v in Priorities
{
If (Importance = v)
Importance := k ". " v
}
If (Importance = "")
Importance := "None"
LV_Add("", ID,Difficulty,Project,Importance,Parent)
Projects.MoveNext()
}
Projects.Close()
GuiControl, -ReDraw, MainList
LV_ModifyCol(1, "Integer sortdesc") ; Enable this to sort by ID, which could show most recent or oldest first, depending.
LV_ModifyCol(ImportanceCol, "sort") ; First sort by importance
LV_ModifyCol(DifficultyCol, "sortdesc") ; Then sort by difficulty, descending. Just so happens my scheme sorts alright on its own, what luck.
If (NextSelection)
LV_Modify(NextSelection, "Focus Select Vis")
Times := LV_GetCount()
Loop % Times
{
ThisLine := A_Index
LV_GetText(Text, ThisLine, ImportanceCol)
for k, v in Priorities ; Remove those numbers added to the priorities to allow for proper sorting
{
P := k ". " v
if (Text = P)
{
LV_Modify(ThisLine,"Col" . ImportanceCol,v)
}
}
LV_GetText(ParentID, ThisLine, ParentCol)
GetParent := db.OpenRecordSet("SELECT project FROM projects WHERE id = " ParentID)
while (!GetParent.EOF)
{
ParentName := GetParent["project"]
GetParent.MoveNext()
}
GetParent.Close()
LV_Modify(ThisLine, "Col" . ParentCol,ParentName)
}
LV_ModifyCol()
Loop % LV_GetCount("Col")
LV_ModifyCol(A_Index,"AutoHdr")
LV_ModifyCol(IDCol, 0) ; Hide ID column
Loop % LV_GetCount()
{
RowNum := A_Index
LV_GetText(RowDiff, RowNum, 2)
for kDiff, vDiff in Difficulties
{
for kCol, vCol in Colors
{
if (RowDiff = vDiff)
{
if (kDiff = kCol)
LV_Modify(RowNum, "Col6", vCol)
}
else if (RowDiff = "Done")
LV_Modify(RowNum, "Col6", BGR("F5FFFA"))
}
}
}
OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" )
LV_ModifyCol(6, 0) ; Hide Color column
GuiControl, +ReDraw, MainList
return
}
GetParentName()
{
global
Times := LV_GetCount()
Loop % Times
{
ThisLine := A_Index
LV_GetText(ParentID, ThisLine, ParentCol)
GetParent := db.OpenRecordSet("SELECT project FROM projects WHERE id = " ParentID)
while (!GetParent.EOF)
{
ParentName := GetParent["project"]
GetParent.MoveNext()
}
GetParent.Close()
LV_Modify(ThisLine, "Col" . ParentCol,ParentName)
}
}
SafeQuote(string) ; Escape single quotes for sql update. Insert doesn't seem to need it because the DB library handles it. SafeQuote(string) ; Escape single quotes for sql update. Insert doesn't seem to need it because the DB library handles it.
{ {
StringReplace, string, string, ','', All StringReplace, string, string, ','', All

View File

@ -46,3 +46,22 @@ return
;~ else ;~ else
;~ WinActivate, %WindowFind% ;~ WinActivate, %WindowFind%
;~ return ;~ return
^1::
^2::
^3::
Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, IDCol)
If (SelectedProjectID == "ID")
{
return
}
else
{
StringTrimLeft, NewConfidence, A_ThisHotkey, 1
db.Query("UPDATE projects SET confidence = " NewConfidence " WHERE id = " SelectedProjectID )
gosub FilterUpdate
;UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected)
return
}
return

View File

@ -28,14 +28,16 @@ return
SkillAutoComplete: SkillAutoComplete:
Critical Critical
Gui, ProjectManager:Submit, NoHide Gui, ProjectManager:Submit, NoHide
If (!GetKeyState("BackSpace","P") && ProjectSkillEdit && Pos := InStr(SkillsDB, "|" . ProjectSkillEdit)) ;~ If (!GetKeyState("BackSpace","P") && ProjectSkillEdit && Pos := InStr(SkillsDB, "|" . ProjectSkillEdit))
{ ;~ {
Found := SubStr(SkillsDB, pos+1, InStr(SkillsDB, "|", 1, Pos + 1) - Pos - 1) ;~ Found := SubStr(SkillsDB, pos+1, InStr(SkillsDB, "|", 1, Pos + 1) - Pos - 1)
GuiControl, ProjectManager:Text, ProjectSkillEdit, %Found% ;~ GuiControl, ProjectManager:Text, ProjectSkillEdit, %Found%
SendInput % "{End}" . "+{Left " . StrLen(Found) - StrLen(ProjectSkillEdit) . "}" ;~ SendInput % "{End}" . "+{Left " . StrLen(Found) - StrLen(ProjectSkillEdit) . "}"
} ;~ }
ToolTip, X%A_CaretX% Y%A_CaretY%, A_CaretX, A_CaretY - 20
return return
ProjectManagerSubmit: ProjectManagerSubmit:
Gui, ProjectManager:Submit, NoHide Gui, ProjectManager:Submit, NoHide
if (ProjectNameEdit = "") if (ProjectNameEdit = "")
@ -43,7 +45,8 @@ if (ProjectNameEdit = "")
MsgBox, 8192, Error, Can't make a project with no name! MsgBox, 8192, Error, Can't make a project with no name!
return return
} }
if (ProjectSkillEdit = "All" || ProjectSkillEdit = "None")
if (ProjectSkillEdit = "All" || ProjectSkillEdit = "None") ; Sort this out during parse of skills
{ {
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
@ -52,40 +55,40 @@ if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd")
{ {
Record := {} Record := {}
Record.Project := ProjectNameEdit Record.Project := ProjectNameEdit
Record.Difficulty := ProjectDifficultyEdit Record.Confidence := KeyGet(ConfidenceList, ProjectConfidenceEdit)
Record.Importance := ProjectImportanceEdit
Record.Skill := Capitalize(ProjectSkillEdit)
Record.dateEntered := A_Now Record.dateEntered := A_Now
S := db.Insert(Record, "projects") db.Insert(Record, "projects")
; Insert skills:
NewProjectID := LastProjectID()
Loop, parse, ProjectSkillsEdit, CSV
{
SkillToInsert = %A_LoopField% ;This removes any leading space due to parse
SkillToInsert := Capitalize(SkillToInsert)
SkillsInsert := {}
SkillsInsert.skill := SkillToInsert
SkillsInsert.projectID := NewProjectID
db.Insert(SkillsInsert, "skills") ; Insert new skill to skills table
}
if (Action = "QuickDone" || Action = "QuickAdd") if (Action = "QuickDone" || Action = "QuickAdd")
{ {
Gui, ProjectManager:Cancel Gui, ProjectManager:Cancel
Gui, 1:Default Gui, 1:Default
if (Action = "QuickDone") if (Action = "QuickDone")
{ {
table := db.Query("SELECT MAX(id) FROM projects") CompleteProject(LastProjectID())
columnCount := table.Columns.Count()
for each, row in table.Rows
{
Loop, % columnCount
QuickID := row[A_index]
}
CompleteProject(QuickID)
} }
} }
} }
else if (Action = "Edit") else if (Action = "Edit")
{ {
db.Query("UPDATE projects SET project = '" SafeQuote(ProjectNameEdit) "' WHERE ID = " SelectedProjectID ) db.Query("UPDATE projects SET project = '" SafeQuote(ProjectNameEdit) "' WHERE ID = " SelectedProjectID )
db.Query("UPDATE projects SET difficulty = '" SafeQuote(ProjectDifficultyEdit) "' WHERE ID = " SelectedProjectID ) db.Query("UPDATE projects SET confidence = '" KeyGet(ConfidenceList, ProjectConfidenceEdit) "' WHERE ID = " SelectedProjectID )
db.Query("UPDATE projects SET importance = '" SafeQuote(ProjectImportanceEdit) "' WHERE ID = " SelectedProjectID )
; Make sure skill is title cased, just to look good: ; Make sure skill is title cased, just to look good:
StringUpper, ProjectSkillEdit, ProjectSkillEdit, T StringUpper, ProjectSkillEdit, ProjectSkillEdit, T
db.Query("UPDATE projects SET skill = '" SafeQuote(ProjectSkillEdit) "' WHERE ID = " SelectedProjectID ) db.Query("UPDATE projects SET skill = '" SafeQuote(ProjectSkillEdit) "' WHERE ID = " SelectedProjectID )
} }
;UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected)
;Notification(Selection . FilterImportanceSelected . FilterSkillSelected, "")
;GuiControlGet, FilterSkillSelected, , FilterSkill
if (Action = "Add" || Action = "Edit") if (Action = "Add" || Action = "Edit")
{ {
GuiChildClose("ProjectManager") GuiChildClose("ProjectManager")
@ -113,14 +116,37 @@ else if (Action = "QuickAdd" || Action = "QuickDone")
} }
return return
LastProjectID()
{
global db
table := db.Query("SELECT MAX(id) FROM projects")
columnCount := table.Columns.Count()
for each, row in table.Rows
{
Loop, % columnCount
QuickID := row[A_index]
}
return QuickID
}
DBGetVal(Query, Val)
{
global db
R := db.OpenRecordSet(Query)
while (!R.EOF)
{
V := R[Val]
R.MoveNext()
}
R.Close()
return V
}
ProjectManage(Action) ProjectManage(Action)
{ {
;global db, ProjectNameEdit, ProjectDifficultyEdit, ProjectImportanceEdit, ProjectSkillEdit
global global
ProjectNameEdit = ProjectNameEdit =
ProjectDifficultyEdit = ProjectConfidenceEdit =
ProjectImportanceEdit =
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")
@ -139,8 +165,7 @@ ProjectManage(Action)
while(!ProjectInfo.EOF) while(!ProjectInfo.EOF)
{ {
ProjectName := ProjectInfo["project"] ProjectName := ProjectInfo["project"]
ProjectDifficulty := ProjectInfo["difficulty"] ProjectConfidence := ProjectInfo["confidence"]
ProjectImportance := ProjectInfo["importance"]
ProjectSkill := ProjectInfo["skill"] ProjectSkill := ProjectInfo["skill"]
ProjectInfo.MoveNext() ProjectInfo.MoveNext()
} }
@ -150,8 +175,7 @@ ProjectManage(Action)
else if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd") else if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd")
{ {
ProjectName = ProjectName =
ProjectDifficulty = ProjectConfidence =
ProjectImportance =
ProjectSkill = ProjectSkill =
} }
; Build the GUI window to either add or edit a project: ; Build the GUI window to either add or edit a project:
@ -168,24 +192,17 @@ ProjectManage(Action)
Gui, ProjectManager:Add, Text, , &Project Name: Gui, ProjectManager:Add, Text, , &Project Name:
Gui, ProjectManager:Add, Edit, vProjectNameEdit W270 r1, %ProjectName% Gui, ProjectManager:Add, Edit, vProjectNameEdit W270 r1, %ProjectName%
; Difficulty: ; Confidence:
Gui, ProjectManager:Add, Text, , &Difficulty: Gui, ProjectManager:Add, Text, , &Confidence:
DifficultyList := ListDifficulties(ProjectDifficulty) Gui, ProjectManager:Add, DropDownList, vProjectConfidenceEdit, % ListConfidence(ProjectConfidence)
Gui, ProjectManager:Add, DropDownList, vProjectDifficultyEdit, %DifficultyList%
; Importance:
if (Action <> "QuickDone")
{
Gui, ProjectManager:Add, Text, , &Importance:
PriorityList := ListPriorities(ProjectImportance)
Gui, ProjectManager:Add, DropDownList, vProjectImportanceEdit, %PriorityList%
}
; Skill: ; Skill:
Gui, ProjectManager:Add, Text, x+20 y52, Set S&kill: Gui, ProjectManager:Add, Text, x+20 y52, Set S&kills:
; To set this, we need to go through all the skills on the table and get all the distinct skills: ; To set this, we need to go through all the skills on the table and get all the distinct skills:
SkillsDB := ListSkills(ProjectSkill) ;SkillsDB := ListSkills(ProjectSkill)
Gui, ProjectManager:Add, ComboBox, vProjectSkillEdit gSkillAutoComplete w130 r7, % SkillsDB ;% ListSkills(ProjectSkill) ;Diplomacy|Art|Piracy|Cleaning|Hunting ;Gui, ProjectManager:Add, ComboBox, vProjectSkillEdit gSkillAutoComplete w130 r7, % SkillsDB ;% ListSkills(ProjectSkill)
Gui, ProjectManager:Add, Edit, vProjectSkillsEdit w130,
; Submit button: ; Submit button:
Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 x15 y+70, &Submit Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 x15 y+70, &Submit
@ -210,6 +227,4 @@ ProjectManage(Action)
PMTitle := Action PMTitle := Action
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
return return
} }
; Kind of duplicate with other skills get function I just made

View File

@ -3,7 +3,7 @@
RemoveProject: RemoveProject:
Selection := LV_GetNext("","F") Selection := LV_GetNext("","F")
LV_GetText(SelectedProjectID, Selection, 1) LV_GetText(SelectedProjectID, Selection, IDCol)
If (SelectedProjectID == "ID") If (SelectedProjectID == "ID")
{ {
return return
@ -18,10 +18,8 @@ else
db.Query("DELETE FROM projects WHERE id = " SelectedProjectID ) db.Query("DELETE FROM projects WHERE id = " SelectedProjectID )
GuiChildClose("RemoveProject") GuiChildClose("RemoveProject")
RefreshSkillsList(FilterSkillSelected) RefreshSkillsList(FilterSkillSelected)
;Notification("RefreshSkillList(",FilterSkillSelected)
gosub FilterUpdate gosub FilterUpdate
;Notification(Selection . ", " . FilterImportanceSelected . ", " . FilterSkillSelected,"") ;UpdateList(Selection, FilterConfidenceSelected, FilterSkillSelected)
UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected)
return return
RemoveProjectNo: RemoveProjectNo:

View File

@ -23,9 +23,9 @@ Gui, Add, Button, gClearSearch vClearSearchButton x+1, &Clear ; Pressing Alt+C a
;~ Filter view by importance: ;~ Filter view by importance:
Gui, Add, Text, x+10 vImpChooseText, &Importance: Gui, Add, Text, x+10 vConfidenceChooseText, &Confidence:
Gui, Add, DropDownList, vImportanceChoose gImportanceUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk Gui, Add, DropDownList, vConfidenceChoose gFilterUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk
GuiControl, , ImportanceChoose, % ListPriorities("All") GuiControl, , ConfidenceChoose, % ListConfidence("All")
; Filter view by skill: ; Filter view by skill:
Gui, Add, Text, x+10 vSkillChooseText, S&kill: Gui, Add, Text, x+10 vSkillChooseText, S&kill:
@ -37,9 +37,9 @@ Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne
;~ ListView: ;~ ListView:
Gui, Add, ListView, x0 y+15 r20 Grid AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|Difficulty|Project|Importance|Parent|Color Gui, Add, ListView, x0 y+15 r20 Grid AltSubmit -Multi Count%CountUp% vMainList hwndColored_LV_1, ID|ConfidenceID|ParentID|ColorID|Confidence|Project|Parent
} }
Colored_LV_1_BG = 6 Colored_LV_1_BG = 4 ;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
@ -65,8 +65,8 @@ else if (A_GuiWidth <= 811)
} }
GuiControl, MoveDraw, SearchQuery, % "w" SearchBarWidth GuiControl, MoveDraw, SearchQuery, % "w" SearchBarWidth
GuiControl, MoveDraw, ClearSearchButton, % "x" 50 + SearchBarWidth + 10 GuiControl, MoveDraw, ClearSearchButton, % "x" 50 + SearchBarWidth + 10
GuiControl, MoveDraw, ImpChooseText, % "x" 50 + SearchBarWidth + 55 GuiControl, MoveDraw, ConfidenceChooseText, % "x" 50 + SearchBarWidth + 55
GuiControl, MoveDraw, ImportanceChoose, % "x" 50 + SearchBarWidth + 120 GuiControl, MoveDraw, ConfidenceChoose, % "x" 50 + SearchBarWidth + 120
GuiControl, MoveDraw, SkillChooseText, % "x" 50 + SearchBarWidth + 190 GuiControl, MoveDraw, SkillChooseText, % "x" 50 + SearchBarWidth + 190
GuiControl, MoveDraw, FilterSkill, % "x" 50 + SearchBarWidth + 220 GuiControl, MoveDraw, FilterSkill, % "x" 50 + SearchBarWidth + 220
GuiControl, MoveDraw, FilterShowDone, % "x" 50 + SearchBarWidth + 350 GuiControl, MoveDraw, FilterShowDone, % "x" 50 + SearchBarWidth + 350
@ -75,4 +75,256 @@ return
;~ =============================================================================== ;~ ===============================================================================
;~ What to do when main window is closed: ;~ What to do when main window is closed:
GuiClose: GuiClose:
ExitApp ExitApp
;Main ListView-related Functions==================================================
; Call to refresh skills list after adding a new skill:
RefreshSkillsList(SkillChosen="All")
{
global
if (SkillChosen = "All" || SkillChosen = "")
{
GuiControl, , FilterSkill, |All||None|
GuiControl, , FilterSkill, % ListSkills()
}
else if (SkillChosen = "None")
{
GuiControl, , FilterSkill, |All|None||
GuiControl, , FilterSkill, % ListSkills()
}
else
{
PickSkill := ListSkills()
if (InStr(PickSkill, SkillChosen))
{
GuiControl, , FilterSkill, |All|None|
StringReplace, PickedSkill, PickSkill, %SkillChosen%, %SkillChosen%|
GuiControl, , FilterSkill, % PickedSkill
}
else
{
GuiControl, , FilterSkill, |All||None|
GuiControl, , FilterSkill, % ListSkills()
}
}
GuiControlGet, FilterSkillSelected, , FilterSkill
}
ListSkills(Selected="")
{
global db
SkillList := Object()
Skills := db.OpenRecordSet("SELECT DISTINCT skill FROM skills ORDER BY skill")
while(!Skills.EOF)
{
Skill := Skills["skill"]
If (Skill <> "")
SkillList.Insert(Skill)
Skills.MoveNext()
}
Skills.Close()
SkillComboList =
For Num, Skill in SkillList
{
SkillComboList .= Skill . "|"
if (Selected and Skill = Selected)
SkillComboList .= "|"
}
return SkillComboList
}
ListConfidence(SetConfidence="")
{
global ConfidenceList
For k, v in ConfidenceList
{
if (k = SetConfidence)
v := v . "|"
else if (k = 1 && SetConfidence <> "All")
v := v . "|"
ConfidenceFormatted .= v . "|"
}
return ConfidenceFormatted
}
KeyGet(obj, val)
{
for k, v in obj
{
if (v = val)
return k
}
}
ListPriorities(SetPriority="")
{
global Priorities
For k, imp in Priorities
{
if (imp = SetPriority)
imp := imp . "|"
else if (k = 1 && SetPriority <> "All")
imp := imp . "|"
PriorityList .= imp . "|"
}
return PriorityList
}
UpdateList(NextSelection="", ConfidenceSelected="All", Skill="All")
{
global
; A number from the database:
IDCol = 1
; A number from the database:
ConfIDCol = 2
; Number from the database:
ParentIDCol = 3
; A number added from confidence rank info:
ColorIDCol = 4
; Text to be deciphered from rank code:
ConfidenceCol = 5
; Text from the database:
ProjNameCol = 6
; Text to be deciphered from database number:
ParentCol = 7
Critical
Gui, 1:Default
GuiControlGet, SearchString, , SearchQuery
GuiControl, -ReDraw, MainList
LV_Delete()
;~ if (Skill = "All")
;~ {
;~ Filter := "Select * from projects "
;~ }
;~ else if (Skill <> "All" && Skill <> "None")
;~ {
;~ Filter := "SELECT p.* FROM projects p, skills s WHERE s.projectID = p.ID AND (s.skill IN ('" . Skill . "')) "
;~ }
;~ else if (Skill = "None")
;~ filter .= ""
;~ if (ConfidenceSelected <> "" || FilterShowDone <> "" || Skill <> "" || SearchString <> "")
;~ Filter .= "WHERE "
;~ if (SearchString <> "")
;~ Filter .= "project LIKE '%" SafeQuote(SearchString) "%' AND"
;~ if (FilterShowDone <> 1)
;~ Filter .= " confidence is not null " ; change this to 0 eventually
;~ else if (FilterShowDone = 1)
;~ Filter .= " confidence = 0 OR confidence is null"
;~ if (ConfidenceSelected && ConfidenceSelected <> "All")
;~ Filter .= " AND confidence = " KeyGet(ConfidenceList, ConfidenceSelected) " "
; Skills:
if (Skill = "All")
{
Filter := "SELECT * FROM Projects "
}
else if (Skill <> "None")
{
Filter := "SELECT p.* FROM projects p, skills s WHERE s.projectID = p.ID AND (s.skill IN ('" . Skill . "')) "
}
; Completion state:
if (Skill <> "None" && Skill <> "All")
Filter .= "AND "
else
Filter .= "WHERE "
if (FilterShowDone = 1)
Filter .= "confidence = 0 or confidence is null "
else
Filter .= "confidence is not null "
; Confidence level
if (ConfidenceSelected <> "All")
Filter .= "AND confidence = " . KeyGet(ConfidenceList, ConfidenceSelected) . " "
; Search string:
if (SearchString <> "")
Filter .= "AND project LIKE '%" . SafeQuote(SearchString) "%'"
;Notification(ConfidenceSelected, Filter)
Projects := db.OpenRecordSet(Filter)
while (!Projects.EOF)
{
ID := Projects["id"]
Confidence := Projects["confidence"]
Project := Projects["project"]
Parent := Projects["parent"]
LV_Add("", ID, Confidence, Parent,"","", Project,"" ) ; This where database info is added to main ListView
Projects.MoveNext()
}
Projects.Close()
GuiControl, -ReDraw, MainList
LV_ModifyCol(IDCol, "Integer sortdesc") ; Enable this to sort by ID, which could show most recent or oldest first, depending.
LV_ModifyCol(ConfIDCol, "sort")
If (NextSelection)
LV_Modify(NextSelection, "Focus Select Vis")
; Display language from database codes and set colors:
Times := LV_GetCount()
Loop % Times
{
ThisLine := A_Index
; Display parent projects names:
LV_GetText(ParentID, ThisLine, ParentCol)
GetParent := db.OpenRecordSet("SELECT project FROM projects WHERE id = " ParentID)
while (!GetParent.EOF)
{
ParentName := GetParent["project"]
GetParent.MoveNext()
}
GetParent.Close()
LV_Modify(ThisLine, "Col" . ParentCol,ParentName)
; Display confidence level names and set color codes:
for k, v in ConfidenceList
{
LV_GetText(ConfidenceCode, ThisLine, ConfIDCol)
if (k = ConfidenceCode)
{
LV_Modify(ThisLine, "Col" . ConfidenceCol, v)
LV_Modify(ThisLine, "Col" . ColorIDCol, Colors[k])
}
else if (ConfidenceCode = "" || ConfidenceCode = 0)
{
LV_Modify(ThisLine, "Col" . ConfidenceCol, "Done")
LV_Modify(ThisLine, "Col" . ColorIDCol, BGR("F5FFFA"))
}
}
; Display parent project names:
LV_GetText(ParentID, ThisLine, ParentIDCol)
GetParent := db.OpenRecordSet("SELECT project FROM projects WHERE id = " ParentID)
while (!GetParent.EOF)
{
ParentName := GetParent["project"]
GetParent.MoveNext()
}
GetParent.Close()
LV_Modify(ThisLine, "Col" . ParentCol, ParentName)
}
; Resize columns here. Hide anything unfriendly/coded:
LV_ModifyCol()
MainColCount := LV_GetCount("Col")
Loop % MainColCount
LV_ModifyCol(A_Index,"AutoHdr")
LV_ModifyCol(IDCol, 0) ; Hide ID column
LV_ModifyCol(ColorIDCol, 0) ; Hide Color column
LV_ModifyCol(ConfIDCol, 0) ; etc.
LV_ModifyCol(ParentIDCol, 0)
; Enable ListView coloring:
OnMessage( WM_NOTIFY := 0x4E, "WM_NOTIFY" )
GuiControl, +ReDraw, MainList
return
}

View File

@ -10,10 +10,10 @@
FilterUpdate: FilterUpdate:
ImportanceUpdate: ImportanceUpdate:
FilterSkillUpdate: FilterSkillUpdate:
GuiControlGet, FilterImportanceSelected, 1:, ImportanceChoose GuiControlGet, FilterConfidenceSelected, 1:, ConfidenceChoose
GuiControlGet, FilterSkillSelected, 1:, FilterSkill GuiControlGet, FilterSkillSelected, 1:, FilterSkill
GuiControlGet, FilterShowDone, 1:, FilterShowDone GuiControlGet, FilterShowDone, 1:, FilterShowDone
UpdateList(Selection,FilterImportanceSelected,FilterSkillSelected) UpdateList(Selection,FilterConfidenceSelected,FilterSkillSelected)
return return
;~ =============================================================================== ;~ ===============================================================================
@ -38,8 +38,8 @@ return
Search: Search:
Critical Critical
GuiControlGet, SearchString, , SearchQuery GuiControlGet, SearchString, , SearchQuery
GuiControlGet, FilterImportanceSelected, , ImportanceChoose GuiControlGet, FilterConfidenceSelected, , ConfidenceChoose
GuiControlGet, FilterSkillSelected, , FilterSkill GuiControlGet, FilterSkillSelected, , FilterSkill
GuiControlGet, FilterShowDone, GuiControlGet, FilterShowDone,
UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected) UpdateList(Selection, FilterConfidenceSelected, FilterSkillSelected)
return return

View File

@ -1,22 +1,22 @@
;~ Autoload and initial settings loading section:============================================ ;~ Autoload and initial settings loading section:============================================
;~ "Character" class, disabled for now b/c have to make HUD progress bar automatically fit:
;CharacterClass := "Artist"
;~ Set icon for window corner: ;~ Set icon for window corner:
IconFile := "res/WP_RPG_VG.ico" IconFile := "res/WP_RPG_VG.ico"
if FileExist(IconFile) if FileExist(IconFile)
Menu, Tray, Icon, %IconFile% Menu, Tray, Icon, %IconFile%
Menu, Tray, NoStandard Menu, Tray, NoStandard
;~ Project difficulties: ;~ Project confidence levels:
Difficulties := ["Really Easy", "Pretty Easy", "Medium", "Hard"] ConfidenceList := ["High", "Medium", "Low"]
; For DB conversion:
Difficulties := ["Really Easy", "Pretty Easy", "Medium", "Hard"]
; Award points for each difficulty: ; Award points for each difficulty:
Awards := [5, 10, 25, 100] Awards := [5, 10, 25, 100]
; Difficulty colors: ; Difficulty colors:
Colors := [BGR("ADFF2F"), BGR("87CEFA"), BGR("FFD700"), BGR("FF6347")] Colors := [BGR("ADFF2F"), BGR("FFD700"), BGR("FF6347")]
;~ Priorities: ;~ Priorities:
Priorities := ["Must", "Should", "Could", "Want"] Priorities := ["Must", "Should", "Could", "Want"]
@ -67,6 +67,8 @@ if (!FileExist(ConnectionString)) ; User must have deleted or moved last used db
else ; we can go ahead and load the last used db: else ; we can go ahead and load the last used db:
db := DBA.DataBaseFactory.OpenDataBase("SQLite", ConnectionString) db := DBA.DataBaseFactory.OpenDataBase("SQLite", ConnectionString)
db.Query("VACUUM")
; Hotkey do not activate list: ; Hotkey do not activate list:
GroupAdd, exclude, New projects database GroupAdd, exclude, New projects database
GroupAdd, exclude, Open a projects database GroupAdd, exclude, Open a projects database

View File

@ -16,15 +16,16 @@ SVy := CenterY(SVh)
; 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 ; 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 projects WHERE skill IS NOT NULL AND skill <> '' 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 difficulty = 'Done'") Table := db.Query("SELECT COUNT(skill) FROM projects WHERE skill = '" . SkillListName . "' AND confidence is null")
columnCount := table.Columns.Count() columnCount := Table.Columns.Count()
for each, row in table.Rows for each, row in Table.Rows
{ {
Loop, % columnCount Loop, % columnCount
;msgbox % row[A_index] ;msgbox % row[A_index]
@ -33,7 +34,6 @@ while (!SkillsList.EOF)
SkillsList.MoveNext() SkillsList.MoveNext()
} }
SkillsList.Close() SkillsList.Close()
;LV_ModifyCol()
LV_ModifyCol(ColSkillLevel, "AutoHDR integer sortdesc") LV_ModifyCol(ColSkillLevel, "AutoHDR integer sortdesc")
Loop % LV_GetCount("Col") Loop % LV_GetCount("Col")
{ {

View File

@ -27,7 +27,7 @@ Gui, AddSubproject:Add, Text, , Subproject Name:
Gui, AddSubproject:Add, Edit, vProjectName W270, Gui, AddSubproject:Add, Edit, vProjectName W270,
Gui, AddSubproject:Add, Text, section, &Difficulty: Gui, AddSubproject:Add, Text, section, &Difficulty:
Gui, AddSubproject:Add, DropDownList, vProjectDifficulty, % ListDifficulties("Really Easy") Gui, AddSubproject:Add, DropDownList, vProjectDifficulty, ;% ListDifficulties("Really Easy")
Gui, AddSubproject:Add, Text, ys, Set S&kill: Gui, AddSubproject:Add, Text, ys, Set S&kill:
SPSkills := ListSkills() SPSkills := ListSkills()