def __init__(self, parent = None): QObject.__init__(self, parent) Extension.__init__(self) Application.getInstance().getOutputDeviceManager().writeStarted.connect(self._onWriteStarted) Application.getInstance().getPreferences().addPreference("info/send_slice_info", True) Application.getInstance().getPreferences().addPreference("info/asked_send_slice_info", False) self._more_info_dialog = None self._example_data_content = None if not Application.getInstance().getPreferences().getValue("info/asked_send_slice_info"): self.send_slice_info_message = Message(catalog.i18nc("@info", "Cura collects anonymized usage statistics."), lifetime = 0, dismissable = False, title = catalog.i18nc("@info:title", "Collecting Data")) self.send_slice_info_message.addAction("MoreInfo", name = catalog.i18nc("@action:button", "More info"), icon = None, description = catalog.i18nc("@action:tooltip", "See more information on what data Cura sends."), button_style = Message.ActionButtonStyle.LINK) self.send_slice_info_message.addAction("Dismiss", name = catalog.i18nc("@action:button", "Allow"), icon = None, description = catalog.i18nc("@action:tooltip", "Allow Cura to send anonymized usage statistics to help prioritize future improvements to Cura. Some of your preferences and settings are sent, the Cura version and a hash of the models you're slicing.")) self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered) self.send_slice_info_message.show() Application.getInstance().initializationFinished.connect(self._onAppInitialized)
def __init__(self) -> None: QObject.__init__(self, None) Extension.__init__(self) # Local data caching for the UI. self._drive_window = None # type: Optional[QObject] self._backups = [] # type: List[Dict[str, Any]] self._is_restoring_backup = False self._is_creating_backup = False # Initialize services. preferences = CuraApplication.getInstance().getPreferences() self._drive_api_service = DriveApiService() # Attach signals. CuraApplication.getInstance().getCuraAPI().account.loginStateChanged.connect(self._onLoginStateChanged) self._drive_api_service.restoringStateChanged.connect(self._onRestoringStateChanged) self._drive_api_service.creatingStateChanged.connect(self._onCreatingStateChanged) # Register preferences. preferences.addPreference(Settings.AUTO_BACKUP_ENABLED_PREFERENCE_KEY, False) preferences.addPreference(Settings.AUTO_BACKUP_LAST_DATE_PREFERENCE_KEY, datetime.now().strftime(self.DATE_FORMAT)) # Register the menu item self.addMenuItem(catalog.i18nc("@item:inmenu", "Manage backups"), self.showDriveWindow) # Make auto-backup on boot if required. CuraApplication.getInstance().engineCreatedSignal.connect(self._autoBackup)
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) self._application = CuraApplication.getInstance() self._application.getOutputDeviceManager().writeStarted.connect(self._onWriteStarted) self.addMenuItem("Send to 3D Print Log", self._onSendMenuButtonClicked) self.addMenuItem("Configure Settings to Log", self.showSettingsDialog) self._application.getPreferences().addPreference( "3d_print_log/logged_settings", ";".join(self.default_logged_settings) ) self._application.getPreferences().addPreference( "3d_print_log/include_profile_name", True ) self._application.getPreferences().addPreference( "3d_print_log/include_filament_name", True ) self._application.getPreferences().addPreference( "3d_print_log/include_snapshot", True ) self._application.engineCreatedSignal.connect(self._onEngineCreated)
def __init__(self, parent=None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self.setMenuName(i18n_catalog.i18nc("@item:inmenu", "Post Processing")) self.addMenuItem(i18n_catalog.i18nc("@item:inmenu", "Modify G-Code"), self.showPopup) self._view = None # Loaded scripts are all scripts that can be used self._loaded_scripts = {} # type: Dict[str, Type[Script]] self._script_labels = {} # type: Dict[str, str] # Script list contains instances of scripts in loaded_scripts. # There can be duplicates, which will be executed in sequence. self._script_list = [] # type: List[Script] self._selected_script_index = -1 Application.getInstance().getOutputDeviceManager( ).writeStarted.connect(self.execute) Application.getInstance().globalContainerStackChanged.connect( self._onGlobalContainerStackChanged ) # When the current printer changes, update the list of scripts. CuraApplication.getInstance().mainWindowChanged.connect( self._createView ) # When the main window is created, create the view so that we can display the post-processing icon if necessary.
def __init__(self, parent = None): QObject.__init__(self, parent) Extension.__init__(self) self._decoders = { "spacemouse": self._decodeSpacemouseEvent, "tiltpad": self._decodeTiltpadEvent } self._application = None self._main_window = None self._controller = None self._scene = None self._camera_tool = None self.setMenuName(catalog.i18nc("@item:inmenu", "RawMouse")) self.addMenuItem(catalog.i18nc("@item:inmenu", "Stop"), self._stop) self.addMenuItem(catalog.i18nc("@item:inmenu", "Restart"), self._restart) self.addMenuItem(catalog.i18nc("@item:inmenu", "Show Device Information"), self._showDeviceInformation) self._buttons = 0 self._running = False self._runner = None self._battery_level = None self._message = None self._redraw_pending = False self._roll = 0 self._hidapi = None self.processTargetValues.connect(self._processTargetValues) self._reload(False) self._start()
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) # add menu items in extensions menu self.setMenuName(catalog.i18nc("@item:inmenu", "Multi slicing")) self.addMenuItem(catalog.i18nc("@item:inmenu", "Configure and run"), self._show_popup) self._view = None # type: Optional[QObject] # user options self._file_pattern = r'.*.stl' self._input_path = '' # type: Union[Path, str] self._output_path = '' # type: Union[Path, str] self._follow_dirs = False self._follow_depth = 0 # type: Optional[int] self._preserve_dirs = False self._files = [] self._current_model = '' # type: Union[Path, str] self._current_model_suffix = '' self._current_model_name = '' self._current_model_url = None # type: Optional[QUrl] # gcode writer signal self._write_done = Signal() # event loop that allows us to wait for a signal self._loop = QEventLoop()
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) self._application = Application.getInstance() self._controller = self._application.getController() self._application.fileLoaded.connect(self._onFileLoaded) self._application.fileCompleted.connect(self._onFileCompleted) self._controller.getScene().sceneChanged.connect(self._onSceneChanged) self._currently_loading_files = [] #type: List[str] self._check_node_queue = [] #type: List[SceneNode] self._mesh_not_watertight_messages = {} #type: Dict[str, Message] self.addMenuItem(catalog.i18nc("@item:inmenu", "Check models"), self.checkMeshes) self.addMenuItem(catalog.i18nc("@item:inmenu", "Fix simple holes"), self.fixSimpleHolesForMeshes) self.addMenuItem(catalog.i18nc("@item:inmenu", "Fix model normals"), self.fixNormalsForMeshes) self.addMenuItem( catalog.i18nc("@item:inmenu", "Split model into parts"), self.splitMeshes) self._message = Message( title=catalog.i18nc("@info:title", "Mesh Tools"))
def __init__(self, parent=None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self.setMenuName("Camera Position") self.addMenuItem("Set camera position", self.showPopup) self._view = None
def test_menuItemOrder(): test_extension = Extension() test_extension.addMenuItem("b", MagicMock()) test_extension.addMenuItem("a", MagicMock()) # Ensure that the order by which the menu items were added is the same. assert test_extension.getMenuItemList() == ["b", "a"]
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) if FlameProfiler.enabled(): self.addMenuItem("Start BFG", startBFG) self.addMenuItem("Stop BFG", stopBFG) else: self.addMenuItem("<Profiling not activated>", noOp)
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) self.addMenuItem('View Profil Analyse', viewCompare) self.addMenuItem('View Active Configuration', viewAll) self.addMenuItem('View All Current Printer Profiles', viewAllQualityChanges)
def test_activateMenuItem(): test_extension = Extension() mock_object = MagicMock() mock_function = mock_object.bla test_extension.addMenuItem("test", mock_function) test_extension.activateMenuItem("test") # Check that the function was called without any attributes being passed along. mock_function.assert_called_once_with()
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) self.addMenuItem("View Active Configuration", viewAll) self.addMenuItem("View Profil Analyse", viewCompare) self.addMenuItem("View All Current Printer Profiles", viewAllPrinterQualityChanges) self.addMenuItem("Set to Standard Quality", changeToStandardQuality)
def __init__(self, parent=None) -> None: """ Executed during registration of the plug-in. This adds a menu item to the extensions menu and the context menu of the settings. :param parent: The parent QObject this is located in. Unused by this particular object. """ QObject.__init__(self, parent) Extension.__init__(self) self.setMenuName( "Ѕettings Guide" ) # Using Cyrillic Ѕ instead of normal S to prevent MacOS detecting the word "setting" and pulling this menu item out of context. self.addMenuItem("Ѕettings Guide", self.startWelcomeGuide) self._dialog = None # Cached instance of the dialogue window. self.definition_container = None # Setting definitions that provide not only the normal settings but also the extra articles added by this guide. self._markdown_per_folder = { } # For each directory containing Markdown files, create one renderer that correctly dereferences images relatively. self.articles = { } # type: Dict[str, Dict[str, List[List[str]]]] # All of the articles by key and language. Key: article ID, value: Dict with language as key and lists of items in each article as value. self.articles_rich_text = { } # type: Dict[str, Dict[str, str]] # For each article and language, the complete Rich Text that should get shown in the tooltip. self.load_definitions() self.article_locations = self.find_articles() self._selected_article_id = "" # Which article is currently shown for the user. Empty string indicates it's the welcome screen. # Add context menu item to the settings list to open the guide for that setting. application = CuraApplication.getInstance() application.getCuraAPI().interface.settings.addContextMenuItem({ "name": "Settings Guide", "icon_name": "help-contents", "actions": ["sidebarMenuItemOnClickHandler"], "menu_item": MenuItemHandler.MenuItemHandler(self) }) preferences = application.getPreferences() preferences.addPreference("settings_guide/language", "cura_default") preferences.addPreference( "settings_guide/show+articles+in+setting+tooltips+%28requires+restart%29", True) preferences.addPreference("settings_guide/window+always+in+front", False) preferences.addPreference("settings_guide/screenshot_tool", False) self.adjust_theme() application.initializationFinished.connect(self.load_all_in_background) application.initializationFinished.connect(self.widen_tooltips)
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) self.addMenuItem("View Active Stack", viewAll) self.addMenuItem("View All Machines", viewAllMachines) self.addMenuItem("View All Materials", viewAllMaterials) self.addMenuItem("View All Qualities", viewAllQualities) self.addMenuItem("View All Quality Changes", viewAllQualityChanges) self.addMenuItem("View All User Containers", viewAllUserContainers) self.addMenuItem("View All Variants", viewAllVariants) self.addMenuItem("View All Stacks", viewAllStacks)
def __init__(self, parent=None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self._controller = CuraApplication.getInstance().getController() self.addMenuItem(catalog.i18nc("@item:inmenu", "Add a cube"), self.addCube) self.addMenuItem(catalog.i18nc("@item:inmenu", "Add a cylinder"), self.addCylinder) self.addMenuItem(catalog.i18nc("@item:inmenu", "Add a sphere"), self.addSphere)
def __init__(self): Extension.__init__(self) QObject.__init__(self) self._scene = Application.getInstance().getController().getScene() self._CTRL = QtCore.Qt.MetaModifier if platform.system() == "Darwin" \ else QtCore.Qt.ControlModifier self._SAVE_MODIFIER = self._CTRL self._RESTORE_MODIFIER = QtCore.Qt.NoModifier self._cameraTrafos = [None] * 10 self._readTrafosFromJson() QtApplication.getInstance().installEventFilter(self)
def __init__(self, application: "CuraApplication") -> None: QObject.__init__(self, parent=application) Extension.__init__(self) self._application = application self.setMenuName("Debug Tools") self.addMenuItem("Dump active machine settings", self._dump_active_machine_settings) self.addMenuItem("Check Print Devices", self._show_print_devices) self._application.initializationFinished.connect( self._onApplicationInitialized)
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) OutputDevicePlugin.__init__(self) self.addMenuItem(catalog.i18n("OctoPrint Servers"), self.showSettingsDialog) self._dialogs = {} self._dialogView = None Preferences.getInstance().addPreference("octoprint/instances", json.dumps({})) self._instances = json.loads( Preferences.getInstance().getValue("octoprint/instances"))
def __init__(self, parent = None): QObject.__init__(self, parent) Extension.__init__(self) self._changelog_window = None self._changelog_context = None version_string = Application.getInstance().getVersion() if version_string is not "master": self._version = Version(version_string) else: self._version = None self._change_logs = None Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated) Preferences.getInstance().addPreference("general/latest_version_changelog_shown", "15.05.90") #First version of CURA with uranium
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) OutputDevicePlugin.__init__(self) self.addMenuItem(catalog.i18n("DuetRRF Connections"), self.showSettingsDialog) self._dialogs = {} self._dialogView = None CuraApplication.getInstance().getPreferences().addPreference( "duetrrf/instances", json.dumps({})) self._instances = json.loads( CuraApplication.getInstance().getPreferences().getValue( "duetrrf/instances"))
def __init__(self, parent = None): QObject.__init__(self, parent) Extension.__init__(self) self._application = Application.getInstance() self._application.getOutputDeviceManager().writeStarted.connect(self._onWriteStarted) self._application.getPreferences().addPreference("info/send_slice_info", True) self._application.getPreferences().addPreference("info/asked_send_slice_info", False) self._more_info_dialog = None self._example_data_content = None self._application.initializationFinished.connect(self._onAppInitialized)
def __init__(self, parent = None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self._application = CuraApplication.getInstance() self.addMenuItem(catalog.i18nc("@item:inmenu", "Set name options"), self.showNameDialog) self._prefix_dialog = None # type: Optional[QObject] self._print_information_patches = None # type: Optional[PrintInformationPatches.PrintInformationPatches] self._output_device_patcher = OutputDevicePatcher.OutputDevicePatcher() self._application.engineCreatedSignal.connect(self._onEngineCreated) self._application.globalContainerStackChanged.connect(self._onGlobalStackChanged)
def __init__(self, parent = None): QObject.__init__(self, parent) Extension.__init__(self) self._changelog_window = None self._changelog_context = None version_string = Application.getInstance().getVersion() if version_string is not "master": self._version = Version(version_string) else: self._version = None self._change_logs = None Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated) Preferences.getInstance().addPreference("general/latest_version_changelog_shown", "2.0.0") #First version of CURA with uranium //self.addMenuItem(catalog.i18nc("@item:inmenu", "Show Changelog"), self.showChangelog)
def __init__(self, parent = None): QObject.__init__(self, parent) Extension.__init__(self) self._changelog_window = None self._changelog_context = None version_string = Application.getInstance().getVersion() if version_string is not "master": self._current_app_version = Version(version_string) else: self._current_app_version = None self._change_logs = None Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated) Application.getInstance().getPreferences().addPreference("general/latest_version_changelog_shown", "2.0.0") #First version of CURA with uranium self.addMenuItem(catalog.i18nc("@item:inmenu", "Show Changelog"), self.showChangelog)
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) self._changelog_window = None self._changelog_context = None version_string = Application.getInstance().getVersion() if version_string is not "master": self._version = Version(version_string) else: self._version = None self._change_logs = None Application.getInstance().engineCreatedSignal.connect( self._onEngineCreated) Preferences.getInstance().addPreference( "general/latest_version_changelog_shown", "15.05.90") #First version of CURA with uranium
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) Application.getInstance().getOutputDeviceManager( ).writeStarted.connect(self._onWriteStarted) Application.getInstance().getPreferences().addPreference( "info/send_slice_info", True) Application.getInstance().getPreferences().addPreference( "info/asked_send_slice_info", False) self._more_info_dialog = None self._example_data_content = None if not Application.getInstance().getPreferences().getValue( "info/asked_send_slice_info"): self.send_slice_info_message = Message(catalog.i18nc( "@info", "Continuum collects anonymized usage statistics."), lifetime=0, dismissable=False, title=catalog.i18nc( "@info:title", "Collecting Data")) self.send_slice_info_message.addAction( "MoreInfo", name=catalog.i18nc("@action:button", "More info"), icon=None, description=catalog.i18nc( "@action:tooltip", "See more information on what data Cura sends."), button_style=Message.ActionButtonStyle.LINK) self.send_slice_info_message.addAction( "Dismiss", name=catalog.i18nc("@action:button", "Allow"), icon=None, description=catalog.i18nc( "@action:tooltip", "Allow Continuum to send anonymized usage statistics to help prioritize future improvements to Cura. Some of your preferences and settings are sent, the Cura version and a hash of the models you're slicing." )) self.send_slice_info_message.actionTriggered.connect( self.messageActionTriggered) self.send_slice_info_message.show() Application.getInstance().initializationFinished.connect( self._onAppInitialized)
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) Application.getInstance().getPreferences().addPreference( "gcode_filename_format_plus/filename_format", DEFAULT_FILENAME_FORMAT) self.setMenuName("Gcode Filename Format Plus") self.addMenuItem("Edit Format", self.editFormat) self.format_window = None self.addMenuItem("Help", self.help) self.help_window = None self._application = CuraApplication.getInstance() self._print_information = None self._application.engineCreatedSignal.connect(self._onEngineCreated)
def __init__(self, parent = None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self._Section ="" self._application = Application.getInstance() self._preferences = self._application.getPreferences() self._preferences.addPreference("import_export_tools/dialog_path", "") self.Major=1 self.Minor=0 # Test version for futur release 4.9 # Logger.log('d', "Info Version CuraVersion --> " + str(Version(CuraVersion))) Logger.log('d', "Info CuraVersion --> " + str(CuraVersion)) if "master" in CuraVersion : # Master is always a developement version. self.Major=4 self.Minor=20 else: try: self.Major = int(CuraVersion.split(".")[0]) self.Minor = int(CuraVersion.split(".")[1]) except: pass # Thanks to Aldo Hoeben / fieldOfView for this code # QFileDialog.Options if VERSION_QT5: self._dialog_options = QFileDialog.Options() if sys.platform == "linux" and "KDE_FULL_SESSION" in os.environ: self._dialog_options |= QFileDialog.DontUseNativeDialog else: self._dialog_options = None self.setMenuName(catalog.i18nc("@item:inmenu", "Import Export Profiles")) self.addMenuItem(catalog.i18nc("@item:inmenu", "Export current profile"), self.exportData) self.addMenuItem("", lambda: None) self.addMenuItem(catalog.i18nc("@item:inmenu", "Merge a profile"), self.importData)
def __init__(self, parent = None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self.setMenuName(i18n_catalog.i18nc("@item:inmenu", "Post Processing")) self.addMenuItem(i18n_catalog.i18nc("@item:inmenu", "Modify G-Code"), self.showPopup) self._view = None # Loaded scripts are all scripts that can be used self._loaded_scripts = {} # type: Dict[str, Type[Script]] self._script_labels = {} # type: Dict[str, str] # Script list contains instances of scripts in loaded_scripts. # There can be duplicates, which will be executed in sequence. self._script_list = [] # type: List[Script] self._selected_script_index = -1 Application.getInstance().getOutputDeviceManager().writeStarted.connect(self.execute) Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged) # When the current printer changes, update the list of scripts. CuraApplication.getInstance().mainWindowChanged.connect(self._createView) # When the main window is created, create the view so that we can display the post-processing icon if necessary.
def __init__(self, parent=None): QObject.__init__(self, parent) Extension.__init__(self) if SettingVisibilityPreset == None: Logger.log( "e", "The plugin is not compatible with this version of Cura") return self._application = CuraApplication.getInstance() self.setMenuName( catalog.i18nc("@item:inmenu", "Custom Setting Visibility Sets")) self.addMenuItem( catalog.i18nc("@item:inmenu", "Store Custom Setting Visibility Set"), self.showNameDialog) self._create_profile_window = None
def __init__(self, parent = None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self._application = CuraApplication.getInstance() self._controller = self._application.getController() self._application.engineCreatedSignal.connect(self._onEngineCreated) self._application.fileLoaded.connect(self._onFileLoaded) self._application.fileCompleted.connect(self._onFileCompleted) self._controller.getScene().sceneChanged.connect(self._onSceneChanged) self._currently_loading_files = [] #type: List[str] self._node_queue = [] #type: List[SceneNode] self._mesh_not_watertight_messages = {} #type: Dict[str, Message] self._settings_dialog = None self._rename_dialog = None self._preferences = self._application.getPreferences() self._preferences.addPreference("meshtools/check_models_on_load", True) self._preferences.addPreference("meshtools/fix_normals_on_load", False) self._preferences.addPreference("meshtools/randomise_location_on_load", False) self._preferences.addPreference("meshtools/model_unit_factor", 1) self.addMenuItem(catalog.i18nc("@item:inmenu", "Reload model"), self.reloadMesh) self.addMenuItem(catalog.i18nc("@item:inmenu", "Rename model..."), self.renameMesh) self.addMenuItem(catalog.i18nc("@item:inmenu", "Replace models..."), self.replaceMeshes) self.addMenuItem("", lambda: None) self.addMenuItem(catalog.i18nc("@item:inmenu", "Check models"), self.checkMeshes) self.addMenuItem(catalog.i18nc("@item:inmenu", "Analyse models"), self.analyseMeshes) self.addMenuItem(catalog.i18nc("@item:inmenu", "Fix simple holes"), self.fixSimpleHolesForMeshes) self.addMenuItem(catalog.i18nc("@item:inmenu", "Fix model normals"), self.fixNormalsForMeshes) self.addMenuItem(catalog.i18nc("@item:inmenu", "Split model into parts"), self.splitMeshes) self.addMenuItem(" ", lambda: None) self.addMenuItem(catalog.i18nc("@item:inmenu", "Randomise location"), self.randomiseMeshLocation) self.addMenuItem(catalog.i18nc("@item:inmenu", "Apply transformations to mesh"), self.bakeMeshTransformation) self.addMenuItem(catalog.i18nc("@item:inmenu", "Reset origin to center of mesh"), self.resetMeshOrigin) self.addMenuItem(" ", lambda: None) self.addMenuItem(catalog.i18nc("@item:inmenu", "Mesh Tools settings..."), self.showSettingsDialog) self._message = Message(title=catalog.i18nc("@info:title", "Mesh Tools")) self._additional_menu = None # type: Optional[QObject]
def __init__(self, parent = None): QObject.__init__(self, parent) SignalEmitter.__init__(self) OutputDevicePlugin.__init__(self) Extension.__init__(self) self._serial_port_list = [] self._printer_connections = {} self._printer_connections_model = None self._update_thread = threading.Thread(target = self._updateThread) self._update_thread.setDaemon(True) self._check_updates = True self._firmware_view = None ## Add menu item to top menu of the application. self.setMenuName(i18n_catalog.i18nc("@title:menu","Firmware")) self.addMenuItem(i18n_catalog.i18nc("@item:inmenu", "Update Firmware"), self.updateAllFirmware) Application.getInstance().applicationShuttingDown.connect(self.stop) self.addConnectionSignal.connect(self.addConnection) #Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
def __init__(self, parent = None) -> None: #Logger.log("d","Initializing CuraSnapmakerSenderPlugin") Extension.__init__(self) QObject.__init__(self) self.setMenuName(i18n_catalog.i18nc("@item:inmenu", "CuraSnapmakerSender")) self.addMenuItem(i18n_catalog.i18nc("@item:inmenu", "Settings"), self.showSettings) self._view = None self.setPluginId("CuraSnapmakerSender") Application.getInstance().mainWindowChanged.connect(self.afterInit) Application.getInstance().applicationShuttingDown.connect(self.stop) self._settingsWindow = None self.settings = dict() self.settings["AutoDiscover"] = True self.settings["machines"] = list() self._active_added_Printers = list() self._active_discovered_Printers = list() self._tokenregistry = dict() self._stop_discovery_running = threading.Event() self._stop_discovery_running.clear() self._discoveryThread = None self._stop_discovery_event = threading.Event()
def __init__(self, parent=None): QObject.__init__(self, parent) SignalEmitter.__init__(self) OutputDevicePlugin.__init__(self) Extension.__init__(self) self._serial_port_list = [] self._printer_connections = {} self._printer_connections_model = None self._update_thread = threading.Thread(target=self._updateThread) self._update_thread.setDaemon(True) self._check_updates = True self._firmware_view = None self.updatetrigger = False # Add menu item to top menu of the application. self.setMenuName(i18n_catalog.i18nc("@title:menu", "Doodle3D")) self.addMenuItem(i18n_catalog.i18nc("@item:inlistbox", "Enable Scan devices..."), self.updateAllFirmware) Application.getInstance().applicationShuttingDown.connect(self.stop) self.addConnectionSignal.connect(self.addConnection)
def __init__(self, parent: Optional[QObject] = None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self._window: Optional["QObject"] = None # If the window has been loaded yet, it'll be cached in here. self._plugin_registry: Optional[PluginRegistry] = None self._package_manager = CuraApplication.getInstance().getPackageManager() self._material_package_list: Optional[RemotePackageList] = None self._plugin_package_list: Optional[RemotePackageList] = None # Not entirely the cleanest code, since the localPackage list also checks the server if there are updates # Since that in turn will trigger notifications to be shown, we do need to construct it here and make sure # that it checks for updates... preferences = CuraApplication.getInstance().getPreferences() preferences.addPreference("info/automatic_plugin_update_check", True) self._local_package_list = LocalPackageList(self) if preferences.getValue("info/automatic_plugin_update_check"): self._local_package_list.checkForUpdates(self._package_manager.local_packages) self._package_manager.installedPackagesChanged.connect(self.checkIfRestartNeeded) self._tab_shown: int = 0 self._restart_needed = False
def test_menuName(): test_extension = Extension() assert test_extension.getMenuName() is None test_extension.setMenuName("bloop") assert test_extension.getMenuName() == "bloop"