def __init__(self, parent, umlmachines, name='InstallerWidget'): QWidget.__init__(self, parent, name) self.resize(600, 600) self.app = get_application_pointer() self.conn = self.app.conn self.umlmachines = umlmachines self.machine = self.umlmachines.current self.current_machine_process = 'start' self.current_profile = None self.current_trait = None self.traitlist = [] self.curenv = CurrentEnvironment(self.conn, self.machine) self.curenv['current_profile'] = 'None' self.curenv['current_trait'] = 'None' self.curenv['current_machine_process'] = self.current_machine_process self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000) self.grid = QGridLayout(self, 4, 1, 5, 7) self.main_label = QLabel(self) self.main_label.setText(self._msg()) self.grid.addWidget(self.main_label, 0, 0) self.profile_progress_lbl = QLabel(self) self.grid.addWidget(self.profile_progress_lbl, 1, 0) self.profile_progress = KProgress(self) self.grid.addWidget(self.profile_progress, 2, 0) self.logview = LogBrowser(self, '/tmp/uml-installer.log') self.grid.addWidget(self.logview, 3, 0) #self.console_view = StdOutBrowser(self) #self.console_view = KTextBrowser(self) #self.grid.addWidget(self.console_view, 4, 0) self.console_text = ''
def setup(self): self.widget = QWidget() layout = QGridLayout() self.widget.setLayout(layout) self.layout.addWidget(self.widget) self.widget.show() self.layout = layout self.setupInputFrame() self.setupFrameControlFrame() self.setupAdditionalFrames() self.setupPlottingFrame() self.setFramesEnabled(False) self.timer = QTimer() self.timer.setInterval(50) self.setupConnections() # initialize slice observers (from DataProbe.py) # keep list of pairs: [observee,tag] so they can be removed easily self.styleObserverTags = [] # keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic self.sliceWidgetsPerStyle = {} self.refreshObservers()
def __init__(self, notifier): from pyqlogger import VERSION self.notifier = notifier self.notified = LooseVersion(VERSION) self.Timer = QTimer() self.Timer.connect(self.Timer, SIGNAL("timeout()"), self.work) self.Timer.start(60 * 60 * 1000)
def __init__(self): QObject.__init__(self) self.sysTray = KMySystemTray() self.sysTray.setPixmap(self.sysTray.loadIcon("ksmarttray")) self.sysTray.show() self.process = KProcIO() self.state = KSmartTray.State.Waiting self.lastKnownStatus = "" self.blinkFlag = False self.updateFailed = False self.checkTimer = QTimer() self.blinkTimer = QTimer() QObject.connect(self.checkTimer, SIGNAL("timeout()"), self.checkUpgrades) QObject.connect(self.process, SIGNAL("processExited(KProcess *)"), self.processDone) QObject.connect(self, PYSIGNAL("foundNewUpgrades()"), self.startBlinking) QObject.connect(self, PYSIGNAL("foundNoUpgrades()"), self.stopBlinking) QObject.connect(self.sysTray, PYSIGNAL("mouseEntered()"), self.stopBlinking) QObject.connect(self.blinkTimer, SIGNAL("timeout()"), self.toggleBlink) QObject.connect(self.sysTray.checkAction, SIGNAL("activated()"), self.manualCheckUpgrades) QObject.connect(self.sysTray.startSmartAction, SIGNAL("activated()"), self.startSmart) QObject.connect(self.sysTray.stopAction, SIGNAL("activated()"), self.stopChecking) QObject.connect(self.sysTray, SIGNAL("quitSelected()"), KApplication.kApplication(), SLOT("quit()")) QObject.connect(self.sysTray, PYSIGNAL("activated()"), self.runUpgrades) self.checkTimer.start(5 * 60 * 1000) self.checkUpgrades()
def receive_delayed_response(self, data, server_url): timer = QTimer() delayed_url = server_url.replace('/predict', '/responses') def check_response(): print('TRYING TO OBTAIN DELAYED RESPONSE') reply = SSLUtil.post(delayed_url, data={'request_id': data['request_id']}, timeout=5.0) responses_json = reply.json() self.process_responses(responses_json, server_url) timer.singleShot(1000, check_response)
def __init__(self): self._reads = {} self._writes = {} self._notifiers = {} self._timer = QTimer() self._timer.setSingleShot(True) self._timer.timeout.connect(self.iterate) if QCoreApplication.instance() is None: # Application Object has not been started yet self.qApp = QCoreApplication([]) self._ownApp = True else: self.qApp = QCoreApplication.instance() self._ownApp = False self._blockApp = None posixbase.PosixReactorBase.__init__(self)
def __init__(self, parent, umlmachines, name='RunnerWidget'): QWidget.__init__(self, parent, name) self.app = get_application_pointer() self.umlmachines = umlmachines self.proc = self.umlmachines.run_machine() self._mainbox = QVBoxLayout(self, 5, 7) # add label self.mainlabel = QLabel(self) self.mainlabel.setText('Running Umlmachine %s' % self.umlmachines.current) self._mainbox.addWidget(self.mainlabel) # add stdout viewer logfile = self.umlmachines.stdout_logfile.name self.logbrowser = LogBrowser(self, logfile) self._mainbox.addWidget(self.logbrowser) self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000)
def __init__(self, *args): apply(KSystemTray.__init__, (self, ) + args) ''' comarInterface instance ''' self.comarInterface = comarInterface(self.winId()) ''' wirelessInterface instance ''' self.wirelessInterface = wirelessInterface() ''' dcopInterface instance''' self.dcopInterface = dcopInterface(self.wirelessInterface) ''' Add /usr/share/PyWireless to KStandardDirs ''' self.KStandardDirs = KStandardDirs() self.KStandardDirs.addResourceDir('icon', '/usr/share/PyWireless') ''' Create tray icon Loader ''' self.icons = KIconLoader('PyWireless', self.KStandardDirs) ''' Timer event triggered every 3 second Until i found a way to use inotify or libfam ''' self.time = QTimer(self) self.connect(self.time, SIGNAL('timeout()'), self.timeoutSlot) self.time.start(3000) self.connect(app, SIGNAL("shutDown()"), self.slotQuit) ''' Popup Menu ''' connectionsMenu = KPopupMenu(self.contextMenu()) ''' list all connections into Connections menu ''' for entry in self.comarInterface.listConnections(): if self.comarInterface.isActive(entry): id = connectionsMenu.insertItem( QIconSet( self.icons.loadIcon('wireless-online', KIcon.Desktop, 16)), entry) else: id = connectionsMenu.insertItem( QIconSet( self.icons.loadIcon('wireless-offline', KIcon.Desktop, 16)), entry) self.connect(connectionsMenu, SIGNAL("activated(int)"), self.switchConnection) self.contextMenu().insertItem(_('Wireless Connections Profiles'), connectionsMenu) # FIXME: Use net-kga self.contextMenu().insertItem(_('Create New Wireless Connection')) self.show()
def __init__(self, client, parent=None): QDialog.__init__(self, parent) decorateWindow(self, i18n('Choose')) self.setObjectName('ClientDialog') self.client = client self.layout = QGridLayout(self) self.progressBar = QProgressBar() self.progressBar.setMinimumHeight(25) self.timer = QTimer() if not client.game.autoPlay: self.timer.timeout.connect(self.timeout) self.deferred = None self.buttons = [] self.setWindowFlags(Qt.SubWindow | Qt.WindowStaysOnTopHint) self.setModal(False) self.btnHeight = 0 self.answered = False self.move = None self.sorry = None
def __init__(self, parent, suite, name='RunnerWidget'): QWidget.__init__(self, parent, name) self.app = get_application_pointer() cfg = self.app.umlcfg basefile = make_base_filesystem(suite, '%s.base' % suite, cfg=cfg, size=300, mkfs='mke2fs') self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg) self._mainbox = QVBoxLayout(self, 5, 7) # add label self.mainlabel = QLabel(self) self.mainlabel.setText('Bootstrapping suite %s' % suite) self._mainbox.addWidget(self.mainlabel) # add stdout viewer logfile = self.umlmachines.stdout_logfile.name self.logbrowser = LogBrowser(self, logfile) self._mainbox.addWidget(self.logbrowser) self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000)
def simulate(self): if self._timer is not None: self._timer.stop() self._timer = None if not self.running: self.running = 1 self.qApp.exit_loop() return self.runUntilCurrent() if self._crashCall is not None: self._crashCall.reset(0) # gah timeout = self.timeout() if timeout is None: timeout = 1.0 timeout = min(timeout, 0.1) * 1010 if self._timer is None: self._timer = QTimer() QObject.connect(self._timer, SIGNAL("timeout()"), self.simulate) self._timer.start(timeout, 1)
def __init__(self): self.workers = {} self.checkTimer = QTimer() self.checkTimer.connect(self.checkTimer, SIGNAL("timeout()"), self.check) self.checkTimer.start(500)
from ctk import * from qt import QTimer # Test display of a CTK widget w = ctkMatrixWidget() w.show() # Test command execution using Python manager pythonManager = _ctkPythonManagerInstance pythonManager.executeString("variableInPythonConsole=523") try: print("variableInPythonConsole was successfully set to {0}".format( variableInPythonConsole)) except: print "PythonManager.executeString failed" qt.QApplication.exit(1) if not _ctkPythonConsoleInstance.isInteractive: #QTimer().singleShot(0, app(), SLOT('quit()')) t = QTimer() t.setInterval(250) t.connect('timeout()', app(), 'quit()') t.start()
def setupPanel(self, parentWidget): logging.debug('ProstateTRUSNavUltrasound.setupPanel') self.connectorNode = self.guideletParent.connectorNode self.connectorNodeConnected = False collapsibleButton = ctkCollapsibleButton() collapsibleButton.setProperty('collapsedHeight', 20) setButtonStyle(collapsibleButton, 2.0) collapsibleButton.text = "Ultrasound" parentWidget.addWidget(collapsibleButton) ultrasoundLayout = QFormLayout(collapsibleButton) ultrasoundLayout.setContentsMargins(12, 4, 4, 4) ultrasoundLayout.setSpacing(4) self.connectDisconnectButton = QPushButton("Connect") self.connectDisconnectButton.setToolTip( "If clicked, connection OpenIGTLink") hbox = QHBoxLayout() hbox.addWidget(self.connectDisconnectButton) ultrasoundLayout.addRow(hbox) self.setupIcons() self.captureIDSelector = QComboBox() self.captureIDSelector.setToolTip("Pick capture device ID") self.captureIDSelector.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.volumeReconstructorIDSelector = QComboBox() self.volumeReconstructorIDSelector.setToolTip( "Pick volume reconstructor device ID") self.volumeReconstructorIDSelector.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding) self.startStopRecordingButton = QPushButton(" Start Recording") self.startStopRecordingButton.setCheckable(True) self.startStopRecordingButton.setIcon(self.recordIcon) self.startStopRecordingButton.setEnabled(False) self.startStopRecordingButton.setToolTip("If clicked, start recording") self.startStopRecordingButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) recordParametersControlsLayout = QGridLayout() self.filenameLabel = self.createLabel("Filename:", visible=False) recordParametersControlsLayout.addWidget(self.filenameLabel, 1, 0) # Offline Reconstruction self.offlineReconstructButton = QPushButton(" Offline Reconstruction") self.offlineReconstructButton.setCheckable(True) self.offlineReconstructButton.setIcon(self.recordIcon) self.offlineReconstructButton.setEnabled(False) self.offlineReconstructButton.setToolTip( "If clicked, reconstruct recorded volume") self.offlineReconstructButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.offlineVolumeToReconstructSelector = QComboBox() self.offlineVolumeToReconstructSelector.setEditable(True) self.offlineVolumeToReconstructSelector.setToolTip( "Pick/set volume to reconstruct") self.offlineVolumeToReconstructSelector.visible = False hbox = QHBoxLayout() hbox.addWidget(self.startStopRecordingButton) hbox.addWidget(self.offlineReconstructButton) ultrasoundLayout.addRow(hbox) # Scout scan (record and low resolution reconstruction) and live reconstruction # Scout scan part self.startStopScoutScanButton = QPushButton( " Scout scan\n Start recording") self.startStopScoutScanButton.setCheckable(True) self.startStopScoutScanButton.setIcon(self.recordIcon) self.startStopScoutScanButton.setToolTip("If clicked, start recording") self.startStopScoutScanButton.setEnabled(False) self.startStopScoutScanButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.startStopLiveReconstructionButton = QPushButton( " Start live reconstruction") self.startStopLiveReconstructionButton.setCheckable(True) self.startStopLiveReconstructionButton.setIcon(self.recordIcon) self.startStopLiveReconstructionButton.setToolTip( "If clicked, start live reconstruction") self.startStopLiveReconstructionButton.setEnabled(False) self.startStopLiveReconstructionButton.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding) self.displayRoiButton = QToolButton() self.displayRoiButton.setCheckable(True) self.displayRoiButton.setIcon(self.visibleOffIcon) self.displayRoiButton.setToolTip("If clicked, display ROI") hbox = QHBoxLayout() hbox.addWidget(self.startStopScoutScanButton) hbox.addWidget(self.startStopLiveReconstructionButton) # hbox.addWidget(self.displayRoiButton) ultrasoundLayout.addRow(hbox) self.snapshotTimer = QTimer() self.snapshotTimer.setSingleShot(True) self.onParameterSetSelected() return collapsibleButton
def __init__(self, parent, name='BaseLogBrowser'): KTextBrowser.__init__(self, parent, name) self.setTextFormat(self.LogText) self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_logtext) self.resume_logging()