本文整理匯總了Python中qt.QObject類的典型用法代碼示例。如果您正苦於以下問題:Python QObject類的具體用法?Python QObject怎麽用?Python QObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了QObject類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _initWidgets
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.")
示例2: test
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()
示例3: __init__
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)
示例4: __init__
def __init__(self, parent):
QObject.__init__(self)
self.parent = parent
try:
self.comar = ComarIface.ComarIface(self.handler, self.errHandler)
except:
self.parent.showErrorMessage(i18n("Cannot connect to Comar daemon"))
self.parent.updateGui()
示例5: plot2d
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()
示例6: main
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)
示例7: __init__
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)
示例8: __init__
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)
示例9: __init__
def __init__(self):
QObject.__init__(self)
bus = dbus.SessionBus()
self.notifyid = 0
try:
object = bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
self.iface = dbus.Interface(object, dbus_interface='org.freedesktop.Notifications')
object.connect_to_signal("ActionInvoked", self.click_handler, dbus_interface="org.freedesktop.Notifications")
except dbus.DBusException:
traceback.print_exc()
示例10: __init__
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)
示例11: __init__
def __init__(self, parent):
QObject.__init__(self)
try:
self.comar = ComarIface.ComarIface(self)
except:
parent.showErrorMessage("Cannot connect to Comar daemon")
self.parent = parent
# Init the database
pisi.api.init(database=True, write=False)
示例12: __init__
def __init__(self, parent, reactor, watcher, socketType):
QObject.__init__(self, parent)
self.reactor = reactor
self.watcher = watcher
fd = watcher.fileno()
self.notifier = QSocketNotifier(fd, socketType, parent)
self.notifier.setEnabled(True)
if socketType == QSocketNotifier.Read:
self.fn = self.read
else:
self.fn = self.write
self.notifier.activated.connect(self.fn)
示例13: __init__
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()
示例14: __init__
def __init__(self, *args):
self.super = super(self.__class__,self)
self.super.__init__(*args)
self.emitter = QObject()
self.selection = None
self.undoStack = UndoStack()
self.undoStackReadOnly = False
示例15: simulate
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)