Python PyQt5.QtGui.QComboBox() Examples

The following are 7 code examples for showing how to use PyQt5.QtGui.QComboBox(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtGui , or try the search function .

Example 1
Project: Quantdom   Author: constverum   File: ui.py    License: Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        self.setTitle('Strategy')
        self.setAlignment(QtCore.Qt.AlignCenter)
        self.layout = QtGui.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.list = QtGui.QComboBox()

        self.add_btn = QtGui.QPushButton('+')
        self.add_btn.clicked.connect(self.add_strategies)

        self.start_btn = QtGui.QPushButton('Start Backtest')
        self.start_btn.clicked.connect(self.load_strategy)

        self.layout.addWidget(self.list, stretch=2)
        self.layout.addWidget(self.add_btn, stretch=0)
        self.layout.addWidget(self.start_btn, stretch=0)

        self.load_strategies_from_settings() 
Example 2
Project: grap   Author: AirbusCyber   File: QtShim.py    License: MIT License 5 votes vote down vote up
def get_QComboBox():
    """QComboBox getter."""

    try:
        import PySide.QtGui as QtGui
        return QtGui.QComboBox
    except ImportError:
        import PyQt5.QtWidgets as QtWidgets
        return QtWidgets.QComboBox 
Example 3
Project: qkit   Author: qkitgroup   File: plot_view.py    License: GNU General Public License v2.0 5 votes vote down vote up
def setupVector(self,Form):
        """Set up slots for value_vector.
        
        It is possible to plot the data over the x_axis and display the numeric
        values in a table.
        Args:
            self: Object of the Ui_Form class.
            Form: PlotWindow object that inherits the used calls here from the
                underlying QWidget class.
        Returns:
            No return variable. The function operates on the given object.
        """
        self.PlotTypeSelector = QtGui.QComboBox(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth())
        self.PlotTypeSelector.setSizePolicy(sizePolicy)
        self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector"))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.horizontalLayout.addWidget(self.PlotTypeSelector)
        self.PlotTypeSelector.setItemText(0, _translate("Form", "Line Plot", None))
        self.PlotTypeSelector.setItemText(1, _translate("Form", "Table", None))
        
        spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self._addIndicatorLabels(Form,sizePolicy,indicators=["PointX","PointY"]) 
Example 4
Project: Quantdom   Author: constverum   File: ui.py    License: Apache License 2.0 5 votes vote down vote up
def init_shares_tab_ui(self):
        """Shares."""
        self.shares_tab = QtGui.QWidget()
        self.shares_layout = QtGui.QFormLayout(self.shares_tab)
        today = datetime.today()

        self.shares_date_from = QtGui.QDateEdit()
        self.shares_date_from.setMinimumDate(QtCore.QDate(1900, 1, 1))
        self.shares_date_from.setMaximumDate(QtCore.QDate(2030, 12, 31))
        self.shares_date_from.setDate(QtCore.QDate(today.year, 1, 1))
        self.shares_date_from.setDisplayFormat('dd.MM.yyyy')

        self.shares_date_to = QtGui.QDateEdit()
        self.shares_date_to.setMinimumDate(QtCore.QDate(1900, 1, 1))
        self.shares_date_to.setMaximumDate(QtCore.QDate(2030, 12, 31))
        self.shares_date_to.setDate(
            QtCore.QDate(today.year, today.month, today.day)
        )
        self.shares_date_to.setDisplayFormat('dd.MM.yyyy')

        self.shares_symbol_list = QtGui.QComboBox()
        self.shares_symbol_list.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.shares_symbol_list.setMaxVisibleItems(20)
        self.shares_symbol_list.setEditable(True)

        self.shares_show_btn = QtGui.QPushButton('Load')
        self.shares_show_btn.clicked.connect(self.update_data)

        self.shares_layout.addRow('From', self.shares_date_from)
        self.shares_layout.addRow('To', self.shares_date_to)
        self.shares_layout.addRow('Symbol', self.shares_symbol_list)
        self.shares_layout.addRow(None, self.shares_show_btn)

        self.select_source.addTab(self.shares_tab, 'Shares/Futures/ETFs') 
Example 5
Project: pychemqt   Author: jjgomera   File: UI_pipe.py    License: GNU General Public License v3.0 4 votes vote down vote up
def rellenarTabla(self):
        self.TablaAccesorios.verticalHeader().hide()
        self.TablaAccesorios.setRowCount(0)
        self.TablaAccesorios.setColumnCount(5)
        titles = self.titles[:]
        del titles[4]
        self.TablaAccesorios.setHorizontalHeaderLabels(titles)
        self.ListaAccesorios = []
        self.diametros = []
        self.pulgadas = []
        self.k = []
        self.comboxPulgadas = []
        self.comboxmm = []

        for i, Di, key, Di_in, K in FITTING:
            if key in self.ListaAccesorios:
                indice = self.ListaAccesorios.index(key)
                self.diametros[indice].append(Di)
                self.pulgadas[indice].append(Di_in)
                self.k[indice].append(K)
                self.comboxPulgadas[indice].addItem(Di_in)
                self.comboxmm[indice].addItem(str(int(Di)))
            else:
                indice = self.TablaAccesorios.rowCount()
                self.ListaAccesorios.append(key)
                self.diametros.append([Di])
                self.pulgadas.append([Di_in])
                self.k.append([K])
                self.TablaAccesorios.setRowCount(indice+1)
                icon = os.environ["pychemqt"]+"images/equip/%s.png" % key
                self.TablaAccesorios.setItem(
                    indice, 0, QtWidgets.QTableWidgetItem(QtGui.QIcon(
                        QtGui.QPixmap(icon)), key))
                self.comboxmm.append(QtWidgets.QComboBox())
                self.TablaAccesorios.setCellWidget(indice, 1, self.comboxmm[-1])
                self.comboxmm[-1].addItem(str(int(Di)))
                self.comboxmm[-1].currentIndexChanged.connect(self.combommChanged)
                self.comboxPulgadas.append(QtWidgets.QComboBox())
                self.TablaAccesorios.setCellWidget(
                    indice, 2, self.comboxPulgadas[-1])
                self.comboxPulgadas[-1].addItem(Di_in)
                self.comboxPulgadas[-1].currentIndexChanged.connect(
                    self.comboinchChanged)
                self.TablaAccesorios.setItem(
                    indice, 3, QtWidgets.QTableWidgetItem("%0.3f" % K))
                self.TablaAccesorios.item(indice, 3).setTextAlignment(
                    QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
                self.TablaAccesorios.setItem(
                    indice, 4, QtWidgets.QTableWidgetItem(FITTING_DESC[key]))
                self.TablaAccesorios.setRowHeight(
                    self.TablaAccesorios.rowCount()-1, 20)

        self.TablaAccesorios.resizeColumnToContents(0)
        self.TablaAccesorios.setColumnWidth(1, 60)
        self.TablaAccesorios.setColumnWidth(2, 60)
        self.TablaAccesorios.setColumnWidth(3, 50) 
Example 6
Project: qkit   Author: qkitgroup   File: plot_view.py    License: GNU General Public License v2.0 4 votes vote down vote up
def setupMatrix(self,Form):
        """Set up slots for value_matrix.
        
        The data can be plotted color coded as a 2d plot, as a 1d plot at a
        user selected value of the x_axis or the numerical values can be
        displayed in a table.

        Args:
            self: Object of the Ui_Form class.
            Form: PlotWindow object that inherits the used calls here from the
                underlying QWidget class.
        Returns:
            No return variable. The function operates on the given object.
        """
        self.PlotTypeSelector = QtGui.QComboBox(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth())
        
        self.PlotTypeSelector.setSizePolicy(sizePolicy)
        self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector"))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.setItemText(0, _translate("Form", "Color Plot", None))
        self.PlotTypeSelector.setItemText(1, _translate("Form", "Line Plot X", None))
        self.PlotTypeSelector.setItemText(2, _translate("Form", "Line Plot Y", None))
        self.PlotTypeSelector.setItemText(3, _translate("Form", "Table", None))
        
        
        self.PlotTypeLayout = QtGui.QVBoxLayout()
        self.PlotTypeLayout.addWidget(self.PlotTypeSelector)
        # add a empty label to move the PlotTypeSelector to the top
        emptyL = QtGui.QLabel(Form)
        self.PlotTypeLayout.addWidget(emptyL)
        self.horizontalLayout.addLayout(self.PlotTypeLayout,stretch = -10)
        
        self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceXSelector",
                                        TraceIndicator="TraceXValue", prefix = self.selector_labels[0]+': ')
        self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceYSelector", 
                                        TraceIndicator="TraceYValue", prefix = self.selector_labels[1]+': ')
        
        #The indicators should be located at the most right side of the bar
        spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)        
        self._addIndicatorLabels(Form,sizePolicy, indicators=["PointX","PointY","PointZ"]) 
Example 7
Project: qkit   Author: qkitgroup   File: plot_view.py    License: GNU General Public License v2.0 4 votes vote down vote up
def setupBox(self,Form):
        """Set up slots for value_box.
        
        The data can be plotted color coded as a 2d plot at a user selected
        value of either the x_, y_ or z_axis or as a 1d plot at a user selected 
        value of the x_ and y_axis.

        Args:
            self: Object of the Ui_Form class.
            Form: PlotWindow object that inherits the used calls here from the
                underlying QWidget class.
        Returns:
            No return variable. The function operates on the given object.
        """
        self.PlotTypeSelector = QtGui.QComboBox(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.PlotTypeSelector.sizePolicy().hasHeightForWidth())
        
        self.PlotTypeSelector.setSizePolicy(sizePolicy)
        self.PlotTypeSelector.setObjectName(_fromUtf8("PlotTypeSelector"))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        self.PlotTypeSelector.addItem(_fromUtf8(""))
        #self.horizontalLayout.addWidget(self.PlotTypeSelector)
        self.PlotTypeSelector.setItemText(0, _translate("Form", "Select X", None))
        self.PlotTypeSelector.setItemText(1, _translate("Form", "Select Y", None))
        self.PlotTypeSelector.setItemText(2, _translate("Form", "Select Z", None))
        self.PlotTypeSelector.setItemText(3, _translate("Form", "Line Plot", None))
        
        self.PlotTypeLayout = QtGui.QVBoxLayout()
        self.PlotTypeLayout.addWidget(self.PlotTypeSelector)
        # add a empty label to move the PlotTypeSelector to the top
        emptyL = QtGui.QLabel(Form)
        self.PlotTypeLayout.addWidget(emptyL)
        self.horizontalLayout.addLayout(self.PlotTypeLayout,stretch = -10)
       
        self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceXSelector", 
                                        TraceIndicator="TraceXValue", prefix = self.selector_labels[0]+': ')
        self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceYSelector", 
                                        TraceIndicator="TraceYValue", prefix = self.selector_labels[1]+': ')
        self._addTraceSelectorIndicator(Form,sizePolicy,TraceSelector = "TraceZSelector",  
                                        TraceIndicator="TraceZValue",  prefix = self.selector_labels[2]+': ')        

        spacerItem = QtGui.QSpacerItem(40, 1, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        
        self._addIndicatorLabels(Form,sizePolicy,indicators=["PointX","PointY","PointZ"])