Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions meshroom/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,20 @@ def _unsetFilepath(self):
self.cacheDir = ""
self.filepathChanged.emit()

@Slot(result=str)
def getCurrentFilename(self):
if os.path.exists(self._filepath):
return os.path.basename(self._filepath)
else:
return ""

@Slot(result=str)
def getCurrentFolder(self):
if os.path.exists(self._filepath):
return os.path.dirname(self._filepath)
else:
return os.getcwd()

def updateInternals(self, startNodes=None, force=False):
nodes, edges = self.dfsOnFinish(startNodes=startNodes)
for node in nodes:
Expand Down
1 change: 1 addition & 0 deletions meshroom/ui/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ def _saveAs(self, url, setupProjectFile=True, template=False):
# ensure file is saved with ".mg" extension
if os.path.splitext(localFile)[-1] != ".mg":
localFile += ".mg"
self.parent().showMessage(f"Saving file to {localFile}", "ok")
self._graph.save(localFile, setupProjectFile=setupProjectFile, template=template)
self._undoStack.setClean()
# saving file on disk impacts cache folder location
Expand Down
4 changes: 4 additions & 0 deletions meshroom/ui/palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def togglePalette(self):
if self.qmlEngine.rootObjects():
self.qmlEngine.reload()
self.paletteChanged.emit()

@Slot(result=bool)
def isDarkPalette(self):
return QApplication.instance().palette() == self.darkPalette
Comment on lines +60 to +62
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isDarkPalette method uses equality comparison (==) to check if the current palette is the dark palette. This comparison may not work as expected since QPalette objects may not be comparable with ==. Consider using a dedicated boolean flag to track which palette is active, or compare specific palette properties instead.

Copilot uses AI. Check for mistakes.

paletteChanged = Signal()
palette = Property(QPalette, lambda self: QApplication.instance().palette(), notify=paletteChanged)
Expand Down
51 changes: 17 additions & 34 deletions meshroom/ui/qml/Application.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import GraphEditor 1.0
import MaterialIcons 2.2
import Utils 1.0
import Controls 1.0
import Dialogs 1.0

Page {
id: root
Expand Down Expand Up @@ -129,49 +130,31 @@ Page {
}

// File dialogs
Platform.FileDialog {
id: saveFileDialog

property var _callback: undefined

signal closed(var result)
MrFileDialog {
id: saveFileDialog
saveMode: true
nameFilters: ["*"]
property string fileToSave: ""

title: "Save File"
nameFilters: ["Meshroom Graphs (*.mg)"]
defaultSuffix: ".mg"
fileMode: Platform.FileDialog.SaveFile
onFileSelected: (path) => {
fileToSave = path.toString().replace("file://", "")
// Do something with the file path
}

onAccepted: {
if (!validateFilepathForSave(currentFile, saveFileDialog))
if (!validateFilepathForSave(fileToSave, saveFileDialog))
{
return;
}

// Only save a valid file
_reconstruction.saveAs(currentFile)
MeshroomApp.addRecentProjectFile(currentFile.toString())
closed(Platform.Dialog.Accepted)
fireCallback(Platform.Dialog.Accepted)
}
onRejected: {
closed(Platform.Dialog.Rejected)
fireCallback(Platform.Dialog.Rejected)
}

function fireCallback(rc)
{
// Call the callback and reset it
if (_callback)
_callback(rc)
_callback = undefined
}

// Open the unsaved dialog warning with an optional
// callback to fire when the dialog is accepted/discarded
function prompt(callback)
{
_callback = callback
open()
_reconstruction.saveAs("file://" + fileToSave)
MeshroomApp.addRecentProjectFile(fileToSave.toString())
}
// onRejected: {
// console.log("File not saved")
// }
Comment on lines +155 to +157
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commented-out code should be removed if it's not needed. Keeping commented-out code reduces maintainability.

Suggested change
// onRejected: {
// console.log("File not saved")
// }

Copilot uses AI. Check for mistakes.
}

Platform.FileDialog {
Expand Down
Loading
Loading