def __init__(self, watch_file): QObject.__init__(self) self.os_name = system().lower() self.watch_file = os.path.realpath(watch_file) self.folder = os.path.split(watch_file)[0] self.u_qmltypes = () self.u_qmltypes_map = {} # add permission if self.os_name != 'windows': # add permissions os.system(f'chmod +rw {self.folder}') self.filename = os.path.join(self.folder, '00001000.qml') self.show_props = False self.old_code = '' self.old_props = '' self.old_qmltypes_codes = {} self.new_qmltypes_files = {} self.not_closed = True self._initialiase()
def __setstate__(self, state: Dict[str, Any]) -> None: """For pickle support""" # We need to call QObject.__init__() in order to initialize the underlying C++ object. # pickle doesn't do that so we have to do this here. QObject.__init__(self, parent=None) self.__dict__.update(state)
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 __init__(self, size=10 * 1024 * 1024): QObject.__init__(self) self._state = QWebEngineDownloadRequest.DownloadState.DownloadRequested self._received = self._total = -1 FakeDownloadItem.idc += 1 self._id = FakeDownloadItem.idc self._size = size self.fname = '%s.epub' % self.id() self.mimeType = lambda: mimetypes.guess_type(self.fname)[0] QTimer.singleShot(100, self._tick)
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.addMenuItem("Рreferences", lambda: self.startWelcomeGuideAndSelectArticle("preferences")) 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.articles_source = {} # type: Dict[str, Dict[str, str]] # For each article and language, the original Markdown source the article is derived from. 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. self.completed_loading = False # Only after loading is completed can we set the tooltips. # 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) application.globalContainerStackChanged.connect(self.set_tooltips)
def __init__(self, parent=None) -> None: QObject.__init__(self, parent) Extension.__init__(self) self._application = CuraApplication.getInstance() self._qml_folder = "qml" if not USE_QT5 else "qml_qt5" 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) -> 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) -> None: PluginObject.__init__(self) QObject.__init__(self) self.menu_item_display_text = None # type: Optional[str] """ Text that will be displayed as an option in the Open File(s) menu. """ self.shortcut = None # type: Optional[str] """ Shortcut key combination (e.g. "Ctrl+O"). """ self.enabled = True """ If the provider is not enabled, it should not be displayed in the interface. """ self.priority = 0 """
def __init__(self, icon_name='busy.svg', icon_size=24, duration=2, frames=120, parent=None): QObject.__init__(self, parent) pmap = get_icon(icon_name).pixmap(icon_size, icon_size) self.interval = duration * 1000 // frames self.timer = t = QTimer(self) t.setInterval(self.interval) t.timeout.connect(self.do_update) self.frame_number = 0 self.frames = [] angle_delta = 360 / frames angle = -angle_delta for i in range(frames): angle += angle_delta p = pmap if angle: p = self.rotated_by(pmap, angle) self.frames.append(p)
def __init__(self, parent=None): QObject.__init__(self, parent) self.items = [] self.tabrefs = [] self._has_active_downloads = False
def __init__(self, val): QObject.__init__(self) self.val = val