Kaydet (Commit) 252fca79 authored tarafından Bahadır Kandemir's avatar Bahadır Kandemir

examples

üst e1b0e497
all:
pyuic mainform.ui -o mainform.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from qt import *
import comar
from dbus.mainloop.qt3 import DBusQtMainLoop
import mainform
class Window(mainform.mainForm):
def __init__(self, parent=None):
mainform.mainForm.__init__(self, parent)
self.link = comar.Link()
self.connect(self.buttonServices, SIGNAL("clicked()"), self.getServices)
def handleServices(self, package, exception, results):
if not exception:
serviceName, serviceDesc, serviceState = results
self.textServices.append("%s - %s - %s - %s" % (package, serviceName, serviceDesc, serviceState))
def getServices(self):
self.link.System.Service.info(async=self.handleServices)
def main():
app = QApplication(sys.argv)
# Attach DBus to main loop
DBusQtMainLoop(set_as_default=True)
app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
win = Window()
win.show()
# Enter main loop
app.exec_loop()
if __name__ == "__main__":
main()
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>mainForm</class>
<widget class="QWidget">
<property name="name">
<cstring>mainForm</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>459</width>
<height>343</height>
</rect>
</property>
<property name="caption">
<string>Qt3 &amp; COMAR</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTextEdit" row="0" column="0">
<property name="name">
<cstring>textServices</cstring>
</property>
</widget>
<widget class="QPushButton" row="1" column="0">
<property name="name">
<cstring>buttonServices</cstring>
</property>
<property name="text">
<string>Get Services</string>
</property>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment