def _generate_hovers(): """Generate list of hoverable buttons.""" TOP_ROW_Y = 21 POWER_ROW_Y = 62 return apply_function( Corner, prepend_to_map( Corner.TOP_LEFT, multi_map({ # Basic Stats "treasury": (160, TOP_ROW_Y), "manpower": (255, TOP_ROW_Y), "sailors": (350, TOP_ROW_Y), "stability": (450, TOP_ROW_Y), "corruption": (510, TOP_ROW_Y), "prestige": (575, TOP_ROW_Y), "legitimacy": (642, TOP_ROW_Y), "power projection": (711, TOP_ROW_Y), # Envoys "merchants": (796, TOP_ROW_Y), "colonists": (836, TOP_ROW_Y), "diplomats": (875, TOP_ROW_Y), "missionaries": (919, TOP_ROW_Y), # Power Points ("administrative power", "admin power"): (508, POWER_ROW_Y), ("diplomatic power", "diplo power"): (567, POWER_ROW_Y), ("military power", "mill power"): (627, POWER_ROW_Y), "age info": (832, 63), }), ), )
chainable_formatters = multi_map({ "camel": "camel", # "studley": "studley", "stud": "studley", # ("snake", "snik", "nick"): "snake", "nick": "snake", ("spine", "spin"): "spine", # TODO: Settle on one/two of these ("dotword", "knob", "pebble"): "dotword", # ("squash", "smash", "mash"): "squash", "mash": "squash", "dunder": "dunder", "upper": "uppercase", # TODO: padded formatting # "pad": "padded", # Common combination, so contract it. ("upsnake", "upsnik", "up nick"): "uppercase_snake", # TODO: Maybe don't allow this to be chained? ( "lower", # "bot", # "low", # "small", # "case", "word", ): "lowercase", # Function calls are euler-style by default. Lisps can override this. "funk": "euler_function_call", # FIXME: This adds https:// in front of every dictation chunk, not just the first one. ("H T T P S", "H T T P S /", "url"): "https_url", "see path": "c_path", # c path # FIXME: Clashes with C path? "path": "forward_slash_path", })
"age info": (832, 63), }), ), ) hoverable_buttons = _generate_hovers() clickable_buttons = multi_map({ "outline": Corner(Corner.TOP_RIGHT, -16, 80), "messages": Corner(Corner.BOTTOM_RIGHT, -14, -237), "history": Corner(Corner.BOTTOM_RIGHT, -167, -24), ("modifiers", "triggered modifiers"): Corner(Corner.BOTTOM_RIGHT, -125, -22), # Log does have a shortcut, "<", but EU4 doesn't always recognize it # (even from an actual keyboard). "show log": Corner(Corner.BOTTOM_RIGHT, -289, -23), "great powers": Corner(Corner.TOP_LEFT, 122, 92), }) ############################################################################# module = Module() module.list("eu4_hoverables", desc="named buttons that may be hovered over") module.list("eu4_clickables", desc="named buttons that may be clicked")
# Many of these formatters may be chained and applied to a single chunk. _chainable_formatters = multi_map({ "camel": "camel", "studley": "studley", ("snake", "snik"): "snake", "spine": "spine", # TODO: Maybe change this command. Dotty? "dotword": "dotword", "squash": "squash", "dunder": "dunder", "upper": "uppercase", # TODO: Maybe don't allow this to be chained? ("lower", "bot"): "lowercase", # Language-specific # TODO: Where is this delimiter used again? "see path": "c_path", # c path # TODO: Maybe move this into a context-specific list "private": "python_private", }) # Only one of these formatters can be applied to each chunk.
symbols = multi_map({ ("back tick", "grave"): "`", ("comma", "camma"): ",", ("dot", "period", "full stop", "stop"): ".", ("semicolon", "semi"): ";", ("apostrophe", "post", "poess"): "'", ( "speech mark", "speech", # Quote now starts a dictated quote # "quote", ): '"', # FIXME: slash and blash recognition conflicts ("forward slash", "slash"): "/", ("backslash", "blash"): "\\", ("minus", "dash"): "-", ( "equals", # "eek", "quals", "quills", # w2l "qual", ): "=", "plus": "+", ("question mark", "question", "quest"): "?", "tilde": "~", ("exclamation", "bang"): "!", ("dollar sign", "dollar"): "$", ("underscore", "score"): "_", ("colon", "coal"): ":", ("asterisk", "star"): "*", # "pound": "#", "hash": "#", "percent": "%", "caret": "^", "at sign": "@", ("ampersand", "amper"): "&", "pipe": "|", # Currency "dollar": "$", "pound": "£", "euro": "€", # FIXME: comes out as "4" # Brackets ("left square", "lack"): "[", ("right square", "rack"): "]", ("left paren", "lub"): "(", ("right paren", "rub"): ")", ("left brace", "lace"): "{", ("right brace", "race"): "}", ("left angle", "langle"): "<", ("right angle", "rangle"): ">", ("space", "gap", "pat"): " ", # Special "new line": "\n", # Multi-char Symbols # TODO: Extract these into a separate list "quiver": "= =", # E[quiva]lent ("walrus", "wally"): ": =", "rittoe": "- >", "leffoe": "< -", "riteek": "= >", "leffeek": "< =", # TODO: Probably a better name for this "box": ": :", })
ctx.lists["self.symbol"] = multi_map({ ("back tick", "grave"): "`", ("comma", "cam"): ",", ("dot", "period", "full stop", "point"): ".", ("semicolon", "semi"): ";", ("apostrophe", "quote"): "'", ("double quote", "dub quote", "speech mark", "speech"): '"', # FIXME: slash and blash recognition conflicts ("forward slash", "slash"): "/", ("backslash", "blash"): "\\", ("minus", "dash"): "-", ("equals", "eek"): "=", "plus": "+", ("question mark", "question", "quest"): "?", "tilde": "~", ("exclamation", "bang"): "!", ("dollar sign", "dollar"): "$", ("underscore", "score"): "_", ("colon", "coal"): ":", ("asterisk", "star"): "*", # "pound": "#", "hash": "#", "percent": "%", "caret": "^", "at sign": "@", ("ampersand", "amper"): "&", "pipe": "|", # Currency "dollar": "$", "pound": "£", "euro": "€", # FIXME: comes out as "4" # Brackets ("left square", "lack"): "[", ("right square", "rack"): "]", ("left paren", "lub"): "(", ("right paren", "rub"): ")", ("left brace", "lace"): "{", ("right brace", "race"): "}", ("left angle", "langle"): "<", ("right angle", "rangle"): ">", })