def __init__(self): QObject.__init__(self) self._action = core.actionManager().addAction("mSettings/aSettings", _tr("Settings.."), QIcon(':/enkiicons/settings.png')) self._action.setStatusTip(_tr("Edit settigns..")) self._action.triggered.connect(self._onEditSettings)
def __init__(self, parent=None): QObject.__init__(self, parent) self._keyboard_state = {} # connect signals to handlers KeySignalEmitter.instance().key_signal.connect(self.on_key_signal)
def __init__(self, dataBack, parent=None): QObject.__init__(self) super(CANPort_QT, self).__init__(parent) self.dataBack = dataBack self.CANacondaMessage_queue = dataBack.CANacondaMessage_queue self.comport = dataBack.comport self.args = dataBack.args
def __init__(self, parent=None, id="~"): """ init """ QWidget.__init__(self, parent) self.setupUi(self) # center this window screen = QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) self.id = id self.flagBtn = RichFlagButton(self) self.linelayout.addWidget(self.flagBtn) self.desc = HtmlWYSIWYG() self.desc.setMinimumHeight(200) self.desclayout.addWidget(self.desc) if not self.id == "~": restore = YeahdocDatasSupply().bc_read1(self.id) self.flagBtn.setIcon(QIcon(getPath("iconDir", "yeahdoc/flag/%s" % str(restore['img'])))) self.flagBtn.setText(restore['img']) self.title.setText(restore['title']) self.desc.fill(restore['desc']) QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"), self.__evt_btn_click)
def __init__(self, fileBrowser): QObject.__init__(self) self._fileBrowser = fileBrowser self._currDir = None self._currIsActive = False self._history = [] self._historyIndex = -1 fileBrowser.titleBarWidget().addSeparator() self._aBack = QAction(QIcon(':enkiicons/previous.png'), self.tr("Back"), self) self._aBack.setShortcut('Alt+Left') fileBrowser.titleBarWidget().addAction(self._aBack) core.actionManager().addAction("mNavigation/mFileBrowser/aBack", self._aBack) self._aBack.triggered.connect(self._onTbBackTriggered) self._aForward = QAction(QIcon(':enkiicons/next.png'), self.tr("Forward"), self) self._aForward.setShortcut('Alt+Right') fileBrowser.titleBarWidget().addAction(self._aForward) core.actionManager().addAction("mNavigation/mFileBrowser/aForward", self._aForward) self._aForward.triggered.connect(self._onTbForwardTriggered) fileBrowser.titleBarWidget().addSeparator() # incoming connections fileBrowser.rootChanged.connect(self._onRootChanged) fileBrowser.fileActivated.connect(self._onFileActivated)
def __init__(self): QObject.__init__(self) super(Gui, self).__init__() self.setupUi(self) self.show() # noinspection PyUnresolvedReferences self.list_leds.itemSelectionChanged.connect(self.selection_changed) self.settings = QSettings('light_show', 'router') self.input_routerip.setText(self.settings.value('address', "")) self.input_user.setText(self.settings.value('user', 'root')) self.input_path.setText(self.settings.value('path', Gui.DEFAULT_PATH)) self.edt_script.setPlainText(self.settings.value('prog', '')) self.router = FreifunkRouter() self.router.connection_changed.connect(self.connection_event) self.router.model_changed.connect(self.update_selection) self.connection_event(None) self.program = None # noinspection PyUnresolvedReferences self.btn_run.clicked.connect(self.runProgram) # noinspection PyUnresolvedReferences self.btn_stop.clicked.connect(self.stopProgram) # noinspection PyUnresolvedReferences self.btn_connect.clicked.connect(self.connect) # noinspection PyUnresolvedReferences self.btn_all.clicked.connect(self.list_leds.selectAll) # noinspection PyUnresolvedReferences self.btn_none.clicked.connect(self.list_leds.clearSelection)
def __init__(self, options=None, observe=None, log_level=mpv.LogLevel.INFO, log_handler=None, parent=None, **kwargs): QObject.__init__(self, parent) AbstractTemplate.__init__(self) mpv.Mpv.__init__(self, options=options, **kwargs) if observe is not None: for prop in observe: self.observe_property(prop) if log_handler is not None: self.request_log_messages(log_level) self.log_handler = log_handler self._event_thread = QThread(self) self._event_worker = EventWorker() self._event_worker.moveToThread(self._event_thread) self._event_worker.mpv_event.connect(self._handle_event) self._event_worker.finished.connect(self._event_worker.deleteLater) self._event_thread.finished.connect(self._event_thread.deleteLater) self._wakeup.connect(self._event_worker.wait_event) self.before_initialize() self.initialize() self._event_thread.start() self._wakeup.emit(self)
def __init__(self): app = QApplication(sys.argv) QObject.__init__(self) super(Gui, self).__init__() self.app = app self.setupUi(self) self.gridLayoutWidget.setStyleSheet("background-color: " "rgb(117,117,117);") self.cell_matrix = [[None for y in range(9)] for x in range(9)] for f_x in range(3): for f_y in range(3): frame = QtWidgets.QFrame(self.gridLayoutWidget) widget = QtWidgets.QWidget(frame) widget.setStyleSheet("background-color: rgb(170,170,170);") # widget.setGeometry(QRect(160, 170, 160, 80)) gridLayout = QtWidgets.QGridLayout(widget) gridLayout.setContentsMargins(0, 0, 0, 0) for x in range(3): for y in range(3): cell = Cell(self) self.cell_matrix[(f_x*3)+x][(f_y*3)+y] = cell cell.setStyleSheet("QLabel{background-color: white;}") gridLayout.addWidget(cell, y, x) self.grid.addWidget(frame, f_y, f_x) self.show()
def __init__(self, navigationInterpreter, positionModel, BoxContr, widget): ''' Class which interacts directly with the image scene :param navigationInterpreter: :param positionModel: :param BoxContr: :param widget: The main widget ''' QObject.__init__(self) self.baseInterpret = navigationInterpreter self._posModel = positionModel self.rubberBand = RedRubberBand(QRubberBand.Rectangle, widget) self.boxController=BoxContr self.leftClickReleased.connect(BoxContr.addNewBox) self.rightClickReceived.connect(BoxContr.onChangedPos) #self.deleteSelectedItemsSignal.connect(BoxContr.deleteSelectedItems) self.origin = QPoint() self.originpos = object()
def __init__(self,editor,connectionInput,boxListModel): ''' Class which controls all boxes on the scene :param scene: :param connectionInput: The imput slot to which connect all the new boxes :param boxListModel: ''' scene = editor.imageScenes[2] self._editor = editor QObject.__init__(self,parent=scene.parent()) self._setUpRandomColors() self.scene=scene self.connectionInput=connectionInput self._currentBoxesList=[] #self._currentActiveItem=[] #self.counter=1000 self.currentColor=self._getNextBoxColor() self.boxListModel=boxListModel self.scene.selectionChanged.connect(self.handleSelectionChange) boxListModel.boxRemoved.connect(self.deleteItem) boxListModel.signalSaveAllBoxesToCSV.connect(self.saveBoxesToCSV)
def __init__(self, weboob, parent=None): QObject.__init__(self, parent) self.weboob = weboob self.weboob.requests.register('login', self.callback(self.LoginRequest)) self.mutex = QMutex() self.requests = [] self.new_request.connect(self.do_request)
def __init__(self, column_name, on_icon, off_icon, hover_icon, parent=None): QObject.__init__(self, parent=parent) self.on_icon = on_icon self.off_icon = off_icon self.hover_icon = hover_icon self.column_name = column_name self.last_index = QModelIndex()
def __init__(self): """ (1) Add a tabWidget (2) Setup the main Window (3) Some basic event slot (4) read datas(menus , actions) """ QMainWindow.__init__(self) # attrs # Notice: These attributes can not be put outside init method self.__actions = {} self.__menus = {} self.__globalActionGroup = QActionGroup(self) #the main widget(Tab) that show all things self.tabs = MainTabWidget(self) self.setCentralWidget(self.tabs) view = SKMainTabShow(self,self.tabs) self.tabs.addTab(view,QIcon(getPath("iconDir",'main.png')),QApplication.translate("default", "MainTab")) QObject.connect(self, SIGNAL("updateWindows()"),self.__updateWindows) self.__addBasicMenus() self.__addBasicActions()
def __init__(self): # initializes Pomodoro as a QObject so it can emit signals QObject.__init__(self) self.pomodori = 0 self.pomodoro_duration = 25 self.running = False self.timer = threading.Timer(self.pomodoro_duration * 60, self.ring)
def __init__(self): """Create and install the plugin """ QObject.__init__(self) self._action = None core.workspace().currentDocumentChanged.connect(self._updateAction) core.workspace().languageChanged.connect(self._updateAction)
def __init__(self, filepath=None): QObject.__init__(self) QTimer.singleShot(0, self.__launchTimerTimedOut) self.prefs = Preferences() self.prefs.load() global APP_PREFS APP_PREFS = self.prefs locale = QLocale.system() dateFormat = self.prefs.dateFormat decimalSep = locale.decimalPoint() groupingSep = locale.groupSeparator() cachePath = QStandardPaths.standardLocations(QStandardPaths.CacheLocation)[0] DateEdit.DATE_FORMAT = dateFormat self.model = MoneyGuruModel( view=self, date_format=dateFormat, decimal_sep=decimalSep, grouping_sep=groupingSep, cache_path=cachePath ) self.mainWindow = MainWindow(app=self) self.preferencesPanel = PreferencesPanel(self.mainWindow, app=self) self.aboutBox = AboutBox(self.mainWindow, self) self.initialFilePath = None if filepath and op.exists(filepath): self.initialFilePath = filepath elif self.prefs.recentDocuments: self.initialFilePath = self.prefs.recentDocuments[0] self.finishedLaunching.connect(self.applicationFinishedLaunching) QCoreApplication.instance().aboutToQuit.connect(self.applicationWillTerminate)
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): QObject.__init__(self) from txplayagui.client import infostream self._rq = infostream() self._rq.lineReceived.connect(self._feedEvent) self._rq.error.connect(self._onError)
def __init__(self): QObject.__init__(self) core.workspace().currentDocumentChanged.connect(self._onCurrentDocumentChanged) core.workspace().documentOpened.connect(self._onDocumentOpenedOrClosed) core.workspace().documentClosed.connect(self._onDocumentOpenedOrClosed) core.actionManager().action("mFile/aOpen").triggered.connect(self._onFileOpenTriggered) core.actionManager().action("mFile/aOpenProject").triggered.connect(self._onProjectOpenTriggered) core.actionManager().action("mFile/mReload/aCurrent").triggered.connect(self._onFileReloadTriggered) core.actionManager().action("mFile/mReload/aAll").triggered.connect(self._onFileReloadAllTriggered) core.actionManager().action("mFile/aNew").triggered.connect( lambda: core.workspace().createEmptyNotSavedDocument(None)) core.actionManager().action("mFile/mClose/aCurrent").triggered.connect(self._onCloseCurrentDocument) core.actionManager().action("mFile/mClose/aAll").triggered.connect(core.workspace().closeAllDocuments) core.actionManager().action("mFile/mSave/aCurrent").triggered.connect(self._onFileSaveCurrentTriggered) core.actionManager().action("mFile/mSave/aAll").triggered.connect(self._onFileSaveAllTriggered) core.actionManager().action("mFile/mSave/aSaveAs").triggered.connect(self._onFileSaveAsTriggered) core.actionManager().action('mFile/mFileSystem').menu().aboutToShow.connect(self._onFsMenuAboutToShow) core.actionManager().action("mFile/mFileSystem/aRename").triggered.connect(self._onRename) if platform.system() != 'Windows': core.actionManager().action("mFile/mFileSystem/aToggleExecutable").triggered.connect( self._onToggleExecutable) core.actionManager().action("mNavigation/aNext").triggered.connect(core.workspace().activateNextDocument) core.actionManager().action("mNavigation/aPrevious").triggered.connect( core.workspace().activatePreviousDocument) core.actionManager().action("mNavigation/aFocusCurrentDocument").triggered.connect( core.workspace().focusCurrentDocument) core.actionManager().action("mNavigation/aGoto").triggered.connect( lambda: core.workspace().currentDocument().invokeGoTo())
def dropMimeData(self, data, action, row, column, parent): # pylint: disable=R0913 """See QAbstractItemModel documentation""" if parent.isValid() or \ ( row == -1 and column == -1 ) or \ action != Qt.MoveAction or \ not data or \ not data.hasFormat(self.mimeTypes()[0]): return False fromRow = data.data(self.mimeTypes()[0]).toInt()[0] if row >= len(self._workspace.sortedDocuments): row -= 1 elif fromRow < row: row -= 1 newDocuments = copy.copy(self._workspace.sortedDocuments) item = newDocuments.pop(fromRow) # if row > fromRow: # row -= 1 newDocuments.insert(row, item) self.rebuildMapping(self._workspace.sortedDocuments, newDocuments) self._manuallySorted = True QObject.parent(self).tvFiles.setCurrentIndex(self.documentIndex(item)) return True
def __init__(self, view): QObject.__init__(self) self.tie = True self.__view = view self.n = 6 self.__stats = Statistics() self.__game = Game(self.__stats)
def __init__(self, setting, widget, signal): QObject.__init__(self) self.setting = setting self.widget = widget self.signal = signal self.connected = False
def __init__(self, **kwargs): QObject.__init__(self) self.filename = kwargs.get("filename") self.text_code = kwargs.get("code") self.__python_exec = kwargs.get("python_exec") self.pre_script = kwargs.get("pre_script") self.post_script = kwargs.get("post_script") self.__params = kwargs.get("params") self.__elapsed = QElapsedTimer() self.outputw = None self.__current_process = None self.main_process = QProcess(self) self.main_process.started.connect(self._process_started) self.main_process.finished.connect(self._process_finished) self.main_process.finished.connect(self.__post_execution) self.main_process.readyReadStandardOutput.connect(self._refresh_output) self.main_process.readyReadStandardError.connect(self._refresh_error) self.pre_process = QProcess(self) self.pre_process.started.connect(self._process_started) self.pre_process.finished.connect(self._process_finished) self.pre_process.finished.connect(self.__main_execution) self.pre_process.readyReadStandardOutput.connect(self._refresh_output) self.pre_process.readyReadStandardError.connect(self._refresh_error) self.post_process = QProcess(self) self.post_process.started.connect(self._process_started) self.post_process.finished.connect(self._process_finished) self.post_process.readyReadStandardOutput.connect(self._refresh_output) self.post_process.readyReadStandardError.connect(self._refresh_error)
def __init__(self, bit_len: int, center: float, noise: float, tolerance: int, modulation_type: int, device: str, backend_handler: BackendHandler): signal = Signal("", "LiveSignal") signal.bit_len = bit_len signal.qad_center = center signal.noise_threshold = noise signal.tolerance = tolerance signal.silent_set_modulation_type(modulation_type) ProtocolAnalyzer.__init__(self, signal) QObject.__init__(self, None) self.backend_handler = backend_handler self.rcv_device = VirtualDevice(self.backend_handler, device, Mode.receive, resume_on_full_receive_buffer=True, raw_mode=False) self.rcv_device.index_changed.connect(self.on_rcv_thread_index_changed) self.rcv_device.started.connect(self.__emit_started) self.rcv_device.stopped.connect(self.__emit_stopped) self.data_cache = [] self.conseq_non_data = 0 self.reading_data = False self.store_messages = True self.__sniff_file = "" self.__store_data = True
def __init__(self, view): self.view = view QObject.__init__(self, view) self.model = QStandardItemModel() delegate = MyDelegate(self.view, self) delegate.error.connect(self.error.emit) delegate.reference_changed.connect(self.reference_changed.emit) self.view.setEditTriggers(QAbstractItemView.DoubleClicked) self.view.setModel(self.model) self.view.setItemDelegate(delegate) self.settings = QSettings() self.model.setHorizontalHeaderLabels(['ReferenceType', 'NodeId', "BrowseName", "TypeDefinition"]) state = self.settings.value("WindowState/refs_widget_state", None) if state is not None: self.view.horizontalHeader().restoreState(state) self.view.horizontalHeader().setSectionResizeMode(0) self.view.horizontalHeader().setStretchLastSection(True) self.node = None self.reloadAction = QAction("Reload", self.model) self.reloadAction.triggered.connect(self.reload) self.addRefAction = QAction("Add Reference", self.model) self.addRefAction.triggered.connect(self.add_ref) self.removeRefAction = QAction("Remove Reference", self.model) self.removeRefAction.triggered.connect(self.remove_ref) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.showContextMenu) self._contextMenu = QMenu() self._contextMenu.addAction(self.reloadAction) self._contextMenu.addSeparator() self._contextMenu.addAction(self.addRefAction) self._contextMenu.addAction(self.removeRefAction)
def __init__(self): QObject.__init__(self) self.gridSize = 10 self.counter = 0 self.breadboard = [[None for _ in range(self.gridSize)] for _ in range(self.gridSize)] self.components = [] self.freePositions = list(itertools.product(range(self.gridSize), range(self.gridSize)))
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, track, filetype, album=None, parent=None): QObject.__init__(self, parent=parent) self._tags = track.tags self._creation_date = track.creation_date self._filetype = filetype self._file = self._get_file(track) self.album = album
def sortDocuments(self, openedDocument=None): """Sort documents list according to current sort mode""" sortedDocuments = self._workspace.sortedDocuments if self._MRU: # Newly-opened documents aren't yet the currentDocument, so we must # use that if supplied. cd = openedDocument or self._workspace.currentDocument() # When the last document is closed, it's been removed from # sortedDocuments, but self._workspace.currentDocument() hasn't been # updated yet. Avoid this case. if cd in sortedDocuments: # Move this document to the beginning of the list. numericIndex = sortedDocuments.index(cd) sortedDocuments.insert(0, sortedDocuments.pop(numericIndex)) elif not self._manuallySorted: sortedDocuments = sorted(sortedDocuments, key=lambda d: d.filePath() or '') self.rebuildMapping(sortedDocuments, sortedDocuments) # Scroll the view. In MRU mode, correct the selected index, since # rebuildMapping will corrupt it. If a document was just opened, avoid # this since its Qutepart widget hasn't been added to the list of opened # widgets, causing errors such as "QStackedWidget::setCurrentWidget: # widget 0x4b48be8 not contained in stack" if the code below runs. if self._MRU and not openedDocument: QObject.parent(self).tvFiles.setCurrentIndex(self.createIndex(0, 0, cd)) selected = QObject.parent(self).tvFiles.selectionModel().selectedIndexes() if selected: QObject.parent(self).tvFiles.scrollTo(selected[0])
def __init__( self, tiling, stackedImageSources, cache_size=100, request_queue_size=100000, n_threads=2, parent=None ): """ Keyword Arguments: cache_size -- maximal number of encountered stacks to cache, i.e. slices if the imagesources draw from slicesources (default 10) request_queue_size -- maximal number of request to queue up (default 100000) n_threads -- maximal number of request threads; this determines the maximal number of simultaneously running requests to the pixelpipeline (default: 2) parent -- QObject """ QObject.__init__(self, parent=parent) self.tiling = tiling self.axesSwapped = False self._sims = stackedImageSources self._request_queue_size = request_queue_size self._n_threads = n_threads self._current_stack_id = self._sims.stackId self._cache = _TilesCache(self._current_stack_id, self._sims, maxstacks=cache_size) self._sims.layerDirty.connect(self._onLayerDirty) self._sims.visibleChanged.connect(self._onVisibleChanged) self._sims.opacityChanged.connect(self._onOpacityChanged) self._sims.sizeChanged.connect(self._onSizeChanged) self._sims.orderChanged.connect(self._onOrderChanged) self._sims.stackIdChanged.connect(self._onStackIdChanged) self._keepRendering = True
def __init__(self, parent=None): QObject.__init__(self, parent) self._parent = parent self.data = QVariant()
def __init__(self, ctx): QObject.__init__(self) self.ctx = ctx