Implementing multiple skills system
This commit is contained in:
parent
3bde7c3d5f
commit
df15f9d1b7
214
Functions.ahk
214
Functions.ahk
|
|
@ -117,220 +117,6 @@ Capitalize(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.
|
||||
{
|
||||
StringReplace, string, string, ','', All
|
||||
|
|
|
|||
19
Hotkeys.ahk
19
Hotkeys.ahk
|
|
@ -46,3 +46,22 @@ return
|
|||
;~ else
|
||||
;~ WinActivate, %WindowFind%
|
||||
;~ 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
|
||||
|
|
@ -28,14 +28,16 @@ return
|
|||
SkillAutoComplete:
|
||||
Critical
|
||||
Gui, ProjectManager:Submit, NoHide
|
||||
If (!GetKeyState("BackSpace","P") && ProjectSkillEdit && Pos := InStr(SkillsDB, "|" . ProjectSkillEdit))
|
||||
{
|
||||
Found := SubStr(SkillsDB, pos+1, InStr(SkillsDB, "|", 1, Pos + 1) - Pos - 1)
|
||||
GuiControl, ProjectManager:Text, ProjectSkillEdit, %Found%
|
||||
SendInput % "{End}" . "+{Left " . StrLen(Found) - StrLen(ProjectSkillEdit) . "}"
|
||||
}
|
||||
;~ If (!GetKeyState("BackSpace","P") && ProjectSkillEdit && Pos := InStr(SkillsDB, "|" . ProjectSkillEdit))
|
||||
;~ {
|
||||
;~ Found := SubStr(SkillsDB, pos+1, InStr(SkillsDB, "|", 1, Pos + 1) - Pos - 1)
|
||||
;~ GuiControl, ProjectManager:Text, ProjectSkillEdit, %Found%
|
||||
;~ SendInput % "{End}" . "+{Left " . StrLen(Found) - StrLen(ProjectSkillEdit) . "}"
|
||||
;~ }
|
||||
ToolTip, X%A_CaretX% Y%A_CaretY%, A_CaretX, A_CaretY - 20
|
||||
return
|
||||
|
||||
|
||||
ProjectManagerSubmit:
|
||||
Gui, ProjectManager:Submit, NoHide
|
||||
if (ProjectNameEdit = "")
|
||||
|
|
@ -43,7 +45,8 @@ if (ProjectNameEdit = "")
|
|||
MsgBox, 8192, Error, Can't make a project with no name!
|
||||
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!
|
||||
return
|
||||
|
|
@ -52,40 +55,40 @@ if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd")
|
|||
{
|
||||
Record := {}
|
||||
Record.Project := ProjectNameEdit
|
||||
Record.Difficulty := ProjectDifficultyEdit
|
||||
Record.Importance := ProjectImportanceEdit
|
||||
Record.Skill := Capitalize(ProjectSkillEdit)
|
||||
Record.Confidence := KeyGet(ConfidenceList, ProjectConfidenceEdit)
|
||||
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")
|
||||
{
|
||||
Gui, ProjectManager:Cancel
|
||||
Gui, 1:Default
|
||||
if (Action = "QuickDone")
|
||||
{
|
||||
table := db.Query("SELECT MAX(id) FROM projects")
|
||||
columnCount := table.Columns.Count()
|
||||
for each, row in table.Rows
|
||||
{
|
||||
Loop, % columnCount
|
||||
QuickID := row[A_index]
|
||||
}
|
||||
CompleteProject(QuickID)
|
||||
CompleteProject(LastProjectID())
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Action = "Edit")
|
||||
{
|
||||
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 importance = '" SafeQuote(ProjectImportanceEdit) "' WHERE ID = " SelectedProjectID )
|
||||
db.Query("UPDATE projects SET confidence = '" KeyGet(ConfidenceList, ProjectConfidenceEdit) "' WHERE ID = " SelectedProjectID )
|
||||
; Make sure skill is title cased, just to look good:
|
||||
StringUpper, ProjectSkillEdit, ProjectSkillEdit, T
|
||||
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")
|
||||
{
|
||||
GuiChildClose("ProjectManager")
|
||||
|
|
@ -113,14 +116,37 @@ else if (Action = "QuickAdd" || Action = "QuickDone")
|
|||
}
|
||||
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)
|
||||
{
|
||||
;global db, ProjectNameEdit, ProjectDifficultyEdit, ProjectImportanceEdit, ProjectSkillEdit
|
||||
global
|
||||
ProjectNameEdit =
|
||||
ProjectDifficultyEdit =
|
||||
ProjectImportanceEdit =
|
||||
ProjectConfidenceEdit =
|
||||
ProjectSkillEdit =
|
||||
; Get the row number of the selected project from the main project ListView:
|
||||
Selection := LV_GetNext("","F")
|
||||
|
|
@ -139,8 +165,7 @@ ProjectManage(Action)
|
|||
while(!ProjectInfo.EOF)
|
||||
{
|
||||
ProjectName := ProjectInfo["project"]
|
||||
ProjectDifficulty := ProjectInfo["difficulty"]
|
||||
ProjectImportance := ProjectInfo["importance"]
|
||||
ProjectConfidence := ProjectInfo["confidence"]
|
||||
ProjectSkill := ProjectInfo["skill"]
|
||||
ProjectInfo.MoveNext()
|
||||
}
|
||||
|
|
@ -150,8 +175,7 @@ ProjectManage(Action)
|
|||
else if (Action = "Add" || Action = "QuickDone" || Action = "QuickAdd")
|
||||
{
|
||||
ProjectName =
|
||||
ProjectDifficulty =
|
||||
ProjectImportance =
|
||||
ProjectConfidence =
|
||||
ProjectSkill =
|
||||
}
|
||||
; 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, Edit, vProjectNameEdit W270 r1, %ProjectName%
|
||||
|
||||
; Difficulty:
|
||||
Gui, ProjectManager:Add, Text, , &Difficulty:
|
||||
DifficultyList := ListDifficulties(ProjectDifficulty)
|
||||
Gui, ProjectManager:Add, DropDownList, vProjectDifficultyEdit, %DifficultyList%
|
||||
|
||||
; Importance:
|
||||
if (Action <> "QuickDone")
|
||||
{
|
||||
Gui, ProjectManager:Add, Text, , &Importance:
|
||||
PriorityList := ListPriorities(ProjectImportance)
|
||||
Gui, ProjectManager:Add, DropDownList, vProjectImportanceEdit, %PriorityList%
|
||||
}
|
||||
; Confidence:
|
||||
Gui, ProjectManager:Add, Text, , &Confidence:
|
||||
Gui, ProjectManager:Add, DropDownList, vProjectConfidenceEdit, % ListConfidence(ProjectConfidence)
|
||||
|
||||
; 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:
|
||||
SkillsDB := ListSkills(ProjectSkill)
|
||||
Gui, ProjectManager:Add, ComboBox, vProjectSkillEdit gSkillAutoComplete w130 r7, % SkillsDB ;% ListSkills(ProjectSkill) ;Diplomacy|Art|Piracy|Cleaning|Hunting
|
||||
;SkillsDB := ListSkills(ProjectSkill)
|
||||
;Gui, ProjectManager:Add, ComboBox, vProjectSkillEdit gSkillAutoComplete w130 r7, % SkillsDB ;% ListSkills(ProjectSkill)
|
||||
|
||||
Gui, ProjectManager:Add, Edit, vProjectSkillsEdit w130,
|
||||
|
||||
; Submit button:
|
||||
Gui, ProjectManager:Add, Button, Default gProjectManagerSubmit w80 x15 y+70, &Submit
|
||||
|
|
@ -211,5 +228,3 @@ ProjectManage(Action)
|
|||
Gui, ProjectManager:Show, w%Width% h%Height% x%xc% y%yc%, %PMTitle% Project
|
||||
return
|
||||
}
|
||||
|
||||
; Kind of duplicate with other skills get function I just made
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
RemoveProject:
|
||||
Selection := LV_GetNext("","F")
|
||||
LV_GetText(SelectedProjectID, Selection, 1)
|
||||
LV_GetText(SelectedProjectID, Selection, IDCol)
|
||||
If (SelectedProjectID == "ID")
|
||||
{
|
||||
return
|
||||
|
|
@ -18,10 +18,8 @@ else
|
|||
db.Query("DELETE FROM projects WHERE id = " SelectedProjectID )
|
||||
GuiChildClose("RemoveProject")
|
||||
RefreshSkillsList(FilterSkillSelected)
|
||||
;Notification("RefreshSkillList(",FilterSkillSelected)
|
||||
gosub FilterUpdate
|
||||
;Notification(Selection . ", " . FilterImportanceSelected . ", " . FilterSkillSelected,"")
|
||||
UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected)
|
||||
;UpdateList(Selection, FilterConfidenceSelected, FilterSkillSelected)
|
||||
return
|
||||
|
||||
RemoveProjectNo:
|
||||
|
|
|
|||
266
ProjectsView.ahk
266
ProjectsView.ahk
|
|
@ -23,9 +23,9 @@ Gui, Add, Button, gClearSearch vClearSearchButton x+1, &Clear ; Pressing Alt+C a
|
|||
|
||||
|
||||
;~ Filter view by importance:
|
||||
Gui, Add, Text, x+10 vImpChooseText, &Importance:
|
||||
Gui, Add, DropDownList, vImportanceChoose gImportanceUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk
|
||||
GuiControl, , ImportanceChoose, % ListPriorities("All")
|
||||
Gui, Add, Text, x+10 vConfidenceChooseText, &Confidence:
|
||||
Gui, Add, DropDownList, vConfidenceChoose gFilterUpdate x+5 w60, All|| ; Filtering subroutines are located in Search.ahk
|
||||
GuiControl, , ConfidenceChoose, % ListConfidence("All")
|
||||
|
||||
; Filter view by skill:
|
||||
Gui, Add, Text, x+10 vSkillChooseText, S&kill:
|
||||
|
|
@ -37,9 +37,9 @@ Gui, Add, Checkbox, vFilterShowDone gFilterUpdate x+10, Show do&ne
|
|||
|
||||
|
||||
;~ 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
|
||||
Gui, Show, w827 h600, %AppTitle% ; Show the GUI we've created
|
||||
UpdateList() ; Show all projects
|
||||
|
|
@ -65,8 +65,8 @@ else if (A_GuiWidth <= 811)
|
|||
}
|
||||
GuiControl, MoveDraw, SearchQuery, % "w" SearchBarWidth
|
||||
GuiControl, MoveDraw, ClearSearchButton, % "x" 50 + SearchBarWidth + 10
|
||||
GuiControl, MoveDraw, ImpChooseText, % "x" 50 + SearchBarWidth + 55
|
||||
GuiControl, MoveDraw, ImportanceChoose, % "x" 50 + SearchBarWidth + 120
|
||||
GuiControl, MoveDraw, ConfidenceChooseText, % "x" 50 + SearchBarWidth + 55
|
||||
GuiControl, MoveDraw, ConfidenceChoose, % "x" 50 + SearchBarWidth + 120
|
||||
GuiControl, MoveDraw, SkillChooseText, % "x" 50 + SearchBarWidth + 190
|
||||
GuiControl, MoveDraw, FilterSkill, % "x" 50 + SearchBarWidth + 220
|
||||
GuiControl, MoveDraw, FilterShowDone, % "x" 50 + SearchBarWidth + 350
|
||||
|
|
@ -76,3 +76,255 @@ return
|
|||
;~ What to do when main window is closed:
|
||||
GuiClose:
|
||||
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
|
||||
}
|
||||
|
|
@ -10,10 +10,10 @@
|
|||
FilterUpdate:
|
||||
ImportanceUpdate:
|
||||
FilterSkillUpdate:
|
||||
GuiControlGet, FilterImportanceSelected, 1:, ImportanceChoose
|
||||
GuiControlGet, FilterConfidenceSelected, 1:, ConfidenceChoose
|
||||
GuiControlGet, FilterSkillSelected, 1:, FilterSkill
|
||||
GuiControlGet, FilterShowDone, 1:, FilterShowDone
|
||||
UpdateList(Selection,FilterImportanceSelected,FilterSkillSelected)
|
||||
UpdateList(Selection,FilterConfidenceSelected,FilterSkillSelected)
|
||||
return
|
||||
|
||||
;~ ===============================================================================
|
||||
|
|
@ -38,8 +38,8 @@ return
|
|||
Search:
|
||||
Critical
|
||||
GuiControlGet, SearchString, , SearchQuery
|
||||
GuiControlGet, FilterImportanceSelected, , ImportanceChoose
|
||||
GuiControlGet, FilterConfidenceSelected, , ConfidenceChoose
|
||||
GuiControlGet, FilterSkillSelected, , FilterSkill
|
||||
GuiControlGet, FilterShowDone,
|
||||
UpdateList(Selection, FilterImportanceSelected, FilterSkillSelected)
|
||||
UpdateList(Selection, FilterConfidenceSelected, FilterSkillSelected)
|
||||
return
|
||||
12
Settings.ahk
12
Settings.ahk
|
|
@ -1,22 +1,22 @@
|
|||
;~ 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:
|
||||
IconFile := "res/WP_RPG_VG.ico"
|
||||
if FileExist(IconFile)
|
||||
Menu, Tray, Icon, %IconFile%
|
||||
Menu, Tray, NoStandard
|
||||
|
||||
;~ Project difficulties:
|
||||
;~ Project confidence levels:
|
||||
ConfidenceList := ["High", "Medium", "Low"]
|
||||
|
||||
; For DB conversion:
|
||||
Difficulties := ["Really Easy", "Pretty Easy", "Medium", "Hard"]
|
||||
|
||||
; Award points for each difficulty:
|
||||
Awards := [5, 10, 25, 100]
|
||||
|
||||
; Difficulty colors:
|
||||
Colors := [BGR("ADFF2F"), BGR("87CEFA"), BGR("FFD700"), BGR("FF6347")]
|
||||
Colors := [BGR("ADFF2F"), BGR("FFD700"), BGR("FF6347")]
|
||||
|
||||
;~ Priorities:
|
||||
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:
|
||||
db := DBA.DataBaseFactory.OpenDataBase("SQLite", ConnectionString)
|
||||
|
||||
db.Query("VACUUM")
|
||||
|
||||
; Hotkey do not activate list:
|
||||
GroupAdd, exclude, New projects database
|
||||
GroupAdd, exclude, Open a projects database
|
||||
|
|
|
|||
|
|
@ -16,15 +16,16 @@ SVy := CenterY(SVh)
|
|||
; 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")
|
||||
while (!SkillsList.EOF)
|
||||
{
|
||||
SkillListName := SkillsList["skill"]
|
||||
LV_Add("", SkillListName)
|
||||
RowNum := A_Index
|
||||
Table := db.Query("SELECT COUNT(skill) FROM projects WHERE skill = '" . SkillListName . "' AND difficulty = 'Done'")
|
||||
columnCount := table.Columns.Count()
|
||||
for each, row in table.Rows
|
||||
Table := db.Query("SELECT COUNT(skill) FROM projects WHERE skill = '" . SkillListName . "' AND confidence is null")
|
||||
columnCount := Table.Columns.Count()
|
||||
for each, row in Table.Rows
|
||||
{
|
||||
Loop, % columnCount
|
||||
;msgbox % row[A_index]
|
||||
|
|
@ -33,7 +34,6 @@ while (!SkillsList.EOF)
|
|||
SkillsList.MoveNext()
|
||||
}
|
||||
SkillsList.Close()
|
||||
;LV_ModifyCol()
|
||||
LV_ModifyCol(ColSkillLevel, "AutoHDR integer sortdesc")
|
||||
Loop % LV_GetCount("Col")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Gui, AddSubproject:Add, Text, , Subproject Name:
|
|||
Gui, AddSubproject:Add, Edit, vProjectName W270,
|
||||
|
||||
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:
|
||||
SPSkills := ListSkills()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user