Beispiel #1
0
    def __init__(self):

        # Set Application Variables
        self.appName = nw.__package__
        self.appHandle = nw.__package__.lower()
        self.showGUI = True
        self.debugInfo = False
        self.cmdOpen = None

        # Set Paths
        self.confPath = None
        self.confFile = None
        self.homePath = None
        self.lastPath = None
        self.appPath = None
        self.appRoot = None
        self.appIcon = None
        self.assetPath = None
        self.themeRoot = None
        self.graphPath = None
        self.dictPath = None
        self.iconPath = None

        # Set default values
        self.confChanged = False

        ## General
        self.guiTheme = "default"
        self.guiSyntax = "default_light"
        self.guiDark = False

        ## Sizes
        self.winGeometry = [1100, 650]
        self.treeColWidth = [120, 30, 50]
        self.mainPanePos = [300, 800]
        self.docPanePos = [400, 400]
        self.isFullScreen = False

        ## Project
        self.autoSaveProj = 60
        self.autoSaveDoc = 30

        ## Text Editor
        self.textFont = None
        self.textSize = 12
        self.textFixedW = True
        self.textWidth = 600
        self.textMargin = 40
        self.tabWidth = 40
        self.zenWidth = 800
        self.doJustify = False
        self.autoSelect = True
        self.doReplace = True
        self.doReplaceSQuote = True
        self.doReplaceDQuote = True
        self.doReplaceDash = True
        self.doReplaceDots = True
        self.wordCountTimer = 5.0
        self.showTabsNSpaces = False
        self.showLineEndings = False
        self.bigDocLimit = 800

        self.fmtApostrophe = nwUnicode.U_RSQUO
        self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO]
        self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO]

        self.spellTool = None
        self.spellLanguage = None

        ## Backup
        self.backupPath = ""
        self.backupOnClose = False
        self.askBeforeBackup = True

        ## State
        self.showRefPanel = True
        self.viewComments = True

        ## Path
        self.recentList = [""] * 10

        # Check Qt5 Versions
        verQt = splitVersionNumber(QT_VERSION_STR)
        self.verQtString = QT_VERSION_STR
        self.verQtMajor = verQt[0]
        self.verQtMinor = verQt[1]
        self.verQtPatch = verQt[2]
        self.verQtValue = verQt[3]

        verQt = splitVersionNumber(PYQT_VERSION_STR)
        self.verPyQtString = PYQT_VERSION_STR
        self.verPyQtMajor = verQt[0]
        self.verPyQtMinor = verQt[1]
        self.verPyQtPatch = verQt[2]
        self.verPyQtValue = verQt[3]

        # Check Python Version
        self.verPyString = sys.version.split()[0]
        self.verPyMajor = sys.version_info[0]
        self.verPyMinor = sys.version_info[1]
        self.verPyPatch = sys.version_info[2]
        self.verPyHexVal = sys.hexversion

        # Check OS Type
        self.osType = sys.platform
        self.osLinux = False
        self.osWindows = False
        self.osDarwin = False
        self.osUnknown = False
        if self.osType.startswith("linux"):
            self.osLinux = True
        elif self.osType.startswith("darwin"):
            self.osDarwin = True
        elif self.osType.startswith("win32"):
            self.osWindows = True
        elif self.osType.startswith("cygwin"):
            self.osWindows = True
        else:
            self.osUnknown = True

        # Packages
        self.hasEnchant = False
        self.hasSymSpell = False

        return
Beispiel #2
0
    def __init__(self):

        # Set Application Variables
        self.appName = "novelWriter"
        self.appHandle = self.appName.lower()

        # Config Error Handling
        self.hasError = False  # True if the config class encountered an error
        self.errData = []  # List of error messages

        # Set Paths
        self.cmdOpen = None  # Path from command line for project to be opened on launch
        self.confPath = None  # Folder where the config is saved
        self.confFile = None  # The config file name
        self.dataPath = None  # Folder where app data is stored
        self.lastPath = None  # The last user-selected folder (browse dialogs)
        self.appPath = None  # The full path to the novelwriter package folder
        self.appRoot = None  # The full path to the novelwriter root folder
        self.appIcon = None  # The full path to the novelwriter icon file
        self.assetPath = None  # The full path to the nw/assets folder
        self.themeRoot = None  # The full path to the nw/assets/themes folder
        self.dictPath = None  # The full path to the nw/assets/dict folder
        self.iconPath = None  # The full path to the nw/assets/icons folder
        self.helpPath = None  # The full path to the novelwriter .qhc help file

        # Runtime Settings and Variables
        self.confChanged = False  # True whenever the config has chenged, false after save
        self.hasHelp = False  # True if the Qt help files are present in the assets folder

        ## General
        self.guiTheme = "default"
        self.guiSyntax = "default_light"
        self.guiIcons = "typicons_colour_light"
        self.guiDark = False  # Load icons for dark backgrounds, if available
        self.guiFont = ""  # Defaults to system default font
        self.guiFontSize = 11  # Is overridden if system default is loaded
        self.guiScale = 1.0  # Set automatically by Theme class
        self.lastNotes = "0x0"  # The latest release notes that have been shown

        ## Localisation
        self.qLocal = QLocale.system()
        self.guiLang = self.qLocal.name()
        self.qtLangPath = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
        self.nwLangPath = None
        self.qtTrans = {}

        ## Sizes
        self.winGeometry = [1200, 650]
        self.prefGeometry = [700, 615]
        self.treeColWidth = [200, 50, 30]
        self.novelColWidth = [200, 50]
        self.projColWidth = [200, 60, 140]
        self.mainPanePos = [300, 800]
        self.docPanePos = [400, 400]
        self.viewPanePos = [500, 150]
        self.outlnPanePos = [500, 150]
        self.isFullScreen = False

        ## Features
        self.hideVScroll = False  # Hide vertical scroll bars on main widgets
        self.hideHScroll = False  # Hide horizontal scroll bars on main widgets

        ## Project
        self.autoSaveProj = 60  # Interval for auto-saving project in seconds
        self.autoSaveDoc = 30  # Interval for auto-saving document in seconds

        ## Text Editor
        self.textFont = None  # Editor font
        self.textSize = 12  # Editor font size
        self.textFixedW = True  # Keep editor text fixed width
        self.textWidth = 600  # Editor text width
        self.textMargin = 40  # Editor/viewer text margin
        self.tabWidth = 40  # Editor tabulator width

        self.focusWidth = 800  # Focus Mode text width
        self.hideFocusFooter = False  # Hide document footer in Focus Mode
        self.showFullPath = True  # Show full document path in editor header
        self.autoSelect = True  # Auto-select word when applying format with no selection

        self.doJustify = False  # Justify text
        self.showTabsNSpaces = False  # Show tabs and spaces in edior
        self.showLineEndings = False  # Show line endings in editor

        self.doReplace = True  # Enable auto-replace as you type
        self.doReplaceSQuote = True  # Smart single quotes
        self.doReplaceDQuote = True  # Smart double quotes
        self.doReplaceDash = True  # Replace multiple hyphens with dashes
        self.doReplaceDots = True  # Replace three dots with ellipsis

        self.scrollPastEnd = True  # Allow scrolling past end of document
        self.autoScroll = False  # Typewriter-like scrolling
        self.autoScrollPos = 30  # Start point for typewriter-like scrolling

        self.wordCountTimer = 5.0  # Interval for word count update in seconds
        self.bigDocLimit = 800  # Size threshold for heavy editor features in kilobytes

        self.highlightQuotes = True  # Highlight text in quotes
        self.allowOpenSQuote = False  # Allow open-ended single quotes
        self.allowOpenDQuote = True  # Allow open-ended double quotes
        self.highlightEmph = True  # Add colour to text emphasis

        self.stopWhenIdle = True  # Stop the status bar clock when the user is idle
        self.userIdleTime = 300  # Time of inactivity to consider user idle

        ## User-Selected Symbols
        self.fmtApostrophe = nwUnicode.U_RSQUO
        self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO]
        self.fmtDoubleQuotes = [nwUnicode.U_LDQUO, nwUnicode.U_RDQUO]
        self.fmtPadBefore = ""
        self.fmtPadAfter = ""
        self.fmtPadThin = False

        ## Spell Checking
        self.spellTool = None
        self.spellLanguage = None

        ## Search Bar Switches
        self.searchCase = False
        self.searchWord = False
        self.searchRegEx = False
        self.searchLoop = False
        self.searchNextFile = False
        self.searchMatchCap = False

        ## Backup
        self.backupPath = ""
        self.backupOnClose = False
        self.askBeforeBackup = True

        ## State
        self.showRefPanel = True
        self.viewComments = True
        self.viewSynopsis = True

        # Check Qt5 Versions
        verQt = splitVersionNumber(QT_VERSION_STR)
        self.verQtString = QT_VERSION_STR
        self.verQtMajor = verQt[0]
        self.verQtMinor = verQt[1]
        self.verQtPatch = verQt[2]
        self.verQtValue = verQt[3]

        verQt = splitVersionNumber(PYQT_VERSION_STR)
        self.verPyQtString = PYQT_VERSION_STR
        self.verPyQtMajor = verQt[0]
        self.verPyQtMinor = verQt[1]
        self.verPyQtPatch = verQt[2]
        self.verPyQtValue = verQt[3]

        # Check Python Version
        self.verPyString = sys.version.split()[0]
        self.verPyMajor = sys.version_info[0]
        self.verPyMinor = sys.version_info[1]
        self.verPyPatch = sys.version_info[2]
        self.verPyHexVal = sys.hexversion

        # Check OS Type
        self.osType = sys.platform
        self.osLinux = False
        self.osWindows = False
        self.osDarwin = False
        self.osUnknown = False
        if self.osType.startswith("linux"):
            self.osLinux = True
        elif self.osType.startswith("darwin"):
            self.osDarwin = True
        elif self.osType.startswith("win32"):
            self.osWindows = True
        elif self.osType.startswith("cygwin"):
            self.osWindows = True
        else:
            self.osUnknown = True

        # Other System Info
        self.hostName = "Unknown"
        self.kernelVer = "Unknown"

        # Packages
        self.hasEnchant = False  # The pyenchant package
        self.hasAssistant = False  # The Qt Assistant executable

        # Recent Cache
        self.recentProj = {}

        return
Beispiel #3
0
    def __init__(self):

        # Set Application Variables
        self.appName = nw.__package__
        self.appHandle = nw.__package__.lower()
        self.showGUI = True
        self.debugGUI = False
        self.debugInfo = False
        self.spellTool = None

        # Set Paths
        self.confPath = None
        self.confFile = None
        self.homePath = None
        self.appPath = None
        self.appRoot = None
        self.appIcon = None
        self.guiPath = None
        self.themeRoot = None
        self.themePath = None

        # Set default values
        self.confChanged = False

        ## General
        self.guiTheme = "default"
        self.guiSyntax = "default_light"
        self.winGeometry = [1100, 650]
        self.treeColWidth = [120, 30, 50]
        self.mainPanePos = [300, 800]
        self.docPanePos = [400, 400]

        ## Dialogs
        self.dlgTimeLine = [600, 400]

        ## Project
        self.autoSaveProj = 60
        self.autoSaveDoc = 30

        ## Text Editor
        self.textFont = None
        self.textSize = 12
        self.textFixedW = True
        self.textWidth = 600
        self.textMargin = 40
        self.tabWidth = 40
        self.doJustify = True
        self.autoSelect = True
        self.doReplace = True
        self.doReplaceSQuote = True
        self.doReplaceDQuote = True
        self.doReplaceDash = True
        self.doReplaceDots = True
        self.wordCountTimer = 5.0

        self.fmtSingleQuotes = ["‘", "’"]
        self.fmtDoubleQuotes = ["“", "”"]

        self.spellLanguage = "en_GB"

        # Backup
        self.backupPath = ""
        self.backupOnClose = False
        self.askBeforeBackup = True

        # Path
        self.recentList = [""] * 10

        # Check Qt5 Versions
        verQt = splitVersionNumber(QT_VERSION_STR)
        self.verQtString = QT_VERSION_STR
        self.verQtMajor = verQt[0]
        self.verQtMinor = verQt[1]
        self.verQtPatch = verQt[2]
        self.verQtValue = verQt[3]

        verQt = splitVersionNumber(PYQT_VERSION_STR)
        self.verPyQtString = PYQT_VERSION_STR
        self.verPyQtMajor = verQt[0]
        self.verPyQtMinor = verQt[1]
        self.verPyQtPatch = verQt[2]
        self.verPyQtValue = verQt[3]

        return