当前位置: 首页>>代码示例>>Python>>正文


Python QTimer.start方法代码示例

本文整理汇总了Python中qt.QTimer.start方法的典型用法代码示例。如果您正苦于以下问题:Python QTimer.start方法的具体用法?Python QTimer.start怎么用?Python QTimer.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qt.QTimer的用法示例。


在下文中一共展示了QTimer.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ui

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class BackGround:
    """ class that provides a timer that checks on background processes,
    and method for adding new background workers. all workers should provide following methods:
    ui(),bg() """
    def __init__(self):
        self.workers = {}
        self.checkTimer = QTimer()
        self.checkTimer.connect(self.checkTimer, SIGNAL("timeout()"), self.check)
        self.checkTimer.start(500)
    
    def check(self):
        for worker in self.workers.keys():
            if not self.workers[worker].THREAD.isAlive():
                self.workers[worker].ui()
                if self.workers[worker].SENDER: 
                    self.workers[worker].SENDER.setEnabled(True)
                del self.workers[worker]
            else:
                self.workers[worker].status()

    def add(self, worker, sender=None):
        if self.workers.has_key(str(worker)): # only add unique workers!
            return False
        worker.THREAD = Thread(args = [worker], target = worker.bg)
        worker.THREAD.start()
        if sender:
            sender.setEnabled(False)            
        worker.SENDER = sender
        self.workers[str(worker)] = worker
        return True
开发者ID:BackupTheBerlios,项目名称:pyqlogger-svn,代码行数:32,代码来源:BG.py

示例2: __init__

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
    def __init__(self, parent, updateinterval):
        SurfacePlot.__init__(self, parent)

        self.setRotation(30, 0, 15)
        self.setShift(0.1, 0, 0)
        self.setZoom(0.8)
        self.coordinates().setNumberFont("Courier", 8)
        
        axes = self.coordinates().axes # alias
        for axis in axes:
            axis.setMajors(7)
            axis.setMinors(4)

        axes[X1].setLabelString("x")
        axes[Y1].setLabelString("y")
        axes[Z1].setLabelString("z")
        axes[X2].setLabelString("x")
        axes[Y2].setLabelString("y")
        axes[Z2].setLabelString("z")
        axes[X3].setLabelString("x")
        axes[Y3].setLabelString("y")
        axes[Z3].setLabelString("z")
        axes[X4].setLabelString("x")
        axes[Y4].setLabelString("y")
        axes[Z4].setLabelString("z")

        timer = QTimer(self)
        self.connect(timer, SIGNAL('timeout()'), self.rotate)
        timer.start(updateinterval)
开发者ID:PyQwt,项目名称:PyQwt3D,代码行数:31,代码来源:AutoSwitch.py

示例3: BaseLogBrowser

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class BaseLogBrowser(KTextBrowser):
    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()
        
    def pause_logging(self):
        self.timer.stop()

    def resume_logging(self):
        self.timer.start(500)
        
    def update_logtext(self):
        raise NotImplementedError
开发者ID:joelsefus,项目名称:paella,代码行数:18,代码来源:widgets.py

示例4: simulate

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
    def simulate(self):
        global _timer
        if _timer: _timer.stop()
        if not self.running:
            self.running = 1
            self.qApp.exit_loop()
            return
        self.runUntilCurrent()

        # gah
        timeout = self.timeout()
        if timeout is None: timeout = 1.0
        timeout = min(timeout, 0.1) * 1010

        if not _timer:
            _timer = QTimer()
            QObject.connect( _timer, SIGNAL("timeout()"), self.simulate )
        _timer.start(timeout, 1)
开发者ID:fxia22,项目名称:ASM_xf,代码行数:20,代码来源:qtreactor.py

示例5: __init__

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class updateCheckWorker:
    """ class that provides new version checking in background """
    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 work(self):
        try:
            req = urllib2.urlopen('http://pyqlogger.berlios.de/ver.php')
            line = req.readline()
            newver = LooseVersion( line.strip() )
            if newver > self.notified :
                self.notified = newver
                self.notifier.info("New version %s is available at the site!"%(str(newver)))
        except:
            pass
开发者ID:BackupTheBerlios,项目名称:pyqlogger-svn,代码行数:22,代码来源:BG.py

示例6: MainWin

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class MainWin(KMainWindow):

    """Main window"""

    SB_TEXT = 1
    SB_TIMEOUT = 10000
    MON_TIMEOUT = 1000
    CHANGE_TIMEOUT = 3001

    def __init__(self, *args):
        apply(KMainWindow.__init__, (self,) + args)
        
        self.lastDir = "/var/log"
        self.monitors = []
        self.currentPage = None
        self.tab = QTabWidget(self)
        self.settingsDlg = SettingsDlg(self)
        self.cfg = LoviConfig().getInstance()
        self.bellIcon = \
            QIconSet(KIconLoader().loadIcon("idea", KIcon.Small, 11))
        self.noIcon = QIconSet()
        self.findDlg = KEdFind(self, "find", False)
        self.connect(self.findDlg, SIGNAL("search()"), self.doFind)
        
        self.setCentralWidget(self.tab)
        self.connect(self.tab, SIGNAL("currentChanged(QWidget *)"), 
            self.onPageChange)
        self.setGeometry(0, 0, 600, 400)
        self.setCaption(makeCaption("(none)"))

        # Timers
        self.timer = QTimer(self)
        self.timer.start(MainWin.MON_TIMEOUT)
        self.statusTimer = QTimer(self)
        self.connect(self.statusTimer, SIGNAL("timeout()"), 
            self.onStatusTimeout)
        self.changeTimer = QTimer(self)
        self.changeTimer.start(MainWin.CHANGE_TIMEOUT)
        self.connect(self.changeTimer, SIGNAL("timeout()"),
            self.onChangeTimeout)

        # Initialize actions
        actions = self.actionCollection()
        self.openAction = KStdAction.open(self.onOpen, actions)
        self.closeAction = KStdAction.close(self.onClose, actions)
        self.closeAction.setEnabled(False)
        self.quitAction = KStdAction.quit(self.onQuit, actions)
        self.copyAction = KStdAction.copy(self.onCopy, actions)
        self.copyAction.setEnabled(False)
        self.clearAction = KStdAction.clear(self.onClear, actions)
        self.clearAction.setEnabled(False)
        self.selectAllAction = KStdAction.selectAll(self.onSelectAll, actions)
        self.selectAllAction.setEnabled(False)
        self.addBookmarkAction = \
            KStdAction.addBookmark(self.onAddBookmark, actions)
        self.addBookmarkAction.setEnabled(False)
        self.settingsAction = KStdAction.preferences(self.onSettings, actions)
        self.findAction = KStdAction.find(self.onFind, actions)
        self.findAction.setEnabled(False)
        self.findNextAction = KStdAction.findNext(self.onFindNext, actions)
        self.findNextAction.setEnabled(False)
        self.findPrevAction = KStdAction.findPrev(self.onFindPrev, actions)
        self.findPrevAction.setEnabled(False)
        
        # Initialize menus
        
        fileMenu = QPopupMenu(self)
        self.openAction.plug(fileMenu)
        self.closeAction.plug(fileMenu)
        fileMenu.insertSeparator()
        self.quitAction.plug(fileMenu)
        self.menuBar().insertItem(i18n("&File"), fileMenu)
        
        editMenu = QPopupMenu(self)
        self.copyAction.plug(editMenu)
        self.clearAction.plug(editMenu)
        editMenu.insertSeparator()
        self.selectAllAction.plug(editMenu)
        self.addBookmarkAction.plug(editMenu)
        editMenu.insertSeparator()
        self.findAction.plug(editMenu)
        self.findNextAction.plug(editMenu)
        self.findPrevAction.plug(editMenu)
        self.menuBar().insertItem(i18n("&Edit"), editMenu)
        
        settingsMenu = QPopupMenu(self)
        self.settingsAction.plug(settingsMenu)
        self.menuBar().insertItem(i18n("&Settings"), settingsMenu)
        
        helpMenu = self.helpMenu("")
        self.menuBar().insertItem(i18n("&Help"), helpMenu)
        
        # Initialize status bar
        self.sb = self.statusBar()
        self.bell = BellButton(None)
        self.displayStatus(False, "")
        
    def displayStatus(self, changed, msg):
        """Display a message in the status bar."""
        self.statusTimer.stop()
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:lovi-svn,代码行数:103,代码来源:main.py

示例7: ctkMatrixWidget

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
from ctk import *
from qt import QTimer

w = ctkMatrixWidget()
w.show()

if not _ctkPythonConsoleInstance.isInteractive:
  #QTimer().singleShot(0, app(), SLOT('quit()'))
  t = QTimer()
  t.setInterval(250)
  t.connect('timeout()', app(), 'quit()')
  t.start()
开发者ID:AndreasFetzer,项目名称:CTK,代码行数:14,代码来源:ctkWidgetsTest.py

示例8: __init__

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]

#.........这里部分代码省略.........
    self.setCurrentFrameNumber(newValue)

  def onVCMRMLSceneChanged(self, mrmlScene):
    logging.debug("qSlicerMultiVolumeExplorerSimplifiedModuleWidget:onVCMRMLSceneChanged")
    self.bgMultiVolumeSelector.setMRMLScene(slicer.mrmlScene)
    self.onBackgroundInputChanged()

  def refreshGUIForNewBackgroundImage(self):
    self._multiVolumeIntensityChart.reset()
    self.setFramesEnabled(True)
    if self._fgMultiVolumeNode and self._bgMultiVolumeNode:
      Helper.SetBgFgVolumes(self._bgMultiVolumeNode.GetID(), self._fgMultiVolumeNode.GetID())
    else:
      Helper.SetBgVolume(self._bgMultiVolumeNode.GetID())
    self.refreshFrameSlider()
    self._multiVolumeIntensityChart.bgMultiVolumeNode = self._bgMultiVolumeNode
    self.refreshObservers()

  def getBackgroundMultiVolumeNode(self):
    return self.bgMultiVolumeSelector.currentNode()

  def onBackgroundInputChanged(self):
    self._bgMultiVolumeNode = self.getBackgroundMultiVolumeNode()

    if self._bgMultiVolumeNode is not None:
      self.refreshGUIForNewBackgroundImage()
    else:
      self.setFramesEnabled(False)

  def onPlayButtonToggled(self, checked):
    if self._bgMultiVolumeNode is None:
      return
    if checked:
      self.timer.start()
      self.playButton.text = 'Stop'
    else:
      self.timer.stop()
      self.playButton.text = 'Play'

  def processEvent(self, observee, event):
    # logging.debug("processing event %s" % event)
    if self._bgMultiVolumeNode is None:
      return

    # TODO: use a timer to delay calculation and compress events
    if event == 'LeaveEvent':
      # reset all the readouts
      # TODO: reset the label text
      return

    if not self.sliceWidgetsPerStyle.has_key(observee):
      return

    interactor = observee.GetInteractor()
    self.createChart(self.sliceWidgetsPerStyle[observee], interactor.GetEventPosition())

  def createChart(self, sliceWidget, position):
    self._multiVolumeIntensityChart.createChart(sliceWidget, position)

  def setCurrentFrameNumber(self, frameNumber):
    mvDisplayNode = self._bgMultiVolumeNode.GetDisplayNode()
    mvDisplayNode.SetFrameComponent(frameNumber)

  def setFramesEnabled(self, enabled):
    pass
开发者ID:naucoin,项目名称:MultiVolumeExplorer,代码行数:69,代码来源:qSlicerMultiVolumeExplorerModuleWidget.py

示例9: KTVMainWindow

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class KTVMainWindow(KParts.MainWindow):
	"""Implements the main KatchTV application window."""

	def __init__(self, title):
		"""Initialises a new window object."""
		self._stopped = True
		
		KParts.MainWindow.__init__(self, None, str(title))
		self.setCaption(config.appFullVersion)
		
		self._initWidgets()
		
		self.__mediaManager = Media.Manager()
		
		self.__downloadTimer = QTimer()
		self.__downloadTimer.connect(self.__downloadTimer,SIGNAL(str(u"timeout()")), self.__updateDownloads)
		
		self.browser.goToURL(u'katchtv:welcome:')

	def saveAll(self):
		self.__mediaManager._saveItems()
	
	def __updateDownloads(self):
		self.__mediaManager.beginNewDownloads()
	
	def enableThreads(self):
		# start everything, and mark as running
		self.__downloadTimer.start(config.updateDownloadsTimerMillisecs)
		self.bmarksList.enableThreads()
		self._stopped = False
	
	def disableThreads(self):
		# stop in the order of slowest to fastest, hoping it'll
		# all finish around the same time
		self.bmarksList.disableThreads()
		self.__mediaManager.stop()
		self.__downloadTimer.stop()
		self._stopped = True
	
	def getMediaManager(self):
		return self.__mediaManager
	
	def isStopped(self):
		"""Returns True if the application should not run yet (ie, if
		it has not been fully initialised)."""
		return self._stopped

	def _initWidgets(self):
		"""Initialises all of the main widgets in the window."""
		global appRoot
		
		appIconPath = os.path.join(appRoot, "images/miniicon.png")
		self.setIcon(QPixmap(appIconPath))
		
		self.mainBox = QHBox(self)
		self.mainSplitter = QSplitter(self.mainBox)
		
		self.bmarksListBox = QVBox(self.mainSplitter)
		self.bmarksListBox.setMaximumWidth(250)
		
		self.bmarksList = KTVBookmarksListView.KTVBookmarksListView(self.bmarksListBox, self)
		QObject.connect(self.bmarksList, SIGNAL(str(u'doubleClicked(QListViewItem *)')), self._bookmarkChosen)
		
		self.browserBox = QVBox(self.mainSplitter)
		self.browser = KTVHTMLPart.KTVHTMLPart(self.browserBox, self)
		
		self.setCentralWidget(self.mainBox)
		
		self._buttonBox = QHBox(self.bmarksListBox)
		self._addButton = QPushButton(u"&Add", self._buttonBox, str(u""))
		QObject.connect(self._addButton, SIGNAL(str(u'clicked()')), self._addItem)
		
		self._deleteButton = QPushButton(u"&Delete", self._buttonBox, str(u""))
		QObject.connect(self._deleteButton, SIGNAL(str(u'clicked()')), self._deleteItem)
		
		self._backButton = QPushButton(u"&Back", self.bmarksListBox, str(u""))
		QObject.connect(self._backButton, SIGNAL(str(u'clicked()')), self._back)
		
		self._helpButton = QPushButton(u"&Help", self.bmarksListBox, str(u""))
		QObject.connect(self._helpButton, SIGNAL(str(u'clicked()')), self._help)
		
		self.statusBar().message(u"KatchTV is now ready for use.")

	def _help(self):
		"""A hook (a Qt signal slot, actually) which is called when the user
		clicks the "Help" button.  Loads the manual into the browser."""
		self.browser.goToURL(u'katchtv:help:')
	
	def _back(self):
		"""A hook (a Qt signal slot) which is called when the user clicks the
		"Back" button.  Navigates one step back through the browser history."""
		self.browser.loadPreviousPage()
	
	def _addItem(self):
		"""A hook (Qt signal slot) which is called when the user clicks
		the "Add" button.  Presents a dialog, asking the user for the
		feed URI to add."""
		validURI = False
		firstTry = True
		while not validURI:
#.........这里部分代码省略.........
开发者ID:lee-b,项目名称:katchtv,代码行数:103,代码来源:KTVMainWindow.py

示例10: ClientDialog

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]

#.........这里部分代码省略.........
            result.setFocus()
            if answer in [Message.Discard, Message.OriginalCall]:
                for uiTile in game.myself.handBoard.uiTiles:
                    if uiTile.tile is parameter:
                        game.myself.handBoard.focusTile = uiTile
        return result

    def askHuman(self, move, answers, deferred):
        """make buttons specified by answers visible. The first answer is default.
        The default button only appears with blue border when this dialog has
        focus but we always want it to be recognizable. Hence setBackgroundRole."""
        self.move = move
        self.deferred = deferred
        for answer in answers:
            self.__declareButton(answer)
        self.focusTileChanged()
        self.show()
        self.checkTiles()
        game = self.client.game
        myTurn = game.activePlayer == game.myself
        prefButton = self.proposeAction()
        if game.autoPlay:
            self.selectButton(prefButton)
            return
        prefButton.setFocus()

        self.progressBar.setVisible(not myTurn)
        if not myTurn:
            msecs = 50
            self.progressBar.setMinimum(0)
            self.progressBar.setMaximum(
                game.ruleset.claimTimeout * 1000 // msecs)
            self.progressBar.reset()
            self.timer.start(msecs)

    def placeInField(self):
        """place the dialog at bottom or to the right depending on space."""
        mainWindow = Internal.scene.mainWindow
        cwi = mainWindow.centralWidget()
        view = mainWindow.centralView
        geometry = self.geometry()
        if not self.btnHeight:
            self.btnHeight = self.buttons[0].height()
        vertical = view.width() > view.height() * 1.2
        if vertical:
            height = (len(self.buttons) + 1) * self.btnHeight * 1.2
            width = (cwi.width() - cwi.height()) // 2
            geometry.setX(cwi.width() - width)
            geometry.setY(min(cwi.height() // 3, cwi.height() - height))
        else:
            handBoard = self.client.game.myself.handBoard
            if not handBoard:
                # we are in the progress of logging out
                return
            hbLeftTop = view.mapFromScene(
                handBoard.mapToScene(handBoard.rect().topLeft()))
            hbRightBottom = view.mapFromScene(
                handBoard.mapToScene(handBoard.rect().bottomRight()))
            width = hbRightBottom.x() - hbLeftTop.x()
            height = self.btnHeight
            geometry.setY(cwi.height() - height)
            geometry.setX(hbLeftTop.x())
        for idx, btn in enumerate(self.buttons + [self.progressBar]):
            self.layout.addWidget(
                btn,
                idx +
开发者ID:KDE,项目名称:kajongg,代码行数:70,代码来源:humanclient.py

示例11: QtReactor

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class QtReactor(posixbase.PosixReactorBase):

    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 _add(self, xer, primary, type):
        """
        Private method for adding a descriptor from the event loop.

        It takes care of adding it if  new or modifying it if already added
        for another state (read -> read/write for example).
        """
        if xer not in primary:
            primary[xer] = TwistedSocketNotifier(None, self, xer, type)

    def addReader(self, reader):
        """
        Add a FileDescriptor for notification of data available to read.
        """
        self._add(reader, self._reads, QSocketNotifier.Read)

    def addWriter(self, writer):
        """
        Add a FileDescriptor for notification of data available to write.
        """
        self._add(writer, self._writes, QSocketNotifier.Write)

    def _remove(self, xer, primary):
        """
        Private method for removing a descriptor from the event loop.

        It does the inverse job of _add, and also add a check in case of the fd
        has gone away.
        """
        if xer in primary:
            notifier = primary.pop(xer)
            notifier.shutdown()

    def removeReader(self, reader):
        """
        Remove a Selectable for notification of data available to read.
        """
        self._remove(reader, self._reads)

    def removeWriter(self, writer):
        """
        Remove a Selectable for notification of data available to write.
        """
        self._remove(writer, self._writes)

    def removeAll(self):
        """
        Remove all selectables, and return a list of them.
        """
        rv = self._removeAll(self._reads, self._writes)
        return rv

    def getReaders(self):
        return self._reads.keys()

    def getWriters(self):
        return self._writes.keys()

    def callLater(self, howlong, *args, **kargs):
        rval = super(QtReactor, self).callLater(howlong, *args, **kargs)
        self.reactorInvocation()
        return rval

    def reactorInvocation(self):
        self._timer.stop()
        self._timer.setInterval(0)
        self._timer.start()

    def _iterate(self, delay=None, fromqt=False):
        """See twisted.internet.interfaces.IReactorCore.iterate.
        """
        self.runUntilCurrent()
        self.doIteration(delay, fromqt)

    iterate = _iterate

    def doIteration(self, delay=None, fromqt=False):
        'This method is called by a Qt timer or by network activity on a file descriptor'

        if not self.running and self._blockApp:
#.........这里部分代码省略.........
开发者ID:KDE,项目名称:kajongg,代码行数:103,代码来源:qt4reactor.py

示例12: SampleControl

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class SampleControl(QObject):
    """ Manages a sample's port connections and emits signals when it has changed.
        SIGNALS:
            PYSIGNAL('loaded'), ()
            PYSIGNAL('unloaded'), ()
            PYSIGNAL('volumeChanged'), (vol,)
            PYSIGNAL('start'), ()
            PYSIGNAL('pause'), (pos,)
            PYSIGNAL('unpause'), (pos,)
            PYSIGNAL('cue'), ()
            PYSIGNAL('cueChanged'), (cue,)
            PYSIGNAL('positionChanged'), (pos,)
            PYSIGNAL('reverbChanged'), (rev,)
            PYSIGNAL('delayChanged'), (del,)
            PYSIGNAL('looping'), (bool,)
            PYSIGNAL('pitchChanged'), (pitch,)
            PYSIGNAL('midiPitchChanged'), (pitch, )
            PYSIGNAL('grouped'), (grouped,)
            PYSIGNAL('zoneChanged'), (zone, a0)
            # slotStart called, awaiting forceSlotStart()
            PYSIGNAL('waitingForStart'), ())
    """
    
    def __init__(self):
        """ sample -> splitter |-> volume -> pan -> muter -> mixers[0]
                               |-> volume -> pan -> muter -> mixers[1]
                               |                   ...
                               |-> volume -> pan -> mute from globals import *
        """
        QObject.__init__(self)
        
        self.sample = None
        self.currentCue = 0
        self.cues = []
        self.groupingEnabled = 0
        self.beatSynced = 0
        self.pitchRange = PITCH_RANGE
        self.savedPitchRange = 0
        
        self.driver = pkaudio.Driver()
        # Pitch : when real/temp pitch match, pitch is not bent
        self.pitchTimer = QTimer(self)
        QObject.connect(self.pitchTimer, SIGNAL("timeout()"),
                        self.slotDoPitchBend)
        self.pitchTemp = 0.0 # the bent pitch
        self.realPitch = 0.0 # the original pitch
        self.pitchDirection = "back"
        self.path = None
        
        self.splitter = pkaudio.Splitter()
        
        # Effect chains
        effectChain0 = {}
        effectChain1 = {}
        self.effectChains = [effectChain0, effectChain1]

        # connect eveything up
        for i, chain in enumerate(self.effectChains):

            chain['volume'] = pkaudio.Volume()
            chain['pan'] = pkaudio.Pan()
            chain['peak'] = pkaudio.PeakModule()
            chain['muter'] = pkaudio.Muter()
            chain['muter'].setOn(0)
            
            chain['volume'].outputPort().connect(chain['pan'].inputPort())
            chain['pan'].outputPort().connect(chain['peak'].inputPort())
            chain['peak'].outputPort().connect(chain['muter'].inputPort())
            if i != 1:
                self.splitter.outputPort(i).connect(chain['volume'].inputPort())
            else:
                self.splitter.outputPort(i).connect(chain['pan'].inputPort())
        
        self.effectChains[0]['volume'].setProperty('volume', 75)
        self.slotConnectMixers()
        
    def __del__(self):
        for chain in self.effectChains:
            if chain['muter'].outputPort() != None:
                chain['muter'].outputPort().disconnect()
            self.unload()

        
    def load(self, path):
        """ Load the file and persistent data at 'path'. """
        try:
            self.sample = pkaudio.Sample(path)
        except pkaudio.FileError:
            Globals.Print('Could not open '+path)
            self.sample = None
            return
            
        self.path = path
        conf = Globals.ConfFile()
        conf.readSampleData(self)
        
        # set cue points
        if len(self.cues):
            self.sample.setProperty('start', self.cues[self.currentCue][0])
            self.sample.setProperty('end', self.cues[self.currentCue][1])
#.........这里部分代码省略.........
开发者ID:patrickkidd,项目名称:pksampler-0.3,代码行数:103,代码来源:SampleControl.py

示例13: Commander

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class Commander(QObject):
    def __init__(self, parent):
        QObject.__init__(self)
        self.parent = parent
        # Modal dialogs freezes pm in dbus signal path
        self.delayTimer = QTimer(self)
        self.lastError = None
        ##
        self.connect(self.delayTimer, SIGNAL("timeout()"), self.exceptionHandler)
        self.iface = PisiIface.Iface()
        self.iface.setHandler(self.handler)
        self.iface.setExceptionHandler(self.exceptionHandler)

    def errHandler(self):
        self.iface.com_lock.unlock()
        self.parent.finished("System.Manager.cancelled")
        self.parent.resetState()
        self.parent.refreshState()

    def exceptionHandler(self, exception=None):
        exception = exception or self.lastError
        if "urlopen error" in str(exception) or "Socket Error" in str(exception):
            KMessageBox.error(None, i18n("Network error. Please check your network connections and try again or check your repository addresses."), i18n("COMAR Error"))
        elif "Access denied" in str(exception):
            message = i18n("You are not authorized for this operation.")
            KMessageBox.sorry(None, message, i18n("Error"))
        elif "PYCURL ERROR" in str(exception):
            message = i18n("Please check your network connection or repository addresses.")
            KMessageBox.sorry(None, message, i18n("Error"))
        else:
            KMessageBox.error(None, QString.fromUtf8(str(exception)), i18n("COMAR Error"))

        self.errHandler()


    def handler(self, package, signal, data):
        if len(data) > 1:
            args = data[1:]
        else:
            args = None

        if signal == "finished":
            command = data[0]
            self.iface.com_lock.unlock()
            self.parent.finished(command)
        elif signal == "progress":
            self.parent.displayProgress(data)
        elif signal == "error":
            self.iface.com_lock.unlock()
            print "Error: ", str(data)
            self.lastError = str(data)
            self.delayTimer.start(500, True)
        elif signal == "cancelled":
            self.parent.finished("System.Manager.cancelled")
        elif signal == "started":
            operation = signal
            self.parent.pisiNotify(operation, args)
        elif signal == "status":
            operation = data[0]
            self.parent.pisiNotify(operation, args)
        elif signal == "warning":
            self.iface.com_lock.unlock()
#            self.parent.showWarningMessage(str(args))
            print "Warning: ", str(data)
            self.parent.resetState()
            self.parent.refreshState()
        elif signal == "PolicyKit" and "policy.no" in data:
            message = i18n("You are not authorized for this operation.")
            KMessageBox.sorry(None, message, i18n("Error"))
        else:
            print "Got notification : %s with data : %s" % (signal, data)

    def startUpdate(self, repo = None, handleErrors=True):
        if repo is None:
            self.updateAllRepos(handleErrors)
        else:
            self.updateRepo(repo)

    def install(self,apps):
        self.iface.installPackage(apps)

    def updatePackage(self,apps):
        self.iface.upgradePackages(apps)

    def remove(self,apps):
        self.iface.removePackages(apps)

    def updateRepo(self, repo):
        self.iface.updateRepository(repo)

    def updateAllRepos(self):
        self.iface.updateRepositories()

    def setRepositories(self, repos):
        self.iface.setRepositories(repos)

    def listUpgradable(self):
        return self.iface.getUpdates()

    def listPackages(self):
#.........这里部分代码省略.........
开发者ID:Tayyib,项目名称:uludag,代码行数:103,代码来源:Commander.py

示例14: KSmartTray

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class KSmartTray(QObject):

    class State:
         Waiting = 'StateWaiting'
         Updating = 'StateUpdating'
         Checking = 'StateChecking'
         Upgrading = 'StateUpgrading'
         RunningSmart = 'StateRunningSmart'

    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 internalCheckUpgrades(self, manual):
        if not manual and self.blinkTimer.isActive():
            return
        if self.state == KSmartTray.State.Waiting:
            self.sysTray.checkAction.setEnabled(False)
            self.sysTray.startSmartAction.setEnabled(False)
            self.sysTray.stopAction.setEnabled(True)
            self.process.resetAll()
            if manual:
                self.process.setArguments(["smart-update"])
            else:
                self.process.setArguments(["smart-update", "--after", "60"])
            if not self.process.start():
                KNotifyClient.event(self.sysTray.winId(), "fatalerror",
                                     "Couldn't run 'smart-update'.")
            else:
                QToolTip.add(self.sysTray, "Updating channels...")
                self.state = KSmartTray.State.Updating
    
    def checkUpgrades(self):
        self.internalCheckUpgrades(False)
    
    def manualCheckUpgrades(self):
        self.internalCheckUpgrades(True)
    
    def runUpgrades(self):
        if self.state != KSmartTray.State.Waiting:
            KNotifyClient.event(self.sysTray.winId(), "fatalerror",
                                 "There is a running process.")
        else:
            self.sysTray.checkAction.setEnabled(False)
            self.sysTray.startSmartAction.setEnabled(False)
            self.sysTray.stopAction.setEnabled(False)
            self.process.resetAll()
            self.process.setArguments(["kdesu", "-d", "-c", "smart --gui upgrade"])
            if not self.process.start():
                KNotifyClient.event(self.sysTray.winId(), "fatalerror",
                                     "Couldn't run 'smart upgrade'.")
            else:
                self.state = KSmartTray.State.Upgrading
                QToolTip.remove(self.sysTray)
                QToolTip.add(self.sysTray, "Running Smart Package Manager...")
    
    def startSmart(self):
        if self.state != KSmartTray.State.Waiting:
            KNotifyClient.event(self.sysTray.winId(), "fatalerror",
                                 "There is a running process.")
        else:
            self.sysTray.checkAction.setEnabled(False)
            self.sysTray.startSmartAction.setEnabled(False)
#.........这里部分代码省略.........
开发者ID:blackPantherOS,项目名称:packagemanagement,代码行数:103,代码来源:ksmarttray.py

示例15: ProstateTRUSNavUltrasound

# 需要导入模块: from qt import QTimer [as 别名]
# 或者: from qt.QTimer import start [as 别名]
class ProstateTRUSNavUltrasound(UltraSound):

  OFFLINE_VOLUME_FILENAME = "RecVol_Reference.mha"
  SCOUT_VOLUME_FILENAME = "ScoutScan.mha"
  LIVE_VOLUME_FILENAME = "LiveReconstructedVolume.mha"

  RECORDING_FILENAME = "Recording.mha"
  SCOUT_RECORDING_FILENAME = "ScoutScanRecording.mha"
  LIVE_RECORDING_FILENAME = LIVE_VOLUME_FILENAME

  SCOUT_VOLUME_NODE_NAME = "ScoutScan"
  OFFLINE_VOLUME_NODE_NAME = "RecVol_Reference"
  LIVE_VOLUME_NODE_NAME = "liveReconstruction"

  APPLY_HOLE_FILLING_FOR_SNAPSHOT = False
  SNAPSHOT_INTERVAL = 3
  OUTPUT_VOLUME_SPACING = 3
  LIVE_OUTPUT_VOLUME_SPACING = 1

  @property
  def roiNode(self):
    return self._roiNode

  @roiNode.setter
  def roiNode(self, node):
    self._roiNode=node
    if node is not None:
      self.startStopLiveReconstructionButton.setEnabled(True)
    else:
      self.startStopLiveReconstructionButton.setEnabled(False)

  def __init__(self, guideletParent):
    UltraSound.__init__(self, guideletParent)

    self.parameterNode = guideletParent.parameterNode
    self.parameterNodeObserver = None
    self._roiNode = None
    self.liveOutputSpacingValue = [self.LIVE_OUTPUT_VOLUME_SPACING, self.LIVE_OUTPUT_VOLUME_SPACING,
                                   self.LIVE_OUTPUT_VOLUME_SPACING]
    self.outputSpacing = [self.OUTPUT_VOLUME_SPACING, self.OUTPUT_VOLUME_SPACING, self.OUTPUT_VOLUME_SPACING]
    self.roiOrigin = None
    self.roiExtent = None
    self.defaultParameterNode = None
    self.logic = ProstateTRUSNavUltrasoundLogic()

  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)
#.........这里部分代码省略.........
开发者ID:SlicerProstate,项目名称:ProstateTRUSNav,代码行数:103,代码来源:ProstateTRUSNav.py


注:本文中的qt.QTimer.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。