Python PySide2.QtWidgets.QHBoxLayout() Examples

The following are 30 code examples of PySide2.QtWidgets.QHBoxLayout(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PySide2.QtWidgets , or try the search function .
Example #1
Source File: universal_tool_template_1100.py    From universal_tool_template.py with MIT License 7 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #2
Source File: universal_tool_template_0803.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #3
Source File: universal_tool_template_v8.1.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #4
Source File: GearBox_template_1010.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #5
Source File: universal_tool_template_1010.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #6
Source File: UITranslator.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #7
Source File: universal_tool_template_1020.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #8
Source File: onionSkinRendererObjectWidget.py    From onionSkinRenderer with MIT License 6 votes vote down vote up
def setupUi(self, onionSkinObject_layout):
        onionSkinObject_layout.setObjectName("onionSkinObject_layout")
        onionSkinObject_layout.resize(204, 38)
        self.horizontalLayout = QtWidgets.QHBoxLayout(onionSkinObject_layout)
        self.horizontalLayout.setSpacing(3)
        self.horizontalLayout.setContentsMargins(4, 2, 4, 2)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.object_label = QtWidgets.QLabel(onionSkinObject_layout)
        self.object_label.setObjectName("object_label")
        self.horizontalLayout.addWidget(self.object_label)
        self.object_remove_btn = QtWidgets.QPushButton(onionSkinObject_layout)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.object_remove_btn.sizePolicy().hasHeightForWidth())
        self.object_remove_btn.setSizePolicy(sizePolicy)
        self.object_remove_btn.setMinimumSize(QtCore.QSize(16, 16))
        self.object_remove_btn.setMaximumSize(QtCore.QSize(16, 16))
        self.object_remove_btn.setObjectName("object_remove_btn")
        self.horizontalLayout.addWidget(self.object_remove_btn)

        self.retranslateUi(onionSkinObject_layout)
        QtCore.QMetaObject.connectSlotsByName(onionSkinObject_layout) 
Example #9
Source File: LNTextEdit.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def __init__(self, *args):
        QtWidgets.QFrame.__init__(self, *args)
 
        self.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Sunken)
 
        self.edit = self.PlainTextEdit()
        self.number_bar = self.NumberBar(self.edit)
 
        hbox = QtWidgets.QHBoxLayout(self)
        hbox.setSpacing(0)
        hbox.setContentsMargins(0,0,0,0) # setMargin
        hbox.addWidget(self.number_bar)
        hbox.addWidget(self.edit)
 
        self.edit.blockCountChanged.connect(self.number_bar.adjustWidth)
        self.edit.updateRequest.connect(self.number_bar.updateContents) 
Example #10
Source File: universal_tool_template_1116.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #11
Source File: universal_tool_template_1115.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #12
Source File: universal_tool_template_1112.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #13
Source File: qast_viewer.py    From angr-management with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _init_widgets(self):

        layout = QHBoxLayout()

        ast_label = QLabel(self)
        self._ast_label = ast_label

        if self._display_size:
            size_label = QLabel(self)
            size_label.setProperty('class', 'ast_viewer_size')
            size_label.setAlignment(Qt.AlignRight)
            size_label.setMaximumSize(QSize(24, 65536))
            self._size_label = size_label
            layout.addWidget(self._size_label)

        if self._ast is not None:
            self.reload()

        layout.addWidget(ast_label)
        layout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(layout) 
Example #14
Source File: universal_tool_template_1000.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #15
Source File: strings_view.py    From angr-management with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _init_widgets(self):
        lbl_function = QLabel(self)
        lbl_function.setText("Function")
        self._function_list = QFunctionComboBox(show_all_functions=True, selection_callback=self._on_function_selected,
                                                parent=self
                                                )

        function_layout = QHBoxLayout()
        function_layout.addWidget(lbl_function)
        function_layout.addWidget(self._function_list)

        self._string_table = QStringTable(self, selection_callback=self._on_string_selected)

        layout = QVBoxLayout()
        layout.addLayout(function_layout)
        layout.addWidget(self._string_table)
        layout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(layout) 
Example #16
Source File: twitter_dapp.py    From Hands-On-Blockchain-for-Python-Developers with MIT License 6 votes vote down vote up
def createTweetsGroupBox(self):
        self.tweets_group_box = QtWidgets.QGroupBox("Tweets")
        self.account_address = QtWidgets.QLineEdit()
        self.fetch_button = QtWidgets.QPushButton("Fetch")
        self.add_to_bookmark_button = QtWidgets.QPushButton("Bookmark it!")

        self.connect(self.fetch_button, QtCore.SIGNAL('clicked()'), self.fetchTweets)
        self.connect(self.add_to_bookmark_button, QtCore.SIGNAL('clicked()'), self.bookmarkAddress)

        account_address_layout = QtWidgets.QHBoxLayout()
        account_address_layout.addWidget(self.account_address)
        account_address_layout.addWidget(self.fetch_button)
        account_address_layout.addWidget(self.add_to_bookmark_button)

        self.tweets_layout = QtWidgets.QVBoxLayout()

        self.tweets_main_layout = QtWidgets.QVBoxLayout()
        self.tweets_main_layout.addWidget(QtWidgets.QLabel("Address:"))
        self.tweets_main_layout.addLayout(account_address_layout)
        self.tweets_main_layout.addSpacing(20)
        self.tweets_main_layout.addLayout(self.tweets_layout)
        self.tweets_group_box.setLayout(self.tweets_main_layout) 
Example #17
Source File: universal_tool_template_1110.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #18
Source File: xref.py    From angr-management with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _init_widgets(self):

        # xref viewer
        xref_viewer = QXRefViewer(
            addr=self._addr, variable_manager=self._variable_manager, variable=self._variable,
            xrefs_manager=self._xrefs_manager, dst_addr=self._dst_addr,
            instance=self._instance, disassembly_view=self._disassembly_view, parent=self,
        )

        # buttons
        btn_ok = QPushButton('OK')

        btn_close = QPushButton('Close')
        btn_close.clicked.connect(self._on_close_clicked)

        buttons_layout = QHBoxLayout()
        buttons_layout.addWidget(btn_ok)
        buttons_layout.addWidget(btn_close)

        layout = QVBoxLayout()
        layout.addWidget(xref_viewer)
        layout.addLayout(buttons_layout)

        self.setLayout(layout) 
Example #19
Source File: dialog.py    From hotbox_designer with BSD 3-Clause Clear License 6 votes vote down vote up
def __init__(self, command, parent=None):
        super(CommandDisplayDialog, self).__init__(parent)
        self.setWindowTitle("Command")
        self.text = QtWidgets.QTextEdit()
        self.text.setReadOnly(True)
        self.text.setPlainText(command)
        self.ok = QtWidgets.QPushButton('ok')
        self.ok.released.connect(self.accept)

        self.button_layout = QtWidgets.QHBoxLayout()
        self.button_layout.setContentsMargins(0, 0, 0, 0)
        self.button_layout.addStretch(1)
        self.button_layout.addWidget(self.ok)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.addWidget(self.text)
        self.layout.addLayout(self.button_layout) 
Example #20
Source File: console_view.py    From angr-management with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _init_widgets(self):

        import angr, claripy, cle

        namespace = {
            'angr': angr,
            'claripy': claripy,
            'cle': cle,
        }

        try:
            ipython_widget = QIPythonWidget(namespace=namespace)
        except MultipleInstanceError:
            _l.warning("Fails to load the Console view since an IPython interpreter has already been loaded. "
                       "You might be running angr Management with IPython.")
            return

        self._ipython_widget = ipython_widget

        hlayout = QHBoxLayout()
        hlayout.addWidget(ipython_widget)

        self.setLayout(hlayout) 
Example #21
Source File: memory.py    From f-ing-around-with-binaryninja with MIT License 6 votes vote down vote up
def __init__(self, parent, name, view):
        try:
            QWidget.__init__(self, parent)
            DockContextHandler.__init__(self, self, name)

            view.session_data['emulator.memory.dockWidget'] = self

            self.view = view

            self.layout = QHBoxLayout(self)

            dock_handler = DockHandler.getActiveDockHandler()
            dock_handler.setVisible('Emulator Memory View', False)

        except Exception as e:
            print(e) 
Example #22
Source File: widgets.py    From hotbox_designer with BSD 3-Clause Clear License 6 votes vote down vote up
def __init__(self, parent=None):
        super(ColorEdit, self).__init__(parent)

        self.text = QtWidgets.QLineEdit()
        self.text.returnPressed.connect(self.apply)
        self.button = QtWidgets.QPushButton(icon('picker.png'), '')
        self.button.setFixedSize(21, 21)
        self.button.released.connect(self.pick_color)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)
        self.layout.addWidget(self.text)
        self.layout.addWidget(self.button)

        self._value = self.value() 
Example #23
Source File: widgets.py    From hotbox_designer with BSD 3-Clause Clear License 6 votes vote down vote up
def __init__(self, parent=None):
        super(BrowseEdit, self).__init__(parent)

        self.text = QtWidgets.QLineEdit()
        self.text.returnPressed.connect(self.apply)
        self.button = QtWidgets.QPushButton('B')
        self.button.setFixedSize(21, 21)
        self.button.released.connect(self.browse)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)
        self.layout.addWidget(self.text)
        self.layout.addWidget(self.button)

        self._value = self.value() 
Example #24
Source File: _output_dock.py    From torba with MIT License 6 votes vote down vote up
def setupUi(self, OutputDock):
        OutputDock.setObjectName("OutputDock")
        OutputDock.resize(700, 397)
        OutputDock.setFloating(False)
        OutputDock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
        self.dockWidgetContents = QtWidgets.QWidget()
        self.dockWidgetContents.setObjectName("dockWidgetContents")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.dockWidgetContents)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.textEdit = QtWidgets.QTextEdit(self.dockWidgetContents)
        self.textEdit.setReadOnly(True)
        self.textEdit.setObjectName("textEdit")
        self.horizontalLayout.addWidget(self.textEdit)
        OutputDock.setWidget(self.dockWidgetContents)

        self.retranslateUi(OutputDock)
        QtCore.QMetaObject.connectSlotsByName(OutputDock) 
Example #25
Source File: universal_tool_template_0903.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #26
Source File: universal_tool_template_0904.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickLayout(self, type, ui_name=""):
        the_layout = ''
        if type in ("form", "QFormLayout"):
            the_layout = QtWidgets.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtWidgets.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtWidgets.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtWidgets.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #27
Source File: universal_tool_template_v8.1.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txtEdit': 'LNTextEdit', 'txt': 'QTextEdit',
            'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt) 
Example #28
Source File: choose_from_list_dialog_UI_pyside2.py    From anima with MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(478, 280)
        self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.listView = QtWidgets.QListView(Dialog)
        self.listView.setObjectName("listView")
        self.horizontalLayout.addWidget(self.listView)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem)
        self.pushButton_2 = QtWidgets.QPushButton(Dialog)
        self.pushButton_2.setObjectName("pushButton_2")
        self.verticalLayout_2.addWidget(self.pushButton_2)
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setObjectName("pushButton")
        self.verticalLayout_2.addWidget(self.pushButton)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem1)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.listView_2 = QtWidgets.QListView(Dialog)
        self.listView_2.setObjectName("listView_2")
        self.horizontalLayout.addWidget(self.listView_2)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #29
Source File: symexec_view.py    From angr-management with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def _init_widgets(self):

        main = QMainWindow()
        main.setWindowFlags(Qt.Widget)

        # main.setCorner(Qt.TopLeftCorner, Qt.TopDockWidgetArea)
        # main.setCorner(Qt.TopRightCorner, Qt.RightDockWidgetArea)

        pathtree = QPathTree(self.current_simgr, self.current_state, self, self.workspace, parent=main)
        pathtree_dock = QDockWidget('PathTree', pathtree)
        main.setCentralWidget(pathtree_dock)
        # main.addDockWidget(Qt.BottomDockWidgetArea, pathtree_dock)
        pathtree_dock.setWidget(pathtree)

        simgrs = QSimulationManagers(self.workspace.instance, self.current_simgr, self.current_state, parent=main)
        simgrs_dock = QDockWidget('SimulationManagers', simgrs)
        main.addDockWidget(Qt.RightDockWidgetArea, simgrs_dock)
        simgrs_dock.setWidget(simgrs)

        state_viewer = StateInspector(self.workspace, self.current_state, parent=self)
        state_viewer_dock = QDockWidget('Selected State', state_viewer)
        main.addDockWidget(Qt.RightDockWidgetArea, state_viewer_dock)
        state_viewer_dock.setWidget(state_viewer)

        self._pathtree = pathtree
        self._simgrs = simgrs
        self._state_viewer = state_viewer

        main_layout = QHBoxLayout()
        main_layout.addWidget(main)
        main_layout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(main_layout)

    #
    # Private methods
    # 
Example #30
Source File: tests.py    From Qt.py with MIT License 5 votes vote down vote up
def test_load_ui_existingLayoutOnMainWindow():
    """Tests to see if loading a ui onto a layout in a MainWindow works"""
    import sys
    from Qt import QtWidgets, QtCompat

    msgs = 'QLayout: Attempting to add QLayout "" to QMainWindow ' \
        '"", which already has a layout'

    with ignoreQtMessageHandler([msgs]):
        app = QtWidgets.QApplication(sys.argv)
        win = QtWidgets.QMainWindow()
        QtWidgets.QComboBox(win)
        QtWidgets.QHBoxLayout(win)
        QtCompat.loadUi(self.ui_qmainwindow, win)
    app.exit()