Python PySide.QtGui.QVBoxLayout() Examples

The following are 30 code examples of PySide.QtGui.QVBoxLayout(). 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 PySide.QtGui , 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: xrefwindow.py    From TimeMachine with GNU Lesser General Public License v3.0 7 votes vote down vote up
def __init__(self, parent=None, win=None, xrefs=None, headers=["Origin", "Method"]):
        super(XrefListView, self).__init__(parent)
        self.parent = parent
        self.mainwin = win
        self.xrefs = xrefs
        self.headers = headers

        self.setMinimumSize(600, 400)

        self.filterPatternLineEdit = QtGui.QLineEdit()
        self.filterPatternLabel = QtGui.QLabel("&Filter origin pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.xrefwindow = XrefValueWindow(self, win, self.xrefs, self.headers)

        sourceLayout = QtGui.QVBoxLayout()
        sourceLayout.addWidget(self.xrefwindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example #3
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 #4
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 #5
Source File: multiLineInputDialog_UI_pyside.py    From anima with MIT License 6 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.verticalLayout = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtGui.QLabel(Dialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.plainTextEdit = QtGui.QPlainTextEdit(Dialog)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.verticalLayout.addWidget(self.plainTextEdit)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.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 #6
Source File: sublink_edit.py    From CurvesWB with GNU Lesser General Public License v2.1 6 votes vote down vote up
def setupUi(self, DockWidget):
        DockWidget.setObjectName(_fromUtf8("DockWidget"))
        DockWidget.resize(400, 200)
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
        #self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        
        for link in self.link_sub:
            groupBox = myGrpBox(self.dockWidgetContents, link, self.obj)
            self.verticalLayout.addWidget(groupBox)
        
        self.pushButton_7 = QtGui.QPushButton(self.dockWidgetContents)
        self.pushButton_7.setObjectName(_fromUtf8("pushButton_7"))
        self.verticalLayout.addWidget(self.pushButton_7, 0, QtCore.Qt.AlignHCenter)
        spacerItem = QtGui.QSpacerItem(20, 237, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        DockWidget.setWidget(self.dockWidgetContents)

        self.retranslateUi(DockWidget)
        QtCore.QMetaObject.connectSlotsByName(DockWidget) 
Example #7
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 #8
Source File: imports.py    From dpa-pipe with MIT License 6 votes vote down vote up
def product_selection_page(self):

        if hasattr(self, '_product_selection_page'):
            return self._product_selection_page

        page = QtGui.QWizardPage()
        page.setTitle("Selection")
        page.setSubTitle(
            "Select the products you'd like to import.")

        self._product_widget = EntityTreeWidget(self.importable_products)
        self._product_widget.setFocusPolicy(QtCore.Qt.NoFocus)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(QtGui.QLabel('Available for import :'))
        layout.addWidget(self.product_widget)

        page.setLayout(layout)

        self._product_selection_page = page
        return self._product_selection_page

    # ------------------------------------------------------------------------- 
Example #9
Source File: _import.py    From dpa-pipe with MIT License 6 votes vote down vote up
def sub_selection_page(self):

        if hasattr(self, '_sub_selection_page'):
            return self._sub_selection_page

        page = QtGui.QWizardPage()
        page.setTitle("Selection")
        page.setSubTitle(
            "Select the subs you'd like to import.")

        self._subs_widget = SubscriptionTreeWidget(self.subs, 
            show_categories=self._category_lookup.keys())
        self._subs_widget.setFocusPolicy(QtCore.Qt.NoFocus)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(QtGui.QLabel('Available for import :'))
        layout.addWidget(self._subs_widget)

        page.setLayout(layout)

        self._sub_selection_page = page
        return self._sub_selection_page

    # ------------------------------------------------------------------------- 
Example #10
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 #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_1115.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
def quickMsg(self, msg, block=1):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            tmpLabel = QtWidgets.QLabel(msg)
            tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
            layout.addWidget(tmpLabel)
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        if block:
            tmpMsg.exec_()
        else:
            tmpMsg.show() 
Example #13
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 #14
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 #15
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 #16
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 #17
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 #18
Source File: IPythonConsole.py    From pcloudpy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, parent=None, App=None):
        super(IPythonConsole, self).__init__(parent)
        self.App = App
        self.console = EmbedIPython(App=self.App)
        self.console.kernel.shell.run_cell('%pylab qt')
        self.console.kernel.shell.run_cell("import numpy as np")
        self.console.kernel.shell.run_cell("from matplotlib import rcParams")
        self.console.kernel.shell.run_cell("rcParams['backend.qt4']='PySide'")
        self.console.kernel.shell.run_cell("import matplotlib.pyplot as plt")

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.console)

        b = QtGui.QWidget()
        b.setLayout(vbox)
        self.setCentralWidget(b) 
Example #19
Source File: xrefwindow.py    From AndroBugs_Framework with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, xrefs=None, headers=["Origin", "Method"]):
        super(XrefListView, self).__init__(parent)
        self.parent = parent
        self.mainwin = win
        self.xrefs = xrefs
        self.headers = headers

        self.setMinimumSize(600, 400)

        self.filterPatternLineEdit = QtGui.QLineEdit()
        self.filterPatternLabel = QtGui.QLabel("&Filter origin pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.xrefwindow = XrefValueWindow(self, win, self.xrefs, self.headers)

        sourceLayout = QtGui.QVBoxLayout()
        sourceLayout.addWidget(self.xrefwindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example #20
Source File: mainform.py    From Satori with Artistic License 2.0 6 votes vote down vote up
def fill_bridges_list(self):
        self.bridges_layout = QtGui.QVBoxLayout(self.bridges_scrollarea_widget_contents)
        self.bridges_layout.setContentsMargins(5, 5, 5, 5)
        font = self.get_default_font(8)

        def bridges_factory(bridge):
            edit = QtGui.QLineEdit(bridge)
            edit.setFont(font)
            edit.setStyleSheet("color:white;background:rgba(142, 116, 173, 100);border: 0px;border-radius: 5px;")
            edit.setReadOnly(True)
            return edit

        with open("bridges.json", 'r') as f:
            bridges_list = json.load(f)

        for bridge in bridges_list:
            bridge_widget = bridges_factory(bridge)
            self.bridges_layout.addWidget(bridge_widget)

        self.bridges_layout.addStretch()
        self.software_scrollarea.setWidget(self.software_layout.widget()) 
Example #21
Source File: universal_tool_template_v7.3.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 = QtGui.QFormLayout()
            the_layout.setLabelAlignment(QtCore.Qt.AlignLeft)
            the_layout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)    
        elif type in ("grid", "QGridLayout"):
            the_layout = QtGui.QGridLayout()
        elif type in ("hbox", "QHBoxLayout"):
            the_layout = QtGui.QHBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        else:        
            the_layout = QtGui.QVBoxLayout()
            the_layout.setAlignment(QtCore.Qt.AlignTop)
        if ui_name != "":
            self.uiList[ui_name] = the_layout
        return the_layout 
Example #22
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 #23
Source File: ClassName_1010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        main_widget = QtWidgets.QWidget()
        self.setCentralWidget(main_widget)
        
        main_layout = QtWidgets.QVBoxLayout()
        main_widget.setLayout(main_layout) 
Example #24
Source File: universal_tool_template_0803.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',
            'txt': 'QTextEdit',
            'list': 'QListWidget', '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 #25
Source File: universal_tool_template_2010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def quickMsg(self, msg, block=1, ask=0):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            tmpLabel = QtWidgets.QLabel(msg)
            tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
            layout.addWidget(tmpLabel)
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        if ask==0:
            tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        else:
            tmpMsg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
        if block:
            value = tmpMsg.exec_()
            if value == QtWidgets.QMessageBox.Ok:
                return 1
            else:
                return 0
        else:
            tmpMsg.show()
            return 0 
Example #26
Source File: recipe-578634.py    From code with MIT License 5 votes vote down vote up
def __init__(self):
            super(Gui, self).__init__()
            self.resize(250, 300)

            self._list = QtGui.QListWidget(self)

            self._button1 = QtGui.QPushButton("Test CallbackEvent", self)     
            self._button2 = QtGui.QPushButton("Test CallbackPool", self)     
            
            layout = QtGui.QVBoxLayout(self)
            layout.setSpacing(2)
            layout.addWidget(self._button1)

            line = QtGui.QFrame(self)
            line.setFrameStyle(line.HLine)
            layout.addSpacing(6)
            layout.addWidget(line)
            layout.addSpacing(6)

            layout.addWidget(self._list)
            layout.addWidget(self._button2)

            self._pool = CallbackThreadPool(4)

            self._button1.clicked.connect(self.runCallbackEvents)
            self._button2.clicked.connect(self.runCallbackPool) 
Example #27
Source File: animate_constraint.py    From FreeCAD_assembly2 with GNU Lesser General Public License v2.1 5 votes vote down vote up
def initUI(self):
        vbox = QtGui.QVBoxLayout()
        hbox = QtGui.QHBoxLayout()
        #hbox2.addStretch(1)
        self.playStopButton = QtGui.QPushButton() #QtGui.QToolButton()
        self.playStopButton.setIcon( QtGui.QIcon(':/assembly2/icons/play.svg') )
        self.playStopButton.clicked.connect( self.playStopButton_clicked )
        self.playStopButton.setFlat( True )
        self.playStopButton.setMaximumWidth( 20 )
        self.playStopButton.setEnabled( False )
        #self.stopButton.setIcon( QtGui.QIcon(':/haas_mill/icons/stop.svg') )
        self.animationSlider = QtGui.QSlider( QtCore.Qt.Orientation.Horizontal )
        self.animationSlider.setMaximum(160)
        self.animationSlider.sliderMoved.connect( self.slider_moved )
        self.animationSlider.setEnabled( False )
        #self.animationSlider.sliderMoved.connect( self.slider_moved )
        hbox.addWidget( self.animationSlider )
        hbox.addWidget( self.playStopButton )
        vbox.addLayout( hbox )
        #operation parameters
        self.parameterDict = {}
        constraint_to_animate = self.taskDialog.constraint_to_animate
        for widgetManager in animation_parameters: #or widgetConstructors or widgetMangers or ...
            w = widgetManager.generateWidget( self.parameterDict, constraint_to_animate )
            if isinstance(w, QtGui.QLayout):
                vbox.addLayout( w )
            else:
                vbox.addWidget( w )
        self.button_generate_animiation =  QtGui.QPushButton('Generate')
        self.button_generate_animiation.clicked.connect( self.generate_animation )
        vbox.addWidget( self.button_generate_animiation )
        self.setLayout(vbox) 
Example #28
Source File: mainform.py    From Satori with Artistic License 2.0 5 votes vote down vote up
def check_sha_sums(self, files):
        self.verify_scroll_area.setVisible(True)
        self.clear_verify_layout()

        def label_factory(text):
            label = QtGui.QLabel(text)
            label.setStyleSheet("color:white;")
            label.setFont(self.get_default_font(10, True))
            return label

        def bridges_factory(bridge):
            edit = QtGui.QLineEdit(bridge)
            edit.setFont(self.get_default_font(10))
            edit.setStyleSheet("color:white;background:rgba(142, 116, 173, 100);border: 0px;border-radius: 5px;")
            edit.setReadOnly(True)
            return edit

        for file_path in files:
            sum = sha256sum(file_path)
            result = self.search_software(sum)
            layout = QtGui.QVBoxLayout()
            layout.setSpacing(3)
            sum_label = bridges_factory(sum)
            filename_label = label_factory(os.path.basename(file_path))
            filename_label.setStyleSheet("background-color:transparent;color:white;")
            layout.addWidget(filename_label)
            layout.addWidget(sum_label)
            if result:
                found_label = label_factory("Software found: " + result)
                found_label.setStyleSheet("font-style: italic; color: rgb(24, 181, 24);background-color:transparent;")
                found_label.setFont(self.get_default_font(14))
                layout.addWidget(found_label)
            self.verify_layout.addLayout(layout)
        if 1 <= self.verify_layout.count() <= 3:
            self.verify_scroll_area.setFixedHeight(85*self.verify_layout.count())
        else:
            self.verify_scroll_area.setFixedHeight(self.height()-200)
        if self.verify_layout.count() > 0:
            self.verify_layout.addStretch() 
Example #29
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 #30
Source File: makeBomCmd.py    From FreeCAD_Assembly4 with GNU Lesser General Public License v2.1 5 votes vote down vote up
def drawUI(self):
        # Our main window will be a QDialog
        self.UI.setWindowTitle('Parts List / BOM')
        self.UI.setWindowIcon( QtGui.QIcon( os.path.join( Asm4.iconPath , 'FreeCad.svg' ) ) )
        self.UI.setWindowFlags( QtCore.Qt.WindowStaysOnTopHint )
        self.UI.setModal(False)
        # set main window widgets layout
        self.mainLayout = QtGui.QVBoxLayout(self.UI)

        # The list, is a plain text field
        self.BOM = QtGui.QPlainTextEdit()
        self.BOM.setMinimumSize(600,500)
        self.BOM.setLineWrapMode(QtGui.QPlainTextEdit.NoWrap)
        self.mainLayout.addWidget(self.BOM)

        # the button row definition
        self.buttonLayout = QtGui.QHBoxLayout()
        self.buttonLayout.addStretch()
        # Save button
        self.CopyButton = QtGui.QPushButton('Copy')
        self.buttonLayout.addWidget(self.CopyButton)
        # Save button
        #self.SaveButton = QtGui.QPushButton('Save')
        #self.buttonLayout.addWidget(self.SaveButton)
        # OK button
        self.OkButton = QtGui.QPushButton('Close')
        self.OkButton.setDefault(True)
        self.buttonLayout.addWidget(self.OkButton)
        self.mainLayout.addLayout(self.buttonLayout)

        # finally, apply the layout to the main window
        self.UI.setLayout(self.mainLayout)

        # Actions
        self.CopyButton.clicked.connect(self.onCopy)
        #self.SaveButton.clicked.connect(self.onSave)
        self.OkButton.clicked.connect(self.onOK)

# add the command to the workbench