コード例 #1
0
    def __init__(self, name, type, data=""):
        QGroupBox.__init__(self)

        if name.find(": ") != -1: name = name.split(": ")[0]
        self.name, self.type = name, type
        self.data = data

        self.defaultElement = QGroupBox()
        mainElementLayout = QVBoxLayout()
        elementLayout = QHBoxLayout()
        if self.data == "": self.lName = QLabel(str(name))
        else: self.lName = QLabel(str(name) + ": " + str(self.data))
        self.lName.setMinimumSize(10, 10)
        duplicate = QPushButton("❐")
        duplicate.clicked.connect(lambda: self.duplicateElement())
        edit = QPushButton("✎")
        edit.clicked.connect(lambda: self.editText())
        remove = QPushButton("×")
        remove.clicked.connect(lambda: self.delElement())
        elementLayout.addWidget(self.lName)
        elementLayout.addWidget(duplicate)
        elementLayout.addWidget(edit)
        elementLayout.addWidget(remove)
        elementLayout.setStretch(0, 2)
        mainElementLayout.addLayout(elementLayout)
        mainElementLayout.addSpacing(10)
        self.defaultElement.setLayout(mainElementLayout)
        self.defaultElement.setFixedHeight(80)
コード例 #2
0
    def __init__(self, target_property_name, template):
        QGroupBox.__init__(self)
        PropertyWidget.__init__(self, target_property_name)

        main_layout = QVBoxLayout(self)
        button_layout = QHBoxLayout()
        self.make_unique_button = QPushButton("Make Unique")
        self.toggle_button = QPushButton("Toggle Editor")
        button_layout.addWidget(self.make_unique_button)
        button_layout.addWidget(self.toggle_button)
        main_layout.addLayout(button_layout)

        form_layout = QFormLayout()
        self.form_widget = QWidget()
        self.editors = []
        for (key, value) in template.items():
            label = QLabel(key)
            editor = value.create_editor()
            self.editors.append(editor)
            form_layout.addRow(label, editor)
        form_layout.setContentsMargins(0, 0, 0, 0)
        self.form_widget.setLayout(form_layout)
        main_layout.addWidget(self.form_widget)
        self.setLayout(main_layout)
        self.form_widget.setVisible(False)

        self.make_unique_button.clicked.connect(self._on_make_unique_clicked)
        self.toggle_button.clicked.connect(lambda: self.form_widget.setVisible(
            not self.form_widget.isVisible()))
コード例 #3
0
ファイル: WMagnetOut.py プロジェクト: mjfwest/pyleecan
    def __init__(self, parent=None):
        """Initialize the widget"""

        QGroupBox.__init__(self, parent)
        self.u = gui_option.unit
        # Setup main widget
        self.setTitle(self.tr("Output"))
        self.setMinimumSize(QSize(200, 0))
        self.setObjectName("g_output")
        self.layout = QVBoxLayout(self)
        self.layout.setObjectName("layout")
        # The widget is composed of several QLabel in a vertical layout
        self.out_Smag = QLabel(self)
        self.out_Smag.setObjectName("out_Smag")
        self.layout.addWidget(self.out_Smag)

        self.out_gap = QLabel(self)
        self.out_gap.setObjectName("out_gap")
        self.layout.addWidget(self.out_gap)

        self.out_gap_min = QLabel(self)
        self.out_gap_min.setObjectName("out_gap_min")
        self.layout.addWidget(self.out_gap_min)

        self.out_taum = QLabel(self)
        self.out_taum.setObjectName("out_taum")
        self.layout.addWidget(self.out_taum)
コード例 #4
0
    def __init__(self, parent=None):
        """Initialize the widget"""

        QGroupBox.__init__(self, parent)
        # Set main widget
        self.u = gui_option.unit
        self.setTitle(self.tr("Output"))
        self.setMinimumSize(QSize(200, 0))
        self.setObjectName("g_output")
        self.layout = QVBoxLayout(self)
        self.layout.setObjectName("layout")
        # The widget is composed of several QLabel in a vertical layout
        self.out_H = QLabel(self)
        self.out_H.setObjectName("out_H")
        self.layout.addWidget(self.out_H)

        self.out_W = QLabel(self)
        self.out_W.setObjectName("out_W")
        self.layout.addWidget(self.out_W)

        self.out_S = QLabel(self)
        self.out_S.setObjectName("out_S")
        self.layout.addWidget(self.out_S)

        self.out_Sact = QLabel(self)
        self.out_Sact.setObjectName("out_Sact")
        self.layout.addWidget(self.out_Sact)

        self.out_K = QLabel(self)
        self.out_K.setObjectName("out_K")
        self.layout.addWidget(self.out_K)
コード例 #5
0
 def __init__(self):
     QGroupBox.__init__(self)
     self.stockList = StockList()
     self.layout = QHBoxLayout()
     self.setLayout(self.layout)
     self.layout.addStretch()
     self.layout.addWidget(self.stockList)
コード例 #6
0
    def __init__(self, target_property_name, template):
        QGroupBox.__init__(self)
        PropertyWidget.__init__(self, target_property_name)

        main_layout = QVBoxLayout(self)
        button_layout = QHBoxLayout()
        self.make_unique_button = QPushButton("Make Unique")
        self.make_unique_button.setSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.MinimumExpanding)
        self.clear_button = QPushButton("Clear")
        self.clear_button.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                        QtWidgets.QSizePolicy.MinimumExpanding)
        self.toggle_button = QPushButton("Toggle Editor")
        self.toggle_button.setSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.MinimumExpanding)
        button_layout.addWidget(self.make_unique_button)
        button_layout.addWidget(self.clear_button)
        button_layout.addWidget(self.toggle_button)
        main_layout.addLayout(button_layout)

        self.property_form = PropertyForm(template)
        self.form_widget = QWidget()
        self.property_form.setContentsMargins(0, 0, 0, 0)
        self.form_widget.setLayout(self.property_form)
        main_layout.addWidget(self.form_widget)
        self.setLayout(main_layout)
        self.form_widget.setVisible(False)

        self.make_unique_button.clicked.connect(self._on_make_unique_clicked)
        self.clear_button.clicked.connect(self._on_clear_clicked)
        self.toggle_button.clicked.connect(lambda: self.form_widget.setVisible(
            not self.form_widget.isVisible()))
コード例 #7
0
    def __init__(self, parent=None):
        """Initialize the widget"""

        QGroupBox.__init__(self, parent)
        # Set main widget
        self.setTitle(self.tr("Output"))
        self.setMinimumSize(QSize(200, 0))
        self.setObjectName("g_output")
        self.layout = QVBoxLayout(self)
        self.layout.setObjectName("layout")
        # The widget is composed of several QLabel in a vertical layout
        self.out_Wlam = QLabel(self)
        self.out_Wlam.setObjectName("out_Wlam")
        self.layout.addWidget(self.out_Wlam)

        self.out_slot_height = QLabel(self)
        self.out_slot_height.setObjectName("out_slot_height")
        self.layout.addWidget(self.out_slot_height)

        self.out_yoke_height = QLabel(self)
        self.out_yoke_height.setObjectName("out_yoke_height")
        self.layout.addWidget(self.out_yoke_height)

        self.out_wind_surface = QLabel(self)
        self.out_wind_surface.setObjectName("out_wind_surface")
        self.layout.addWidget(self.out_wind_surface)

        self.out_tot_surface = QLabel(self)
        self.out_tot_surface.setObjectName("out_tot_surface")
        self.layout.addWidget(self.out_tot_surface)

        self.out_op_angle = QLabel(self)
        self.out_op_angle.setObjectName("out_op_angle")
        self.layout.addWidget(self.out_op_angle)
コード例 #8
0
    def __init__(self, parent=None):
        """Initialize the widget"""

        QGroupBox.__init__(self, parent)
        # Init the main widget
        self.u = gui_option.unit
        self.setTitle(self.tr("Output"))
        self.setMinimumSize(QSize(300, 0))
        self.setObjectName("g_output")
        self.layout = QVBoxLayout(self)
        self.layout.setObjectName("layout")

        # The widget is composed of several QLabel in a vertical layout
        self.out_Rint = QLabel(self)
        self.out_Rint.setObjectName("out_Rint")
        self.layout.addWidget(self.out_Rint)

        self.out_Rext = QLabel(self)
        self.out_Rext.setObjectName("out_Rext")
        self.layout.addWidget(self.out_Rext)

        self.out_lam_surface = QLabel(self)
        self.out_lam_surface.setObjectName("out_lam_surface")
        self.layout.addWidget(self.out_lam_surface)

        self.out_lam_vent_surface = QLabel(self)
        self.out_lam_vent_surface.setObjectName("out_lam_vent_surface")
        self.layout.addWidget(self.out_lam_vent_surface)

        self.out_vent_surf = QLabel(self)
        self.out_vent_surf.setObjectName("out_vent_surf")
        self.layout.addWidget(self.out_vent_surf)
コード例 #9
0
 def __init__(self, cName, parent):
     QGroupBox.__init__(self, parent)
     self.cName = cName
     vidFiles = [name for name in os.listdir(VIDEO_DIR) if cName in name]
     self.videoFiles = sorted(vidFiles)
     self.createElements()
     self.createLayout()
     self.updateSequence()
     self.updateImg()
コード例 #10
0
ファイル: ui_password_view.py プロジェクト: rickmer/keyswarm
 def __init__(self, pass_file_object=None):
     QGroupBox.__init__(self)
     self.setLayout(QGridLayout())
     welcome_message = QTextBrowser()
     welcome_message.setText('Leeloo Dallas - Multipass!')
     self.layout().addWidget(welcome_message, 0, 0)
     self.setTitle('Password Details')
     self.pass_file = None
     if pass_file_object:
         self.load_pass_file(pass_file_object)
コード例 #11
0
ファイル: bitflags_editor.py プロジェクト: thane98/paragon
 def __init__(self, target_property_name, flags):
     QGroupBox.__init__(self)
     PropertyWidget.__init__(self, target_property_name)
     if len(flags) > 8:
         raise ValueError
     layout = QFormLayout(self)
     self.editors = []
     for i in range(0, len(flags)):
         label = QLabel(flags[i])
         editor = QCheckBox()
         editor.stateChanged.connect(self._on_edit)
         self.editors.append(editor)
         layout.addRow(label, editor)
     self.setLayout(layout)
コード例 #12
0
    def __init__(self, cp: ControlPoint, game: Game):
        QGroupBox.__init__(self, "Recruitment")
        self.cp = cp
        self.game = game

        self.bought_amount_labels = {}
        self.existing_units_labels = {}

        for event in self.game.events:
            if event.__class__ == UnitsDeliveryEvent and event.from_cp == self.cp:
                self.deliveryEvent = event
        if not self.deliveryEvent:
            self.deliveryEvent = self.game.units_delivery_event(self.cp)

        self.init_ui()
コード例 #13
0
    def __init__(self, parent=None):
        """Create the widget

        Parameters
        ----------
        self : WPathSelector
            A WPathSelector object
        parent : QWidget
            A reference to the widgets parent
        """

        # Build the interface according to the .ui file
        QGroupBox.__init__(self, parent)

        # Setup widget
        self.verticalLayout = QVBoxLayout(self)

        self.b_path = QPushButton(self)
        self.b_path.setObjectName(u"b_path")

        self.verticalLayout.addWidget(self.b_path)

        self.le_path = QLineEdit(self)
        self.le_path.setObjectName(u"le_path")
        # sizePolicy2 = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        # sizePolicy2.setHorizontalStretch(0)
        # sizePolicy2.setVerticalStretch(0)
        # sizePolicy2.setHeightForWidth(self.le_path.sizePolicy().hasHeightForWidth())
        # self.le_path.setSizePolicy(sizePolicy2)
        # self.le_path.setMinimumSize(QSize(150, 0))

        self.verticalLayout.addWidget(self.le_path)

        # Create the property of the widget
        self.obj = None  # object that has a path property to set
        self.verbose_name = (
            ""  # Name to display in the GUI (leave empty to use param_name)
        )
        self.param_name = ""  # path property name
        self.is_file = True  # True path to a file, False path to a folder
        self.extension = ""  # Filter file type

        # Connect the slot/signals
        self.le_path.editingFinished.connect(self.set_obj_path)
        self.b_path.clicked.connect(self.select_path)
コード例 #14
0
    def __init__(self, target_property_name):
        QGroupBox.__init__(self)
        PropertyWidget.__init__(self, target_property_name)
        self.main_layout = QFormLayout(self)

        self.buffer_editor = QLineEdit()
        self.buffer_editor.editingFinished.connect(self._on_buffer_edit)
        self.buffer_editor.setInputMask("HH HH HH HH HH HH HH HH;0")
        self.buffer_editor.setVisible(False)

        self.stats_layout = QFormLayout()
        self.stats_layout.setContentsMargins(0, 0, 0, 0)
        self.stat_editors = [
            QSpinBox(),
            QSpinBox(),
            QSpinBox(),
            QSpinBox(),
            QSpinBox(),
            QSpinBox(),
            QSpinBox(),
            QSpinBox()
        ]
        labels = self._get_labels_for_project()
        for i in range(0, 8):
            editor = self.stat_editors[i]
            editor.setRange(-128, 127)
            self.stats_layout.addRow(QLabel(labels[i]), editor)

        self.stats_widget = QWidget()
        self.stats_widget.setLayout(self.stats_layout)

        self.editor_toggle = QPushButton("Toggle Stats/Hex Editor")
        self.editor_toggle.clicked.connect(self._on_editor_toggle)

        self.main_layout.addRow(self.editor_toggle)
        self.main_layout.addRow(self.stats_widget)

        self.stat_editors[0].valueChanged.connect(lambda: self._on_stat_edit(0))
        self.stat_editors[1].valueChanged.connect(lambda: self._on_stat_edit(1))
        self.stat_editors[2].valueChanged.connect(lambda: self._on_stat_edit(2))
        self.stat_editors[3].valueChanged.connect(lambda: self._on_stat_edit(3))
        self.stat_editors[4].valueChanged.connect(lambda: self._on_stat_edit(4))
        self.stat_editors[5].valueChanged.connect(lambda: self._on_stat_edit(5))
        self.stat_editors[6].valueChanged.connect(lambda: self._on_stat_edit(6))
        self.stat_editors[7].valueChanged.connect(lambda: self._on_stat_edit(7))
コード例 #15
0
    def __init__(self, parent=None):
        """
        Set a reference to a material libray and material data path,
        updates the Combobox by the material names of the libary
        and set a referenced material by name.

        Parameters
        ----------
        self :
            A WMatSelect object
        parent :
            A reference to the widgets parent

        Returns
        -------

        """

        # Build the interface according to the .ui file
        QGroupBox.__init__(self, parent)

        self.verticalLayout = QVBoxLayout(self)
        self.c_mat_type = QComboBox(self)
        self.c_mat_type.setObjectName(u"c_mat_type")
        self.verticalLayout.addWidget(self.c_mat_type)

        self.b_matlib = QPushButton(self)
        self.b_matlib.setObjectName(u"b_matlib")
        self.b_matlib.setText("Edit Materials")
        self.verticalLayout.addWidget(self.b_matlib)

        # Create the property of the widget
        self.mat_win = None  # DMatLib widget
        self.obj = None  # object that has a material attribute
        self.mat_attr_name = ""  # material attribute name
        self.matlib = list()  # Matlib
        self.matlib_path = ""  # Path to save the matlib
        self.def_mat = "M400-50A"  # Default material
        self.is_hide_button = False  # To hide the "Edit material" button

        # Connect the signals
        self.c_mat_type.currentIndexChanged.connect(self.set_mat_type)
        self.b_matlib.clicked.connect(self.s_open_matlib)
コード例 #16
0
    def __init__(self, target_property_name):
        QGroupBox.__init__(self)
        PropertyWidget.__init__(self, target_property_name)
        layout = QFormLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        self.editors = [QSpinBox(), QSpinBox(), QSpinBox()]

        labels = self._get_labels_for_project()
        for i in range(0, 3):
            editor = self.editors[i]
            editor.setRange(-128, 127)
            layout.addRow(QLabel(labels[i]), editor)
            self.setLayout(layout)

        self.editors[0].valueChanged.connect(
            lambda: self._on_edit(0, self.editors[0].value()))
        self.editors[1].valueChanged.connect(
            lambda: self._on_edit(1, self.editors[1].value()))
        self.editors[2].valueChanged.connect(
            lambda: self._on_edit(2, self.editors[2].value()))
コード例 #17
0
ファイル: WBarOut.py プロジェクト: teodoralupu/pyleecan
    def __init__(self, parent=None):
        """Initialize the widget"""
        # Main widget setup
        QGroupBox.__init__(self, parent)
        self.u = gui_option.unit
        self.setTitle(self.tr("Output"))
        self.setMinimumSize(QSize(200, 0))
        self.setObjectName("g_output")
        self.layout = QVBoxLayout(self)
        self.layout.setObjectName("layout")

        # The widget is composed of 3 QLabel in a vertical layout
        self.out_Sbar = QLabel(self)
        self.out_Sbar.setObjectName("out_Sbar")
        self.layout.addWidget(self.out_Sbar)

        self.out_Sslot = QLabel(self)
        self.out_Sslot.setObjectName("out_Sslot")
        self.layout.addWidget(self.out_Sslot)

        self.out_ratio = QLabel(self)
        self.out_ratio.setMinimumSize(QSize(140, 0))
        self.out_ratio.setObjectName("out_ratio")
        self.layout.addWidget(self.out_ratio)
コード例 #18
0
    def __init__(self, client):
        QGroupBox.__init__(self)

        self.client = client
        # Creation of node list in network
        node_list = client.refresh_node_list()
        self.label = QLabel("Incubed nodes listing:")
        self.button = QPushButton("Update list")

        self.nodes_listing = QListWidget()
        self.items = []
        for node in node_list.nodes:
            self.items.append(
                QListWidgetItem(QIcon(), node.url, self.nodes_listing))

        self.server_listing_layout = QVBoxLayout()
        self.server_listing_layout.addWidget(self.label)

        self.server_listing_layout.addWidget(self.nodes_listing)

        self.server_listing_layout.addWidget(self.button)
        self.setLayout(self.server_listing_layout)
        # Button to update the list with nodes
        self.button.clicked.connect(self.update_list)
コード例 #19
0
    def __init__(self, client):
        QGroupBox.__init__(self)
        # This parameters are displaying information about picked contract
        self.block_registry = ""
        self.node_registry = ""
        self.timeout = ""
        self.admin_key = ""
        self.max_deposit = 0
        self.min_deposit = 0

        self.p_key = ""
        self.client = client

        # Those are modals to work with contract functions
        self.register_node_modal = RegisterNode(self.client)
        self.convict_modal = Convict(self.client)
        self.remove_node_modal = RemoveNode(self.client)

        self.main = QGroupBox()

        # This layout is done to add new contracts(it is ComboBox)
        self.top_horisontal_layout = QVBoxLayout()

        self.contract_group_box = QGroupBox("Contract")
        self.contract_group_layout = QFormLayout()
        self.contract_group_layout.addRow(
            QLabel("Select contract or add new one:"))
        self.butt = QToolButton()
        self.butt.setIcon(QIcon("./resources/plus.jpeg"))
        self.butt.clicked.connect(self.add_new_address)
        self.contracts_pick = QComboBox()

        self.no_key_error_label = QLabel(
            "Enter your private key first(button top right corner).")

        self.add_cont_address("0x6C095A05764A23156eFD9D603eaDa144a9B1AF33")
        self.add_cont_address("0xfAFB978544b6D0610641cd936a005009fecc2f25")
        self.no_key_error_label.hide()

        self.contracts_pick.currentTextChanged.connect(
            self.change_contract_addr)
        self.contract_group_layout.addRow(self.butt, self.contracts_pick)
        self.contract_group_box.setLayout(self.contract_group_layout)

        # This part of layout are buttons for Admin functionality
        self.admin_button_group_box = QGroupBox("Admin functionality")
        self.admin_buttons_listing_layout = QVBoxLayout()
        self.admin_buttons = []
        self.admin_buttons.append(QPushButton("Remove node"))
        self.admin_buttons.append(QPushButton("Update logic"))
        for i in range(len(self.admin_buttons)):
            self.admin_buttons_listing_layout.addWidget(self.admin_buttons[i -
                                                                           1])

        self.admin_button_group_box.setLayout(
            self.admin_buttons_listing_layout)

        # This part of layout are buttons for common functionality
        self.people_button_group_box = QGroupBox("Common functionality")
        self.people_buttons_listing_layout = QVBoxLayout()
        self.people_buttons = []
        self.people_buttons.append(QPushButton("Convict"))
        self.people_buttons.append(QPushButton("Register node"))
        self.people_buttons.append(QPushButton("Return deposit"))
        self.people_buttons.append(QPushButton("Reveal convict_modal"))
        self.people_buttons.append(QPushButton("Transfer ownership"))
        self.people_buttons.append(QPushButton("Unregister node"))
        self.people_buttons.append(QPushButton("Update node"))
        for i in range(len(self.people_buttons)):
            self.people_buttons_listing_layout.addWidget(
                self.people_buttons[i - 1])

        # This part of layout is a gtoup box which stores and shows all information about registry smart contract
        self.people_button_group_box.setLayout(
            self.people_buttons_listing_layout)

        self.admin_key_label = QLabel(self.admin_key)
        self.block_registry_label = QLabel(self.block_registry)
        self.node_registry_label = QLabel(self.node_registry)
        self.timeout_label = QLabel(str(self.timeout))
        self.max_deposit_label = QLabel(str(self.max_deposit) + " tokens")
        self.min_deposit_label = QLabel(str(self.min_deposit) + " tokens")

        self.contract_info_box = QGroupBox()
        self.contract_info_layout = QFormLayout()
        self.contract_info_layout.addRow(QLabel("Owner:"),
                                         self.admin_key_label)
        self.contract_info_layout.addRow(QLabel("Block Registry:"),
                                         self.block_registry_label)
        self.contract_info_layout.addRow(QLabel("Node Registry:"),
                                         self.node_registry_label)
        self.contract_info_layout.addRow(QLabel("Timeout:"),
                                         self.timeout_label)
        self.contract_info_layout.addRow(QLabel("Max deposit:"),
                                         self.max_deposit_label)
        self.contract_info_layout.addRow(QLabel("Min deposit:"),
                                         self.min_deposit_label)
        self.contract_info_box.setLayout(self.contract_info_layout)

        # Establishing overall view of the layout
        self.top_horisontal_layout.addWidget(self.contract_group_box)
        self.top_horisontal_layout.addWidget(self.contract_info_box)
        self.top_horisontal_layout.addWidget(self.no_key_error_label)
        self.top_horisontal_layout.addWidget(self.admin_button_group_box)
        self.top_horisontal_layout.addWidget(self.people_button_group_box)
        self.setLayout(self.top_horisontal_layout)

        for i in range(2, len(self.people_buttons)):
            self.people_buttons[i].setEnabled(False)

        for i in range(1, len(self.admin_buttons)):
            self.admin_buttons[i].setEnabled(False)

        self.add_address = ContractModal(self)

        # connecting buttons with functionality
        self.people_buttons[1].clicked.connect(self.register_new_node)
        self.people_buttons[0].clicked.connect(self.convict_node)
        self.admin_buttons[0].clicked.connect(self.remove_node)
コード例 #20
0
 def __init__(self):
     QGroupBox.__init__(self)
     self.createElements(5)
     self.createLayout()
     self.createActions()
コード例 #21
0
 def __init__(self, text):
     QGroupBox.__init__(self)
     self.pushButton = QPushButton(text)
     self.layout = QVBoxLayout()
     self.layout.addWidget(self.pushButton)
     self.setLayout(self.layout)
コード例 #22
0
 def __init__(self, text):
     QGroupBox.__init__(self)
     self.label = QLabel(text)
     self.layout = QVBoxLayout()
     self.layout.addWidget(self.label)
     self.setLayout(self.layout)
コード例 #23
0
 def __init__(self, title, fs):
     QGroupBox.__init__(self, title)
     self.fs = fs
コード例 #24
0
    def __init__(self, parent: Optional[QWidget] = None) -> None:
        QGroupBox.__init__(self, parent)

        self.__sliders = []
        self.__visualization_widgets = []
        self.__value_labels = []