本文整理汇总了Python中PyQt4.QtGui.QBoxLayout类的典型用法代码示例。如果您正苦于以下问题:Python QBoxLayout类的具体用法?Python QBoxLayout怎么用?Python QBoxLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QBoxLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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__
def __init__(self, parent = None, direction = "ltr", rtf = False):
""" Creates a new QPageWidget on given parent object.
parent: QWidget parent
direction: "ltr" -> Left To Right
"ttb" -> Top To Bottom
rtf: Return to first, if its True it flips to the first page
when next page requested at the last page
"""
# First initialize, QPageWidget is based on QScrollArea
QScrollArea.__init__(self, parent)
# Properties for QScrollArea
self.setFrameShape(QFrame.NoFrame)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setWidgetResizable(True)
# Main widget, which stores all Pages in it
self.widget = QWidget(self)
# Layout based on QBoxLayout which supports Vertical or Horizontal layout
if direction == "ltr":
self.layout = QBoxLayout(QBoxLayout.LeftToRight, self.widget)
self.__scrollBar = self.horizontalScrollBar()
self.__base_value = self.width
else:
self.layout = QBoxLayout(QBoxLayout.TopToBottom, self.widget)
self.__scrollBar = self.verticalScrollBar()
self.__base_value = self.height
self.layout.setSpacing(0)
self.layout.setMargin(0)
# Return to first
self.__return_to_first = rtf
# TMP_PAGE, its using as last page in stack
# A workaround for a QScrollArea bug
self.__tmp_page = Page(QWidget(self.widget))
self.__pages = [self.__tmp_page]
self.__current = 0
self.__last = 0
# Set main widget
self.setWidget(self.widget)
# Animation TimeLine
self.__timeline = QTimeLine()
self.__timeline.setUpdateInterval(2)
# Updates scrollbar position when frame changed
self.__timeline.frameChanged.connect(lambda x: self.__scrollBar.setValue(x))
# End of the animation
self.__timeline.finished.connect(self._animateFinished)
# Initialize animation
self.setAnimation()
self.setDuration()
示例3: init_ui
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)
示例4: __init__
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)
示例5: __init__
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)
示例6: init_parameters
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
示例7: __init__
def __init__(self, actions=None, parent=None,
direction=QBoxLayout.LeftToRight):
QWidget.__init__(self, parent)
self.actions = []
self.buttons = []
layout = QBoxLayout(direction)
layout.setContentsMargins(0, 0, 0, 0)
self.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
if actions is not None:
for action in actions:
self.addAction(action)
self.setLayout(layout)
示例8: __init__
def __init__( self, parent = None ):
super(XActionGroupWidget, self).__init__( parent )
# define custom properties
self._actionGroup = None
self._padding = 5
self._cornerRadius = 10
# set default properties
layout = QBoxLayout(QBoxLayout.LeftToRight)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
self.setLayout(layout)
示例9: __init__
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)
示例10: 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)
示例11: __init__
def __init__(self, parent=None):
super(XDockToolbar, self).__init__(parent)
# defines the position for this widget
self._currentAction = -1
self._selectedAction = None
self._padding = 8
self._position = XDockToolbar.Position.South
self._minimumPixmapSize = QSize(16, 16)
self._maximumPixmapSize = QSize(48, 48)
self._hoverTimer = QTimer()
self._hoverTimer.setSingleShot(True)
self._hoverTimer.setInterval(1000)
self._actionHeld = False
self._easingCurve = QEasingCurve(QEasingCurve.InOutQuad)
self._duration = 200
self._animating = False
# install an event filter to update the location for this toolbar
layout = QBoxLayout(QBoxLayout.LeftToRight)
layout.setContentsMargins(2, 2, 2, 2)
layout.setSpacing(0)
layout.addStretch(1)
layout.addStretch(1)
self.setLayout(layout)
self.setContentsMargins(2, 2, 2, 2)
self.setMouseTracking(True)
parent.window().installEventFilter(self)
parent.window().statusBar().installEventFilter(self)
self._hoverTimer.timeout.connect(self.emitActionHovered)
示例12: __init__
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)
示例13: __init__
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)
示例14: __init__
def __init__( self, orientation = 2, parent = None ):
QWidget.__init__( self, parent )
self.__tabBar = QTabBar()
self.__tabBar.setDrawBase( True )
self.__tabBar.setShape( QTabBar.RoundedNorth )
self.__tabBar.setFocusPolicy( Qt.NoFocus )
self.__tabBar.setUsesScrollButtons( True )
self.__tabBar.setElideMode( 1 )
self.__stackedWidget = QStackedWidget( self )
self.__stackedWidget.setContentsMargins( 0, 0, 0, 0 )
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.__tabBar )
self.layout.addLayout( self.barLayout )
self.layout.addWidget( self.__stackedWidget )
self.setLayout( self.layout )
self.__minimized = False
self.__minSize = 0
self.__maxSize = 0
self.__bigSize = QSize()
self.splitter = None
self.__tabBar.installEventFilter( self )
self.__orientation = orientation
self.setOrientation( orientation )
self.__tabBar.currentChanged.connect(
self.__stackedWidget.setCurrentIndex )
return
示例15: __init__
def __init__(self, search, parent=None):
QWidget.__init__(self, parent)
# Load de l'UI
PyQt4.uic.loadUi('ui/downloads.ui', self)
# Ajout de la progressBar
self.progressBar = QProgressBar()
self.progressBar.setMinimum(0)
self.progressBar.setMaximum(100)
self.progressBar.hide()
self.HLayout = QBoxLayout(QBoxLayout.LeftToRight)
self.HLayout.addWidget(self.progress_label)
self.HLayout.addWidget(self.progressBar)
self.formLayout_3.addRow(self.HLayout)
# Vars
TabDownloads.instance = self
self.downloads = Downloads()
self.pos = None
self.download_looked = None
# Affichage custom
#self.downloads_table.setStyleSheet(\
# "QTableView::item{ \
# border-right-style:solid; \
# border-width:0.5; \
# border-color: #9B9B9B; \
# }")
# On autorise la creation de menu contextuel
self.setContextMenuPolicy(Qt.CustomContextMenu)
# Signaux
self.customContextMenuRequested.connect(self.contextMenu)
self.downloads_table.itemClicked.connect(self.show_info_download)
# Init
self.load_downloads()
# On remove les finis et en erreur si Config.clean_dl_list = 1
if Configuration.clean_dl_list == 1:
self.clean_list_Action()
#########################################################
# On désactive les boutons qui sont pas encore implantés
self.button_stop_all.setEnabled(False)
self.button_resume_all.setEnabled(False)