def __init__(self, parent=None):
        super(SegmentPropertiesWidget, self).__init__(parent)
        self.block_signals = False
        self.spline_editor = None

        self.c1_pane_widget = PaneWidget()
        self.c2_pane_widget = PaneWidget()
        self.p_pane_widget = PaneWidget()

        main_layout = QVBoxLayout()

        main_layout.addWidget(self.c1_pane_widget)
        main_layout.addWidget(self.c2_pane_widget)
        main_layout.addWidget(self.p_pane_widget)

        self.setLayout(main_layout)

        self.c1_pane_widget.point_label.setText("c1")
        self.c1_pane_widget.smooth_checkbox.setVisible(False)
        self.c1_pane_widget.x_spin_box.valueChanged.connect(self.c1Updated)
        self.c1_pane_widget.y_spin_box.valueChanged.connect(self.c1Updated)

        self.c2_pane_widget.point_label.setText("c2")
        self.c2_pane_widget.smooth_checkbox.setVisible(False)
        self.c2_pane_widget.x_spin_box.valueChanged.connect(self.c2Updated)
        self.c2_pane_widget.y_spin_box.valueChanged.connect(self.c2Updated)

        self.p_pane_widget.point_label.setText("p1")
        self.p_pane_widget.smooth_checkbox.toggled.connect(self.pUpdated)
        self.p_pane_widget.x_spin_box.valueChanged.connect(self.pUpdated)
        self.p_pane_widget.y_spin_box.valueChanged.connect(self.pUpdated)
    def __init__(self, parent=None):
        super(NoObjectSelectedWidget, self).__init__(parent)

        self.label = QLabel("There is no object selected.\n Please select one to see it's properties.")
        main_layout = QVBoxLayout()
        main_layout.addWidget(self.label)
        self.setLayout(main_layout)
Example #3
0
    def _create_control(self, parent):
        layout=QVBoxLayout()
        pb = QProgressBar()

        self._message_control=QLabel()
        self._message_control.setText('     ')
        layout.addWidget(self._message_control)
        layout.addWidget(pb)

        return pb
    def _init_ui(self, txt):
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint)

        pal = QPalette()
        color = QColor()
        color.setNamedColor(self._window_bgcolor)
        color.setAlpha(255 * self._opacity)
        pal.setColor(QPalette.Background, color)

        self.setAutoFillBackground(True)
        self.setPalette(pal)

        wm, hm = 5, 5
        spacing = 8
        layout = QVBoxLayout()
        layout.setSpacing(spacing)
        layout.setContentsMargins(wm, hm, wm, hm)

        nlines, ts = self._generate_text(txt)

        qlabel = QLabel('\n'.join(ts))

        ss = 'QLabel {{color: {}; font-family:{}, sans-serif; font-size: {}px}}'.format(self._color,
                                                                                        self._font,
                                                                                        self._fontsize)
        qlabel.setStyleSheet(ss)
        layout.addWidget(qlabel)

        hlabel = QLabel('double click to dismiss')
        hlabel.setStyleSheet('QLabel {font-size: 10px}')

        hlayout = QHBoxLayout()

        hlayout.addStretch()
        hlayout.addWidget(hlabel)
        hlayout.addStretch()

        layout.addLayout(hlayout)

        self.setLayout(layout)

        font = QFont(self._font, self._fontsize)
        fm = QFontMetrics(font)

        pw = max([fm.width(ti) for ti in ts])
        ph = (fm.height() + 2) * nlines

        w = pw + wm * 2
        h = ph + (hm + spacing + 1) * 2

        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.setFixedWidth(w)
        self.setFixedHeight(h)

        self.setMask(mask(self.rect(), 10))
Example #5
0
    def __init__(self, text):
        super(GosubPopupWidget, self).__init__()
        self.setWindowFlags(Qt.ToolTip)
        layout = QVBoxLayout()

        if text:
            self.text = QPlainTextEdit()
            self.text.setPlainText(text)

        else:
            self.text = QLabel('Invalid Gosub')
            self.text.setStyleSheet('QLabel {color: green; font-size: 30px}')

        layout.addWidget(self.text)
        self.setLayout(layout)
        self.resize(500, 300)
Example #6
0
    def __init__(self, text):
        super(GosubPopupWidget, self).__init__()
        self.setWindowFlags(Qt.ToolTip)
        layout = QVBoxLayout()

        if text:
            self.text = QPlainTextEdit()
            self.text.setPlainText(text)

        else:
            self.text = QLabel('Invalid Gosub')
            self.text.setStyleSheet('QLabel {color: green; font-size: 30px}')

        layout.addWidget(self.text)
        self.setLayout(layout)
        self.resize(500, 300)
Example #7
0
    def _create_control(self):
        ctrl = QGraphicsView()
        scene = QGraphicsScene()
        ctrl.setScene(scene)

        scene.setBackgroundBrush(QBrush(QColor(237, 237, 237)))
        ctrl.setStyleSheet("border: 0px")
        md = self._dimension * 3 + self._spacing * 4
        ctrl.setMaximumWidth(md)
        ctrl.setMaximumHeight(md)

        layout = QVBoxLayout()

        layout.addWidget(ctrl)
        self._scene = scene
        self.control = QWidget()
        self.control.setLayout(layout)
    def __init__(self, parent=None):
        super(AtomPropertiesWidget, self).__init__(parent)
        self.atom = None

        self.name_editor = QLineEdit()
        self.name_editor_groupbox = QGroupBox("Name")
        self.name_editor_groupbox_layout = QHBoxLayout()
        self.name_editor_groupbox.setLayout(self.name_editor_groupbox_layout)
        self.name_editor_groupbox_layout.addWidget(self.name_editor)
        self.name_editor_groupbox_layout.addStretch()

        main_layout = QVBoxLayout()
        main_layout.addWidget(self.name_editor_groupbox)
        main_layout.addStretch()
        self.setLayout(main_layout)

        self.name_editor.textChanged.connect(self.name_editor_text_changed)

        self.setDisabled(True)
Example #9
0
    def init(self, parent):
        """
        """
        rad = self.factory.radius

        if not rad:
            rad = 20

        if self.control is None:

            scene = QGraphicsScene()

            # system background color
            scene.setBackgroundBrush(QBrush(QColor(237, 237, 237)))

            x, y = 10, 10
            cx = x + rad / DIAMETER_SCALAR
            cy = y + rad / DIAMETER_SCALAR

            self.colors = [QColor(ci) for ci in self.factory.colors]
            brush = get_gradient(self.colors[self.value], cx, cy, rad / 2)
            pen = QPen()
            pen.setWidth(0)
            self._led_ellipse = scene.addEllipse(x, y, rad, rad, pen=pen, brush=brush)

            ctrl = LEDGraphicsView(rad, scene)

            layout = QVBoxLayout()
            layout.addWidget(ctrl)
            layout.setAlignment(ctrl, Qt.AlignHCenter)

            if self.factory.label:
                txt = QLabel(self.factory.label)
                layout.addWidget(txt)
                layout.setAlignment(txt, Qt.AlignHCenter)

            self.control = QWidget()
            self.control.setLayout(layout)
Example #10
0
    def _create_control(self, parent):
        layout = QVBoxLayout()
        pb = QProgressBar()

        self._message_control = QLabel()
        self._message_control.setText('     ')
        layout.addWidget(self._message_control)
        layout.addWidget(pb)

        return pb
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        self.visualization = Visualization()

        # If you want to debug, beware that you need to remove the Qt
        # input hook.
        #QtCore.pyqtRemoveInputHook()
        #import pdb ; pdb.set_trace()
        #QtCore.pyqtRestoreInputHook()

        # The edit_traits call will generate the widget to embed.
        self.ui = self.visualization.edit_traits(parent=self,
                                                 kind='subpanel').control
        layout.addWidget(self.ui)
        self.ui.setParent(self)
    def __init__(self, parent=None):
        super(RadialForcePropertiesWidget, self).__init__(parent)
        self.radial_force = None

        self.name_editor = QLineEdit()
        self.name_editor_groupbox = QGroupBox("Name")
        self.name_editor_groupbox_layout = QHBoxLayout()
        self.name_editor_groupbox.setLayout(self.name_editor_groupbox_layout)
        self.name_editor_groupbox_layout.addWidget(self.name_editor)
        self.name_editor_groupbox_layout.addStretch()

        self.explicit_bezier_curve_widget = ExplicitBezierCurveWidget()

        main_layout = QVBoxLayout()
        main_layout.addWidget(self.name_editor_groupbox)
        main_layout.addWidget(self.explicit_bezier_curve_widget)
        main_layout.addStretch()
        self.setLayout(main_layout)

        self.name_editor.textChanged.connect(self.name_editor_text_changed)
        self.explicit_bezier_curve_widget.bezier_curve_changed.connect(self.bezier_curve_changed)

        self.setDisabled(True)
    def __init__(self, parent=None):
        super(ExplicitBezierCurveWidget, self).__init__(parent)

        graphics_view = QGraphicsView()

        def graphics_view_resize_event(event):
            assert isinstance(event, QResizeEvent)
            graphics_view.fitInView(QRectF(0, -SCENE_SIZE_2, SCENE_SIZE, SCENE_SIZE), Qt.KeepAspectRatio)
            super(QGraphicsView, graphics_view).resizeEvent(event)

        graphics_view.resizeEvent = graphics_view_resize_event
        self.explicit_bezier_curve_scene = ExplicitBezierCurveScene(self)
        graphics_view.setScene(self.explicit_bezier_curve_scene)
        graphics_view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)

        properties_group_box = QGroupBox()
        properties_group_box.setTitle("Properties")

        properties_group_box_layout = QVBoxLayout()
        properties_group_box.setLayout(properties_group_box_layout)

        # Degree

        degree_layout = QHBoxLayout()
        properties_group_box_layout.addLayout(degree_layout)
        degree_label = QLabel("Polynomial degree")
        self.degree_spinbox = QSpinBox()
        self.degree_spinbox.setRange(MIN_POLYNOMIAL_DEGREE, MAX_POLYNOMIAL_DEGREE)
        self.degree_spinbox.setValue(POLYNOMIAL_DEGREE_DEFAULT)
        self.degree_spinbox.valueChanged.connect(self.process_degree_changed)
        degree_label.setBuddy(self.degree_spinbox)
        degree_layout.addWidget(degree_label)
        degree_layout.addWidget(self.degree_spinbox)

        # X - range

        x_layout = QHBoxLayout()
        x_label = QLabel("X:")
        x_layout.addWidget(x_label)
        properties_group_box_layout.addLayout(x_layout)

        min_x_value_label = QLabel("Min")
        x_layout.addWidget(min_x_value_label)
        self.min_x_value_spinbox = QDoubleSpinBox()
        x_layout.addWidget(self.min_x_value_spinbox)
        self.min_x_value_spinbox.setRange(MIN_X_VALUE, DEFAULT_MAX_X_VALUE-MIN_X_RANGE)
        self.min_x_value_spinbox.setValue(DEFAULT_MIN_X_VALUE)
        self.min_x_value_spinbox.valueChanged.connect(self.process_min_x_value_changed)

        max_x_value_label = QLabel("Max")
        x_layout.addWidget(max_x_value_label)
        self.max_x_value_spinbox = QDoubleSpinBox()
        x_layout.addWidget(self.max_x_value_spinbox)
        self.max_x_value_spinbox.setRange(DEFAULT_MIN_X_VALUE - MIN_X_RANGE, MAX_X_VALUE)
        self.max_x_value_spinbox.setValue(DEFAULT_MAX_X_VALUE)
        self.max_x_value_spinbox.valueChanged.connect(self.process_max_x_value_changed)

        # Y - range

        y_layout = QHBoxLayout()
        properties_group_box_layout.addLayout(y_layout)
        y_label = QLabel("Y:")
        y_layout.addWidget(y_label)

        min_y_value_label = QLabel("Min")
        y_layout.addWidget(min_y_value_label)
        self.min_y_value_spinbox = QDoubleSpinBox()
        self.min_y_value_spinbox.setRange(MIN_Y_VALUE, DEFAULT_MAX_Y_VALUE-MIN_Y_RANGE)
        self.min_y_value_spinbox.setValue(DEFAULT_MIN_Y_VALUE)
        self.min_y_value_spinbox.valueChanged.connect(self.process_min_value_changed)
        min_y_value_label.setBuddy(self.min_y_value_spinbox)
        y_layout.addWidget(self.min_y_value_spinbox)

        max_y_value_label = QLabel("Max")
        y_layout.addWidget(max_y_value_label)
        self.max_y_value_spinbox = QDoubleSpinBox()
        self.max_y_value_spinbox.setRange(DEFAULT_MIN_Y_VALUE - MIN_Y_RANGE, MAX_Y_VALUE)
        self.max_y_value_spinbox.setValue(DEFAULT_MAX_Y_VALUE)
        self.max_y_value_spinbox.valueChanged.connect(self.process_max_value_changed)
        max_y_value_label.setBuddy(self.max_y_value_spinbox)
        y_layout.addWidget(self.max_y_value_spinbox)

        properties_group_box_layout.addStretch()

        self.polynom_widget = LatexLabelWidget()

        main_layout = QVBoxLayout()

        upper_layout = QVBoxLayout()
        upper_layout.addWidget(graphics_view)
        upper_layout.addWidget(properties_group_box)

        main_layout.addLayout(upper_layout)
        main_layout.addWidget(self.polynom_widget)

        self.setLayout(main_layout)
        self.process_control_points_changed()
    def __init__(self, universe, parent=None):
        super(NaturalLawPropertiesWidget, self).__init__(parent)
        self.natural_law = None
        self.universe = universe

        self.name_editor = QLineEdit()
        self.name_editor_groupbox = QGroupBox("Name")
        self.name_editor_groupbox_layout = QHBoxLayout()
        self.name_editor_groupbox.setLayout(self.name_editor_groupbox_layout)
        self.name_editor_groupbox_layout.addWidget(self.name_editor)
        self.name_editor_groupbox_layout.addStretch()

        self.force_combo_box = QComboBox()
        self.force_combo_box.setModel(ForcesInUniverseListModel(universe))
        self.atom_in_combo_box = QComboBox()
        self.atom_in_combo_box.setModel(AtomsInUniverseListModel(universe))
        self.atom_out_combo_box = QComboBox()
        self.atom_out_combo_box.setModel(AtomsInUniverseListModel(universe))
        self.transformation_label = QLabel()

        self.conversion_scheme_groupbox = QGroupBox("Conversion scheme")
        self.conversion_scheme_groupbox.setVisible(False)
        self.conversion_scheme_groupbox_layout = QGridLayout()
        self.conversion_scheme_groupbox.setLayout(self.conversion_scheme_groupbox_layout)
        self.conversion_scheme_groupbox_layout.addWidget(self.atom_in_combo_box, 1, 0)
        self.conversion_scheme_groupbox_layout.addWidget(self.force_combo_box, 0, 1)
        self.conversion_scheme_groupbox_layout.addWidget(self.atom_out_combo_box, 1, 2)
        self.conversion_scheme_groupbox_layout.addWidget(self.transformation_label, 1, 1)

        self.conversion_rate_formula_label = LatexLabelWidget()

        self.multiplicative_component_label = QLabel(u"υ = ")
        self.multiplicative_component_label.setFont(QFont("Times New Roman", 15, italic=True))
        self.multiplicative_component_double_spinbox = QDoubleSpinBox()

        self.additive_component_label = QLabel(u"s = ")
        self.additive_component_label.setFont(QFont("Times New Roman", 15, italic=True))
        self.additive_component_double_spinbox = QDoubleSpinBox()

        self.conversion_rate_groupbox = QGroupBox("Conversion rate")
        self.conversion_rate_groupbox_layout = QGridLayout()
        self.conversion_rate_groupbox.setLayout(self.conversion_rate_groupbox_layout)
        self.conversion_rate_groupbox_layout.addWidget(self.conversion_rate_formula_label, 0, 0, 1, 2)
        self.conversion_rate_groupbox_layout.addWidget(self.multiplicative_component_label, 1, 0)
        self.conversion_rate_groupbox_layout.addWidget(self.multiplicative_component_double_spinbox, 1, 1)
        self.conversion_rate_groupbox_layout.addWidget(self.additive_component_label, 2, 0)
        self.conversion_rate_groupbox_layout.addWidget(self.additive_component_double_spinbox, 2, 1)

        main_layout = QVBoxLayout()
        main_layout.addWidget(self.name_editor_groupbox)
        main_layout.addWidget(self.conversion_scheme_groupbox)
        main_layout.addWidget(self.conversion_rate_groupbox)
        main_layout.addStretch()

        self.setLayout(main_layout)

        self.name_editor.textChanged.connect(self.name_editor_text_changed)
        self.multiplicative_component_double_spinbox.valueChanged.connect(self.multiplicative_component_value_changed)
        self.additive_component_double_spinbox.valueChanged.connect(self.additive_component_value_changed)

        self.atom_in_combo_box.currentIndexChanged.connect(self.atom_in_combo_box_current_index_changed)

        self.setDisabled(True)