Files
novelWriter/nw/gui/doctabs.py
T
2018-09-29 20:33:19 +02:00

74 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*
"""novelWriter GUI Document Tabs
novelWriter GUI Document Tabs
=================================
Class holding the document tab view
File History:
Created: 2018-09-29 [0.1.0]
"""
import logging
import nw
from os import path
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QTabWidget, QWidget, QVBoxLayout
from nw.gui.doceditor import GuiDocEditor
from nw.gui.projecteditor import GuiProjectEditor
logger = logging.getLogger(__name__)
class GuiDocTabs(QTabWidget):
def __init__(self):
QTabWidget.__init__(self)
logger.debug("Initialising DocTabs ...")
self.mainConf = nw.CONFIG
self.tabList = []
self.resize(900,500)
logger.debug("DocTabs initialisation complete")
return
def createTab(self, theName=None, tabType=None):
if tabType == nw.DOCTYPE_DOC:
self._createTabDoc(theName)
return True
elif tabType == nw.DOCTYPE_PROJECT:
self._createTabProject(theName)
return True
return False
#
# Internal Functions
#
def _createTabDoc(self, docName=None):
if docName is None:
tabName = "New Document"
else:
tabName = docName
thisTab = GuiDocEditor()
self.tabList.append(thisTab)
self.addTab(self.tabList[-1],tabName)
return True
def _createTabProject(self, projectName=None):
if projectName is None:
tabName = "New Project"
else:
tabName = projectName
thisTab = GuiProjectEditor()
self.tabList.append(thisTab)
self.addTab(self.tabList[-1],tabName)
return True
# END Class GuiDocTabs