Export dialog working

This commit is contained in:
Veronica K. B. Olsen
2019-10-13 13:31:59 +02:00
parent dbd1964ff4
commit 32a4e43459
5 changed files with 95 additions and 25 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ class GuiConfigEditor(QDialog):
self.show()
logger.debug("ProjectEditor ConfigEditor complete")
logger.debug("ConfigEditor initialisation complete")
return
+80
View File
@@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
"""novelWriter GUI Export Tools
novelWriter GUI Export Tool
================================
Tool for exporting project files to other formats
File History:
Created: 2019-10-13 [0.2.3]
"""
import logging
import nw
from os import path
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtSvg import QSvgWidget
from PyQt5.QtWidgets import (
QDialog, QHBoxLayout, QVBoxLayout, QWidget, QTabWidget, QDialogButtonBox
)
logger = logging.getLogger(__name__)
class GuiExport(QDialog):
def __init__(self, theParent, theProject):
QDialog.__init__(self, theParent)
logger.debug("Initialising GuiExport ...")
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theProject = theProject
self.outerBox = QHBoxLayout()
self.innerBox = QVBoxLayout()
self.setWindowTitle("Export Project")
self.setLayout(self.outerBox)
self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","gear.svg"))
self.svgGradient = QSvgWidget(self.gradPath)
self.svgGradient.setFixedSize(QSize(64,64))
self.theProject.countStatus()
self.tabMain = GuiExportMain(self.theParent, self.theProject)
self.tabWidget = QTabWidget()
self.tabWidget.addTab(self.tabMain, "Settings")
self.outerBox.addWidget(self.svgGradient, 0, Qt.AlignTop)
self.outerBox.addLayout(self.innerBox)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
# self.buttonBox.accepted.connect(self._doSave)
# self.buttonBox.rejected.connect(self._doClose)
self.innerBox.addWidget(self.tabWidget)
self.innerBox.addWidget(self.buttonBox)
self.show()
logger.debug("GuiExport initialisation complete")
return
# END Class GuiExport
class GuiExportMain(QWidget):
def __init__(self, theParent, theProject):
QWidget.__init__(self, theParent)
self.theParent = theParent
self.theProject = theProject
return
# END Class GuiExportMain
-24
View File
@@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
"""novelWriter GUI Export Tools
novelWriter GUI Export Tool
================================
Tool for exporting project files to other formats
File History:
Created: 2019-10-13 [0.2.3]
"""
import logging
import nw
from os import path
from PyQt5.QtWidgets import QDialog
logger = logging.getLogger(__name__)
class GuiExport(QDialog):
# END Class GuiExport
+7
View File
@@ -192,6 +192,13 @@ class GuiMainMenu(QMenuBar):
menuItem.triggered.connect(self.theParent.editProjectDialog)
self.projMenu.addAction(menuItem)
# Project > Export Project
menuItem = QAction("Export Project", self)
menuItem.setStatusTip("Export project")
menuItem.setShortcut("F5")
menuItem.triggered.connect(self.theParent.exportProjectDialog)
self.projMenu.addAction(menuItem)
# Project > Separator
self.projMenu.addSeparator()
+7
View File
@@ -30,6 +30,7 @@ from nw.gui.searchbar import GuiSearchBar
from nw.gui.mainmenu import GuiMainMenu
from nw.gui.configeditor import GuiConfigEditor
from nw.gui.projecteditor import GuiProjectEditor
from nw.gui.export import GuiExport
from nw.gui.itemeditor import GuiItemEditor
from nw.gui.statusbar import GuiMainStatus
from nw.gui.timelineview import GuiTimeLineView
@@ -511,6 +512,12 @@ class GuiMain(QMainWindow):
self._setWindowTitle(self.theProject.projName)
return True
def exportProjectDialog(self):
if self.hasProject:
dlgExport = GuiExport(self, self.theProject)
dlgExport.exec_()
return True
def showTimeLineDialog(self):
if self.hasProject:
dlgTLine = GuiTimeLineView(self, self.theProject, self.theIndex)