def __init__(self, *args): QVBox.__init__(self, *args) self.slider = QSlider(QSlider.Horizontal, self, "slider") self.slider.setRange(0, 999) self.slider.setValue(0) QObject.connect(self.slider, SIGNAL("valueChanged(int)"), self.valueChanged) self.setFocusProxy(self.slider)
def test(): from qt import QWidget class W(QWidget): def __init__(self): QWidget.__init__(self) def create(): global _list s = SampleControl() s.load('/home/ajole/wav/trance.wav') s.slotStart() s.slotSetZone(0, True) _list.append(s) import pkaudio from qt import QApplication, QPushButton, QObject, SIGNAL pkaudio.connect_to_host(startserver=0) a = QApplication([]) w1 = SampleControl() w1.load('/home/ajole/wav/track.wav') w1.slotStart() w1.slotSetZone(0, True) b = QPushButton('create', None) QObject.connect(b, SIGNAL('clicked()'), create) b.show() a.setMainWidget(b) a.exec_loop()
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 plot2d(self): self.box = QHBox() toolbar = QVBox(self.box) self.plot2d = Plot2D(self.box, self.plotdata) self.slider = QSlider(QSlider.Vertical, toolbar, "slider") self.slider.setRange(0, self.plotdata.xmax - 1) self.slider.setValue(0) QObject.connect(self.slider, SIGNAL("valueChanged(int)"), self.plot2d.slice) self.plot2d.slice(0) self.box.show()
def __init__(self, reactor, watcher, type): QSocketNotifier.__init__(self, watcher.fileno(), type) self.reactor = reactor self.watcher = watcher self.fn = None if type == QSocketNotifier.Read: self.fn = self.read elif type == QSocketNotifier.Write: self.fn = self.write QObject.connect(self, SIGNAL("activated(int)"), self.fn)
def __init__(self, f, log): super(LyJob, self).__init__() self.f = f self.setExecutable(config("commands").get("lilypond", "lilypond")) self.setWorkingDirectory(f.directory) self.log = log self.stdout = Outputter(log, f) self.stderr = Outputter(log, f) QObject.connect(self, SIGNAL("receivedStdout(KProcess*, char*, int)"), self.stdout.receive) QObject.connect(self, SIGNAL("receivedStderr(KProcess*, char*, int)"), self.stderr.receive)
def main(): app = KdeQt.KQApplication(sys.argv, None) stat = KdeQt.prepareCommandLine() QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) wnd = MainForm_Impl.MainForm_Impl(statusbar=stat) if wnd.init(): app.setMainWidget(wnd) KdeQt.setupKDE(app, wnd) wnd.show() res = app.exec_loop() sys.exit(res)
def __init__(self, parentWidget, window): """Initialises a new KTVHTMLPart object. Requires the same arguments as KHTMLPart, plus the parent window it will attach to.""" KHTMLPart.__init__(self, parentWidget) self._window = window QObject.connect(self.browserExtension(), SIGNAL('openURLRequestDelayed(const KURL&, const KParts::URLArgs&)'), self._openURLRequest) self.__lastURL = None self.__currentURL = None self.setFormNotification(self.NoNotification)
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 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)
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) 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 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, filename, *args): QHBox.__init__(self, *args) t = QVBox(self) self.plotdata = PlotData(file(filename)) self.plot = Plot3D(self, self.plotdata) self.xmax = self.plotdata.xmax self.ymax = self.plotdata.ymax self.size = LCDRange(t, "size") self.size.setRange(30, 125) self.size.setValue(125) self.xpos = LCDRange(t, "xpos") self.xpos.setValue(725) self.ypos = LCDRange(t, "ypos") self.ypos.setValue(400) self.plot2d() QObject.connect(self.size, PYSIGNAL("valueChanged(int)"), self.plotdata.size) QObject.connect(self.xpos, PYSIGNAL("valueChanged(int)"), self.plotdata.xpos) QObject.connect(self.ypos, PYSIGNAL("valueChanged(int)"), self.plotdata.ypos) QObject.connect(self.plotdata, PYSIGNAL("sizeChanged()"), self.sizeChanged) self.sizeChanged()
def __init__(self, sample): self.sample = sample QObject.connect(self.sample, PYSIGNAL('volumeChanged'), self.slotVolume) QObject.connect(self.sample, PYSIGNAL('start'), self.slotStart) QObject.connect(self.sample, PYSIGNAL('pause'), self.slotPause) QObject.connect(self.sample, PYSIGNAL('unpause'), self.slotUnpause) QObject.connect(self.sample, PYSIGNAL('cue'), self.slotCue) QObject.connect(self.sample, PYSIGNAL('cueChanged'), self.slotCueChanged) QObject.connect(self.sample, PYSIGNAL('positionChanged'), self.slotPositionChanged) QObject.connect(self.sample, PYSIGNAL('reverbChanged'), self.slotReverbChanged) QObject.connect(self.sample, PYSIGNAL('delayChanged'), self.slotDelayChanged) QObject.connect(self.sample, PYSIGNAL('looping'), self.slotLooping) QObject.connect(self.sample, PYSIGNAL('pitchChanged'), self.slotPitchChanged) QObject.connect(self.sample, PYSIGNAL('midiPitchChanged'), self.slotMidiPitchChanged) QObject.connect(self.sample, PYSIGNAL('grouped'), self.slotGrouped) QObject.connect(self.sample, PYSIGNAL('zoneChanged'), self.slotZoneChanged) QObject.connect(self.sample, PYSIGNAL('waitingForStart'), self.slotWaitingForStart)
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 __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 __init__(self, url): KRun.__init__(self, KURL(url)) self.setAutoDelete(False) krun.__savedInstances.append(self) QObject.connect(self, SIGNAL("finished()"), self._slotExit)
def __init__(self): KProcess.__init__(self) QObject.connect(self, SIGNAL("processExited(KProcess*)"), self._slotExit)
def sig(func): QObject.connect(sender, SIGNAL(signal), func) return func
#!/usr/bin/python # -*- coding: utf-8 -*- import sys from kdecore import KApplication, KAboutData, KCmdLineArgs, KGlobal, KIcon from qt import QObject, SIGNAL, SLOT from pakito.gui.mainwindow import MainWindow def I18N_NOOP(x): return x name = "Pakito" version = "0.3" mail = "*****@*****.**" description = I18N_NOOP("A tool for accelerating package making process") if __name__ == "__main__": about = KAboutData(name.lower(), name, version, description, KAboutData.License_GPL_V2, "(C) Gökçen Eraslan 2007", None, None, mail) about.addAuthor("Gökçen Eraslan", None, mail) KCmdLineArgs.init(sys.argv, about) app = KApplication() programLogo = KGlobal.iconLoader().loadIcon("pisikga", KIcon.Desktop) about.setProgramLogo(programLogo.convertToImage()) QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) pac = MainWindow(None, name) app.setMainWidget(pac) pac.show() app.exec_loop()
def createEditor(self): """Crea un editor para interactuar con el contenido. En este caso es un botón, ya que permite asignar una acción al click de ratón""" boton = QButton(self.table().viewport(), "Ventana abierta") #El padre es viewport, es invisible QObject.connect(boton, SIGNAL("clicked()"), self.__editar) return boton
def __init__(self, window, mesh): Txq3dPlotWin.__init__(self, window) self.setAxes(mesh.xmin, mesh.ymin, mesh.zmin, mesh.xmax, mesh.ymax, mesh.zmax) self.mesh = mesh QObject.connect(self.mesh, PYSIGNAL("dataChanged()"), self.meshChanged) self.meshChanged()
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from kdecore import KApplication, KAboutData, KCmdLineArgs, KGlobal, KIcon from qt import QObject, SIGNAL, SLOT from pakito.gui.mainwindow import MainWindow def I18N_NOOP(x): return x name = "Pakito" version = "0.3" mail = "*****@*****.**" description = I18N_NOOP("A tool for accelerating package making process") if __name__ == "__main__": about = KAboutData(name.lower(), name, version, description, KAboutData.License_GPL_V2, "(C) Gökçen Eraslan 2007", None, None, mail) about.addAuthor("Gökçen Eraslan", None, mail) KCmdLineArgs.init(sys.argv, about) app = KApplication() programLogo = KGlobal.iconLoader().loadIcon("pisikga", KIcon.Desktop) about.setProgramLogo(programLogo.convertToImage()) QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) pac = MainWindow(None, name) app.setMainWidget(pac) pac.show() app.exec_loop()