예제 #1
0
파일: dialogs.py 프로젝트: scenaristeur/ts2
    def __init__(self, parent, train):
        """Constructor for the SplitTrainDialog."""
        super().__init__(parent)
        self.setObjectName("split_train_dialog")
        self.setWindowTitle(self.tr("Split a train"))
        layout = QtWidgets.QVBoxLayout()

        label0 = QtWidgets.QLabel(self)
        label0.setText(train.trainType.elements[0].description)
        layout.addWidget(label0)
        self.radioButtons = []
        for element in train.trainType.elements[1:]:
            self.radioButtons.append(
                QtWidgets.QRadioButton(self.tr("Split here"), self))
            layout.addWidget(self.radioButtons[-1])
            label = QtWidgets.QLabel(self)
            label.setText(element.description)
            layout.addWidget(label)
        self.radioButtons[0].setChecked(True)
        buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        layout.addWidget(buttonBox)
        self.setLayout(layout)
        self.setMinimumWidth(300)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        settings.restoreWindow(self)
예제 #2
0
파일: dialogs.py 프로젝트: scenaristeur/ts2
 def __init__(self, parent):
     """Constructor for the DownloadSimulationsDialog."""
     super().__init__(parent)
     self.setWindowTitle(self.tr("Download simulations from server"))
     label = QtWidgets.QLabel(self)
     label.setText(self.tr("Download server: "))
     self.url = QtWidgets.QLineEdit(self)
     self.url.setText(ts2.get_info().get('simulations_repo'))
     hlayout = QtWidgets.QHBoxLayout()
     hlayout.addWidget(label)
     hlayout.addWidget(self.url)
     note = QtWidgets.QLabel(self)
     note.setText(
         self.tr("<em>The download server must be the url of a "
                 "valid GitHub repository.</em>"))
     buttonBox = QtWidgets.QDialogButtonBox()
     buttonBox.addButton(self.tr("Download"),
                         QtWidgets.QDialogButtonBox.AcceptRole)
     buttonBox.addButton(self.tr("Cancel"),
                         QtWidgets.QDialogButtonBox.RejectRole)
     vlayout = QtWidgets.QVBoxLayout()
     vlayout.addLayout(hlayout)
     vlayout.addSpacing(5)
     vlayout.addWidget(note)
     vlayout.addSpacing(10)
     vlayout.addWidget(buttonBox)
     self.setLayout(vlayout)
     buttonBox.accepted.connect(self.accept)
     buttonBox.rejected.connect(self.reject)
    def setupUi(self, QSpectrumAnalyzerSettingsHelp):
        QSpectrumAnalyzerSettingsHelp.setObjectName(
            "QSpectrumAnalyzerSettingsHelp")
        QSpectrumAnalyzerSettingsHelp.resize(1200, 700)
        self.verticalLayout = QtWidgets.QVBoxLayout(
            QSpectrumAnalyzerSettingsHelp)
        self.verticalLayout.setObjectName("verticalLayout")
        self.helpTextEdit = QtWidgets.QPlainTextEdit(
            QSpectrumAnalyzerSettingsHelp)
        self.helpTextEdit.setUndoRedoEnabled(False)
        self.helpTextEdit.setTextInteractionFlags(
            QtCore.Qt.TextSelectableByKeyboard
            | QtCore.Qt.TextSelectableByMouse)
        self.helpTextEdit.setObjectName("helpTextEdit")
        self.verticalLayout.addWidget(self.helpTextEdit)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            QSpectrumAnalyzerSettingsHelp)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(QSpectrumAnalyzerSettingsHelp)
        self.buttonBox.accepted.connect(QSpectrumAnalyzerSettingsHelp.accept)
        self.buttonBox.rejected.connect(QSpectrumAnalyzerSettingsHelp.reject)
        QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerSettingsHelp)
        QSpectrumAnalyzerSettingsHelp.setTabOrder(self.helpTextEdit,
                                                  self.buttonBox)
예제 #4
0
    def __init__(self, *args, **kwargs):
        super(MatteLoadDialog, self).__init__(*args, **kwargs)

        self.label = QtWidgets.QLabel('Load selected mattes')

        self.matte_list = MatteList()
        self.matte_list.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)

        self.ignore_namespaces = QtWidgets.QCheckBox('ignore namespaces')

        self.button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Apply
            | QtWidgets.QDialogButtonBox.Cancel)
        self.button_box.button(
            QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget(self.label)
        self.layout.addWidget(self.matte_list)
        self.layout.addWidget(self.ignore_namespaces)
        self.layout.addWidget(self.button_box)
        self.setLayout(self.layout)
        self.setWindowTitle('Load Matte AOVS')
예제 #5
0
파일: dialg.py 프로젝트: imec-myhdl/Spyce
    def __init__(self,
                 title='TextEditor',
                 size=(400, 300),
                 parent=None):  # pins is a listof tuples: (name, type, x, y)
        '''display text, and edit the contents'''
        super(txtDialog, self).__init__(parent)
        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)

        # edit widget
        self.text_edit = QtWidgets.QTextEdit(parent)
        font = QtGui.QFont()
        font.setFamily('Lucida')
        font.setFixedPitch(True)
        font.setPointSize(12)
        self.text_edit.setFont(font)
        self.layout.addWidget(self.text_edit)

        # Cancel and OK buttons
        buttons = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
        self.bbox = QtWidgets.QDialogButtonBox(buttons)
        self.bbox.accepted.connect(self.accept)
        self.bbox.rejected.connect(self.reject)
        self.layout.addWidget(self.bbox)

        # set window title and window size
        self.setWindowTitle(title)
        self.resize(size[0], size[1])
예제 #6
0
파일: dialg.py 프로젝트: imec-myhdl/Spyce
    def __init__(self,
                 label,
                 title='Add Label',
                 content="",
                 size=(300, 100),
                 parent=None):
        super(textLineDialog, self).__init__(parent)
        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)

        self.layout.addWidget(QtWidgets.QLabel(label))
        # edit widget
        self.text_edit = QtWidgets.QLineEdit(content, parent)
        font = QtGui.QFont()
        font.setFamily('Lucida')
        font.setFixedPitch(True)
        font.setPointSize(12)
        self.text_edit.setFont(font)
        self.layout.addWidget(self.text_edit)

        # Cancel and OK buttons
        buttons = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
        self.bbox = QtWidgets.QDialogButtonBox(buttons)
        self.bbox.accepted.connect(self.accept)
        self.bbox.rejected.connect(self.reject)
        self.layout.addWidget(self.bbox)

        # set window title and window size
        self.setWindowTitle(title)
        self.resize(size[0], size[1])
예제 #7
0
def launch_yes_no_dialog(title,
                         message,
                         show_not_again_checkbox=True,
                         parent=None):
    '''
    Launch a dialog box that has "yes" and "no" buttons.
    Optionally display a checkbox that asks whether to show this dialog box again.
    return the result of this dialog (True/False) and whether the user checked on
    the "Don't ask again" checkbox (True/False).
    '''

    dialog = QtWidgets.QDialog(parent=parent)
    dialog.setWindowTitle(title)
    dialog.verticalLayout = QtWidgets.QVBoxLayout(dialog)

    # Create the dialogs main message (Qlabel)
    dialog.label = QtWidgets.QLabel(dialog)
    dialog.label.setAlignment(QtCore.Qt.AlignCenter)
    dialog.label.setTextInteractionFlags(dialog.label.textInteractionFlags()
                                         | QtCore.Qt.TextBrowserInteraction)
    dialog.label.setTextFormat(QtCore.Qt.RichText)
    dialog.label.setOpenExternalLinks(True)
    dialog.label.setText(message)
    dialog.verticalLayout.addWidget(dialog.label)

    dialog.widget = QtWidgets.QWidget(dialog)
    dialog.horizontalLayout = QtWidgets.QHBoxLayout(dialog.widget)
    dialog.horizontalLayout.setContentsMargins(-1, -1, -1, 0)
    dialog.horizontalLayout.setObjectName("horizontalLayout")
    dialog.verticalLayout.addWidget(dialog.widget)

    # Create the "Don\t ask again" checkbox
    dialog.checkBox = QtWidgets.QCheckBox(dialog.widget)
    dialog.checkBox.setText("Don\'t ask again")
    dialog.horizontalLayout.addWidget(dialog.checkBox)

    # Create the buttonbox with "yes" and "no buttons"
    dialog.buttonBox = QtWidgets.QDialogButtonBox(dialog.widget)
    dialog.buttonBox.setOrientation(QtCore.Qt.Horizontal)
    dialog.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                        | QtWidgets.QDialogButtonBox.Yes)
    dialog.horizontalLayout.addWidget(dialog.buttonBox)
    # Connect the buttonbox signals
    dialog.buttonBox.accepted.connect(dialog.accept)
    dialog.buttonBox.rejected.connect(dialog.reject)
    QtCore.QMetaObject.connectSlotsByName(dialog)

    # Hide the checkbox if not desired
    if not show_not_again_checkbox:
        dialog.checkBox.hide()

    # Resize the dialog box to scale to its contents
    dialog.adjustSize()

    # Launch the dialog
    yes = dialog.exec_()
    dont_notify_again = dialog.checkBox.isChecked()
    return bool(yes), dont_notify_again
예제 #8
0
    def setupUi(self, QSpectrumAnalyzerSmoothing):
        QSpectrumAnalyzerSmoothing.setObjectName("QSpectrumAnalyzerSmoothing")
        QSpectrumAnalyzerSmoothing.resize(250, 130)
        self.verticalLayout = QtWidgets.QVBoxLayout(QSpectrumAnalyzerSmoothing)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(QSpectrumAnalyzerSmoothing)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.windowFunctionComboBox = QtWidgets.QComboBox(
            QSpectrumAnalyzerSmoothing)
        self.windowFunctionComboBox.setObjectName("windowFunctionComboBox")
        self.windowFunctionComboBox.addItem("")
        self.windowFunctionComboBox.addItem("")
        self.windowFunctionComboBox.addItem("")
        self.windowFunctionComboBox.addItem("")
        self.windowFunctionComboBox.addItem("")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.windowFunctionComboBox)
        self.label_2 = QtWidgets.QLabel(QSpectrumAnalyzerSmoothing)
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)
        self.windowLengthSpinBox = QtWidgets.QSpinBox(
            QSpectrumAnalyzerSmoothing)
        self.windowLengthSpinBox.setMinimum(3)
        self.windowLengthSpinBox.setMaximum(1001)
        self.windowLengthSpinBox.setProperty("value", 11)
        self.windowLengthSpinBox.setObjectName("windowLengthSpinBox")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.windowLengthSpinBox)
        self.verticalLayout.addLayout(self.formLayout)
        spacerItem = QtWidgets.QSpacerItem(20, 1,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(QSpectrumAnalyzerSmoothing)
        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.label.setBuddy(self.windowFunctionComboBox)
        self.label_2.setBuddy(self.windowLengthSpinBox)

        self.retranslateUi(QSpectrumAnalyzerSmoothing)
        self.windowFunctionComboBox.setCurrentIndex(1)
        self.buttonBox.accepted.connect(QSpectrumAnalyzerSmoothing.accept)
        self.buttonBox.rejected.connect(QSpectrumAnalyzerSmoothing.reject)
        QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerSmoothing)
        QSpectrumAnalyzerSmoothing.setTabOrder(self.windowFunctionComboBox,
                                               self.windowLengthSpinBox)
        QSpectrumAnalyzerSmoothing.setTabOrder(self.windowLengthSpinBox,
                                               self.buttonBox)
예제 #9
0
 def createButtons(self):
     self.browseButton = QtWidgets.QToolButton(text=self.tr("..."),
                                               clicked=self.browse)
     self.buttonBox = QtWidgets.QDialogButtonBox(
         QtWidgets.QDialogButtonBox.Open
         | QtWidgets.QDialogButtonBox.Cancel
         | QtWidgets.QDialogButtonBox.Help,
         accepted=self.openFile,
         rejected=self.reject,
         helpRequested=self.help,
     )
예제 #10
0
파일: dialg.py 프로젝트: imec-myhdl/Spyce
    def __init__(self, title='View settings', size=(400, 300), parent=None):
        super(viewConfigDialog, self).__init__(parent)
        self.layout = self.layout = QtWidgets.QGridLayout()
        self.setLayout(self.layout)
        self.viewWidgets = []
        self.n = 1

        import spycelib.const
        reload(spycelib.const)
        from spycelib.const import viewTypes

        self.layout.addWidget(QtWidgets.QLabel("viewtype:"), 0, 0)
        self.layout.addWidget(QtWidgets.QLabel("editor command:"), 0, 1)
        self.layout.addWidget(QtWidgets.QLabel("extension:"), 0, 2)
        # edit widget
        for viewtype, (viewEditor, extension) in list(viewTypes.items()):

            view_w = QtWidgets.QLabel(viewtype)
            self.layout.addWidget(view_w, self.n, 0)

            editor_w = QtWidgets.QLineEdit(viewEditor)
            font = QtGui.QFont()
            font.setFamily('Lucida')
            font.setFixedPitch(True)
            font.setPointSize(12)
            editor_w.setFont(font)
            self.layout.addWidget(editor_w, self.n, 1)

            extension_w = QtWidgets.QLineEdit(extension)
            font = QtGui.QFont()
            font.setFamily('Lucida')
            font.setFixedPitch(True)
            font.setPointSize(12)
            extension_w.setFont(font)
            self.layout.addWidget(extension_w, self.n, 2)
            self.n += 1
            self.viewWidgets.append(
                dict(type=viewtype, editor=viewEditor, extension=extension))

        # Cancel and OK buttons
        buttons = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
        self.bbox = QtWidgets.QDialogButtonBox(buttons)
        self.bbox.accepted.connect(self.accept)
        self.bbox.rejected.connect(self.reject)
        self.layout.addWidget(self.bbox, self.n, 2)

        # set window title and window size
        self.setWindowTitle(title)
        self.resize(size[0], size[1])
예제 #11
0
    def __init__(self, header, body, title, parent=None):
        super(Notice, self).__init__(title or '', parent)

        self.header_label = Label(header, self)
        self.body_label = QtWidgets.QTextEdit(parent=self)
        self.body_label.setPlainText(body)
        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok
        )
        self.buttons.accepted.connect(self.accept)

        self.layout.addWidget(self.header_label)
        self.layout.addWidget(self.body_label)
        self.layout.addStretch(1)
        self.layout.addWidget(self.buttons)
        self.setMaximumWidth(1024)
        self.adjustSize()
예제 #12
0
    def __init__(self, question, more=None, title=None, parent=None):
        super(Question, self).__init__(title or '', parent)

        self.question_label = Label(question, self)
        self.more_label = Label(parent=self)
        if more:
            self.more_label.setText(more)

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Yes | QtWidgets.QDialogButtonBox.No)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.layout.addWidget(self.question_label)
        self.layout.addWidget(self.more_label)
        self.layout.addStretch(1)
        self.layout.addWidget(self.buttons)
예제 #13
0
    def __init__(self, icon, title, messages, cancelable=False):
        super(ScrollMessageBox, self).__init__()
        self.setWindowTitle(title)
        self.icon = icon

        self.setWindowFlags(QtCore.Qt.WindowTitleHint)

        layout = QtWidgets.QVBoxLayout(self)

        scroll_widget = QtWidgets.QScrollArea(self)
        scroll_widget.setWidgetResizable(True)
        content_widget = QtWidgets.QWidget(self)
        scroll_widget.setWidget(content_widget)

        max_len = 0
        content_layout = QtWidgets.QVBoxLayout(content_widget)
        for message in messages:
            label_widget = QtWidgets.QLabel(message, content_widget)
            content_layout.addWidget(label_widget)
            max_len = max(max_len, len(message))

        # guess size of scrollable area
        max_width = QtWidgets.QApplication.desktop().availableGeometry().width
        scroll_widget.setMinimumWidth(min(max_width, max_len * 6))
        layout.addWidget(scroll_widget)

        if not cancelable:  # if no specific buttons OK only
            buttons = QtWidgets.QDialogButtonBox.Ok
        else:
            buttons = QtWidgets.QDialogButtonBox.Ok | \
                      QtWidgets.QDialogButtonBox.Cancel

        btn_box = QtWidgets.QDialogButtonBox(buttons)
        btn_box.accepted.connect(self.accept)

        if cancelable:
            btn_box.reject.connect(self.reject)

        btn = QtWidgets.QPushButton('Copy to clipboard')
        btn.clicked.connect(lambda: QtWidgets.QApplication.
                            clipboard().setText("\n".join(messages)))
        btn_box.addButton(btn, QtWidgets.QDialogButtonBox.NoRole)

        layout.addWidget(btn_box)
        self.show()
    def setupUi(self, QSpectrumAnalyzerBaseline):
        QSpectrumAnalyzerBaseline.setObjectName("QSpectrumAnalyzerBaseline")
        QSpectrumAnalyzerBaseline.resize(500, 100)
        self.verticalLayout = QtWidgets.QVBoxLayout(QSpectrumAnalyzerBaseline)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.label = QtWidgets.QLabel(QSpectrumAnalyzerBaseline)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.baselineFileEdit = QtWidgets.QLineEdit(QSpectrumAnalyzerBaseline)
        self.baselineFileEdit.setObjectName("baselineFileEdit")
        self.horizontalLayout.addWidget(self.baselineFileEdit)
        self.baselineFileButton = QtWidgets.QToolButton(
            QSpectrumAnalyzerBaseline)
        self.baselineFileButton.setMinimumSize(QtCore.QSize(50, 0))
        self.baselineFileButton.setObjectName("baselineFileButton")
        self.horizontalLayout.addWidget(self.baselineFileButton)
        self.formLayout.setLayout(0, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout)
        self.verticalLayout.addLayout(self.formLayout)
        spacerItem = QtWidgets.QSpacerItem(20, 1,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(QSpectrumAnalyzerBaseline)
        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.label.setBuddy(self.baselineFileEdit)

        self.retranslateUi(QSpectrumAnalyzerBaseline)
        self.buttonBox.accepted.connect(QSpectrumAnalyzerBaseline.accept)
        self.buttonBox.rejected.connect(QSpectrumAnalyzerBaseline.reject)
        QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerBaseline)
        QSpectrumAnalyzerBaseline.setTabOrder(self.baselineFileEdit,
                                              self.baselineFileButton)
예제 #15
0
    def _set_items(self, list_data, file_open_picture):

        self.list_widget = QtWidgets.QListWidget()
        ly_vbox = QtWidgets.QVBoxLayout()

        for item in list_data:
            self._setItem(item, file_open_picture)

        ly_vbox.addWidget(self.list_widget)
        self.list_widget.itemDoubleClicked.connect(self.item_doubleclick_slot)

        button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        ly_vbox.addWidget(button_box)
        button_box.accepted.connect(self.close)
        button_box.rejected.connect(self.reject)

        self.setLayout(ly_vbox)
        self.resize(300, 400)
        self.check_test()
예제 #16
0
파일: dialogs.py 프로젝트: scenaristeur/ts2
    def __init__(self, parent, simulation):
        super().__init__(parent)
        self.setObjectName("service_assign_dialog")
        self.setWindowTitle(
            self.tr("Choose a service to assign to this train"))
        self.serviceListView = servicelistview.ServiceListView(self)
        self.serviceListView.setupServiceList(simulation)
        buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.serviceListView)
        layout.addWidget(buttonBox)
        self.setLayout(layout)
        self.resize(600, 300)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        self.serviceListView.doubleClicked.connect(self.accept)

        settings.restoreWindow(self)
예제 #17
0
파일: dialg.py 프로젝트: imec-myhdl/Spyce
    def __init__(self, optionlist, title='selection', parent=None):
        super(selectionDialog, self).__init__(parent)
        #        self.layout = QtWidgets.QGridLayout()
        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)
        self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.resize(380, 180)
        self.cb = QtWidgets.QComboBox()
        for elem in optionlist:
            self.cb.addItem(str(elem))
        self.cb.setCurrentIndex(0)
        self.layout.addWidget(self.cb)
        buttons = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
        self.bbox = QtWidgets.QDialogButtonBox(buttons)
        self.bbox.accepted.connect(self.accept)
        self.bbox.rejected.connect(self.reject)
        self.layout.addWidget(self.bbox)

        # set window title and window size
        self.setWindowTitle(title)
예제 #18
0
    def __init__(self, *args, **kwargs):
        super(MatteSaveDialog, self).__init__(*args, **kwargs)

        self.label = QtWidgets.QLabel('Save selected mattes')

        self.matte_list = MatteList()
        self.matte_list.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)

        self.button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Save
            | QtWidgets.QDialogButtonBox.Cancel)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

        self.layout = QtWidgets.QVBoxLayout()
        self.layout.addWidget(self.label)
        self.layout.addWidget(self.matte_list)
        self.layout.addWidget(self.button_box)
        self.setLayout(self.layout)
        self.setWindowTitle('Save Matte AOVS')
예제 #19
0
파일: dialogs.py 프로젝트: scenaristeur/ts2
    def __init__(self, parent, simulation):
        """Constructor for the PropertiesDialog class."""
        super().__init__(parent)
        self.simulation = simulation
        self.setWindowTitle(self.tr("Simulation properties"))
        self.setMinimumWidth(500)

        titleLabel = QtWidgets.QLabel(self)
        titleLabel.setText("<u>" + self.tr("Simulation title:") + "</u>")
        titleText = QtWidgets.QLabel(simulation.option("title"), self)

        hlayout = QtWidgets.QHBoxLayout()
        hlayout.addWidget(titleLabel)
        hlayout.addWidget(titleText)
        hlayout.addStretch()
        descriptionLabel = QtWidgets.QLabel(self)
        descriptionLabel.setText("<u>" + self.tr("Description:") + "</u>")
        descriptionText = QtWidgets.QTextEdit(self)
        descriptionText.setReadOnly(True)
        descriptionText.setText(simulation.option("description"))
        optionsLabel = QtWidgets.QLabel(self)
        optionsLabel.setText("<u>" + self.tr("Options:") + "</u>")
        tibOptionCB = QtWidgets.QCheckBox(self)
        tibOptionCB.stateChanged.connect(self.changeTIB)
        tibOptionCB.setChecked(
            int(simulation.option("trackCircuitBased")) != 0)
        optionLayout = QtWidgets.QFormLayout()
        optionLayout.addRow(self.tr("Play simulation with track circuits"),
                            tibOptionCB)
        buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok)
        layout = QtWidgets.QVBoxLayout()
        layout.addLayout(hlayout)
        layout.addWidget(descriptionLabel)
        layout.addWidget(descriptionText)
        layout.addWidget(optionsLabel)
        layout.addLayout(optionLayout)
        layout.addWidget(buttonBox)
        self.setLayout(layout)
        buttonBox.accepted.connect(self.accept)
예제 #20
0
    def setupUi(self, QSpectrumAnalyzerSettings):
        QSpectrumAnalyzerSettings.setObjectName("QSpectrumAnalyzerSettings")
        QSpectrumAnalyzerSettings.resize(600, 388)
        self.verticalLayout = QtWidgets.QVBoxLayout(QSpectrumAnalyzerSettings)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.label_3 = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label_3.setObjectName("label_3")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label_3)
        self.backendComboBox = QtWidgets.QComboBox(QSpectrumAnalyzerSettings)
        self.backendComboBox.setObjectName("backendComboBox")
        self.backendComboBox.addItem("")
        self.backendComboBox.addItem("")
        self.backendComboBox.addItem("")
        self.backendComboBox.addItem("")
        self.backendComboBox.addItem("")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.backendComboBox)
        self.label = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label.setObjectName("label")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.executableEdit = QtWidgets.QLineEdit(QSpectrumAnalyzerSettings)
        self.executableEdit.setObjectName("executableEdit")
        self.horizontalLayout.addWidget(self.executableEdit)
        self.executableButton = QtWidgets.QToolButton(
            QSpectrumAnalyzerSettings)
        self.executableButton.setMinimumSize(QtCore.QSize(50, 0))
        self.executableButton.setObjectName("executableButton")
        self.horizontalLayout.addWidget(self.executableButton)
        self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout)
        self.label_5 = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label_5.setObjectName("label_5")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole,
                                  self.label_5)
        self.label_4 = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label_4.setObjectName("label_4")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole,
                                  self.label_4)
        self.label_2 = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)
        self.waterfallHistorySizeSpinBox = QtWidgets.QSpinBox(
            QSpectrumAnalyzerSettings)
        self.waterfallHistorySizeSpinBox.setMinimum(1)
        self.waterfallHistorySizeSpinBox.setMaximum(10000000)
        self.waterfallHistorySizeSpinBox.setProperty("value", 100)
        self.waterfallHistorySizeSpinBox.setObjectName(
            "waterfallHistorySizeSpinBox")
        self.formLayout.setWidget(7, QtWidgets.QFormLayout.FieldRole,
                                  self.waterfallHistorySizeSpinBox)
        self.label_7 = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label_7.setObjectName("label_7")
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole,
                                  self.label_7)
        self.label_8 = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label_8.setObjectName("label_8")
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole,
                                  self.label_8)
        self.label_6 = QtWidgets.QLabel(QSpectrumAnalyzerSettings)
        self.label_6.setObjectName("label_6")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                  self.label_6)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.paramsEdit = QtWidgets.QLineEdit(QSpectrumAnalyzerSettings)
        self.paramsEdit.setObjectName("paramsEdit")
        self.horizontalLayout_2.addWidget(self.paramsEdit)
        self.paramsHelpButton = QtWidgets.QToolButton(
            QSpectrumAnalyzerSettings)
        self.paramsHelpButton.setMinimumSize(QtCore.QSize(50, 0))
        self.paramsHelpButton.setObjectName("paramsHelpButton")
        self.horizontalLayout_2.addWidget(self.paramsHelpButton)
        self.formLayout.setLayout(2, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout_2)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.deviceEdit = QtWidgets.QLineEdit(QSpectrumAnalyzerSettings)
        self.deviceEdit.setObjectName("deviceEdit")
        self.horizontalLayout_3.addWidget(self.deviceEdit)
        self.deviceHelpButton = QtWidgets.QToolButton(
            QSpectrumAnalyzerSettings)
        self.deviceHelpButton.setMinimumSize(QtCore.QSize(50, 0))
        self.deviceHelpButton.setObjectName("deviceHelpButton")
        self.horizontalLayout_3.addWidget(self.deviceHelpButton)
        self.formLayout.setLayout(3, QtWidgets.QFormLayout.FieldRole,
                                  self.horizontalLayout_3)
        self.sampleRateSpinBox = QtWidgets.QDoubleSpinBox(
            QSpectrumAnalyzerSettings)
        self.sampleRateSpinBox.setProperty("showGroupSeparator", True)
        self.sampleRateSpinBox.setDecimals(3)
        self.sampleRateSpinBox.setMinimum(0.0)
        self.sampleRateSpinBox.setMaximum(999999.99)
        self.sampleRateSpinBox.setSingleStep(0.01)
        self.sampleRateSpinBox.setProperty("value", 61.44)
        self.sampleRateSpinBox.setObjectName("sampleRateSpinBox")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole,
                                  self.sampleRateSpinBox)
        self.bandwidthSpinBox = QtWidgets.QDoubleSpinBox(
            QSpectrumAnalyzerSettings)
        self.bandwidthSpinBox.setProperty("showGroupSeparator", True)
        self.bandwidthSpinBox.setDecimals(3)
        self.bandwidthSpinBox.setMinimum(0.0)
        self.bandwidthSpinBox.setMaximum(999999.99)
        self.bandwidthSpinBox.setSingleStep(0.01)
        self.bandwidthSpinBox.setProperty("value", 0.0)
        self.bandwidthSpinBox.setObjectName("bandwidthSpinBox")
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole,
                                  self.bandwidthSpinBox)
        self.lnbSpinBox = QtWidgets.QDoubleSpinBox(QSpectrumAnalyzerSettings)
        self.lnbSpinBox.setProperty("showGroupSeparator", True)
        self.lnbSpinBox.setDecimals(3)
        self.lnbSpinBox.setMinimum(-999999.999)
        self.lnbSpinBox.setMaximum(999999.999)
        self.lnbSpinBox.setSingleStep(0.01)
        self.lnbSpinBox.setProperty("value", 0.0)
        self.lnbSpinBox.setObjectName("lnbSpinBox")
        self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole,
                                  self.lnbSpinBox)
        self.verticalLayout.addLayout(self.formLayout)
        spacerItem = QtWidgets.QSpacerItem(20, 21,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(QSpectrumAnalyzerSettings)
        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.label_3.setBuddy(self.backendComboBox)
        self.label.setBuddy(self.executableEdit)
        self.label_5.setBuddy(self.deviceEdit)
        self.label_4.setBuddy(self.sampleRateSpinBox)
        self.label_2.setBuddy(self.waterfallHistorySizeSpinBox)
        self.label_7.setBuddy(self.bandwidthSpinBox)
        self.label_8.setBuddy(self.lnbSpinBox)
        self.label_6.setBuddy(self.paramsEdit)

        self.retranslateUi(QSpectrumAnalyzerSettings)
        self.buttonBox.accepted.connect(QSpectrumAnalyzerSettings.accept)
        self.buttonBox.rejected.connect(QSpectrumAnalyzerSettings.reject)
        QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerSettings)
        QSpectrumAnalyzerSettings.setTabOrder(self.backendComboBox,
                                              self.executableEdit)
        QSpectrumAnalyzerSettings.setTabOrder(self.executableEdit,
                                              self.executableButton)
        QSpectrumAnalyzerSettings.setTabOrder(self.executableButton,
                                              self.paramsEdit)
        QSpectrumAnalyzerSettings.setTabOrder(self.paramsEdit,
                                              self.paramsHelpButton)
        QSpectrumAnalyzerSettings.setTabOrder(self.paramsHelpButton,
                                              self.deviceEdit)
        QSpectrumAnalyzerSettings.setTabOrder(self.deviceEdit,
                                              self.deviceHelpButton)
        QSpectrumAnalyzerSettings.setTabOrder(self.deviceHelpButton,
                                              self.sampleRateSpinBox)
        QSpectrumAnalyzerSettings.setTabOrder(self.sampleRateSpinBox,
                                              self.bandwidthSpinBox)
        QSpectrumAnalyzerSettings.setTabOrder(self.bandwidthSpinBox,
                                              self.lnbSpinBox)
        QSpectrumAnalyzerSettings.setTabOrder(self.lnbSpinBox,
                                              self.waterfallHistorySizeSpinBox)
예제 #21
0
파일: dialg.py 프로젝트: imec-myhdl/Spyce
    def __init__(self, title='Create block', size=(400, 300), parent=None):
        super(createBlockDialog, self).__init__(parent)
        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)

        # edit widget
        self.layout.addWidget(QtWidgets.QLabel('Name'))

        self.text_name = QtWidgets.QLineEdit(parent)
        font = QtGui.QFont()
        font.setFamily('Lucida')
        font.setFixedPitch(True)
        font.setPointSize(12)
        self.text_name.setFont(font)
        self.layout.addWidget(self.text_name)

        self.layout.addWidget(QtWidgets.QLabel('Icon'))
        self.text_icon = QtWidgets.QWidget()
        self.icon_layout = QtWidgets.QHBoxLayout()
        #        self.icon_createBtn = QtWidgets.QPushButton('Create Icon')
        self.icon_selectIcon = QtWidgets.QPushButton('Select Icon')
        self.icon_selectIcon.clicked.connect(self.selectIcon)
        #        self.icon_layout.addWidget(self.icon_createBtn)
        self.icon_layout.addWidget(self.icon_selectIcon)
        self.text_icon.setLayout(self.icon_layout)
        self.layout.addWidget(self.text_icon)

        self.layout.addWidget(QtWidgets.QLabel('Inputs'))
        self.text_input = QtWidgets.QWidget()
        self.input_layout = QtWidgets.QVBoxLayout()
        self.text_input.setLayout(self.input_layout)

        inputLabels = QtWidgets.QWidget()
        inputLabels_layout = QtWidgets.QHBoxLayout()
        inputLabels_layout.addWidget(QtWidgets.QLabel('Name'))
        inputLabels_layout.addWidget(QtWidgets.QLabel('      X'))
        inputLabels_layout.addWidget(QtWidgets.QLabel('           Y'))
        inputLabels_layout.addWidget(QtWidgets.QLabel('         Hide label'))
        inputLabels.setLayout(inputLabels_layout)
        self.input_layout.addWidget(inputLabels)

        self.layout.addWidget(self.text_input)

        self.addInput = QtWidgets.QPushButton('Add input')
        self.addInput.clicked.connect(self.addInputFunc)
        self.layout.addWidget(self.addInput)

        self.layout.addWidget(QtWidgets.QLabel('Outputs'))
        self.text_output = QtWidgets.QWidget()
        self.output_layout = QtWidgets.QVBoxLayout()
        self.text_output.setLayout(self.output_layout)

        ouputLabels = QtWidgets.QWidget()
        ouputLabels_layout = QtWidgets.QHBoxLayout()
        ouputLabels_layout.addWidget(QtWidgets.QLabel('Name'))
        ouputLabels_layout.addWidget(QtWidgets.QLabel('      X'))
        ouputLabels_layout.addWidget(QtWidgets.QLabel('           Y'))
        ouputLabels_layout.addWidget(QtWidgets.QLabel('         Hide label'))
        ouputLabels.setLayout(ouputLabels_layout)
        self.output_layout.addWidget(ouputLabels)

        self.layout.addWidget(self.text_output)

        self.addOutput = QtWidgets.QPushButton('Add output')
        self.addOutput.clicked.connect(self.addOutputFunc)
        self.layout.addWidget(self.addOutput)

        self.layout.addWidget(QtWidgets.QLabel('Parameters'))
        self.warningLabel = QtWidgets.QLabel(
            "Don't forget to add a parameter function to the text view")
        myFont = QtGui.QFont()
        myFont.setItalic(True)
        self.warningLabel.setFont(myFont)
        self.layout.addWidget(self.warningLabel)
        self.text_parameters = QtWidgets.QWidget()

        self.gridPar = QtWidgets.QGridLayout()
        self.valuesPar = dict()
        self.nPar = 0

        self.key_fieldPar = QtWidgets.QLineEdit('key')
        self.addParam = QtWidgets.QPushButton('Add parameter')
        self.addParam.clicked.connect(self.addParamAction)
        self.gridPar.addWidget(self.key_fieldPar, 99, 0)
        self.gridPar.addWidget(self.addParam, 99, 1)

        self.text_parameters.setLayout(self.gridPar)
        self.layout.addWidget(self.text_parameters)

        #
        #

        self.layout.addWidget(QtWidgets.QLabel('Properties'))
        self.text_properties = QtWidgets.QWidget()

        self.grid = QtWidgets.QGridLayout()
        self.values = dict()
        self.n = 0

        self.key_field = QtWidgets.QLineEdit('key')
        self.addProperty = QtWidgets.QPushButton('Add property')
        self.addProperty.clicked.connect(self.addPropertyAction)
        self.grid.addWidget(self.key_field, 99, 0)
        self.grid.addWidget(self.addProperty, 99, 1)

        self.text_properties.setLayout(self.grid)
        self.layout.addWidget(self.text_properties)

        # Cancel and OK buttons
        buttons = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
        self.bbox = QtWidgets.QDialogButtonBox(buttons)
        self.bbox.accepted.connect(self.accept)
        self.bbox.rejected.connect(self.reject)
        self.layout.addWidget(self.bbox)

        # set window title and window size
        self.setWindowTitle(title)
        self.resize(size[0], size[1])

        self.inputInstances = []
        self.outputInstances = []

        self.inputCounter = 0
        self.outputCounter = 0
        self.filename = (0, 0)
예제 #22
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(531, 626)
        self.gridLayout_2 = QtWidgets.QGridLayout(Form)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.label = QtWidgets.QLabel(Form)
        self.label.setObjectName("label")
        self.horizontalLayout_3.addWidget(self.label)
        self.lineEdit = QtWidgets.QLineEdit(Form)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout_3.addWidget(self.lineEdit)
        self.toolButton = QtWidgets.QToolButton(Form)
        self.toolButton.setObjectName("toolButton")
        self.horizontalLayout_3.addWidget(self.toolButton)
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setObjectName("pushButton")
        self.horizontalLayout_3.addWidget(self.pushButton)
        self.gridLayout_2.addLayout(self.horizontalLayout_3, 0, 0, 1, 2)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.fontComboBox = QtWidgets.QFontComboBox(Form)
        self.fontComboBox.setObjectName("fontComboBox")
        self.horizontalLayout_2.addWidget(self.fontComboBox)
        self.spinBox = QtWidgets.QSpinBox(Form)
        self.spinBox.setObjectName("spinBox")
        self.horizontalLayout_2.addWidget(self.spinBox)
        self.lcdNumber = QtWidgets.QLCDNumber(Form)
        self.lcdNumber.setObjectName("lcdNumber")
        self.horizontalLayout_2.addWidget(self.lcdNumber)
        self.dial = QtWidgets.QDial(Form)
        self.dial.setObjectName("dial")
        self.horizontalLayout_2.addWidget(self.dial)
        self.lcdNumber_2 = QtWidgets.QLCDNumber(Form)
        self.lcdNumber_2.setObjectName("lcdNumber_2")
        self.horizontalLayout_2.addWidget(self.lcdNumber_2)
        self.gridLayout_2.addLayout(self.horizontalLayout_2, 1, 0, 1, 2)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.radioButton = QtWidgets.QRadioButton(Form)
        self.radioButton.setObjectName("radioButton")
        self.horizontalLayout.addWidget(self.radioButton)
        self.radioButton_2 = QtWidgets.QRadioButton(Form)
        self.radioButton_2.setObjectName("radioButton_2")
        self.horizontalLayout.addWidget(self.radioButton_2)
        self.checkBox = QtWidgets.QCheckBox(Form)
        self.checkBox.setObjectName("checkBox")
        self.horizontalLayout.addWidget(self.checkBox)
        self.comboBox = QtWidgets.QComboBox(Form)
        self.comboBox.setObjectName("comboBox")
        self.horizontalLayout.addWidget(self.comboBox)
        self.gridLayout_2.addLayout(self.horizontalLayout, 2, 0, 1, 2)
        self.commandLinkButton = QtWidgets.QCommandLinkButton(Form)
        self.commandLinkButton.setObjectName("commandLinkButton")
        self.gridLayout_2.addWidget(self.commandLinkButton, 3, 0, 1, 1)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.treeWidget = QtWidgets.QTreeWidget(Form)
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.treeWidget, 0, 0, 1, 1)
        self.listWidget = QtWidgets.QListWidget(Form)
        self.listWidget.setObjectName("listWidget")
        self.gridLayout.addWidget(self.listWidget, 0, 1, 1, 1)
        self.tableWidget = QtWidgets.QTableWidget(Form)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(0)
        self.tableWidget.setRowCount(0)
        self.gridLayout.addWidget(self.tableWidget, 1, 0, 1, 1)
        self.textBrowser = QtWidgets.QTextBrowser(Form)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout.addWidget(self.textBrowser, 1, 1, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 4, 0, 1, 2)
        self.buttonBox = QtWidgets.QDialogButtonBox(Form)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                          | QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout_2.addWidget(self.buttonBox, 5, 1, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
예제 #23
0
    def __init__(self):
        super(DagCapturePanel, self).__init__()

        # Variables
        self.dag = get_dag()
        if not self.dag:
            raise RuntimeError("Couldn't get DAG widget")

        self.dag_bbox = None
        self.capture_thread = DagCapture(self.dag)
        self.capture_thread.finished.connect(self.show_finished_popup)
        self.selection = []

        # UI
        self.setWindowTitle("DAG Capture options")

        main_layout = QtWidgets.QVBoxLayout()
        form_layout = QtWidgets.QFormLayout()
        form_layout.setFieldGrowthPolicy(form_layout.AllNonFixedFieldsGrow)
        form_layout.setLabelAlignment(QtCore.Qt.AlignRight)
        main_layout.addLayout(form_layout)

        # Options
        # Path
        container = QtWidgets.QWidget()
        path_layout = QtWidgets.QHBoxLayout()
        path_layout.setMargin(0)
        container.setLayout(path_layout)
        self.path = QtWidgets.QLineEdit()
        browse_button = QtWidgets.QPushButton("Browse")
        browse_button.clicked.connect(self.show_file_browser)
        path_layout.addWidget(self.path)
        path_layout.addWidget(browse_button)
        form_layout.addRow("File Path", container)

        # Zoom
        self.zoom_level = QtWidgets.QDoubleSpinBox()
        self.zoom_level.setValue(1.0)
        self.zoom_level.setRange(0.01, 5)
        self.zoom_level.setSingleStep(.5)
        self.zoom_level.valueChanged.connect(self.display_info)
        form_layout.addRow("Zoom Level", self.zoom_level)

        # Margins
        self.margins = QtWidgets.QSpinBox()
        self.margins.setRange(0, 1000)
        self.margins.setValue(20)
        self.margins.setSuffix("px")
        self.margins.setSingleStep(10)
        self.margins.valueChanged.connect(self.display_info)
        form_layout.addRow("Margins", self.margins)

        # Right Crop
        self.ignore_right = QtWidgets.QSpinBox()
        self.ignore_right.setRange(0, 1000)
        self.ignore_right.setValue(200)
        self.ignore_right.setSuffix("px")
        self.ignore_right.setToolTip(
            "The right side of the DAG usually contains a mini version of itself.\n"
            "This gets included in the screen capture, so it is required to crop it out. \n"
            "If you scaled it down, you can reduce this number to speed up capture slightly."
        )
        self.ignore_right.valueChanged.connect(self.display_info)
        form_layout.addRow("Crop Right Side", self.ignore_right)

        # Delay
        self.delay = QtWidgets.QDoubleSpinBox()
        self.delay.setValue(.3)
        self.delay.setRange(0.1, 1)
        self.delay.setSuffix("s")
        self.delay.setSingleStep(.1)
        self.delay.valueChanged.connect(self.display_info)
        self.delay.setToolTip(
            "A longer delay ensures the Nuke DAG has fully refreshed between capturing tiles.\n"
            "It makes the capture slower, but ensures a correct result.\n"
            "Feel free to adjust based on results you have seen on your machine.\n"
            "Increase if the capture looks incorrect.")
        form_layout.addRow("Delay Between Captures", self.delay)

        # Capture all nodes or selection
        self.capture = QtWidgets.QComboBox()
        self.capture.addItems(["All Nodes", "Selected Nodes"])
        self.capture.currentIndexChanged.connect(self.inspect_dag)
        form_layout.addRow("Nodes to Capture", self.capture)

        # Deselect Nodes before Capture?
        self.deselect = QtWidgets.QCheckBox("Deselect Nodes before capture")
        self.deselect.setChecked(True)
        form_layout.addWidget(self.deselect)

        # Add Information box
        self.info = QtWidgets.QLabel("Hi")
        info_box = QtWidgets.QFrame()
        info_box.setFrameStyle(info_box.StyledPanel)
        info_box.setLayout(QtWidgets.QVBoxLayout())
        info_box.layout().addWidget(self.info)
        main_layout.addWidget(info_box)

        # Buttons
        button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        button_box.accepted.connect(self.do_capture)
        button_box.rejected.connect(self.reject)
        main_layout.addWidget(button_box)

        self.setLayout(main_layout)

        self.inspect_dag()
예제 #24
0
    def __init__(self, parent, color):
        super(PickColorDialog, self).__init__(parent)

        self.color = color
        self.qcolor = QtGui.QColor()
        self.qcolor.setRgbF(self.color[0], self.color[1], self.color[2])

        self.setWindowTitle("Pick Color")
        self.setFixedSize(300, 150)

        self.uiMainLAY = QtWidgets.QGridLayout()
        self.uiMainLAY.setContentsMargins(3, 3, 3, 3)
        self.setLayout(self.uiMainLAY)

        # Colors
        self.uiPresetGRP = QtWidgets.QGroupBox(" Presets ")
        self.uiColorLAY = QtWidgets.QGridLayout()
        self.uiColorLAY.setContentsMargins(3, 3, 3, 3)
        self.uiColorLAY.setSpacing(3)

        # Custom Color
        self.uiColorGRP = QtWidgets.QGroupBox(" Color ")
        self.uiCustomLAY = QtWidgets.QVBoxLayout()
        self.uiCustomLAY.setContentsMargins(3, 3, 3, 3)
        self.uiColorGRP.setLayout(self.uiCustomLAY)

        self.uiCustomBTN = QtWidgets.QPushButton("Pick Color")
        self.uiCustomBTN.setFixedHeight(85)

        self.setColor(self.qcolor)

        self.uiCustomLAY.addWidget(self.uiCustomBTN)

        # Button Box
        self.uiButtonBOX = QtWidgets.QDialogButtonBox()
        self.uiButtonBOX.setOrientation(QtCore.Qt.Horizontal)
        self.uiButtonBOX.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                            | QtWidgets.QDialogButtonBox.Ok)

        self.uiPresetGRP.setLayout(self.uiColorLAY)
        self.uiMainLAY.addWidget(self.uiPresetGRP, 0, 0)
        self.uiMainLAY.addWidget(self.uiColorGRP, 0, 1)
        self.uiMainLAY.addWidget(self.uiButtonBOX, 2, 0, 1, 0)

        # Color Buttons
        for i, hue in enumerate(COLORHUE):
            for j, lum in enumerate((.25, .5, .85)):
                btn = QtWidgets.QPushButton(self)
                btnColor = QtGui.QColor()
                btnColor.setHslF(hue, 1, lum)
                palette = QtGui.QPalette()
                palette.setColor(QtGui.QPalette.Button, btnColor)
                btn.setPalette(palette)

                row = j
                column = i
                self.uiColorLAY.addWidget(btn, row, column)

                btn.clicked.connect(partial(self.setColor, btnColor))

        for i in range(4):
            btn = QtWidgets.QPushButton(self)
            btnColor = QtGui.QColor()
            btnColor.setHslF(0, 0, i / 3.0)
            palette = QtGui.QPalette()
            palette.setColor(QtGui.QPalette.Button, btnColor)
            btn.setPalette(palette)

            row = j + 1
            column = i
            self.uiColorLAY.addWidget(btn, row, column)

            btn.clicked.connect(partial(self.setColor, btnColor))

        # Connections
        self.uiCustomBTN.clicked.connect(self.pickCustomColor)
        self.uiButtonBOX.accepted.connect(self.accept)
        self.uiButtonBOX.rejected.connect(self.reject)
예제 #25
0
파일: dialg.py 프로젝트: imec-myhdl/Spyce
    def __init__(self,
                 inps,
                 outps,
                 title='Edit pins',
                 size=(600, 300),
                 parent=None):
        super(editPinsDialog, self).__init__(parent)
        self.scrollArea = QtWidgets.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QtWidgets.QWidget(self.scrollArea)
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 600, 300))
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        self.scrolllayout = QtWidgets.QVBoxLayout(self)
        self.scrolllayout.addWidget(self.scrollArea)

        self.layout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)

        self.setLayout(self.scrolllayout)

        self.layout.addWidget(QtWidgets.QLabel('Inputs'))
        self.text_input = QtWidgets.QWidget()
        self.input_layout = QtWidgets.QVBoxLayout()
        self.text_input.setLayout(self.input_layout)

        inputLabels = QtWidgets.QWidget()
        inputLabels_layout = QtWidgets.QHBoxLayout()
        inputLabels_layout.addWidget(QtWidgets.QLabel('Name'))
        inputLabels_layout.addWidget(QtWidgets.QLabel('   X'))
        inputLabels_layout.addWidget(QtWidgets.QLabel('       Y'))
        inputLabels_layout.addWidget(QtWidgets.QLabel('     Hide label'))
        inputLabels_layout.addWidget(QtWidgets.QLabel())
        inputLabels.setLayout(inputLabels_layout)
        self.input_layout.addWidget(inputLabels)

        self.layout.addWidget(self.text_input)

        self.addInput = QtWidgets.QPushButton('Add input')
        self.addInput.clicked.connect(self.addInputFunc)
        self.layout.addWidget(self.addInput)

        self.layout.addWidget(QtWidgets.QLabel('Outputs'))
        self.text_output = QtWidgets.QWidget()
        self.output_layout = QtWidgets.QVBoxLayout()
        self.text_output.setLayout(self.output_layout)

        ouputLabels = QtWidgets.QWidget()
        ouputLabels_layout = QtWidgets.QHBoxLayout()
        ouputLabels_layout.addWidget(QtWidgets.QLabel('Name'))
        ouputLabels_layout.addWidget(QtWidgets.QLabel('   X'))
        ouputLabels_layout.addWidget(QtWidgets.QLabel('       Y'))
        ouputLabels_layout.addWidget(QtWidgets.QLabel('     Hide label'))
        ouputLabels_layout.addWidget(QtWidgets.QLabel())
        ouputLabels.setLayout(ouputLabels_layout)
        self.output_layout.addWidget(ouputLabels)

        self.layout.addWidget(self.text_output)

        self.addOutput = QtWidgets.QPushButton('Add output')
        self.addOutput.clicked.connect(self.addOutputFunc)
        self.layout.addWidget(self.addOutput)

        # Cancel and OK buttons
        buttons = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
        self.bbox = QtWidgets.QDialogButtonBox(buttons)
        self.bbox.accepted.connect(self.accept)
        self.bbox.rejected.connect(self.reject)
        self.scrolllayout.addWidget(self.bbox)

        # set window title and window size
        self.setWindowTitle(title)
        self.resize(size[0], size[1])

        self.inputInstances = []
        self.outputInstances = []

        self.inputCounter = 0
        self.outputCounter = 0

        if isinstance(inps, int):
            for _ in range(inps):
                self.addInputFunc(hide=True)
        else:
            for inp in inps:
                if len(inp) == 4:
                    self.addInputFunc(inp[0], inp[1], inp[2], inp[3])
                else:
                    self.addInputFunc(inp[0], inp[1], inp[2])
        if isinstance(outps, int):
            for _ in range(outps):
                self.addInputFunc(hide=True)
        else:
            for outp in outps:
                if len(outp) == 4:
                    self.addOutputFunc(outp[0], outp[1], outp[2], outp[3])
                else:
                    self.addOutputFunc(outp[0], outp[1], outp[2])
예제 #26
0
파일: dialg.py 프로젝트: imec-myhdl/Spyce
    def __init__(self, title='Convert Symbol', size=(400, 300), parent=None):
        super(convertSymDialog, self).__init__(parent)
        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)

        # edit widget
        self.layout.addWidget(QtWidgets.QLabel('Name'))

        self.text_name = QtWidgets.QLineEdit(parent)
        font = QtGui.QFont()
        font.setFamily('Lucida')
        font.setFixedPitch(True)
        font.setPointSize(12)
        self.text_name.setFont(font)
        self.layout.addWidget(self.text_name)

        self.layout.addWidget(QtWidgets.QLabel('Icon'))
        self.text_icon = QtWidgets.QWidget()
        self.icon_layout = QtWidgets.QHBoxLayout()
        self.icon_createBtn = QtWidgets.QPushButton('Create Icon')
        self.icon_selectIcon = QtWidgets.QPushButton('Select Icon')
        self.icon_selectIcon.clicked.connect(self.selectIcon)
        #        self.icon_layout.addWidget(self.icon_createBtn)
        self.icon_layout.addWidget(self.icon_selectIcon)
        self.text_icon.setLayout(self.icon_layout)
        self.layout.addWidget(self.text_icon)

        #        self.layout.addWidget(QtWidgets.QLabel('Parameters'))
        #        self.text_parameters = QtWidgets.QWidget()
        #        self.parameter_layout = QtWidgets.QHBoxLayout()
        #        self.parameter_inp = QtWidgets.QCheckBox('input')
        #        self.parameter_outp = QtWidgets.QCheckBox('output')
        #        self.parameter_layout.addWidget(self.parameter_inp)
        #        self.parameter_layout.addWidget(self.parameter_outp)
        #        self.text_parameters.setLayout(self.parameter_layout)
        #        self.layout.addWidget(self.text_parameters)

        #
        #        myFont=QtGui.QFont()
        #        myFont.setBold(True)
        #        self.label.setFont(myFont)

        self.layout.addWidget(QtWidgets.QLabel('Properties'))
        self.text_properties = QtWidgets.QWidget()

        self.grid = QtWidgets.QGridLayout()
        self.values = dict()
        self.n = 0

        self.key_field = QtWidgets.QLineEdit('key')
        self.addProperty = QtWidgets.QPushButton('Add property')
        self.addProperty.clicked.connect(self.addPropertyAction)
        self.grid.addWidget(self.key_field, 99, 0)
        self.grid.addWidget(self.addProperty, 99, 1)

        self.text_properties.setLayout(self.grid)
        self.layout.addWidget(self.text_properties)

        #        self.layout.addWidget(QtWidgets.QLabel('Properties'))
        #        self.text_properties = QtWidgets.QTextEdit(parent)
        #        font = QtGui.QFont()
        #        font.setFamily('Lucida')
        #        font.setFixedPitch(True)
        #        font.setPointSize(12)
        #        self.text_properties.setFont(font)
        #        self.layout.addWidget(self.text_properties)

        # Cancel and OK buttons
        buttons = QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel
        self.bbox = QtWidgets.QDialogButtonBox(buttons)
        self.bbox.accepted.connect(self.accept)
        self.bbox.rejected.connect(self.reject)
        self.layout.addWidget(self.bbox)

        # set window title and window size
        self.setWindowTitle(title)
        self.resize(size[0], size[1])
        self.filename = (0, 0)
예제 #27
0
def launch_yes_no_cancel_dialog(title,
                                message,
                                show_not_again_checkbox=True,
                                parent=None):
    '''
    Launch a dialog box that has "yes", "no" and "cancel" buttons.
    Optionally display a checkbox that asks whether to show this dialog box again.
    This is different from the Yes/No style of dialog since it offers three choices.
    As a consequence, the return code needs to return one of three statuses.
    return the result of this dialog (0/1/2) for 'Yes'/'No'/'Cancel' respectively, and
    whether the user checked the "Don't ask again" checkbox (True/False).
    '''

    dialog = QtWidgets.QDialog(parent=parent)
    dialog.setWindowTitle(title)
    dialog.verticalLayout = QtWidgets.QVBoxLayout(dialog)

    # Create the dialogs main message (Qlabel)
    dialog.label = QtWidgets.QLabel(dialog)
    dialog.label.setAlignment(QtCore.Qt.AlignCenter)
    dialog.label.setTextInteractionFlags(dialog.label.textInteractionFlags()
                                         | QtCore.Qt.TextBrowserInteraction)
    dialog.label.setTextFormat(QtCore.Qt.RichText)
    dialog.label.setText(message)
    dialog.verticalLayout.addWidget(dialog.label)

    dialog.widget = QtWidgets.QWidget(dialog)
    dialog.horizontalLayout = QtWidgets.QHBoxLayout(dialog.widget)
    dialog.horizontalLayout.setContentsMargins(-1, -1, -1, 0)
    dialog.verticalLayout.addWidget(dialog.widget)

    # Create the "Don't ask again" checkbox
    dialog.checkBox = QtWidgets.QCheckBox(dialog.widget)
    dialog.checkBox.setText("Don't ask again")
    dialog.horizontalLayout.addWidget(dialog.checkBox)

    # Create the buttonbox
    dialog.buttonBox = QtWidgets.QDialogButtonBox(dialog.widget)
    dialog.buttonBox.setOrientation(QtCore.Qt.Horizontal)

    # Create the "Yes", "No" and "Cancel" options
    dialog.yesButton = QtWidgets.QPushButton('Yes', dialog.widget)
    dialog.noButton = QtWidgets.QPushButton('No', dialog.widget)
    dialog.cancelButton = QtWidgets.QPushButton('Cancel', dialog.widget)

    # Link the buttons to their respective return values
    dialog.yesButton.clicked.connect(lambda: dialog.done(1))
    dialog.noButton.clicked.connect(lambda: dialog.done(2))
    dialog.cancelButton.clicked.connect(lambda: dialog.done(0))

    # Add the buttons to the UI
    dialog.buttonBox.addButton(dialog.yesButton,
                               QtWidgets.QDialogButtonBox.ActionRole)
    dialog.buttonBox.addButton(dialog.noButton,
                               QtWidgets.QDialogButtonBox.ActionRole)
    dialog.buttonBox.addButton(dialog.cancelButton,
                               QtWidgets.QDialogButtonBox.ActionRole)

    dialog.horizontalLayout.addWidget(dialog.buttonBox)

    # Connect the buttonbox signals
    QtCore.QMetaObject.connectSlotsByName(dialog)

    # Hide the checkbox if not desired
    if not show_not_again_checkbox:
        dialog.checkBox.hide()

    # Resize the dialog box to scale to its contents
    dialog.adjustSize()

    # Launch the dialog
    yes = dialog.exec_()
    dont_notify_again = dialog.checkBox.isChecked()

    return yes, dont_notify_again
예제 #28
0
    def __init__(self):
        super(Login_Dialog_ui, self).__init__()
        self.Dialog = QtWidgets.QDialog()
        self.Dialog.setStyleSheet(style.load_stylesheet())
        self.Dialog.setObjectName("Dialog")
        self.Dialog.resize(SIZE_W, SIZE_H)
        self.Dialog.setMinimumSize(QtCore.QSize(SIZE_W, SIZE_H))
        self.verticalLayoutWidget = QtWidgets.QWidget(self.Dialog)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, SIZE_W + 1, SIZE_H + 1))
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setContentsMargins(10, 5, 10, 5)
        self.verticalLayout.setObjectName("verticalLayout")
        self.user_label = QtWidgets.QLabel(self.verticalLayoutWidget)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.user_label.sizePolicy().hasHeightForWidth())
        self.user_label.setSizePolicy(sizePolicy)
        self.user_label.setMinimumSize(QtCore.QSize(150, 28))
        font = QtGui.QFont()
        font.setFamily("DejaVu Sans Condensed")
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(50)
        font.setKerning(True)
        self.user_label.setFont(font)
        self.user_label.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        self.user_label.setTextFormat(QtCore.Qt.RichText)
        self.user_label.setObjectName("user_label")
        self.verticalLayout.addWidget(self.user_label)
        self.user_input = QtWidgets.QLineEdit(self.verticalLayoutWidget)
        self.user_input.setEnabled(True)
        self.user_input.setFrame(True)
        self.user_input.setObjectName("user_input")
        self.verticalLayout.addWidget(self.user_input)
        self.passw_label = QtWidgets.QLabel(self.verticalLayoutWidget)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.passw_label.sizePolicy().hasHeightForWidth())
        self.passw_label.setSizePolicy(sizePolicy)
        self.passw_label.setMinimumSize(QtCore.QSize(150, 28))
        font = QtGui.QFont()
        font.setFamily("DejaVu Sans Condensed")
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(50)
        font.setKerning(True)
        self.passw_label.setFont(font)
        self.passw_label.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
        self.passw_label.setTextFormat(QtCore.Qt.RichText)
        self.passw_label.setObjectName("passw_label")
        self.verticalLayout.addWidget(self.passw_label)
        self.passw_input = QtWidgets.QLineEdit(self.verticalLayoutWidget)
        self.passw_input.setEnabled(True)
        self.passw_input.setInputMethodHints(
            QtCore.Qt.ImhHiddenText | QtCore.Qt.ImhNoAutoUppercase | QtCore.Qt.ImhNoPredictiveText | QtCore.Qt.ImhSensitiveData)
        self.passw_input.setInputMask("")
        self.passw_input.setText("")
        self.passw_input.setFrame(True)
        self.passw_input.setEchoMode(QtWidgets.QLineEdit.Password)
        self.passw_input.setReadOnly(False)
        self.passw_input.setObjectName("passw_input")
        self.verticalLayout.addWidget(self.passw_input)
        spacerItem = QtWidgets.QSpacerItem(
            20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(self.verticalLayoutWidget)
        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(self.Dialog)
        self.buttonBox.accepted.connect(self.execute)
        self.buttonBox.rejected.connect(self.Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(self.Dialog)
        self.Dialog.setTabOrder(self.user_input, self.passw_input)
예제 #29
0
    def setupUi(self, QSpectrumAnalyzerColors):
        QSpectrumAnalyzerColors.setObjectName("QSpectrumAnalyzerColors")
        QSpectrumAnalyzerColors.resize(253, 266)
        self.verticalLayout = QtWidgets.QVBoxLayout(QSpectrumAnalyzerColors)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout = QtWidgets.QFormLayout()
        self.formLayout.setObjectName("formLayout")
        self.label_2 = QtWidgets.QLabel(QSpectrumAnalyzerColors)
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label_2)
        self.mainColorButton = ColorButton(QSpectrumAnalyzerColors)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.mainColorButton.sizePolicy().hasHeightForWidth())
        self.mainColorButton.setSizePolicy(sizePolicy)
        self.mainColorButton.setObjectName("mainColorButton")
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                                  self.mainColorButton)
        self.label_4 = QtWidgets.QLabel(QSpectrumAnalyzerColors)
        self.label_4.setObjectName("label_4")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole,
                                  self.label_4)
        self.peakHoldMaxColorButton = ColorButton(QSpectrumAnalyzerColors)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.peakHoldMaxColorButton.sizePolicy().hasHeightForWidth())
        self.peakHoldMaxColorButton.setSizePolicy(sizePolicy)
        self.peakHoldMaxColorButton.setObjectName("peakHoldMaxColorButton")
        self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole,
                                  self.peakHoldMaxColorButton)
        self.label_6 = QtWidgets.QLabel(QSpectrumAnalyzerColors)
        self.label_6.setObjectName("label_6")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole,
                                  self.label_6)
        self.peakHoldMinColorButton = ColorButton(QSpectrumAnalyzerColors)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.peakHoldMinColorButton.sizePolicy().hasHeightForWidth())
        self.peakHoldMinColorButton.setSizePolicy(sizePolicy)
        self.peakHoldMinColorButton.setObjectName("peakHoldMinColorButton")
        self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole,
                                  self.peakHoldMinColorButton)
        self.label_5 = QtWidgets.QLabel(QSpectrumAnalyzerColors)
        self.label_5.setObjectName("label_5")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole,
                                  self.label_5)
        self.averageColorButton = ColorButton(QSpectrumAnalyzerColors)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.averageColorButton.sizePolicy().hasHeightForWidth())
        self.averageColorButton.setSizePolicy(sizePolicy)
        self.averageColorButton.setObjectName("averageColorButton")
        self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole,
                                  self.averageColorButton)
        self.label_3 = QtWidgets.QLabel(QSpectrumAnalyzerColors)
        self.label_3.setObjectName("label_3")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole,
                                  self.label_3)
        self.persistenceColorButton = ColorButton(QSpectrumAnalyzerColors)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.persistenceColorButton.sizePolicy().hasHeightForWidth())
        self.persistenceColorButton.setSizePolicy(sizePolicy)
        self.persistenceColorButton.setObjectName("persistenceColorButton")
        self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole,
                                  self.persistenceColorButton)
        self.label = QtWidgets.QLabel(QSpectrumAnalyzerColors)
        self.label.setObjectName("label")
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
        self.baselineColorButton = ColorButton(QSpectrumAnalyzerColors)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.baselineColorButton.sizePolicy().hasHeightForWidth())
        self.baselineColorButton.setSizePolicy(sizePolicy)
        self.baselineColorButton.setObjectName("baselineColorButton")
        self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole,
                                  self.baselineColorButton)
        self.verticalLayout.addLayout(self.formLayout)
        spacerItem = QtWidgets.QSpacerItem(20, 2,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(QSpectrumAnalyzerColors)
        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.label_2.setBuddy(self.mainColorButton)
        self.label_4.setBuddy(self.peakHoldMaxColorButton)
        self.label_6.setBuddy(self.peakHoldMinColorButton)
        self.label_5.setBuddy(self.averageColorButton)
        self.label_3.setBuddy(self.persistenceColorButton)
        self.label.setBuddy(self.baselineColorButton)

        self.retranslateUi(QSpectrumAnalyzerColors)
        self.buttonBox.accepted.connect(QSpectrumAnalyzerColors.accept)
        self.buttonBox.rejected.connect(QSpectrumAnalyzerColors.reject)
        QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerColors)
        QSpectrumAnalyzerColors.setTabOrder(self.mainColorButton,
                                            self.peakHoldMaxColorButton)
        QSpectrumAnalyzerColors.setTabOrder(self.peakHoldMaxColorButton,
                                            self.peakHoldMinColorButton)
        QSpectrumAnalyzerColors.setTabOrder(self.peakHoldMinColorButton,
                                            self.averageColorButton)
        QSpectrumAnalyzerColors.setTabOrder(self.averageColorButton,
                                            self.persistenceColorButton)
        QSpectrumAnalyzerColors.setTabOrder(self.persistenceColorButton,
                                            self.baselineColorButton)
예제 #30
0
    def create(self):

        self._mouse_pressed = False
        self._mouse_position = None
        self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint)
        self.setMouseTracking(True)
        self.setSizePolicy(
            QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding,
        )

        self.title_label = QtWidgets.QLabel()
        self.title_label.setProperty('titlebar', True)
        self.title_label.setSizePolicy(
            QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Minimum,
        )
        self.title_label.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
        self.title_label.setFocusPolicy(QtCore.Qt.NoFocus)
        self.close_button = Icon(':/icons/close', size=24)
        self.close_button.clicked.connect(self.reject)
        self.titlebar_layout = QtWidgets.QHBoxLayout()
        self.titlebar_layout.addWidget(self.title_label)
        self.titlebar_layout.addStretch(1)
        self.titlebar_layout.addWidget(self.close_button)
        self.titlebar_layout.setContentsMargins(0, 0, 0, 0)

        self.title_label.setFocus()

        self.title_label.setText('Publish ' + os.path.basename(self.data.file))
        self.header_label = Label(
            'Publish the current workfile?',
            parent=self,
        )

        action_ctx = construct.ActionContext(self.action, (), {})
        group_tmpl = '{}<br>'
        task_tmpl = '<b>{}</b> - {}<br>'
        summary = ''
        for group, tasks in action_ctx.task_groups.items():
            summary += group_tmpl.format(group.description)
            summary += '<p style="padding: 0; margin: 0px 0px 0px 20px;">'
            for task in tasks:
                summary += task_tmpl.format(task.identifier, task.description)
            summary += '</p>'
        self.summary_label = Label(summary, self)

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Yes | QtWidgets.QDialogButtonBox.No)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.layout = QtWidgets.QVBoxLayout()
        margin = [pix(16)] * 4
        spacing = pix(20)
        self.layout.setSpacing(spacing)
        self.layout.setContentsMargins(*margin)
        self.layout.addWidget(self.header_label)
        self.layout.addWidget(self.summary_label)
        self.layout.addStretch(1)
        self.layout.addWidget(self.buttons)

        self.grid_layout = QtWidgets.QGridLayout()
        self.grid_layout.setContentsMargins(0, 0, 0, 0)
        self.grid_layout.addLayout(self.titlebar_layout, 0, 0)
        self.grid_layout.setRowStretch(1, 1)
        self.grid_layout.addLayout(self.layout, 1, 0)
        self.setLayout(self.grid_layout)
        self.adjustSize()