Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def demo():
"QGroup Widget"
w = Qt.QWidget()
l = Qt.QVBoxLayout()
w.setLayout(l)
panel = QGroupWidget()
panel.title = "Database"
contentLayout = Qt.QFormLayout()
panel.content().setLayout(contentLayout)
contentLayout.addRow("&Host", Qt.QLineEdit())
contentLayout.addRow("&Port", Qt.QLineEdit())
l.addWidget(panel, 0)
panel = QGroupWidget()
panel.title = "Hello world"
panel.titleIcon = Qt.QIcon.fromTheme("video-x-generic")
panel.setTitleStyle({
'start_color': 'rgb(255, 60, 60)',
'stop_color': 'rgb(200, 0, 0)',
Qt.QSplitter.__init__(self, parent)
self.editorstacks = []
self.editorwindows = []
self.menu_actions, self.io_actions = self.createMenuActions()
self.find_widget = FindReplace(self, enable_replace=True)
self.outlineexplorer = OutlineExplorerWidget(self, show_fullpath=False,
show_all_files=False)
self.outlineexplorer.edit_goto.connect(self.go_to_file)
self.editor_splitter = EditorSplitter(self, self, self.menu_actions,
first=True)
editor_widgets = Qt.QWidget(self)
editor_layout = Qt.QVBoxLayout()
editor_layout.setContentsMargins(0, 0, 0, 0)
editor_widgets.setLayout(editor_layout)
editor_layout.addWidget(self.editor_splitter)
editor_layout.addWidget(self.find_widget)
self.setContentsMargins(0, 0, 0, 0)
self.addWidget(editor_widgets)
self.addWidget(self.outlineexplorer)
self.setStretchFactor(0, 5)
self.setStretchFactor(1, 1)
self.toolbar_list = None
self.menu_list = None
self.setup_window([], [])
def createActionBar(self):
layout = Qt.QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
deleteButton = Qt.QToolButton()
deleteButton.setDefaultAction(self.list.removeAction)
layout.addWidget(deleteButton)
deleteAllButton = Qt.QToolButton()
deleteAllButton.setDefaultAction(self.list.removeAllAction)
layout.addWidget(deleteAllButton)
moveUpButton = Qt.QToolButton()
moveUpButton.setDefaultAction(self.list.moveUpAction)
layout.addWidget(moveUpButton)
moveDownButton = Qt.QToolButton()
moveDownButton.setDefaultAction(self.list.moveDownAction)
layout.addWidget(moveDownButton)
spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
layout.addItem(spacerItem)
return layout
def __init__(self, input_data=None, parent=None,
input_panel_klass=None, designMode=False):
if input_panel_klass is None:
from taurus.qt.qtgui.panel import TaurusInputPanel
input_panel_klass = TaurusInputPanel
self.input_data = input_data
self.input_panel_klass = input_panel_klass
Qt.QDialog.__init__(self, parent)
if input_data and 'title' in input_data:
self.setWindowTitle(input_data['title'])
layout = Qt.QVBoxLayout()
self.setLayout(layout)
self._panel = panel = input_panel_klass(input_data, self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self._panel)
self.connect(panel.buttonBox(), Qt.SIGNAL("accepted()"), self.accept)
self.connect(panel.buttonBox(), Qt.SIGNAL("rejected()"), self.reject)
self._panel.setInputFocus()
def __init__(self, parent=None):
Qt.QWidget.__init__(self, parent)
panel_l = Qt.QVBoxLayout()
self.setLayout(panel_l)
panel_l.setContentsMargins(M, M, M, M)
panel_l.setSpacing(M)
w = TaurusLabel()
display_panel = Qt.QGroupBox("Taurus Label Display")
display_l = Qt.QHBoxLayout()
display_l.setContentsMargins(M, M, M, M)
display_l.setSpacing(M)
display_panel.setLayout(display_l)
# display_l.addStretch(1)
display_l.addWidget(w)
control_panel = Qt.QGroupBox("Control Panel")
control_l = Qt.QFormLayout()
control_l.setContentsMargins(M, M, M, M)
def initComponents(self):
self.setLayout(Qt.QHBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 0)
self.tree = MacroParametersTree(self)
self.delegate = ParamEditorDelegate(self.tree)
self.tree.setItemDelegate(self.delegate)
self.tree.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Expanding)
self.layout().addWidget(self.tree)
actionLayout = Qt.QVBoxLayout()
actionLayout.setContentsMargins(0, 0, 0, 0)
addButton = Qt.QToolButton()
addButton.setDefaultAction(self.tree.addAction)
actionLayout.addWidget(addButton)
deleteButton = Qt.QToolButton()
deleteButton.setDefaultAction(self.tree.deleteAction)
actionLayout.addWidget(deleteButton)
moveUpButton = Qt.QToolButton()
moveUpButton.setDefaultAction(self.tree.moveUpAction)
actionLayout.addWidget(moveUpButton)
moveDownButton = Qt.QToolButton()
moveDownButton.setDefaultAction(self.tree.moveDownAction)
actionLayout.addWidget(moveDownButton)
spacerItem = Qt.QSpacerItem(0, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding)
actionLayout.addItem(spacerItem)
def build_gui():
mw = Qt.QMainWindow()
mw.setObjectName("main window")
w = Qt.QWidget()
w.setObjectName("central widget")
mw.setCentralWidget(w)
l = Qt.QVBoxLayout()
w.setLayout(l)
l1 = Qt.QLabel("H1")
l1.setObjectName("label 1")
l.addWidget(l1)
l2 = Qt.QLabel("H2")
l2.setObjectName("label 2")
l.addWidget(l2)
mw.show()
return mw
detailed description of this QMimeData object.
:param singleModel: (bool) If True, the selection will be of just one
model. Otherwise (default) a list of models can be selected
:param windowTitle: (str) Title of the dialog (default="Model Chooser")
:param listedModels: (list) List of model names for initializing the
model list
:return: (list,bool or QMimeData,bool) Returns a models,ok tuple. models can be
either a list of models or a QMimeData object, depending on
`asMimeData`. ok is True if the dialog was accepted (by
clicking on the "update" button) and False otherwise
'''
dlg = Qt.QDialog(parent)
dlg.setWindowTitle(windowTitle)
dlg.setWindowIcon(Qt.QIcon("logos:taurus.png"))
layout = Qt.QVBoxLayout()
w = TaurusModelChooser(
parent=parent, selectables=selectables, host=host, singleModel=singleModel)
if listedModels is not None:
w.setListedModels(listedModels)
layout.addWidget(w)
dlg.setLayout(layout)
w.updateModels.connect(dlg.accept)
dlg.exec_()
return w.getListedModels(asMimeData=asMimeData), (dlg.result() == dlg.Accepted)
def __init__(self, err_type=None, err_value=None, err_traceback=None,
parent=None, designMode=False):
Qt.QDialog.__init__(self, parent)
layout = Qt.QVBoxLayout()
self.setLayout(layout)
import taurus.qt.qtgui.panel
MsgPanel = taurus.qt.qtgui.panel.TaurusMessagePanel
self._panel = MsgPanel(err_type, err_value, err_traceback,
self, designMode)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self._panel)
self.connect(self.panel().buttonBox(), Qt.SIGNAL("accepted()"),
self.accept)
self.connect(self._panel, Qt.SIGNAL("toggledDetails(bool)"),
self._onShowDetails)
def setButtonsPos(self, buttonsPos):
# we must delete the previous layout before we can set a new one
currlayout = self.layout()
if currlayout is not None:
currlayout.deleteLater()
Qt.QCoreApplication.sendPostedEvents(
currlayout, Qt.QEvent.DeferredDelete)
# add to layout
if buttonsPos is None:
self.setLayout(Qt.QVBoxLayout())
self.layout().addWidget(self._deviceTree)
elif buttonsPos == Qt.Qt.BottomToolBarArea:
self._toolbar.setOrientation(Qt.Qt.Horizontal)
self.setLayout(Qt.QVBoxLayout())
self.layout().addWidget(self._deviceTree)
self.layout().addWidget(self._toolbar)
elif buttonsPos == Qt.Qt.TopToolBarArea:
self._toolbar.setOrientation(Qt.Qt.Horizontal)
self.setLayout(Qt.QVBoxLayout())
self.layout().addWidget(self._toolbar)
self.layout().addWidget(self._deviceTree)
elif buttonsPos == Qt.Qt.LeftToolBarArea:
self._toolbar.setOrientation(Qt.Qt.Vertical)
self.setLayout(Qt.QHBoxLayout())
self.layout().addWidget(self._toolbar)
self.layout().addWidget(self._deviceTree)
elif buttonsPos == Qt.Qt.RightToolBarArea:
self._toolbar.setOrientation(Qt.Qt.Vertical)
self.setLayout(Qt.QHBoxLayout())
self.layout().addWidget(self._deviceTree)