Improve item auto-select on welcome dialog
This commit is contained in:
@@ -460,6 +460,7 @@ class ProjectBuilder:
|
|||||||
source = data.get("template")
|
source = data.get("template")
|
||||||
if not (isinstance(source, Path) and source.is_file()
|
if not (isinstance(source, Path) and source.is_file()
|
||||||
and source.name == nwFiles.PROJ_FILE):
|
and source.name == nwFiles.PROJ_FILE):
|
||||||
|
logger.error("Could not access source project: %s", source)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info("Copying project: %s", source)
|
logger.info("Copying project: %s", source)
|
||||||
|
|||||||
@@ -249,8 +249,7 @@ class _OpenProjectPage(QWidget):
|
|||||||
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
|
|
||||||
self.listWidget.setCurrentIndex(self.listModel.index(0))
|
self._selectFirstItem()
|
||||||
self._projectClicked(self.listModel.index(0))
|
|
||||||
|
|
||||||
baseCol = self.palette().base().color()
|
baseCol = self.palette().base().color()
|
||||||
self.setStyleSheet((
|
self.setStyleSheet((
|
||||||
@@ -278,9 +277,9 @@ class _OpenProjectPage(QWidget):
|
|||||||
@pyqtSlot(QModelIndex)
|
@pyqtSlot(QModelIndex)
|
||||||
def _projectClicked(self, index: QModelIndex) -> None:
|
def _projectClicked(self, index: QModelIndex) -> None:
|
||||||
"""Process single click on project item."""
|
"""Process single click on project item."""
|
||||||
if index.isValid():
|
path = self.tr("Path")
|
||||||
path = self.tr("Path")
|
value = index.data()[1] if index.isValid() else ""
|
||||||
self.selectedPath.setText(f"{path}: {index.data()[1]}")
|
self.selectedPath.setText(f"{path}: {value}")
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(QModelIndex)
|
@pyqtSlot(QModelIndex)
|
||||||
@@ -300,6 +299,7 @@ class _OpenProjectPage(QWidget):
|
|||||||
).format(index.data()[0])
|
).format(index.data()[0])
|
||||||
if SHARED.question(text):
|
if SHARED.question(text):
|
||||||
self.listModel.removeEntry(index)
|
self.listModel.removeEntry(index)
|
||||||
|
self._selectFirstItem()
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot("QPoint")
|
@pyqtSlot("QPoint")
|
||||||
@@ -315,6 +315,17 @@ class _OpenProjectPage(QWidget):
|
|||||||
ctxMenu.deleteLater()
|
ctxMenu.deleteLater()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
##
|
||||||
|
# Internal Functions
|
||||||
|
##
|
||||||
|
|
||||||
|
def _selectFirstItem(self) -> None:
|
||||||
|
"""Select the first item, if any are available."""
|
||||||
|
index = self.listModel.index(0)
|
||||||
|
self.listWidget.setCurrentIndex(index)
|
||||||
|
self._projectClicked(index)
|
||||||
|
return
|
||||||
|
|
||||||
# END Class _OpenProjectPage
|
# END Class _OpenProjectPage
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user