Exemplo n.º 1
0
    def __init__(self, theParent, theProject):
        QTextBrowser.__init__(self)

        logger.debug("Initialising DocViewer ...")

        # Class Variables
        self.mainConf = nw.CONFIG
        self.theProject = theProject
        self.theParent = theParent
        self.theTheme = theParent.theTheme
        self.theHandle = None

        self.qDocument = self.document()
        self.setMinimumWidth(300)
        self.setOpenExternalLinks(False)
        self.initViewer()

        theOpt = QTextOption()
        if self.mainConf.doJustify:
            theOpt.setAlignment(Qt.AlignJustify)
        self.qDocument.setDefaultTextOption(theOpt)

        self.anchorClicked.connect(self._linkClicked)
        self.setFocusPolicy(Qt.StrongFocus)

        logger.debug("DocViewer initialisation complete")

        return
Exemplo n.º 2
0
    def __init__(self, parent=None):
        """Initialize the viewer.

        Arguments:
            parent -- the parent widget, if given
        """
        QTextBrowser.__init__(self, parent)
Exemplo n.º 3
0
 def __init__(self):
     QTextBrowser.__init__(self)
     self.setVerticalScrollBarPolicy(
         Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
     self.timer = QTimer()
     self.timer.timeout.connect(self.handleTimer)
     self.timer.start(100)
Exemplo n.º 4
0
    def __init__(self, *args):
        QTextBrowser.__init__(self, *args)

        self.setStyleSheet("background:white;color:black;")

        try:
            self.setText(codecs.open(self.loadFile(), "r", "UTF-8").read())
        except Exception, msg:
            raise GUIError(msg)
Exemplo n.º 5
0
 def __init__(self, tab):
     QTextBrowser.__init__(self)
     self.tab = tab
     # if set to True, links to other files will unsuccessfully be opened as anchors
     self.setOpenLinks(False)
     self.anchorClicked.connect(self.openInternal)
     self.lastRenderTime = 0
     self.distToBottom = None
     self.verticalScrollBar().rangeChanged.connect(
         self.updateScrollPosition)
Exemplo n.º 6
0
    def __init__(self, *args):
        QTextBrowser.__init__(self, *args)

        self.setStyleSheet("background:white;color:black;")

        try:
            self.setText(codecs.open(self.loadFile(), "r", "UTF-8").read())
        except Exception, msg:
            ctx.logger.error(
                _("General", "An error occurred when showing "
                  "to release nostes:%s") % (msg))
Exemplo n.º 7
0
    def __init__(self, *args, **kwargs):
        QTextBrowser.__init__(self, *args, **kwargs)

        self.setOpenExternalLinks(False)
        self.setOpenLinks(False)

        self.__text = ""
        self.__permanentText = ""

        self.__timer = QTimer(self, timeout=self.__on_timeout, singleShot=True)
        self.anchorClicked.connect(self.__on_anchorClicked)
    def __init__(self, parent=None, **kwargs):
        QTextBrowser.__init__(self, parent=parent)
        self.settings_manager = injector.get_settings_manager()
        self.stand_alone = kwargs.get('stand_alone', False)

        self.post_text_font_size = self.settings_manager.database_view_post_text_font_size
        self.post_text_font = QFont(
            self.settings_manager.database_view_post_text_font,
            self.post_text_font_size)
        self.setFont(self.post_text_font)

        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.context_menu)
Exemplo n.º 9
0
    def __init__(self, mainGui):
        QTextBrowser.__init__(self, mainGui)

        logger.debug("Initialising GuiDocViewer ...")

        # Class Variables
        self.mainConf   = novelwriter.CONFIG
        self.mainGui    = mainGui
        self.mainTheme  = mainGui.mainTheme
        self.theProject = mainGui.theProject

        # Internal Variables
        self._docHandle = None

        # Settings
        self.setMinimumWidth(self.mainConf.pxInt(300))
        self.setAutoFillBackground(True)
        self.setOpenExternalLinks(False)
        self.setFocusPolicy(Qt.StrongFocus)
        self.setFrameStyle(QFrame.NoFrame)

        # Document Header and Footer
        self.docHeader  = GuiDocViewHeader(self)
        self.docFooter  = GuiDocViewFooter(self)
        self.docHistory = GuiDocViewHistory(self)
        self.stickyRef  = False

        # Signals
        self.anchorClicked.connect(self._linkClicked)

        # Context Menu
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self._openContextMenu)

        self.initViewer()

        logger.debug("GuiDocViewer initialisation complete")

        return
Exemplo n.º 10
0
    def __init__(self, theParent, theProject):
        QTextBrowser.__init__(self)

        logger.debug("Initialising DocViewer ...")

        # Class Variables
        self.mainConf = nw.CONFIG
        self.theProject = theProject
        self.theParent = theParent
        self.theTheme = theParent.theTheme
        self.theHandle = None

        self.qDocument = self.document()
        self.setMinimumWidth(300)
        self.initViewer()

        theOpt = QTextOption()
        if self.mainConf.doJustify:
            theOpt.setAlignment(Qt.AlignJustify)
        self.qDocument.setDefaultTextOption(theOpt)

        logger.debug("DocViewer initialisation complete")

        return
Exemplo n.º 11
0
    def __init__(self, theParent):
        QTextBrowser.__init__(self, theParent)

        logger.debug("Initialising GuiDocViewer ...")

        # Class Variables
        self.mainConf = nw.CONFIG
        self.theParent = theParent
        self.theTheme = theParent.theTheme
        self.theProject = theParent.theProject
        self.theHandle = None

        self.qDocument = self.document()
        self.setMinimumWidth(self.mainConf.pxInt(300))
        self.setAutoFillBackground(True)
        self.setOpenExternalLinks(False)
        self.setFocusPolicy(Qt.StrongFocus)

        # Document Header and Footer
        self.docHeader = GuiDocViewHeader(self)
        self.docFooter = GuiDocViewFooter(self)
        self.docHistory = GuiDocViewHistory(self)
        self.stickyRef = False

        # Signals
        self.anchorClicked.connect(self._linkClicked)

        # Context Menu
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self._openContextMenu)

        self.initViewer()

        logger.debug("GuiDocViewer initialisation complete")

        return
Exemplo n.º 12
0
	def __init__(self, tab):
		QTextBrowser.__init__(self)
		self.tab = tab
		# if set to True, links to other files will unsuccessfully be opened as anchors
		self.setOpenLinks(False)
		self.anchorClicked.connect(self.openInternal)
Exemplo n.º 13
0
 def __init__(self, tab):
     QTextBrowser.__init__(self)
     self.tab = tab
     # if set to True, links to other files will unsuccessfully be opened as anchors
     self.setOpenLinks(False)
     self.anchorClicked.connect(self.openInternal)
Exemplo n.º 14
0
 def __init__(self, parent=None, name=None):
     self.parent = parent
     QTextBrowser.__init__(self, parent)
Exemplo n.º 15
0
 def __init__(self, parent=None):
     QTextBrowser.__init__(self, parent)
     AbstractViewer.__init__(self)
Exemplo n.º 16
0
 def __init__(self, parent=None, name=None, basePath=None):
     self.parent = parent
     self.basePath = basePath
     QTextBrowser.__init__(self)
Exemplo n.º 17
0
 def __init__(self, parent=None):
     QTextBrowser.__init__(self, parent)
Exemplo n.º 18
0
 def __init__(self, parent):
     self.parent = parent
     # QWebView
     self.view = QTextBrowser.__init__(self, parent)
     #self.view.setPage(MyBrowser())
     self.setWindowTitle('Loading...')
Exemplo n.º 19
0
 def __init__(self, parent=None, name=None, basePath=None):
     self.parent = parent
     self.basePath = os.path.dirname(basePath)
     QTextBrowser.__init__(self)
Exemplo n.º 20
0
 def __init__(self, system):
     QTextBrowser.__init__(self)
     self._system = system
     self.horizontalScrollBar().setHidden(True)
     self.aux_format()
Exemplo n.º 21
0
    def __init__(self, theParent, theProject):
        QTextBrowser.__init__(self, theParent)

        logger.debug("Initialising GuiBuildNovelDocView ...")

        self.mainConf = nw.CONFIG
        self.theProject = theProject
        self.theParent = theParent
        self.theTheme = theParent.theTheme
        self.buildTime = 0

        self.setMinimumWidth(40 * self.theParent.theTheme.textNWidth)
        self.setOpenExternalLinks(False)

        self.qDocument = self.document()
        self.qDocument.setDocumentMargin(self.mainConf.getTextMargin())
        self.setPlaceholderText(
            "This area will show the content of the document to be "
            "exported or printed. Press the \"Build Novel Project\" "
            "button to generate content.")

        theFont = QFont()
        if self.mainConf.textFont is None:
            # If none is defined, set the default back to config
            self.mainConf.textFont = self.qDocument.defaultFont().family()
        theFont.setFamily(self.mainConf.textFont)
        theFont.setPointSize(self.mainConf.textSize)
        self.setFont(theFont)

        # Set the tab stops
        if self.mainConf.verQtValue >= 51000:
            self.setTabStopDistance(self.mainConf.getTabWidth())
        else:
            self.setTabStopWidth(self.mainConf.getTabWidth())

        docPalette = self.palette()
        docPalette.setColor(QPalette.Base, QColor(255, 255, 255))
        docPalette.setColor(QPalette.Text, QColor(0, 0, 0))
        self.setPalette(docPalette)

        lblPalette = self.palette()
        lblPalette.setColor(QPalette.Background,
                            lblPalette.toolTipBase().color())
        lblPalette.setColor(QPalette.Foreground,
                            lblPalette.toolTipText().color())

        lblFont = self.font()
        lblFont.setPointSizeF(0.9 * self.theTheme.fontPointSize)

        fPx = int(1.1 * self.theTheme.fontPixelSize)

        self.theTitle = QLabel("<b>Build Time:</b> Unknown", self)
        self.theTitle.setIndent(0)
        self.theTitle.setAutoFillBackground(True)
        self.theTitle.setAlignment(Qt.AlignCenter)
        self.theTitle.setFixedHeight(fPx)
        self.theTitle.setPalette(lblPalette)
        self.theTitle.setFont(lblFont)

        self._updateDocMargins()
        self.setStyleSheet()

        # Age Timer
        self.ageTimer = QTimer()
        self.ageTimer.setInterval(10000)
        self.ageTimer.timeout.connect(self._updateBuildAge)
        self.ageTimer.start()

        logger.debug("GuiBuildNovelDocView initialisation complete")

        return
Exemplo n.º 22
0
 def __init__(self, *args):
     QTextBrowser.__init__(self, *args)
     self.dropCount = 0
     self.setPlainText('Drops: %d' % (self.dropCount))
     self.setAcceptDrops(True)