mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 23:23:57 -06:00
Change the Open File(s) option according to the file providers count
When there is only one file provider (i.e. the local file provider), the Open File(s) will be a simple item in the File menu. When there are more than one file providers, the Open File(s) will become a submenu in the File menu, which will contain all the file providers as submenu items. CURA-7868
This commit is contained in:
parent
43615a57b6
commit
71994eaaf9
3 changed files with 31 additions and 9 deletions
|
@ -30,6 +30,7 @@ from UM.Operations.SetTransformOperation import SetTransformOperation
|
|||
from UM.Platform import Platform
|
||||
from UM.PluginError import PluginNotFoundError
|
||||
from UM.Preferences import Preferences
|
||||
from UM.Qt.Bindings.FileProviderModel import FileProviderModel
|
||||
from UM.Qt.QtApplication import QtApplication # The class we're inheriting from.
|
||||
from UM.Resources import Resources
|
||||
from UM.Scene.Camera import Camera
|
||||
|
@ -822,6 +823,9 @@ class CuraApplication(QtApplication):
|
|||
self._add_printer_pages_model_without_cancel.initialize(cancellable = False)
|
||||
self._whats_new_pages_model.initialize()
|
||||
|
||||
# Initialize the FileProviderModel
|
||||
self._file_provider_model.initialize(self._onFileProviderEnabledChanged)
|
||||
|
||||
# Detect in which mode to run and execute that mode
|
||||
if self._is_headless:
|
||||
self.runWithoutGUI()
|
||||
|
@ -1051,6 +1055,13 @@ class CuraApplication(QtApplication):
|
|||
self._simple_mode_settings_manager = SimpleModeSettingsManager()
|
||||
return self._simple_mode_settings_manager
|
||||
|
||||
@pyqtSlot(result = QObject)
|
||||
def getFileProviderModel(self) -> FileProviderModel:
|
||||
return self._file_provider_model
|
||||
|
||||
def _onFileProviderEnabledChanged(self):
|
||||
self._file_provider_model.update()
|
||||
|
||||
def event(self, event):
|
||||
"""Handle Qt events"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue