mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
Merge pull request #2221 from alicevision/dev/clearImagesGallery
[ui] ImageGallery: Add "Remove All Images" menu to clear all images
This commit is contained in:
commit
5ccbfe408a
6 changed files with 44 additions and 23 deletions
|
@ -356,13 +356,13 @@ class ListAttributeRemoveCommand(GraphCommand):
|
||||||
listAttribute.insert(self.index, self.value)
|
listAttribute.insert(self.index, self.value)
|
||||||
|
|
||||||
|
|
||||||
class ClearImagesCommand(GraphCommand):
|
class RemoveImagesCommand(GraphCommand):
|
||||||
def __init__(self, graph, cameraInitNodes, parent=None):
|
def __init__(self, graph, cameraInitNodes, parent=None):
|
||||||
super(ClearImagesCommand, self).__init__(graph, parent)
|
super(RemoveImagesCommand, self).__init__(graph, parent)
|
||||||
self.cameraInits = cameraInitNodes
|
self.cameraInits = cameraInitNodes
|
||||||
self.viewpoints = { cameraInit.name: cameraInit.attribute("viewpoints").getExportValue() for cameraInit in self.cameraInits }
|
self.viewpoints = { cameraInit.name: cameraInit.attribute("viewpoints").getExportValue() for cameraInit in self.cameraInits }
|
||||||
self.intrinsics = { cameraInit.name: cameraInit.attribute("intrinsics").getExportValue() for cameraInit in self.cameraInits }
|
self.intrinsics = { cameraInit.name: cameraInit.attribute("intrinsics").getExportValue() for cameraInit in self.cameraInits }
|
||||||
self.title = "Clear{}Images".format(" " if len(self.cameraInits) == 1 else " All ")
|
self.title = "Remove{}Images".format(" " if len(self.cameraInits) == 1 else " All ")
|
||||||
self.setText(self.title)
|
self.setText(self.title)
|
||||||
|
|
||||||
def redoImpl(self):
|
def redoImpl(self):
|
||||||
|
|
|
@ -813,14 +813,14 @@ class UIGraph(QObject):
|
||||||
self.push(commands.ListAttributeRemoveCommand(self._graph, attribute))
|
self.push(commands.ListAttributeRemoveCommand(self._graph, attribute))
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def clearImages(self):
|
def removeAllImages(self):
|
||||||
with self.groupedGraphModification("Clear Images"):
|
with self.groupedGraphModification("Remove All Images"):
|
||||||
self.push(commands.ClearImagesCommand(self._graph, [self.cameraInit]))
|
self.push(commands.RemoveImagesCommand(self._graph, [self.cameraInit]))
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def clearAllImages(self):
|
def removeImagesFromAllGroups(self):
|
||||||
with self.groupedGraphModification("Clear All Images"):
|
with self.groupedGraphModification("Remove Images From All CameraInit Nodes"):
|
||||||
self.push(commands.ClearImagesCommand(self._graph, list(self.cameraInits)))
|
self.push(commands.RemoveImagesCommand(self._graph, list(self.cameraInits)))
|
||||||
|
|
||||||
@Slot(Node)
|
@Slot(Node)
|
||||||
def appendSelection(self, node):
|
def appendSelection(self, node):
|
||||||
|
|
|
@ -20,6 +20,7 @@ Item {
|
||||||
|
|
||||||
signal pressed(var mouse)
|
signal pressed(var mouse)
|
||||||
signal removeRequest()
|
signal removeRequest()
|
||||||
|
signal removeAllImagesRequest()
|
||||||
|
|
||||||
default property alias children: imageMA.children
|
default property alias children: imageMA.children
|
||||||
|
|
||||||
|
@ -78,6 +79,11 @@ Item {
|
||||||
enabled: !root.readOnly
|
enabled: !root.readOnly
|
||||||
onClicked: removeRequest()
|
onClicked: removeRequest()
|
||||||
}
|
}
|
||||||
|
MenuItem {
|
||||||
|
text: "Remove All Images"
|
||||||
|
enabled: !root.readOnly
|
||||||
|
onClicked: removeAllImagesRequest()
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Define As Center Image"
|
text: "Define As Center Image"
|
||||||
property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("SfMTransform").node : null
|
property var activeNode: _reconstruction ? _reconstruction.activeNodes.get("SfMTransform").node : null
|
||||||
|
|
|
@ -289,8 +289,22 @@ Panel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeAllImages() {
|
||||||
|
_reconstruction.removeAllImages()
|
||||||
|
_reconstruction.selectedViewId = "-1"
|
||||||
|
}
|
||||||
|
|
||||||
onRemoveRequest: sendRemoveRequest()
|
onRemoveRequest: sendRemoveRequest()
|
||||||
Keys.onDeletePressed: sendRemoveRequest()
|
Keys.onPressed: (event) => {
|
||||||
|
if (event.key === Qt.Key_Delete && event.modifiers === Qt.ShiftModifier) {
|
||||||
|
removeAllImages()
|
||||||
|
} else if (event.key === Qt.Key_Delete) {
|
||||||
|
sendRemoveRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onRemoveAllImagesRequest: {
|
||||||
|
removeAllImages()
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
|
@ -79,7 +79,7 @@ Item {
|
||||||
tempCameraInit: reconstruction ? reconstruction.tempCameraInit : null
|
tempCameraInit: reconstruction ? reconstruction.tempCameraInit : null
|
||||||
cameraInitIndex: reconstruction ? reconstruction.cameraInitIndex : -1
|
cameraInitIndex: reconstruction ? reconstruction.cameraInitIndex : -1
|
||||||
onRemoveImageRequest: reconstruction.removeAttribute(attribute)
|
onRemoveImageRequest: reconstruction.removeAttribute(attribute)
|
||||||
onAllViewpointsCleared: { reconstruction.clearImages(); reconstruction.selectedViewId = "-1" }
|
onAllViewpointsCleared: { reconstruction.removeAllImages(); reconstruction.selectedViewId = "-1" }
|
||||||
onFilesDropped: reconstruction.handleFilesDrop(drop, augmentSfm ? null : cameraInit)
|
onFilesDropped: reconstruction.handleFilesDrop(drop, augmentSfm ? null : cameraInit)
|
||||||
}
|
}
|
||||||
LiveSfmView {
|
LiveSfmView {
|
||||||
|
|
|
@ -477,21 +477,21 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: clearImagesAction
|
id: removeAllImagesAction
|
||||||
property string tooltip: "Clear images for the current CameraInit group"
|
property string tooltip: "Remove all the images from the current CameraInit group"
|
||||||
text: "Clear Images"
|
text: "Remove All Images"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
_reconstruction.clearImages()
|
_reconstruction.removeAllImages()
|
||||||
_reconstruction.selectedViewId = "-1"
|
_reconstruction.selectedViewId = "-1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: clearAllImagesAction
|
id: removeImagesFromAllGroupsAction
|
||||||
property string tooltip: "Clear all the images for all the CameraInit groups"
|
property string tooltip: "Remove all the images from all the CameraInit groups"
|
||||||
text: "Clear All Images"
|
text: "Remove Images From All CameraInit Nodes"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
_reconstruction.clearAllImages()
|
_reconstruction.removeImagesFromAllGroups()
|
||||||
_reconstruction.selectedViewId = "-1"
|
_reconstruction.selectedViewId = "-1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,15 +723,16 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
action: clearImagesAction
|
action: removeAllImagesAction
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: clearImagesAction.tooltip
|
ToolTip.text: removeAllImagesAction.tooltip
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
Menu {
|
Menu {
|
||||||
id: advancedMenu
|
id: advancedMenu
|
||||||
title: "Advanced"
|
title: "Advanced"
|
||||||
|
implicitWidth: 300
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
id: saveAsTemplateAction
|
id: saveAsTemplateAction
|
||||||
|
@ -768,9 +769,9 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
action: clearAllImagesAction
|
action: removeImagesFromAllGroupsAction
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: clearAllImagesAction.tooltip
|
ToolTip.text: removeImagesFromAllGroupsAction.tooltip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MenuSeparator { }
|
MenuSeparator { }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue