# -*- coding: utf-8 -*- """novelWriter Constants novelWriter – Constants ========================= Constants for translating flags and enums to text File History: Created: 2019-04-28 [0.0.1] This file is a part of novelWriter Copyright 2020, Veronica Berglyd Olsen This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . """ from nw.constants.enum import nwItemClass, nwItemLayout, nwOutline class nwConst(): tStampFmt = "%Y-%m-%d %H:%M:%S" # Default format fStampFmt = "%Y-%m-%d %H.%M.%S" # FileName safe format # END Class nwConst class nwFiles(): PROJ_FILE = "nwProject.nwx" PROJ_DICT = "wordlist.txt" PROJ_LOCK = "nwProject.lock" SESS_INFO = "sessionInfo.log" INDEX_FILE = "tagsIndex.json" OPTS_FILE = "guiOptions.json" RECENT_FILE = "recentProjects.json" # END Class nwFiles class nwKeyWords: TAG_KEY = "@tag" POV_KEY = "@pov" CHAR_KEY = "@char" PLOT_KEY = "@plot" TIME_KEY = "@time" WORLD_KEY = "@location" OBJECT_KEY = "@object" ENTITY_KEY = "@entity" CUSTOM_KEY = "@custom" # END Class nwKeyWords class nwLabels(): CLASS_NAME = { nwItemClass.NO_CLASS : "None", nwItemClass.NOVEL : "Novel", nwItemClass.PLOT : "Plot", nwItemClass.CHARACTER : "Characters", nwItemClass.WORLD : "Locations", nwItemClass.TIMELINE : "Timeline", nwItemClass.OBJECT : "Objects", nwItemClass.ENTITY : "Entity", nwItemClass.CUSTOM : "Custom", nwItemClass.TRASH : "Trash", } CLASS_FLAG = { nwItemClass.NO_CLASS : "0", nwItemClass.NOVEL : "N", nwItemClass.PLOT : "P", nwItemClass.CHARACTER : "C", nwItemClass.WORLD : "L", nwItemClass.TIMELINE : "T", nwItemClass.OBJECT : "O", nwItemClass.ENTITY : "E", nwItemClass.CUSTOM : "X", nwItemClass.TRASH : "R", } CLASS_ICON = { nwItemClass.NO_CLASS : "cls_none", nwItemClass.NOVEL : "cls_novel", nwItemClass.PLOT : "cls_plot", nwItemClass.CHARACTER : "cls_character", nwItemClass.WORLD : "cls_world", nwItemClass.TIMELINE : "cls_timeline", nwItemClass.OBJECT : "cls_object", nwItemClass.ENTITY : "cls_entity", nwItemClass.CUSTOM : "cls_custom", nwItemClass.TRASH : "cls_trash", } LAYOUT_NAME = { nwItemLayout.NO_LAYOUT : "None", nwItemLayout.TITLE : "Title Page", nwItemLayout.BOOK : "Book", nwItemLayout.PAGE : "Plain Page", nwItemLayout.PARTITION : "Partition", nwItemLayout.UNNUMBERED : "Unnumbered", nwItemLayout.CHAPTER : "Chapter", nwItemLayout.SCENE : "Scene", nwItemLayout.NOTE : "Note", } LAYOUT_FLAG = { nwItemLayout.NO_LAYOUT : "Xo", nwItemLayout.TITLE : "Tt", nwItemLayout.BOOK : "Bk", nwItemLayout.PAGE : "Pg", nwItemLayout.PARTITION : "Pt", nwItemLayout.UNNUMBERED : "Un", nwItemLayout.CHAPTER : "Ch", nwItemLayout.SCENE : "Sc", nwItemLayout.NOTE : "Nt", } KEY_NAME = { nwKeyWords.TAG_KEY : "Tag", nwKeyWords.POV_KEY : "Point of View", nwKeyWords.CHAR_KEY : "Characters", nwKeyWords.PLOT_KEY : "Plot", nwKeyWords.TIME_KEY : "Time", nwKeyWords.WORLD_KEY : "Locations", nwKeyWords.OBJECT_KEY : "Objects", nwKeyWords.ENTITY_KEY : "Entities", nwKeyWords.CUSTOM_KEY : "Custom", } OUTLINE_COLS = { nwOutline.TITLE : "Title", nwOutline.HANDLE : "Handle", nwOutline.LEVEL : "Level", nwOutline.LABEL : "Document", nwOutline.LINE : "Line", nwOutline.CCOUNT : "Chars", nwOutline.WCOUNT : "Words", nwOutline.PCOUNT : "Pars", nwOutline.POV : "POV", nwOutline.CHAR : KEY_NAME[nwKeyWords.CHAR_KEY], nwOutline.PLOT : KEY_NAME[nwKeyWords.PLOT_KEY], nwOutline.TIME : KEY_NAME[nwKeyWords.TIME_KEY], nwOutline.WORLD : KEY_NAME[nwKeyWords.WORLD_KEY], nwOutline.OBJECT : KEY_NAME[nwKeyWords.OBJECT_KEY], nwOutline.ENTITY : KEY_NAME[nwKeyWords.ENTITY_KEY], nwOutline.CUSTOM : KEY_NAME[nwKeyWords.CUSTOM_KEY], nwOutline.SYNOP : "Synopsis", } # END Class nwLabels class nwQuotes(): """Allowed quotation marks. Source: https://en.wikipedia.org/wiki/Quotation_mark """ SYMBOLS = [ "\u0022", # Quotation mark "\u0027", # Apostrophe "\u00ab", # Left-pointing double angle quotation mark "\u00bb", # Right-pointing double angle quotation mark "\u2018", # Left single quotation mark "\u2019", # Right single quotation mark "\u201a", # Single low-9 quotation mark "\u201b", # Single high-reversed-9 quotation mark "\u201c", # Left double quotation mark "\u201d", # Right double quotation mark "\u201e", # Double low-9 quotation mark "\u201f", # Double high-reversed-9 quotation mark "\u2039", # Single left-pointing angle quotation mark "\u203a", # Single right-pointing angle quotation mark "\u2e42", # Double low-reversed-9 quotation mark "\u300c", # Left corner bracket "\u300d", # Right corner bracket "\u300e", # Left white corner bracket "\u300f", # Right white corner bracket ] # END Class nwQuotes class nwUnicode: """Suppoted unicode character constants and translation maps. """ # Unicode Constants ## Quotation Marks U_QUOT = "\u0022" # Quotation mark U_APOS = "\u0027" # Apostrophe U_LAQUO = "\u00ab" # Left-pointing double angle quotation mark U_RAQUO = "\u00bb" # Right-pointing double angle quotation mark U_LSQUO = "\u2018" # Left single quotation mark U_RSQUO = "\u2019" # Right single quotation mark U_SBQUO = "\u201a" # Single low-9 quotation mark U_SUQUO = "\u201b" # Single high-reversed-9 quotation mark U_LDQUO = "\u201c" # Left double quotation mark U_RDQUO = "\u201d" # Right double quotation mark U_BDQUO = "\u201e" # Double low-9 quotation mark U_UDQUO = "\u201f" # Double high-reversed-9 quotation mark U_LSAQUO = "\u2039" # Single left-pointing angle quotation mark U_RSAQUO = "\u203a" # Single right-pointing angle quotation mark U_BDRQUO = "\u2e42" # Double low-reversed-9 quotation mark U_LCQUO = "\u300c" # Left corner bracket U_RCQUO = "\u300d" # Right corner bracket U_LWCQUO = "\u300e" # Left white corner bracket U_RECQUO = "\u300f" # Right white corner bracket ## Punctuation U_ENDASH = "\u2013" # Short dash U_EMDASH = "\u2014" # Long dash U_HELLIP = "\u2026" # Ellipsis ## Other U_NBSP = "\u00a0" # Non-breaking space U_PARA = "\u2029" # Paragraph separator U_CHECK = "\u2714" # Heavy check mark U_MULT = "\u2715" # Multiplication x ## Arrows U_UTRI = "\u25b2" # Up-pointing triangle U_UTRIS = "\u25b4" # Up-pointing triangle, small U_RTRI = "\u25b6" # Right-pointing triangle U_RTRIS = "\u25b8" # Right-pointing triangle, small U_DTRI = "\u25bc" # Down-pointing triangle U_DTRIS = "\u25be" # Down-pointing triangle, small U_LTRI = "\u25c0" # Left-pointing triangle U_LTRIS = "\u25c2" # Left-pointing triangle, small # HTML Equivalents ## Quotes H_QUOT = """ H_APOS = "'" H_LAQUO = "«" H_RAQUO = "»" H_LSQUO = "‘" H_RSQUO = "’" H_SBQUO = "‚" H_SUQUO = "‛" H_LDQUO = "“" H_RDQUO = "”" H_BDQUO = "„" H_UDQUO = "‟" H_LSAQUO = "‹" H_RSAQUO = "›" H_BDRQUO = "⹂" H_LCQUO = "「" H_RCQUO = "」" H_LWCQUO = "『" H_LWCQUO = "『" ## Punctuation H_ENDASH = "–" H_EMDASH = "—" H_HELLIP = "…" ## Other H_NBSP = " " H_CHECK = "✔" H_MULT = "✕" ## Arrows H_UTRI = "▲" H_UTRIS = "▴" H_RTRI = "▶" H_RTRIS = "▸" H_DTRI = "▼" H_DTRIS = "▾" H_LTRI = "◀" H_LTRIS = "◂" # END Class nwUnicode