本文整理汇总了Python中PyQt4.QtGui.QBoxLayout.addWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QBoxLayout.addWidget方法的具体用法?Python QBoxLayout.addWidget怎么用?Python QBoxLayout.addWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout.addWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def __init__(self, autoaccept=False, parent=None):
"""
:param autoaccept: if True, the value of the ComboBox is immediately
accepted after selecting it.
"""
super(ComboBoxInputDialog, self).__init__(parent)
self._autoaccept = autoaccept
layout = QVBoxLayout()
label = QtGui.QLabel()
label.setObjectName( 'label' )
combobox = QtGui.QComboBox()
combobox.setObjectName( 'combobox' )
combobox.activated.connect( self._combobox_activated )
ok_button = QPushButton('OK')
ok_button.setObjectName( 'ok' )
cancel_button = QPushButton('Cancel')
cancel_button.setObjectName( 'cancel' )
ok_button.pressed.connect(self.accept)
cancel_button.pressed.connect(self.reject)
button_layout = QBoxLayout(QBoxLayout.RightToLeft)
button_layout.addWidget(cancel_button)
button_layout.addWidget(ok_button)
layout.addWidget( label )
layout.addWidget( combobox )
layout.addLayout( button_layout )
self.setLayout( layout )
示例2: init_ui
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def init_ui(self):
"""
UI setup.
"""
layout = QBoxLayout(0, self)
self.setLayout(layout)
layout.addWidget(self.view)
self.view.move(0, 0)
#self.view.resize(self.parent().width(), self.parent().height())
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def __init__(self, labelText=QString(), topLeftTuple=LEFT, parent=None):
super(LabelledTextEdit, self).__init__(parent)
self.label = QLabel(labelText)
self.textEdit = QTextEdit()
self.label.setBuddy(self.textEdit)
layout = QBoxLayout(QBoxLayout.LeftToRight
if topLeftTuple == LEFT else QBoxLayout.TopToBottom)
layout.addWidget(self.label)
layout.addWidget(self.textEdit)
self.setLayout(layout)
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def __init__(self, labelText=QString(), position=LEFT,
parent=None):
super(LabelledLineEdit, self).__init__(parent)
self.label = QLabel(labelText)
self.lineEdit = QLineEdit()
self.label.setBuddy(self.lineEdit)
layout = QBoxLayout(QBoxLayout.LeftToRight
if position == LEFT else QBoxLayout.TopToBottom)
layout.addWidget(self.label)
layout.addWidget(self.lineEdit)
self.setLayout(layout)
示例5: init_parameters
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def init_parameters(self):
""" Creates the layout of the settings screen
"""
net_layout = QGridLayout()
net_layout.addWidget(QLabel("MARC:"), 0, 1)
net_layout.addWidget(QLabel("WASABI:"), 0, 2)
label_network = QLabel("Network:")
label_network.setStyleSheet("QLabel {font-weight:bold}")
net_layout.addWidget(label_network, 1, 0)
net_layout.addWidget(QLabel("IP:"), 2, 0)
net_layout.addWidget(self.marc_settings["ip"], 2, 1)
net_layout.addWidget(self.wasabi_settings["ip"], 2, 2)
net_layout.addWidget(QLabel("Input Port:"), 3, 0)
net_layout.addWidget(self.marc_settings["port_in"], 3, 1)
net_layout.addWidget(self.wasabi_settings["port_in"], 3, 2)
net_layout.addWidget(QLabel("Output Port:"), 4, 0)
net_layout.addWidget(self.marc_settings["port_out"], 4, 1)
net_layout.addWidget(self.wasabi_settings["port_out"], 4, 2)
button_test_wasabi = QPushButton("&Test")
button_test_wasabi.clicked.connect(self.test_wasabi)
net_layout.addWidget(button_test_wasabi, 4, 3)
net_values = QWidget()
net_values.setLayout(net_layout)
# Open Mary:
label_mary = QLabel("Open Mary:")
label_mary.setStyleSheet("QLabel {font-weight:bold}")
layout_mary = QGridLayout()
layout_mary.addWidget(label_mary, 0, 0)
layout_mary.addWidget(QLabel("Request:"), 1, 0)
layout_mary.addWidget(QLabel("Voice:"), 2, 0)
layout_mary.addWidget(QLabel("Path:"), 3, 0)
layout_mary.addWidget(self.mary_settings["ip"], 1, 1)
layout_mary.addWidget(self.mary_settings["voice"], 2, 1)
layout_mary.addWidget(self.mary_settings["path"], 3, 1)
widget_mary = QWidget()
widget_mary.setLayout(layout_mary)
main_layout = QBoxLayout(2)
main_layout.addWidget(net_values)
main_layout.addWidget(widget_mary)
main_widget = QWidget()
main_widget.setLayout(main_layout)
return main_widget
示例6: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def __init__(self, parent):
QToolBar.__init__(self, parent)
assert parent
self.dock = parent
# a fake spacer widget
w = QWidget(self)
l = QHBoxLayout(w)
l.setMargin(0)
l.setSpacing(0)
l.addStretch()
frame = QFrame()
layout = QBoxLayout(QBoxLayout.LeftToRight, frame)
layout.setContentsMargins(4, 4, 0, 0)
layout.setSpacing(2)
self.aDockFrame = self.addWidget(frame)
self.__icon = QLabel()
layout.addWidget(self.__icon)
layout.addWidget(QLabel(self.dock.windowTitle()))
self.dock.windowIconChanged.connect(self.__setWindowIcon)
# fake spacer item
spacer = QWidgetAction(self)
spacer.setDefaultWidget(w)
self.setMovable(False)
self.setFloatable(False)
self.setIconSize(QSize(12, 12))
self.aFloat = QAction(self)
self.aClose = QAction(self)
QToolBar.addAction(self, spacer)
self.separator = QToolBar.addSeparator(self)
QToolBar.addAction(self, self.aFloat)
QToolBar.addAction(self, self.aClose)
self.updateStandardIcons()
self.dockWidgetFeaturesChanged(self.dock.features())
self.dock.featuresChanged.connect(self.dockWidgetFeaturesChanged)
self.aFloat.triggered.connect(self._floatTriggered)
self.aClose.triggered.connect(self.dock.close)
示例7: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def __init__(self, parent=None):
super(Welcome, self).__init__(parent)
button_settings = QPushButton("&Edit settings")
button_emotions = QPushButton("&Edit emotions")
button_mapping = QPushButton("&Edit mapping")
button_start = QPushButton("&Start training")
button_start_user = QPushButton("&Start with applied settings.")
button_start_neutral = QPushButton("&Start with neutral agent.")
button_start_rulebased = QPushButton("&Start with rulebased agent.")
button_start_wasabi = QPushButton("&Start with wasabi based agent.")
# Define button funcionalty:
button_settings.clicked.connect(self.options)
button_emotions.clicked.connect(self.emotions)
button_mapping.clicked.connect(self.mapping)
button_start_user.clicked.connect(self.start_user)
button_start_neutral.clicked.connect(self.start_neutral)
button_start_rulebased.clicked.connect(self.start_rulebased)
button_start_wasabi.clicked.connect(self.start_wasabi)
button_layout = QBoxLayout(2)
button_layout.addWidget(button_settings)
button_layout.addWidget(button_emotions)
button_layout.addWidget(button_mapping)
buttons = QWidget()
buttons.setLayout(button_layout)
left_top = QWidget()
left_bottom = QWidget()
right_top = QWidget()
right_bottom = QWidget()
layout = QGridLayout()
layout.addWidget(left_top, 0, 0)
layout.addWidget(buttons, 0, 1)
layout.addWidget(right_top, 0, 2)
layout.addWidget(QLabel("Paired Associate Task:"), 1, 1)
layout.addWidget(button_start_user, 2, 1)
layout.addWidget(button_start_neutral, 3, 1)
layout.addWidget(button_start_rulebased, 4, 1)
layout.addWidget(button_start_wasabi, 5, 1)
self.setLayout(layout)
self.resize(600, 100)
示例8: init_ui
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def init_ui(self):
""" Creates the layout of the settings screen.
Basic button functionality is designed here. Parameter settings
have to be overwritten in init_parameters
"""
button_layout = QBoxLayout(0)
button_layout.addWidget(self.button("&Reset", self.reset))
button_layout.addWidget(self.button("&Cancel", self.cancel))
button_layout.addWidget(self.button("&Save", self.save))
buttons = QWidget()
buttons.setLayout(button_layout)
main_layout = QBoxLayout(2)
main_layout.addWidget(self.init_parameters())
main_layout.addWidget(buttons)
return main_layout
示例9: Expression_Examples
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
class Expression_Examples(QtGui.QWidget):
def __init__(self):
super(Expression_Examples, self).__init__()
self.initUI()
def initUI(self):
self.setWindowTitle("Expressions")
self.layout = QVBoxLayout()
self.btnlayout = QBoxLayout(2)
self.playlist_names = QComboBox()
self.layout.addLayout(self.btnlayout)
self.label = QTextEdit()
self.label.setText("nucleus1_wind_CTRL.windSpeed = abs( noise( frame * .05) * 8);\
\n\n#connect:\
\nlocator1_WIND.localWind = abs( noise(sin(frame* .001)*8)*2)\
\n\n#connect:\
\nvortexField1.magnitude=turbulenceField1.magnitude;\
\n\n#sine:\
\npSphere1.translateY = sin(time);\
\n\n#bounce:\
\n$sine = sin(frame * .001);\
\npSphere1.translateY = abs( noise($sine) *4);\
\n\n#bounce random:\
\npSphere1.translateY = abs( noise(sin(frame* .01) *2));\
\n\n#offset:\
\nint $currentTime=`currentTime -q`;\
\nint $offset=5;\
\n$offsetTime=$currentTime-$offset;\
\n$getPos=`getAttr -t $offsetTime pSphere1.rotateY`;\
\npSphere1.rotateY=$getPos;\
\nint $offset=7;\
\n$offsetTime=$currentTime-$offset;\
\n$getPos=`getAttr -t $offsetTime pSphere1.rotateY`;\
\npSphere2.rotateY=$getPos;\
")
self.sel_button = QPushButton(" close")
self.connect(self.sel_button, SIGNAL("clicked()"),lambda: self.gotoAppend())
self.btnlayout.addWidget(self.label)
self.btnlayout.addWidget(self.sel_button)
self.setLayout(self.layout)
def gotoAppend(self):
self.close()
示例10: AboutWindowUI
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
class AboutWindowUI(object):
def setupUi(self, AboutWindow):
"""GUI building for About window"""
AboutWindow.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
self.centralwidget = QtGui.QWidget(AboutWindow)
self.qbox = QBoxLayout(QBoxLayout.TopToBottom, self.centralwidget)
self.centralwidget.setLayout(self.qbox)
###Titre###
self.title = QtGui.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.title.setFont(font)
self.title.setAlignment(QtCore.Qt.AlignCenter)
###Description###
self.description = QtGui.QLabel(self.centralwidget)
self.description.setTextFormat(QtCore.Qt.RichText)
self.description.setScaledContents(False)
self.description.setWordWrap(True)
###Créateurs de l'application###
self.creator = QtGui.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.creator.setFont(font)
self.creator.setAlignment(QtCore.Qt.AlignCenter)
###Ajout des composants à la fenêtre principale###
self.qbox.addWidget(self.title)
self.qbox.addWidget(self.description)
self.qbox.addWidget(self.creator)
AboutWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(AboutWindow)
QtCore.QMetaObject.connectSlotsByName(AboutWindow)
def retranslateUi(self, AboutWindow):
AboutWindow.setWindowTitle(_translate("AboutWindow", "A propos", None))
self.title.setText(_translate("AboutWindow", "Candidate Crawler\n\n""Recherche ponctuelle\n", None))
self.description.setText(_translate("AboutWindow", "<html><body><p align = justify>Ce programme parcours le site de l'APEC pour trouver les meilleurs CVs, à partir d'une liste de critères.</p><p align = justify>Une fois la recherche effectuée, l\'utilisateur télécharge un fichier Zip contenant un tableau Excel récapitulatif ainsi que les CVs trouvés.</p><p align = justify>Le programme exploite une base CSV pour stocker les CVs trouvés.</p></body></html>", None))
self.creator.setText(_translate("AboutWindow", "<html><body><br>Application créée par Guillaume DELAMARE,</br><br>Jonathan SCHIEBEL, Julie SPENS,</br><br>Laura TAPIAS, Pierre THEILHARD</br></body><html>", None))
示例11: E4SideBar
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
class E4SideBar(QWidget):
"""
Class implementing a sidebar with a widget area, that is hidden or shown, if the
current tab is clicked again.
"""
Version = 1
North = 0
East = 1
South = 2
West = 3
def __init__(self, orientation = None, delay = 200, parent = None):
"""
Constructor
@param orientation orientation of the sidebar widget (North, East, South, West)
@param delay value for the expand/shrink delay in milliseconds (integer)
@param parent parent widget (QWidget)
"""
QWidget.__init__(self, parent)
self.__tabBar = QTabBar()
self.__tabBar.setDrawBase(True)
self.__tabBar.setShape(QTabBar.RoundedNorth)
self.__tabBar.setUsesScrollButtons(True)
self.__tabBar.setDrawBase(False)
self.__stackedWidget = QStackedWidget(self)
self.__stackedWidget.setContentsMargins(0, 0, 0, 0)
self.__autoHideButton = QToolButton()
self.__autoHideButton.setCheckable(True)
self.__autoHideButton.setIcon(UI.PixmapCache.getIcon("autoHideOff.png"))
self.__autoHideButton.setChecked(True)
self.__autoHideButton.setToolTip(
self.trUtf8("Deselect to activate automatic collapsing"))
self.barLayout = QBoxLayout(QBoxLayout.LeftToRight)
self.barLayout.setMargin(0)
self.layout = QBoxLayout(QBoxLayout.TopToBottom)
self.layout.setMargin(0)
self.layout.setSpacing(0)
self.barLayout.addWidget(self.__autoHideButton)
self.barLayout.addWidget(self.__tabBar)
self.layout.addLayout(self.barLayout)
self.layout.addWidget(self.__stackedWidget)
self.setLayout(self.layout)
# initialize the delay timer
self.__actionMethod = None
self.__delayTimer = QTimer(self)
self.__delayTimer.setSingleShot(True)
self.__delayTimer.setInterval(delay)
self.connect(self.__delayTimer, SIGNAL("timeout()"), self.__delayedAction)
self.__minimized = False
self.__minSize = 0
self.__maxSize = 0
self.__bigSize = QSize()
self.splitter = None
self.splitterSizes = []
self.__hasFocus = False # flag storing if this widget or any child has the focus
self.__autoHide = False
self.__tabBar.installEventFilter(self)
self.__orientation = E4SideBar.North
if orientation is None:
orientation = E4SideBar.North
self.setOrientation(orientation)
self.connect(self.__tabBar, SIGNAL("currentChanged(int)"),
self.__stackedWidget, SLOT("setCurrentIndex(int)"))
self.connect(e4App(), SIGNAL("focusChanged(QWidget*, QWidget*)"),
self.__appFocusChanged)
self.connect(self.__autoHideButton, SIGNAL("toggled(bool)"),
self.__autoHideToggled)
def setSplitter(self, splitter):
"""
Public method to set the splitter managing the sidebar.
@param splitter reference to the splitter (QSplitter)
"""
self.splitter = splitter
self.connect(self.splitter, SIGNAL("splitterMoved(int, int)"),
self.__splitterMoved)
self.splitter.setChildrenCollapsible(False)
index = self.splitter.indexOf(self)
self.splitter.setCollapsible(index, False)
def __splitterMoved(self, pos, index):
"""
Private slot to react on splitter moves.
@param pos new position of the splitter handle (integer)
@param index index of the splitter handle (integer)
"""
if self.splitter:
self.splitterSizes = self.splitter.sizes()
#.........这里部分代码省略.........
示例12: QPageWidget
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
#.........这里部分代码省略.........
# Update scrollbar position for current page
self.__scrollBar.setValue(self.__current * self.__base_value())
# Return the Event
return QScrollArea.event(self, event)
def keyPressEvent(self, event):
""" Overrides the keyPressEvent to ignore them """
pass
def wheelEvent(self, event):
""" Overrides the wheelEvent to ignore them """
pass
def createPage(self, widget, inMethod = None, outMethod = None):
""" Creates and adds new Page for given widget with given in/out methods.
widget: A QWidget which is the mainwidget for this Page
inMethod: (optional) QPageWidget triggers this method when the Page appear
outMethod: (optional) QPageWidget triggers this method when the Page disappear
"""
self.addPage(Page(widget, inMethod, outMethod))
def addPage(self, page):
""" Adds the given Page to the stack.
page: A Page object
"""
# First remove the last page; its __tmp_page
self.__pages.pop()
# Add new page
self.__pages.append(page)
self.layout.addWidget(page.widget)
# Add __tmp_page to end
self.__pages.append(self.__tmp_page)
self.layout.addWidget(self.__tmp_page.widget)
# Create connections for page navigation signals from new page
self.connect(page.widget, SIGNAL("pageNext()"), self.next)
self.connect(page.widget, SIGNAL("pagePrevious()"), self.prev)
self.connect(page.widget, SIGNAL("setCurrent(int)"), self.setCurrent)
def __setCurrent(self, pageNumber):
""" Internal method to set current page index. """
self.__last = self.__current
self.__current = min(max(0, pageNumber), len(self.__pages) - 2)
if pageNumber == len(self.__pages) - 1 and self.__return_to_first:
self.__current = 0
def setCurrent(self, pageNumber = 0):
""" Set and flip the page with given pageNumber.
pageNumber: index number of Page (default is 0)
"""
self.__setCurrent(pageNumber)
self.flipPage()
def getCurrent(self):
""" Returns current page index. """
return self.__current
def getCurrentWidget(self):
""" Returns current page widget. """
return self.getWidget(self.getCurrent())
示例13: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
def __init__(self, parent=None):
super(urlgroup, self).__init__(parent)
self.setGeometry(10,30,500,80)
self.setObjectName('urlgroup')
self.urlbar = QLineEdit()
self.urlbar.setObjectName('urlbar')
self.urlbar.setText('Collez votre URL içi')
self.urlbar.setStyleSheet('font-weight:lighter;color:gray;')
self.urlbar.show()
self.parsebutton = QPushButton('Go !!')
self.parsebutton.setObjectName('parsebutton')
self.parsebutton.show()
layout = QBoxLayout(QBoxLayout.LeftToRight, self)
layout.addWidget(self.urlbar)
layout.addWidget(self.parsebutton)
self.show()
self.group2 = QGroupBox(parent)
self.group2.setObjectName('core')
self.group2.setGeometry(10,120,500,280)
self.group2.show()
self.group3 = QGroupBox(self.group2)
self.group3.setObjectName('albuminfos')
self.group3.setGeometry(10,15,200,245)
self.group3.show()
self.itemlist = QListWidget(self.group2)
self.itemlist.setGeometry(250,15,230,245)
self.itemlist.show()
self.dlgroup = QGroupBox(parent)
self.dlgroup.setObjectName('dlgroup')
self.dlgroup.setGeometry(10,420,500,100)
self.dlgroup.show()
self.dlgroup.dlbutton = QPushButton('Download', self.dlgroup)
self.dlgroup.dlbutton.setObjectName('dlbutton')
self.dlgroup.dlbutton.move(10,20)
self.dlgroup.dlbutton.show()
self.dlgroup.progressbar = QProgressBar(self.dlgroup)
self.dlgroup.progressbar.setObjectName('progressbar')
self.dlgroup.progressbar.setGeometry(100,21,380,21)
self.dlgroup.progressbar.show()
self.dlgroup.dlinfos = QLabel(self.dlgroup)
self.dlgroup.dlinfos.setGeometry(100,70,200,21)
self.dlgroup.dlinfos.show()
self.dlgroup.dledfile = QLabel(self.dlgroup)
self.dlgroup.dledfile.setGeometry(300,70,200,21)
self.dlgroup.dledfile.show()
self.dlgroup.dlto = QLineEdit('C:\\', self.dlgroup)
self.dlgroup.dlto.setGeometry(100,50,350,21)
self.dlgroup.dlto.show()
self.dlgroup.dlto.changebt = QToolButton(self.dlgroup)
self.dlgroup.dlto.changebt.setObjectName('dltobt')
self.dlgroup.dlto.changebt.setGeometry(10,50,75,21)
self.dlgroup.dlto.changebt.setText('To')
self.dlgroup.dlto.changebt.show()
self.dlgroup.dlto.openf = QPushButton('Open', self.dlgroup)
self.dlgroup.dlto.openf.setGeometry(455,50,35,21)
self.dlgroup.dlto.openf.setObjectName('openfolder')
self.dlgroup.dlto.openf.show()
self.album = QLabel(self.group3)
self.artist = QLabel(self.group3)
self.year = QLabel(self.group3)
self.tracks = QLabel(self.group3)
self.coverart = QLabel(self.group3)
self.urlbar.setFocus(True)
self.connect(self.parsebutton, SIGNAL('clicked()'), self.parseclicked )
self.connect(self.dlgroup.dlbutton, SIGNAL('clicked()'), self.launchdl)
self.connect(self.dlgroup.dlto.changebt, SIGNAL('clicked()'), self.changedir)
self.connect(self.dlgroup.dlto.openf, SIGNAL('clicked()'), self.openfolder)
示例14: MainWindow
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
class MainWindow (QWidget):
def __init__ (self):
QWidget.__init__ (self)
self.sessionBus = dbus.SessionBus()
self.systemBus = dbus.SystemBus()
self.powerdevil = self.sessionBus.get_object('org.kde.screensaver', '/App')
self.powerdevil2 = self.sessionBus.get_object('org.kde.screensaver', '/ScreenSaver')
#self.powerdevil3 = self.sessionBus.get_object('org.kde.kopete', '/Kopete')
#self.powerdevil4 = self.sessionBus.get_object('org.kde.kopete', '/Kopete')
#self.powerdevil5 = self.sessionBus.get_object('org.kde.kopete', '/Kopete')
self.powerdevil6 = self.sessionBus.get_object('org.kde.plasma-desktop', '/App')
#self.powerdevil7 = self.sessionBus.get_object('org.kde.yakuake', '/yakuake/MainWindow_1')
#self.powerdevil8 = self.sessionBus.get_object('org.kde.amarok', '/Player')
#self.sistemeGonder=self.systemBus.get_object('tr.org.pardus.comar','/package/iptables')
self.sistemeGonder=self.systemBus.get_object('tr.org.pardus.comar','/package/openssh')
self.layout = QBoxLayout(QBoxLayout.TopToBottom, self)
self.setLayout(self.layout)
label = QLabel ("bir program", self)
self.layout.addWidget(label)
button0 = QPushButton("comarrr!", self)
self.layout.addWidget(button0)
button = QPushButton("yazdir!", self)
self.layout.addWidget(button)
button2 = QPushButton("ekrani kilitle!", self)
self.layout.addWidget(button2)
button3 = QPushButton("kopete baglantisini kes!", self)
self.layout.addWidget(button3)
button4 = QPushButton("canerle sohbet baslat!", self)
self.layout.addWidget(button4)
button6 = QPushButton("dashboardı goster!", self)
self.layout.addWidget(button6)
button7 = QPushButton("yakuake yi toogle et!", self)
self.layout.addWidget(button7)
button8 = QPushButton("amarok baslat/duraklat!", self)
self.layout.addWidget(button8)
QObject.connect(button0, SIGNAL("clicked()"), self.screenOff0)
QObject.connect(button, SIGNAL("clicked()"), self.screenOff)
QObject.connect(button2, SIGNAL("clicked()"), self.screenOff2)
QObject.connect(button3, SIGNAL("clicked()"), self.screenOff3)
QObject.connect(button4, SIGNAL("clicked()"), self.screenOff4)
QObject.connect(button6, SIGNAL("clicked()"), self.screenOff6)
QObject.connect(button7, SIGNAL("clicked()"), self.screenOff7)
QObject.connect(button8, SIGNAL("clicked()"), self.screenOff8)
self.resize (640, 480)
def screenOff(self):
self.powerdevil.showTaskManager(dbus_interface='org.kde.krunner.App')
def screenOff2(self):
self.powerdevil2.Lock(dbus_interface='org.freedesktop.ScreenSaver')
def screenOff3(self):
self.powerdevil3.disconnectAll(dbus_interface='org.kde.Kopete')
def screenOff4(self):
self.powerdevil3.openChat("[email protected]", dbus_interface='org.kde.Kopete')
def screenOff6(self):
self.powerdevil6.showDashboard(True, dbus_interface='local.PlasmaApp')
def screenOff7(self):
self.powerdevil7.toggleWindowState(dbus_interface='org.kde.yakuake')
def screenOff8(self):
self.powerdevil8.PlayPause(dbus_interface='org.freedesktop.MediaPlayer')
def screenOff0(self):
#self.sistemeGonder.start(dbus_interface='tr.pardus.comar.System.Service')
self.sistemeGonder.start(dbus_interface='tr.pardus.comar.System.Service')
示例15: QWidget
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import addWidget [as 别名]
#ssdp.search()
#ssdp.search(addr=('192.168.0.114', 1900))
widget = QWidget()
widget.setWindowTitle("SSDP Client/Server")
widget.setVisible(True)
closeButton = QPushButton("Zamknij")
closeButton.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
QWidget.connect(closeButton, SIGNAL("clicked()"), upnpy.qtApp.quit)
searchButton = QPushButton("Search")
QWidget.connect(searchButton, SIGNAL("clicked()"), search)
adButton = QPushButton('Advertise Device')
QWidget.connect(adButton, SIGNAL('clicked()'), advertise)
global edit
edit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
layout = QBoxLayout(QBoxLayout.TopToBottom)
layout.addWidget(edit, 3)
layout.addWidget(searchButton)
layout.addWidget(adButton)
layout.addWidget(closeButton)
widget.setLayout(layout)
upnpy.run()
print "Zamykam aplikacje"