Python PyQt5.QtCore.QTimer() Examples

The following are 30 code examples of PyQt5.QtCore.QTimer(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtCore , or try the search function .
Example #1
Source File: rawscriptsmenu.py    From Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader with MIT License 8 votes vote down vote up
def __init__(self, username):
        QWidget.__init__(self)
        uic.loadUi("UI/rawscripts.ui", self)
        self.setWindowTitle("Script Select Menu")
        self.loggedinas.setText("Logged in as: %s" % username)
        self.treeWidget.currentItemChanged.connect(self.changeSelected)
        self.startEditing.clicked.connect(self.startVideoEditor)
        self.refreshScripts.clicked.connect(self.refreshScriptsRequest)
        self.flagQuality.clicked.connect(lambda : self.flagScript("QUALITY"))
        self.addscript.clicked.connect(self.addScriptFromURL)
        self.update_table.connect(self.updateColors)
        self.add_url_response.connect(self.addedNewScript)
        self.reset_editing_status.connect(self.resetEditingStatus)
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.updateTime)
        self.timer.start(4000)
        self.currentScriptSelected = None
        self.isEditing = False 
Example #2
Source File: first.py    From FIRST-plugin-ida with GNU General Public License v2.0 7 votes vote down vote up
def __init__(self, parent, dialog, **kwargs):
            super(FIRSTUI.Dialog, self).__init__(parent)
            self.parent = parent
            self.data = None


            self.ui = dialog(**kwargs)
            self.ui.setupUi(self)

            self.should_show = self.ui.should_show

            self.accepted.connect(self.success_callback)
            self.rejected.connect(self.reject_callback)
            self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)

            self.hide_attempts = 0
            self.timer = QtCore.QTimer()
            self.timer.timeout.connect(self.__hide)
            self.timer.start(500) 
Example #3
Source File: pkmixins.py    From pkmeter with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def attribute_iter(self, data, value):
        count = 0
        length = len(value) if value else 0
        for i in range(length):
            count += 1
            subwidget = self._get_subwidget(i)
            data['this'] = value[i]
            for action in subwidget.actions:
                action.apply(data)
            if self.itermax and i >= self.itermax-1:
                break
        for subwidget in self.subwidgets[count:]:
            utils.remove_widget(subwidget)
        self.subwidgets = self.subwidgets[:count]
        timer = QtCore.QTimer()
        timer.singleShot(10, self.control.resize_to_min) 
Example #4
Source File: spool.py    From kite with GNU General Public License v3.0 6 votes vote down vote up
def progressStarted(self, args):
        if self.progress.isVisible():
            return

        nargs = len(args)

        text = args[0]
        maximum = 0 if nargs < 2 else args[1]
        progress_func = None if nargs < 3 else args[2]

        self.progress.setWindowTitle('Processing...')
        self.progress.setLabelText(text)
        self.progress.setMaximum(maximum)
        self.progress.setValue(0)

        @QtCore.pyqtSlot()
        def updateProgress():
            if progress_func:
                self.progress.setValue(progress_func())

        self.progress_timer = QtCore.QTimer()
        self.progress_timer.timeout.connect(updateProgress)
        self.progress_timer.start(250)

        self.progress.show() 
Example #5
Source File: player.py    From MusicBox with MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(DesktopLyric, self).__init__()
        self.lyric = QString('Lyric Show.')
        self.intervel = 0
        self.maskRect = QRectF(0, 0, 0, 0)
        self.maskWidth = 0
        self.widthBlock = 0
        self.t = QTimer()
        self.screen = QApplication.desktop().availableGeometry()
        self.setObjectName(_fromUtf8("Dialog"))
        self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.Tool)
        self.setMinimumHeight(65)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.handle = lyric_handle(self)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.font = QFont(_fromUtf8('微软雅黑, verdana'), 50)
        self.font.setPixelSize(50)
        # QMetaObject.connectSlotsByName(self)
        self.handle.lyricmoved.connect(self.newPos)
        self.t.timeout.connect(self.changeMask) 
Example #6
Source File: ModelChecker.py    From Cura with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self):
        super().__init__()

        self._button_view = None

        self._caution_message = Message("", #Message text gets set when the message gets shown, to display the models in question.
            lifetime = 0,
            title = catalog.i18nc("@info:title", "3D Model Assistant"))

        self._change_timer = QTimer()
        self._change_timer.setInterval(200)
        self._change_timer.setSingleShot(True)
        self._change_timer.timeout.connect(self.onChanged)

        Application.getInstance().initializationFinished.connect(self._pluginsInitialized)
        Application.getInstance().getController().getScene().sceneChanged.connect(self._onChanged)
        Application.getInstance().globalContainerStackChanged.connect(self._onChanged) 
Example #7
Source File: RTTView.py    From JRTTView with MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(RTTView, self).__init__(parent)
        
        uic.loadUi('RTTView.ui', self)

        self.initSetting()

        self.initQwtPlot()

        self.rcvbuff = b''
        
        self.tmrRTT = QtCore.QTimer()
        self.tmrRTT.setInterval(10)
        self.tmrRTT.timeout.connect(self.on_tmrRTT_timeout)
        self.tmrRTT.start()

        self.tmrRTT_Cnt = 0 
Example #8
Source File: optionwidgets.py    From kawaii-player with GNU General Public License v3.0 6 votes vote down vote up
def info_preview(self, command, picn, length, change_aspect, tsec, counter, x, y, use_existing=None, lock=None):
        if self.preview_process.processId() != 0:
            self.preview_process.kill()
        if self.preview_process.processId() == 0 and lock is False and not use_existing:
            ui.logger.debug('\npreview_generating - {} - {}\n'.format(length, tsec))
            self.preview_process = QtCore.QProcess()
            self.preview_process.finished.connect(partial(self.preview_generated, picn, length, change_aspect, tsec, counter, x, y))
            QtCore.QTimer.singleShot(1, partial(self.preview_process.start, command))
        elif use_existing:
            newpicn = os.path.join(self.preview_dir, "{}.jpg".format(int(tsec)))
            if ui.live_preview == 'fast':
                self.apply_pic(newpicn, x, y, length)
                ui.logger.debug('\n use existing preview image \n')
            else:
                self.preview_process = QtCore.QProcess()
                command = 'echo "hello"'
                self.preview_process.finished.connect(partial(self.preview_generated, picn, length, change_aspect, tsec, counter, x, y))
                QtCore.QTimer.singleShot(1, partial(self.preview_process.start, command)) 
Example #9
Source File: app.py    From bitmask-dev with GNU General Public License v3.0 6 votes vote down vote up
def shutdown(self, *args):
        global bitmaskd
        if self.closing:
            return
        self.closing = True

        bitmaskd.join()
        terminate(pid)
        cleanup()
        print('[bitmask] shutting down gui...')

        try:
            self.stop()
            try:
                global pixbrowser
                pixbrowser.stop()
                del pixbrowser
            except:
                pass
            QtCore.QTimer.singleShot(0, qApp.deleteLater)

        except Exception as ex:
            print('exception catched: %r' % ex)
            sys.exit(1) 
Example #10
Source File: SettingInheritanceManager.py    From Cura with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, parent = None) -> None:
        super().__init__(parent)

        self._global_container_stack = None  # type: Optional[ContainerStack]
        self._settings_with_inheritance_warning = []  # type: List[str]
        self._active_container_stack = None  # type: Optional[ExtruderStack]

        self._update_timer = QTimer()
        self._update_timer.setInterval(500)
        self._update_timer.setSingleShot(True)
        self._update_timer.timeout.connect(self._update)

        Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged)
        ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged)
        self._onGlobalContainerChanged()
        self._onActiveExtruderChanged() 
Example #11
Source File: player_functions.py    From kawaii-player with GNU General Public License v3.0 6 votes vote down vote up
def qmsg_message(txt):
    print(txt)
    #root = tkinter.Tk()
    #width = root.winfo_screenwidth()
    #height = root.winfo_screenheight()
    #print(width, height, '--screen--tk--')
    msg = QtWidgets.QMessageBox()
    msg.setGeometry(0, 0, 50, 20)
    #msg.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
    msg.setWindowModality(QtCore.Qt.NonModal)
    msg.setWindowTitle("Kawaii-Player MessageBox")
    
    msg.setIcon(QtWidgets.QMessageBox.Information)
    msg.setText(txt+'\n\n(Message Will Autohide in 5 seconds)')
    msg.show()
    
    frame_timer = QtCore.QTimer()
    frame_timer.timeout.connect(lambda x=0: frame_options(msg))
    frame_timer.setSingleShot(True)
    frame_timer.start(5000)
    msg.exec_() 
Example #12
Source File: server_monitor.py    From imperialism-remake with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.layout = QtWidgets.QVBoxLayout(self)

        self.status = QtWidgets.QLabel('No information yet.')
        self.layout.addWidget(self.status)
        self.layout.addStretch()

        local_network_client.connect_to_channel(constants.C.SYSTEM, self.update_monitor)

        # one initial update
        self.request_monitor_update()

        # set timer for following updates
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.request_monitor_update)
        self.timer.setInterval(10000)
        self.timer.start() 
Example #13
Source File: qt.py    From imperialism-remake with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        """
        We initialize the timer and set the update interval (one minute) and start it and update the clock at least
        once.
        """
        super().__init__(*args, **kwargs)

        # customize format if desired (https://docs.python.org/3.5/library/datetime.html#strftime-strptime-behavior)
        self.time_format = '%H:%M'

        # initial update
        self.update_clock()

        # create and start timer for all following updates
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update_clock)
        self.timer.setInterval(60000)
        self.timer.start() 
Example #14
Source File: messageview.py    From qutebrowser with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        self._messages = []  # type: typing.MutableSequence[Message]
        self._vbox = QVBoxLayout(self)
        self._vbox.setContentsMargins(0, 0, 0, 0)
        self._vbox.setSpacing(0)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        self._clear_timer = QTimer()
        self._clear_timer.timeout.connect(self.clear_messages)
        config.instance.changed.connect(self._set_clear_timer_interval)

        self._last_text = None 
Example #15
Source File: GlobalStacksModel.py    From Cura with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, parent = None) -> None:
        super().__init__(parent)

        self._catalog = i18nCatalog("cura")

        self.addRoleName(self.NameRole, "name")
        self.addRoleName(self.IdRole, "id")
        self.addRoleName(self.HasRemoteConnectionRole, "hasRemoteConnection")
        self.addRoleName(self.MetaDataRole, "metadata")
        self.addRoleName(self.DiscoverySourceRole, "discoverySource")

        self._change_timer = QTimer()
        self._change_timer.setInterval(200)
        self._change_timer.setSingleShot(True)
        self._change_timer.timeout.connect(self._update)

        # Listen to changes
        CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged)
        CuraContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged)
        CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged)
        self._updateDelayed() 
Example #16
Source File: CuraSplashScreen.py    From Cura with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self):
        super().__init__()
        self._scale = 0.7
        self._version_y_offset = 0  # when extra visual elements are in the background image, move version text down

        if ApplicationMetadata.IsEnterpriseVersion:
            splash_image = QPixmap(Resources.getPath(Resources.Images, "cura_enterprise.png"))
            self._version_y_offset = 26
        else:
            splash_image = QPixmap(Resources.getPath(Resources.Images, "cura.png"))

        self.setPixmap(splash_image)

        self._current_message = ""

        self._loading_image_rotation_angle = 0

        self._to_stop = False
        self._change_timer = QTimer()
        self._change_timer.setInterval(50)
        self._change_timer.setSingleShot(False)
        self._change_timer.timeout.connect(self.updateLoadingImage)

        self._last_update_time = None 
Example #17
Source File: autodocwidget.py    From PyPipboyApp with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, startEnabled, startSetting, startLimit, formID):
        self.Enabled = startEnabled
        self.Setting = startSetting
        self.Limit = startLimit
        self.FormID = formID
        
        self.Num = 0
        self.Active = False
        
        self.UseFlag = False
        self.UseTimer = QtCore.QTimer()
        self.UseTimer.setSingleShot(True)
        self.UseTimer.timeout.connect(self.UseTimerTimeout)
        self.UseTimerDelay = 2000
        
        self.FreezeUseFlag = False 
Example #18
Source File: matplotlib_renderer.py    From MDT with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, controller):
        self.controller = controller

        self._start_x = 0
        self._start_y = 0
        self._end_x = 0
        self._end_y = 0

        self._drag_timer = QTimer()
        self._drag_timer.timeout.connect(self._perform_drag)
        self._drag_timer.timeout.connect(self._drag_timer.stop) 
Example #19
Source File: globalmapwidget.py    From PyPipboyApp with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, handle, controller, parent):
        super().__init__('Global Map', parent)
        self.basepath = handle.basepath
        self.controller = controller
        self.widget = uic.loadUi(os.path.join(self.basepath, 'ui', 'globalmapwidget.ui'))
        self.setWidget(self.widget)
        self._logger = logging.getLogger('pypipboyapp.map.globalmap')
        self.mapZoomLevel = 1.0
        self.characterDataManager = None
        self.collectablesNearPlayer = []
        self.collectableNearSoundEffects = {}
        self.collectableNearUpdateTimer = QtCore.QTimer() 
Example #20
Source File: qt_main.py    From MDT with GNU Lesser General Public License v3.0 5 votes vote down vote up
def start_gui(base_dir=None, app_exec=True):
    """Start the model fitting GUI.

    Args:
        base_dir (str): the starting directory for the file opening actions
        app_exec (boolean): if true we execute the Qt application, set to false to disable.
    """
    try:
        mdt.configuration.load_user_gui()
    except IOError:
        pass

    enable_pyqt_exception_hook()

    app = QtManager.get_qt_application_instance()

    state = SharedState()
    state.base_dir = base_dir

    computations_thread = ComputationsThread()
    computations_thread.start()

    # catches the sigint
    timer = QTimer()
    timer.start(500)
    timer.timeout.connect(lambda: None)

    composite_model_gui = MDTGUISingleModel(state, computations_thread)
    signal.signal(signal.SIGINT, composite_model_gui.send_sigint)

    center_window(composite_model_gui)
    composite_model_gui.show()

    QtManager.add_window(composite_model_gui)
    if app_exec:
        QtManager.exec_() 
Example #21
Source File: matplotlib_renderer.py    From MDT with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, controller):
        self.controller = controller

        self._scrolls = 0

        self._scroll_timer = QTimer()
        self._scroll_timer.timeout.connect(self._perform_scroll)
        self._scroll_timer.timeout.connect(self._scroll_timer.stop) 
Example #22
Source File: DiscoveredPrintersModel.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None:
        super().__init__(parent)

        self._application = application
        self._discovered_printer_by_ip_dict = dict()  # type: Dict[str, DiscoveredPrinter]

        self._plugin_for_manual_device = None  # type: Optional[OutputDevicePlugin]
        self._network_plugin_queue = []  # type: List[OutputDevicePlugin]
        self._manual_device_address = ""

        self._manual_device_request_timeout_in_seconds = 5  # timeout for adding a manual device in seconds
        self._manual_device_request_timer = QTimer()
        self._manual_device_request_timer.setInterval(self._manual_device_request_timeout_in_seconds * 1000)
        self._manual_device_request_timer.setSingleShot(True)
        self._manual_device_request_timer.timeout.connect(self._onManualRequestTimeout) 
Example #23
Source File: ConvexHullDecorator.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def createRecomputeConvexHullTimer(self) -> None:
        self._recompute_convex_hull_timer = QTimer()
        self._recompute_convex_hull_timer.setInterval(200)
        self._recompute_convex_hull_timer.setSingleShot(True)
        self._recompute_convex_hull_timer.timeout.connect(self.recomputeConvexHull) 
Example #24
Source File: webengine_process.py    From openconnect-sso with GNU General Public License v3.0 5 votes vote down vote up
def run(self):
        # To work around funky GC conflicts with C++ code by ensuring QApplication terminates last
        global app
        cfg = config.load()

        argv = sys.argv.copy()
        if self.display_mode == config.DisplayMode.HIDDEN:
            argv += ["-platform", "minimal"]
        app = QApplication(argv)

        # In order to make Python able to handle signals
        force_python_execution = QTimer()
        force_python_execution.start(200)

        def ignore():
            pass

        force_python_execution.timeout.connect(ignore)
        web = WebBrowser(cfg.auto_fill_rules, self._states.put)

        startup_info = self._commands.get()
        logger.info("Browser started", startup_info=startup_info)

        logger.info("Loading page", url=startup_info.url)

        web.authenticate_at(QUrl(startup_info.url), startup_info.credentials)

        web.show()
        rc = app.exec_()

        logger.info("Exiting browser")
        return rc 
Example #25
Source File: AutoSave.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, application: "CuraApplication") -> None:
        self._application = application
        self._application.getPreferences().preferenceChanged.connect(self._triggerTimer)

        self._global_stack = None

        self._application.getPreferences().addPreference("cura/autosave_delay", 1000 * 10)

        self._change_timer = QTimer()
        self._change_timer.setInterval(int(self._application.getPreferences().getValue("cura/autosave_delay")))
        self._change_timer.setSingleShot(True)

        self._enabled = True
        self._saving = False 
Example #26
Source File: QualityProfilesDropDownMenuModel.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, parent = None):
        super().__init__(parent)

        self.addRoleName(self.NameRole, "name")
        self.addRoleName(self.QualityTypeRole, "quality_type")
        self.addRoleName(self.LayerHeightRole, "layer_height")
        self.addRoleName(self.LayerHeightUnitRole, "layer_height_unit")
        self.addRoleName(self.AvailableRole, "available") #Whether the quality profile is available in our current nozzle + material.
        self.addRoleName(self.QualityGroupRole, "quality_group")
        self.addRoleName(self.QualityChangesGroupRole, "quality_changes_group")
        self.addRoleName(self.IsExperimentalRole, "is_experimental")

        application = cura.CuraApplication.CuraApplication.getInstance()
        machine_manager = application.getMachineManager()

        application.globalContainerStackChanged.connect(self._onChange)
        machine_manager.activeQualityGroupChanged.connect(self._onChange)
        machine_manager.activeMaterialChanged.connect(self._onChange)
        machine_manager.activeVariantChanged.connect(self._onChange)
        machine_manager.extruderChanged.connect(self._onChange)

        extruder_manager = application.getExtruderManager()
        extruder_manager.extrudersChanged.connect(self._onChange)

        self._layer_height_unit = ""  # This is cached

        self._update_timer = QTimer()  # type: QTimer
        self._update_timer.setInterval(100)
        self._update_timer.setSingleShot(True)
        self._update_timer.timeout.connect(self._update)

        self._onChange() 
Example #27
Source File: IntentCategoryModel.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, intent_category: str) -> None:
        """Creates a new model for a certain intent category.

        :param intent_category: category to list the intent profiles for.
        """

        super().__init__()
        self._intent_category = intent_category

        self.addRoleName(self.NameRole, "name")
        self.addRoleName(self.IntentCategoryRole, "intent_category")
        self.addRoleName(self.WeightRole, "weight")
        self.addRoleName(self.QualitiesRole, "qualities")
        self.addRoleName(self.DescriptionRole, "description")

        application = cura.CuraApplication.CuraApplication.getInstance()

        ContainerRegistry.getInstance().containerAdded.connect(self._onContainerChange)
        ContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChange)
        machine_manager = cura.CuraApplication.CuraApplication.getInstance().getMachineManager()
        machine_manager.activeMaterialChanged.connect(self.update)
        machine_manager.activeVariantChanged.connect(self.update)
        machine_manager.extruderChanged.connect(self.update)

        extruder_manager = application.getExtruderManager()
        extruder_manager.extrudersChanged.connect(self.update)

        self._update_timer = QTimer()
        self._update_timer.setInterval(500)
        self._update_timer.setSingleShot(True)
        self._update_timer.timeout.connect(self._update)

        self.update() 
Example #28
Source File: ExtrudersModel.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, parent = None):
        """Initialises the extruders model, defining the roles and listening for changes in the data.

        :param parent: Parent QtObject of this list.
        """

        super().__init__(parent)

        self.addRoleName(self.IdRole, "id")
        self.addRoleName(self.NameRole, "name")
        self.addRoleName(self.EnabledRole, "enabled")
        self.addRoleName(self.ColorRole, "color")
        self.addRoleName(self.IndexRole, "index")
        self.addRoleName(self.DefinitionRole, "definition")
        self.addRoleName(self.MaterialRole, "material")
        self.addRoleName(self.VariantRole, "variant")
        self.addRoleName(self.StackRole, "stack")
        self.addRoleName(self.MaterialBrandRole, "material_brand")
        self.addRoleName(self.ColorNameRole, "color_name")
        self._update_extruder_timer = QTimer()
        self._update_extruder_timer.setInterval(100)
        self._update_extruder_timer.setSingleShot(True)
        self._update_extruder_timer.timeout.connect(self.__updateExtruders)

        self._active_machine_extruders = []  # type: Iterable[ExtruderStack]
        self._add_optional_extruder = False

        # Listen to changes
        Application.getInstance().globalContainerStackChanged.connect(self._extrudersChanged)  # When the machine is swapped we must update the active machine extruders
        Application.getInstance().getExtruderManager().extrudersChanged.connect(self._extrudersChanged)  # When the extruders change we must link to the stack-changed signal of the new extruder
        Application.getInstance().getContainerRegistry().containerMetaDataChanged.connect(self._onExtruderStackContainersChanged)  # When meta data from a material container changes we must update
        self._extrudersChanged()  # Also calls _updateExtruders 
Example #29
Source File: MultiBuildPlateModel.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, parent = None):
        super().__init__(parent)

        self._update_timer = QTimer()
        self._update_timer.setInterval(100)
        self._update_timer.setSingleShot(True)
        self._update_timer.timeout.connect(self._updateSelectedObjectBuildPlateNumbers)

        self._application = Application.getInstance()
        self._application.getController().getScene().sceneChanged.connect(self._updateSelectedObjectBuildPlateNumbersDelayed)
        Selection.selectionChanged.connect(self._updateSelectedObjectBuildPlateNumbers)

        self._max_build_plate = 1  # default
        self._active_build_plate = -1 
Example #30
Source File: MachineErrorChecker.py    From Cura with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: Optional[QObject] = None) -> None:
        super().__init__(parent)

        self._global_stack = None

        self._has_errors = True  # Result of the error check, indicating whether there are errors in the stack
        self._error_keys = set()  # type: Set[str] # A set of settings keys that have errors
        self._error_keys_in_progress = set()  # type: Set[str]  # The variable that stores the results of the currently in progress check

        self._stacks_and_keys_to_check = None  # type: Optional[deque]  # a FIFO queue of tuples (stack, key) to check for errors

        self._need_to_check = False  # Whether we need to schedule a new check or not. This flag is set when a new
                                     # error check needs to take place while there is already one running at the moment.
        self._check_in_progress = False  # Whether there is an error check running in progress at the moment.

        self._application = cura.CuraApplication.CuraApplication.getInstance()
        self._machine_manager = self._application.getMachineManager()

        self._start_time = 0.  # measure checking time

        # This timer delays the starting of error check so we can react less frequently if the user is frequently
        # changing settings.
        self._error_check_timer = QTimer(self)
        self._error_check_timer.setInterval(100)
        self._error_check_timer.setSingleShot(True)

        self._keys_to_check = set()  # type: Set[str]