def create(self): self.v_layout = QtGui.QGridLayout(self.central) self.v_layout.setContentsMargins(0, 0, 0, 0) self.v_layout.setSpacing(0) self.tab_panel = self.panel() self.v_layout.addWidget(self.tab_panel, 0, 0) self.v_layout.setRowStretch(0, 0) self.tab_layout = QtGui.QGridLayout(self.tab_panel) self.tab_layout.setContentsMargins(0, 0, 0, 0) self.tabs = qtgui.Tabs() self.tab_layout.addWidget(self.tabs) self.h_layout = QtGui.QGridLayout() self.h_layout.setContentsMargins(0, 0, 0, 0) self.h_layout.setSpacing(0) self.v_layout.addLayout(self.h_layout, 1, 0) self.v_layout.setRowStretch(1, 1) self.b_panel = self.panel() self.bottom = QtGui.QBoxLayout(QtGui.QBoxLayout.BottomToTop, self.b_panel) self.v_layout.addWidget(self.b_panel, 2, 0) self.v_layout.setRowStretch(2, 0) self.l_panel = self.panel() self.left_top = QtGui.QStackedLayout(self.l_panel) self.h_layout.addWidget(self.l_panel, 0, 0) self.h_layout.setColumnStretch(0, 0) self.t_layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) self.h_layout.addLayout(self.t_layout, 0, 1) self.h_layout.setColumnStretch(1, 1) self.t_panel = self.panel() self.top = VLayout(self.t_panel) self.top.setSizeConstraint(QtGui.QLayout.SetMinAndMaxSize) self.t_layout.addWidget(self.t_panel) self.t_panel.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Maximum) self.canvas = Canvas(self, app=self.app) self.t_layout.addWidget(self.canvas) self.r_panel = self.panel() self.right_top = QtGui.QStackedLayout(self.r_panel) self.h_layout.addWidget(self.r_panel, 0, 2) self.h_layout.setColumnStretch(2, 0) self.progressBar = qtgui.ProgressBar() self.bottom.addWidget(self.progressBar)
def __init__(self): # create the se Toolbar self.mw = FreeCADGui.getMainWindow() self.seWidget = QtGui.QDockWidget() self.baseWidget = DraftDockWidget() self.seWidget.setObjectName("seToolbar") self.seWidget.setTitleBarWidget(self.baseWidget) self.seWidget.setWindowTitle( translate("se", "Surface Editor Command Bar")) self.mw.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.seWidget) self.baseWidget.setVisible(False) self.seWidget.setVisible(False) #self.seWidget.toggleViewAction().setVisible(False) #self.sourceCmd = None #self.taskmode = Draft.getParam("UiMode") self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self.baseWidget) self.layout.setDirection(QtGui.QBoxLayout.LeftToRight) self.layout.setObjectName("layout") self.l1 = self.label("l1", "current command: ") self.lcommand = self.label("lcommand", "None") self.w1 = self.lineedit("w1", width=100) self.l2 = self.label("l1", "value:") self.w2 = self.lineedit("w2", width=100) self.q1 = self.combo("q1", [("String", "App::PropertyString"), ("Float", "App::PropertyFloat"), ("Vector", "App::PropertyVector")]) self.b1 = self.button("b1", "OK") self.layout.addStretch(100)
def createWindow(widget): ''' Example on creating a new plot window in the main window MDI-Area ''' import plotWidget from PySide import QtGui from numpy import linspace from scipy.special import jn from chaco.api import ArrayPlotData, Plot window = widget.createNewWindow() container = plotWidget.plotContainer(window) plotWidget = plotWidget.PlotWidget(container) container.setPlotWidget(plotWidget) x = linspace(-2.0, 10.0, 100) pd = ArrayPlotData(index=x) for i in range(5): pd.set_data("y" + str(i), jn(i, x)) plot = Plot(pd, title=None, padding_left=60, padding_right=5, padding_top=5, padding_bottom=30, border_visible=True) plot.plot(("index", "y0", "y1", "y2"), name="j_n, n<3", color="red") plotWidget.setPlot(plot) layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) layout.addWidget(container) window.setLayout(layout) window.show()
def __init__(self, parent): QtGui.QWidget.__init__(self, parent) self.adapter = PlotWidgetAdapter(self) box = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) box.addWidget(self.adapter.control) self.setLayout(box) self.variables = []
def __init__(self, name, low_value, high_value, increment, default_value, parent=None): super(Slider, self).__init__(parent=parent) self._increment = increment low_int = int(math.floor(float(low_value) / increment)) high_int = int(math.ceil(float(high_value) / increment)) self.label = QtGui.QLabel(self) self.label.setText(name) self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.slider.setRange(low_int, high_int) self.slider.valueChanged[int].connect(self._value_changed) self.text = QtGui.QLabel(self) self.text.setText(str(self.value)) self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight) self.layout.addWidget(self.label) self.layout.addWidget(self.slider) self.layout.addWidget(self.text) self.setLayout(self.layout) self.value = default_value
def layoutUI(self): """ Layout widgets """ mainLayout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) mainLayout.addWidget(self.tabWidget) self.setLayout(mainLayout)
def __init__(self, orientation, title, parent=None): super(SlidersGroup, self).__init__(title, parent) self.slider = QtGui.QSlider(orientation) self.slider.setFocusPolicy(QtCore.Qt.StrongFocus) self.slider.setTickPosition(QtGui.QSlider.TicksBothSides) self.slider.setTickInterval(10) self.slider.setSingleStep(1) self.scrollBar = QtGui.QScrollBar(orientation) self.scrollBar.setFocusPolicy(QtCore.Qt.StrongFocus) self.dial = QtGui.QDial() self.dial.setFocusPolicy(QtCore.Qt.StrongFocus) self.slider.valueChanged[int].connect(self.scrollBar.setValue) self.scrollBar.valueChanged[int].connect(self.dial.setValue) self.dial.valueChanged[int].connect(self.slider.setValue) self.dial.valueChanged[int].connect(self.valueChanged) if orientation == QtCore.Qt.Horizontal: direction = QtGui.QBoxLayout.TopToBottom else: direction = QtGui.QBoxLayout.LeftToRight slidersLayout = QtGui.QBoxLayout(direction) slidersLayout.addWidget(self.slider) slidersLayout.addWidget(self.scrollBar) slidersLayout.addWidget(self.dial) self.setLayout(slidersLayout)
def __init__(self): super(TaskPanel, self).__init__() self.setMinimumHeight(250) self.child = QtGui.QWidget() self.child.setContentsMargins(0, 0, 0, 0) self.child.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) self.setWidget(self.child) self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom, self.child)
def __init__(self, labelText="", position=LEFT, parent=None): QtGui.QWidget.__init__(self, parent) self.label = QtGui.QLabel(labelText) self.textEdit = QtGui.QTextEdit() self.label.setBuddy(self.textEdit) layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight if position == LEFT else QtGui.QBoxLayout.TopToBottom) layout.addWidget(self.label) layout.addWidget(self.textEdit) self.setLayout(layout)
def layoutUI(self): form = QtGui.QFormLayout() form.addRow("Invert Direction", self.invertCheckBox) form.addRow("Multiply", self.multiplyLE) form.addRow("Rotate", self.rotateLE) layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) layout.addLayout(form) layout.addWidget(self.button) self.setLayout(layout)
def siapkanUI(self): self.resize(300, 200) self.setWindowTitle('Tutorial PySide') self.btn1 = QtGui.QPushButton('Tombol 1') self.btn2 = QtGui.QPushButton('Tombol 2') self.btn3 = QtGui.QPushButton('Tombol 3') self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom, self) self.layout.addWidget(self.btn1) self.layout.addWidget(self.btn2) self.layout.addWidget(self.btn3)
def __init__(self, parent=None): """ Init """ super(Content, self).__init__(parent) self.button = QtGui.QPushButton("button") self.le = QtGui.QLineEdit("lineedit") self.textEdit = QtGui.QTextEdit("text edit") layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) layout.addWidget(self.button) layout.addWidget(self.le) layout.addWidget(self.textEdit) self.setLayout(layout)
def __init__(self, mode='vertical', parent=None): super(LayoutWidget, self).__init__(parent=parent) if mode in ('vertical', 'horizontal'): self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, parent=self) # On est oblige de donner une direction a la creation du layout if mode == 'horizontal': self.layout.setDirection(QtGui.QBoxLayout.LeftToRight) elif mode =='vertical': self.layout.setDirection(QtGui.QBoxLayout.TopToBottom) elif mode == 'grid': self.layout = QtGui.QGridLayout(self) # On est oblige de donner une direction a la creation du layout else: raise() self.setLayout(self.layout) self.layout.setContentsMargins(0, 0, 0, 0)
def siapkanUI(self): self.resize(250, 200) self.setWindowTitle('Tutorial PySide') self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom, self) self.btnMessageDialog = QtGui.QPushButton('Message Dialog') self.btnErrorDialog = QtGui.QPushButton('Error Dialog') self.btnInputDialog = QtGui.QPushButton('Input Dialog') self.btnProgressDialog = QtGui.QPushButton('Progress Dialog') self.btnFileDialog = QtGui.QPushButton('File Dialog') self.layout.addWidget(self.btnMessageDialog) self.layout.addWidget(self.btnErrorDialog) self.layout.addWidget(self.btnInputDialog) self.layout.addWidget(self.btnProgressDialog) self.layout.addWidget(self.btnFileDialog)
def _initTimeLine(self): """Initializes the TimeLineWidget. The timeline widget is setup with the class variables for the default in and out frames. The frameChanged signal is connected to the onFrameChanged method along with the Value Editor's onFrameChanged method too. """ self.timeLinePortIndex = -1 self.timeLinePortPath = None self.timeLine = TimeLine.TimeLineWidget() self.timeLine.setTimeRange(CanvasWindow.defaultFrameIn, CanvasWindow.defaultFrameOut) self.timeLine.updateTime(1) self.dfgWidget.stylesReloaded.connect(self.timeLine.reloadStyles) self.timeLine.frameChanged.connect(self.onFrameChanged) self.timeLine.frameChanged.connect(self.valueEditor.onFrameChanged) self.scriptEditor.setTimeLineGlobal(self.timeLine) self.timelineFrame = QtGui.QFrame() self.timelineFrame.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) self.timelineFrame.setObjectName("DFGTimelineFrame") self.timelineFrame.setLineWidth(0) self.timelineFrame.setContentsMargins(0, 0, 0, 0) self.timelineFrame.setFrameStyle(QtGui.QFrame.NoFrame | QtGui.QFrame.Plain) self.timelineFrameLayout = QtGui.QBoxLayout( QtGui.QBoxLayout.LeftToRight) self.timelineFrameLayout.setContentsMargins(0, 0, 0, 0) self.timelineFrameLayout.setSpacing(0) self.timelineFrameLayout.addWidget(self.timeLine) self.timelineFrameLayout.addSpacing(4) self.timelineFrameLayout.addWidget(self.fpsLabel) self.timelineFrame.setLayout(self.timelineFrameLayout)
def __init__(self, parent=getMayaWindow()): super(bSkinSaverUI, self).__init__(parent, QtCore.Qt.WindowStaysOnTopHint) tab_widget = QtGui.QTabWidget() objectsTab = QtGui.QWidget() verticesTab = QtGui.QWidget() tab_widget.addTab(objectsTab, "Objects") tab_widget.addTab(verticesTab, "Vertices") self.descLabel = QtGui.QLabel("(C) 2015 by Thomas Bittner", parent=self) self.setWindowTitle('bSkinSaver 1.1') self.objectsFileLine = QtGui.QLineEdit('/Users/thomas/default.weights', parent=self) self.selectObjectsFileButton = QtGui.QPushButton("Set File", parent=self) self.saveObjectsButton = QtGui.QPushButton( "Save Weights from selected Objects", parent=self) self.loadObjectsButton = QtGui.QPushButton("Load", parent=self) self.loadObjectsSelectionButton = QtGui.QPushButton( "Load to Selected Object", parent=self) objectsLayout = QtGui.QVBoxLayout(objectsTab) objectsLayout.setAlignment(QtCore.Qt.AlignTop) objectsLayout.setSpacing(3) objectsFileLayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight) objectsFileLayout.addWidget(self.objectsFileLine) objectsFileLayout.addWidget(self.selectObjectsFileButton) objectsLayout.addLayout(objectsFileLayout) objectsButtonLayout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) objectsButtonLayout.setSpacing(0) objectsButtonLayout.addWidget(self.saveObjectsButton) objectsButtonLayout.addWidget(self.loadObjectsButton) objectsButtonLayout.addWidget(self.loadObjectsSelectionButton) objectsLayout.addLayout(objectsButtonLayout) self.verticesFileLine = QtGui.QLineEdit( '/Users/thomas/defaultVertex.weights', parent=self) self.selectVerticesFileButton = QtGui.QPushButton("Set File", parent=self) self.saveVerticesButton = QtGui.QPushButton( "Save Weights from selected Vertices", parent=self) self.loadVerticesButton = QtGui.QPushButton( "Load onto selected Object", parent=self) self.ignoreSoftSelectionWhenSaving = QtGui.QCheckBox( "ignore Soft Selection when Saving", parent=self) self.ignoreJointLocksWhenLoading = QtGui.QCheckBox( "ignore Joint Locks when Loading", parent=self) verticesLayout = QtGui.QVBoxLayout(verticesTab) verticesLayout.setAlignment(QtCore.Qt.AlignTop) verticesLayout.setSpacing(3) verticesFileLayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight) verticesFileLayout.addWidget(self.verticesFileLine) verticesFileLayout.addWidget(self.selectVerticesFileButton) verticesLayout.addLayout(verticesFileLayout) verticesButtonLayout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom) verticesButtonLayout.setSpacing(0) verticesButtonLayout.addWidget(self.saveVerticesButton) verticesButtonLayout.addWidget(self.loadVerticesButton) verticesButtonLayout.addWidget(self.ignoreSoftSelectionWhenSaving) verticesButtonLayout.addWidget(self.ignoreJointLocksWhenLoading) verticesLayout.addLayout(verticesButtonLayout) self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom, self) self.layout.addWidget(tab_widget) self.layout.addWidget(self.descLabel) self.resize(400, 10) #select files self.connect(self.selectObjectsFileButton, QtCore.SIGNAL("clicked()"), self.selectObjectsFile) self.connect(self.selectVerticesFileButton, QtCore.SIGNAL("clicked()"), self.selectVerticesFile) self.connect(self.saveObjectsButton, QtCore.SIGNAL("clicked()"), self.saveObjects) self.connect(self.loadObjectsButton, QtCore.SIGNAL("clicked()"), self.loadObjects) self.connect(self.loadObjectsSelectionButton, QtCore.SIGNAL("clicked()"), self.loadObjectsSelection) self.connect(self.saveVerticesButton, QtCore.SIGNAL("clicked()"), self.saveVertices) self.connect(self.loadVerticesButton, QtCore.SIGNAL("clicked()"), self.loadVertices)
import sys, time from PySide import QtGui app = QtGui.QApplication(sys.argv) window = QtGui.QWidget() window.resize(250, 200) window.setWindowTitle('Tutorial PySide') layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom, window) btnMessageDialog = QtGui.QPushButton('Message Dialog') btnErrorDialog = QtGui.QPushButton('Error Dialog') btnInputDialog = QtGui.QPushButton('Input Dialog') btnProgressDialog = QtGui.QPushButton('Progress Dialog') btnFileDialog = QtGui.QPushButton('File Dialog') layout.addWidget(btnMessageDialog) layout.addWidget(btnErrorDialog) layout.addWidget(btnInputDialog) layout.addWidget(btnProgressDialog) layout.addWidget(btnFileDialog) def showMessageDialog(): messageBox = QtGui.QMessageBox(window) messageBox.setWindowTitle('Message Box') messageBox.setText('The document has been modified') messageBox.setInformativeText('Do you want to save your changes?') messageBox.setStandardButtons(QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard
def __init__(self): super(CategoryPanel, self).__init__() qtgui.Widget.__init__(self) self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.BottomToTop, self)