Some cleanup of the merge document dialog
This commit is contained in:
+14
-23
@@ -15,12 +15,11 @@ import nw
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton, QLabel,
|
QDialog, QHBoxLayout, QVBoxLayout, QGridLayout, QPushButton,
|
||||||
QProgressBar, QListWidget, QAbstractItemView, QListWidgetItem
|
QListWidget, QAbstractItemView, QListWidgetItem
|
||||||
)
|
)
|
||||||
from nw.constants import nwFiles, nwAlert, nwItemClass, nwItemType
|
from nw.constants import nwAlert, nwItemType
|
||||||
from nw.project import NWDoc
|
from nw.project import NWDoc
|
||||||
from nw.tools import OptLastState
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -35,8 +34,6 @@ class GuiDocMerge(QDialog):
|
|||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theProject
|
||||||
self.sourceItem = None
|
self.sourceItem = None
|
||||||
self.optState = DocMergeLastState(self.theProject,nwFiles.MERGE_OPT)
|
|
||||||
self.optState.loadSettings()
|
|
||||||
|
|
||||||
self.outerBox = QHBoxLayout()
|
self.outerBox = QHBoxLayout()
|
||||||
self.innerBox = QVBoxLayout()
|
self.innerBox = QVBoxLayout()
|
||||||
@@ -80,6 +77,10 @@ class GuiDocMerge(QDialog):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def _doMerge(self):
|
def _doMerge(self):
|
||||||
|
"""Perform the merge of the files in the selected folder, and
|
||||||
|
create a new file in the same parent folder. The old files are
|
||||||
|
not removed in the merge process, and must be deleted manually.
|
||||||
|
"""
|
||||||
|
|
||||||
logger.verbose("GuiDocMerge merge button clicked")
|
logger.verbose("GuiDocMerge merge button clicked")
|
||||||
|
|
||||||
@@ -111,12 +112,10 @@ class GuiDocMerge(QDialog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def _doClose(self):
|
def _doClose(self):
|
||||||
|
"""Close the dialog window without doing anything.
|
||||||
|
"""
|
||||||
logger.verbose("GuiDocMerge close button clicked")
|
logger.verbose("GuiDocMerge close button clicked")
|
||||||
|
|
||||||
self.optState.saveSettings()
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -124,6 +123,11 @@ class GuiDocMerge(QDialog):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def _populateList(self):
|
def _populateList(self):
|
||||||
|
"""Get the item selected in the tree, check that it is a folder,
|
||||||
|
and try to find all files associated with it. The valid files
|
||||||
|
are then added to the list view in order. The list itself can be
|
||||||
|
reordered by the user.
|
||||||
|
"""
|
||||||
|
|
||||||
tHandle = self.theParent.treeView.getSelectedHandle()
|
tHandle = self.theParent.treeView.getSelectedHandle()
|
||||||
self.sourceItem = tHandle
|
self.sourceItem = tHandle
|
||||||
@@ -151,16 +155,3 @@ class GuiDocMerge(QDialog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocMerge
|
# END Class GuiDocMerge
|
||||||
|
|
||||||
class DocMergeLastState(OptLastState):
|
|
||||||
|
|
||||||
def __init__(self, theProject, theFile):
|
|
||||||
OptLastState.__init__(self, theProject, theFile)
|
|
||||||
self.theState = {
|
|
||||||
}
|
|
||||||
self.stringOpt = ()
|
|
||||||
self.boolOpt = ()
|
|
||||||
self.intOpt = ()
|
|
||||||
return
|
|
||||||
|
|
||||||
# END Class DocMergeLastState
|
|
||||||
|
|||||||
Reference in New Issue
Block a user