Skip to content

Commit

Permalink
Add parsing of the 'Locations' window proposed by Paul today
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Sep 2, 2024
1 parent dda3332 commit 591898c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 1 deletion.
2 changes: 1 addition & 1 deletion implement/alternate-ui/source/src/Common/App.elm
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module Common.App exposing (versionId)

versionId : String
versionId =
"2024-05-28"
"2024-09-02"
65 changes: 65 additions & 0 deletions implement/alternate-ui/source/src/EveOnline/ParseUserInterface.elm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type alias ParsedUserInterface =
, repairShopWindow : Maybe RepairShopWindow
, characterSheetWindow : Maybe CharacterSheetWindow
, fleetWindow : Maybe FleetWindow
, locationsWindow : Maybe LocationsWindow
, watchListPanel : Maybe WatchListPanel
, standaloneBookmarkWindow : Maybe StandaloneBookmarkWindow
, moduleButtonTooltip : Maybe ModuleButtonTooltip
Expand Down Expand Up @@ -572,6 +573,18 @@ type alias CompressionWindow =
}


type alias LocationsWindow =
{ uiNode : UITreeNodeWithDisplayRegion
, placeEntries : List LocationsWindowPlaceEntry
}


type alias LocationsWindowPlaceEntry =
{ uiNode : UITreeNodeWithDisplayRegion
, mainText : String
}


type alias WindowControls =
{ uiNode : UITreeNodeWithDisplayRegion
, minimizeButton : Maybe UITreeNodeWithDisplayRegion
Expand Down Expand Up @@ -618,6 +631,7 @@ parseUserInterfaceFromUITree uiTree =
, repairShopWindow = parseRepairShopWindowFromUITreeRoot uiTree
, characterSheetWindow = parseCharacterSheetWindowFromUITreeRoot uiTree
, fleetWindow = parseFleetWindowFromUITreeRoot uiTree
, locationsWindow = parseLocationsWindowFromUITreeRoot uiTree
, watchListPanel = parseWatchListPanelFromUITreeRoot uiTree
, standaloneBookmarkWindow = parseStandaloneBookmarkWindowFromUITreeRoot uiTree
, neocom = parseNeocomFromUITreeRoot uiTree
Expand Down Expand Up @@ -2991,6 +3005,57 @@ parseCompressionWindow windowUiNode =
}


parseLocationsWindowFromUITreeRoot : UITreeNodeWithDisplayRegion -> Maybe LocationsWindow
parseLocationsWindowFromUITreeRoot uiTreeRoot =
{-
2024-09-02 'Locations' window as shared by Paul with 'session-recording-2024-08-26T22-54-47.zip'
For discussion of the 'Locations' window, see <https://forum.botlab.org/t/the-mining-robot-cant-find-its-way-home/4922/5>
-}
uiTreeRoot
|> listDescendantsWithDisplayRegion
|> List.filter (.uiNode >> .pythonObjectTypeName >> (==) "LocationsWindow")
|> List.head
|> Maybe.map parseLocationsWindow


parseLocationsWindow : UITreeNodeWithDisplayRegion -> LocationsWindow
parseLocationsWindow windowNode =
let
placeEntries : List LocationsWindowPlaceEntry
placeEntries =
windowNode
|> listDescendantsWithDisplayRegion
|> List.filter (.uiNode >> .pythonObjectTypeName >> String.contains "PlaceEntry")
|> List.filterMap parseLocationsWindowPlaceEntry
in
{ uiNode = windowNode
, placeEntries = placeEntries
}


parseLocationsWindowPlaceEntry : UITreeNodeWithDisplayRegion -> Maybe LocationsWindowPlaceEntry
parseLocationsWindowPlaceEntry entryNode =
{-
Screenshots show a grid layout of cells with text in each cell aligned in columns.
But at least in 'session-recording-2024-08-26T22-54-47.zip', the text appeared in a single node of type "EveLabelMedium"
As already seen in other windows, that text appears split into the cells texts by '<t>' tags.
Following is a middle part of an observed text in a 'EveLabelMedium' node in a 'PlaceEntry' node:
...<t>Refinery<t>0<t>Y5C-YD<t>...
-}
case
entryNode
|> getAllContainedDisplayTextsWithRegion
|> List.sortBy (Tuple.second >> .totalDisplayRegion >> areaFromDisplayRegion >> Maybe.withDefault 0)
|> List.map Tuple.first
|> List.head
of
Nothing ->
Nothing

Just mainText ->
Just { uiNode = entryNode, mainText = mainText }


parseWindowControlsFromWindow : UITreeNodeWithDisplayRegion -> Maybe WindowControls
parseWindowControlsFromWindow =
listDescendantsWithDisplayRegion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ renderTreeNodeFromParsedUserInterface maybeInputRoute uiNodesWithDisplayRegion p
, fieldValueSummary = always "..."
, fieldValueChildren = treeNodeChildrenFromFleetWindow viewConfig
}
, parsedUserInterface.locationsWindow
|> fieldFromMaybeInstance
{ fieldName = "locationsWindow"
, fieldValueSummary = always "..."
, fieldValueChildren = treeNodeChildrenFromLocationsWindow viewConfig
}
, parsedUserInterface.watchListPanel
|> fieldFromMaybeInstance
{ fieldName = "watchListPanel"
Expand Down Expand Up @@ -1448,6 +1454,34 @@ treeNodeChildrenFromFleetWindow viewConfig fleetWindow =
]


treeNodeChildrenFromLocationsWindow :
ViewConfig event
-> EveOnline.ParseUserInterface.LocationsWindow
-> List (TreeViewNode event ParsedUITreeViewPathNode)
treeNodeChildrenFromLocationsWindow viewConfig locationsWindow =
treeNodeChildrenFromRecordWithUINode
viewConfig
locationsWindow.uiNode
[ locationsWindow.placeEntries
|> fieldFromListInstance
{ fieldName = "placeEntries"
, fieldValueChildren = treeNodeChildrenFromLocationsWindowPlaceEntry viewConfig
}
]


treeNodeChildrenFromLocationsWindowPlaceEntry :
ViewConfig event
-> EveOnline.ParseUserInterface.LocationsWindowPlaceEntry
-> List (TreeViewNode event ParsedUITreeViewPathNode)
treeNodeChildrenFromLocationsWindowPlaceEntry viewConfig node =
treeNodeChildrenFromRecordWithUINode
viewConfig
node.uiNode
[ node.mainText |> fieldFromString "mainText"
]


treeNodeChildrenFromWatchListPanel :
ViewConfig event
-> EveOnline.ParseUserInterface.WatchListPanel
Expand Down

0 comments on commit 591898c

Please sign in to comment.