Example #1
0
class Current:
    def __init__(self):
        self.layout = QGridLayout()
        self.wrapper = QFrame()
        self.wrapper.setLayout(self.layout)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.time = QLabel()
        self.icon = QSvgWidget()
        self.temp = QLabel()
        self.precip = QLabel()
        self.wind = QLabel()

        self.layout.addWidget(self.time, 0, 0, 1, 2)
        self.layout.addWidget(self.icon, 1, 0, 3, 1)
        self.layout.addWidget(self.temp, 1, 1, 1, 1)
        self.layout.addWidget(self.wind, 2, 1, 1, 1)
        self.layout.addWidget(self.precip, 3, 1, 1, 1)

    def update(self, values):
        self.icon.load(values.icon)
        self.time.setText(values.time)
        self.temp.setText(values.temp)
        self.wind.setText(values.wind)
        self.precip.setText(values.precip)
Example #2
0
    def initUI(self):
        #创建三个标签
        title = QLabel('标题')
        author = QLabel('作者')
        summary = QLabel('摘要')
        #创建三个文本输入框
        titleEdit = QLineEdit()
        authorEdit = QLineEdit()
        summaryEdit = QTextEdit()
        #创建网格布局对象
        grid = QGridLayout()
        #设置单元格的距离
        grid.setSpacing(10)
        #将创建的控件加入布局对象
        grid.addWidget(title, 1, 0)
        grid.addWidget(titleEdit, 1, 1)

        grid.addWidget(author, 2, 0)
        grid.addWidget(authorEdit, 2, 1)

        grid.addWidget(summary, 3, 0)
        grid.addWidget(summaryEdit, 3, 1, 5, 1)
        #把 布局应用于当前窗口
        self.setLayout(grid)

        self.setGeometry(300, 300, 350, 300)

        self.setWindowTitle('网格布局')
        self.show()
Example #3
0
class MainWindow(QMainWindow):

    def __init__(self, game):
        super().__init__()
        self.game = game


        # tag::grid[]
        self.grid = QGridLayout()
        self.grid.setSpacing(0)
        #self.grid.setSizeConstraint(QLayout.SetFixedSize)
        # end::grid[]
        a = WidgetTest()
        self.grid.addWidget(a, 0, 0)
        #self.init_map()
        widget = QWidget()
        widget.setLayout(self.grid)
        self.setCentralWidget(widget)



    def init_map(self):
        # Add positions to the map
        for x in range(0, self.game.board.width):
            for y in range(0, self.game.board.height):
                w = Pos(x, y, self.game)
                self.grid.addWidget(w, y, x)
                # Connect signal to handle expansion.
                # w.clicked.connect(self.select_robot)

        # Place resize on the event queue, giving control back to Qt before.
        QTimer.singleShot(0, lambda: self.resize(1, 1))
Example #4
0
    def initUI(self):
        title = QLabel('Title')
        author = QLabel('Author')
        review = QLabel('Review')

        titleEdit = QLineEdit()
        authorEdit = QLineEdit()
        reviewEdit = QTextEdit()

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(title, 0, 0)
        grid.addWidget(titleEdit, 0, 1)

        grid.addWidget(author, 1, 0)
        grid.addWidget(authorEdit, 1, 1)

        # (foo, x, y)
        # (foo, x, y, row span, column span)
        # on met reviewEdit troisième ligne, colonne 1 (commence à 0) et il a
        # une hauteur de cinq lignes pour une largeur de une colonne.
        grid.addWidget(review, 2, 0)
        grid.addWidget(reviewEdit, 2, 1, 5, 1)

        # Il faut noter que dans son tuto, l'auteur fait commencer les indices
        # des lignes à 1 et non 0 comme les colonnes. C'est parfaitement légal.
        # En fait, on peut même faire commencer les lignes à 4 ou 23867868. Je
        # hais Python.

        self.setLayout(grid)

        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('Review')
        self.show()
Example #5
0
    def __init__(self, fig, title=None, parent=None):
        """Constructor.
        Defines some properties and buttons

        Parameters:
            fig: the figure to be shown
            title (optional): the window title
            parent (default None): the parent object,
                which should have a property lastPaperStats
        """
        super(PaperStatsPlots, self).__init__(parent)
        self.fig = fig
        self.canvas = None
        if title is not None:
            self.setWindowTitle(title)
        layout = QGridLayout(self)
        layout.setSpacing(1)
        self.setLayout(layout)
        self.updatePlots()

        nlines = 1
        self.layout().addWidget(PBLabel(igstr.lineMoreInfo), nlines + 1, 0)

        self.textBox = QLineEdit("")
        self.textBox.setReadOnly(True)
        self.layout().addWidget(self.textBox, nlines + 2, 0, 1, 2)
        self.saveButton = QPushButton(igstr.save, self)
        self.saveButton.clicked.connect(self.saveAction)
        self.layout().addWidget(self.saveButton, nlines + 3, 0)

        self.clButton = QPushButton(igstr.close, self)
        self.clButton.clicked.connect(self.onClose)
        self.clButton.setAutoDefault(True)
        self.layout().addWidget(self.clButton, nlines + 3, 1)
Example #6
0
    def init_visual(self):
        main_layout = QGridLayout()

        label = QLabel('Place your ships.')

        randomize_btn = QPushButton(text='randomize')
        randomize_btn.clicked.connect(self.randomize_field)

        internal_layout = QGridLayout()
        internal_layout.setSpacing(0)
        for row in range(10):
            for column in range(10):
                button = QPushButton()
                button.setFixedSize(20, 20)
                button.setObjectName(f'{row}_{column}')
                button.installEventFilter(self)
                self.buttons[(row, column)] = button
                internal_layout.addWidget(button, row, column)

        self.next_btn = QPushButton(text='Start')
        self.next_btn.clicked.connect(root_widget.start_battle)
        self.next_btn.setEnabled(False)

        main_layout.addWidget(label, 0, 0, Qt.AlignCenter)
        main_layout.addWidget(randomize_btn, 1, 0)
        main_layout.addLayout(internal_layout, 3, 0)
        main_layout.addWidget(self.next_btn, 5, 0)

        self.setLayout(main_layout)
Example #7
0
 def init(self):
     widget = QWidget()
     layout = QGridLayout(widget)
     layout.setSpacing(0)
     layout.setContentsMargins(0, 0, 0, 0)
     num = 0
     self.ColorDict = dict()
     self.ButtonList = QButtonGroup()
     for column in range(self._columns):
         for row in range(self._rows):
             if num < len(self.palette):
                 newColor = self.palette[num]
                 button = QPushButton('')
                 button.setContentsMargins(0,0,0,0)
                 button.setStyleSheet("padding: 0px;margin: 0px;")
                 button.setFixedSize(20,20)
                 self.ColorDict[button] = self.palette[num]
                 self.ButtonList.addButton(button)
                 pixmap = QPixmap(20, 20)
                 pixmap.fill(newColor)
                 button.setIcon(QIcon(pixmap))
                 layout.addWidget(button, row, column)
                 num+=1
             else:
                 break
     self.ButtonList.buttonClicked.connect(self.handleButton)
     self.setDefaultWidget(widget)
Example #8
0
    def update_params(self, plist: list) -> QGridLayout:
        """Update camera's paramters and sliders shown on the windows.
        """
        #self.current_params.clear()
        self.current_params = self.camera.get_current_params("selected", plist)
        for key, value in self.current_params.items():
            self.add_slider(key)

        # add sliders
        grid = QGridLayout()
        grid.setSpacing(15)
        grid.setContentsMargins(20, 20, 20, 20)
        for row, param in enumerate(self.current_params):
            grid.addWidget(self.current_params[param]["slider_label"], row, 0)
            grid.addWidget(self.current_params[param]["slider"], row, 1)
            grid.addWidget(self.current_params[param]["slider_value"], row, 2)
        if len(self.current_params) > 15:
            self.param_separate = True
        else:
            self.param_separate = False
        self.slider_group = grid
        self.update_mainlayout()
        self.update_prop_table()
        self.write_text("update sliders")
        return grid
Example #9
0
    def initUI(self):
        title = QLabel("Title")
        author = QLabel("Author")
        review = QLabel("Review")

        titleEdit = QLineEdit()
        authorEdit = QLineEdit()
        reviewEdit = QTextEdit()

        submitBtn = QPushButton("Submit", self)

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(title, 1, 0)
        grid.addWidget(titleEdit, 1, 1)

        grid.addWidget(author, 2, 0)
        grid.addWidget(authorEdit, 2, 1)

        grid.addWidget(review, 3, 0)
        grid.addWidget(reviewEdit, 3, 1)

        grid.addWidget(submitBtn, 4, 1)

        self.setLayout(grid)
        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle("Review")
        self.show()
Example #10
0
    def gui_init(self):

        self.setMaximumHeight(16)

        layout = QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(2)
        self.setLayout(layout)

        for i, but in enumerate(self.sorted_move_buttons):

            if but == abs(but):
                pref = 'p'
            else:
                pref = 'm'

            def some():
                print('SOME')

            button = LongButton(self)
            button.released.connect(some)
            button.setStyleSheet("padding: 0px;")
            layout.addWidget(button, 0, i, Qt.AlignCenter)

            if self.sorted_move_buttons[but]:
                self.__long_buttos__.append(button)

            button.setIcon(Icon(r'jog\JOG{}{}_32'.format(pref, abs(but))))
            button.setIconSize(QSize(32, 32))
            button.setFixedSize(QSize(32, 32))
            button.setText("")
            button.pressed.connect(partial(self.buttons_action, but))
Example #11
0
    def _create_status_lights(self, layout):
        # Create a frame to hold the register's bits
        status_frame = QFrame(self)
        layout.addWidget(status_frame)
        layout.setAlignment(status_frame, Qt.AlignBottom)
        status_layout = QGridLayout(status_frame)
        status_layout.setSpacing(0)
        status_layout.setMargin(0)
        status_frame.setLayout(status_layout)
        status_frame.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        # Add indicators for each status in the register, from MSB to LSB
        for col, stat in enumerate(STATUS_INDS.keys()):
            check = QCheckBox(status_frame)
            check.setFixedSize(30, 20)
            check.setStyleSheet(
                'QCheckBox::indicator{subcontrol-position:center;}')
            check.stateChanged.connect(lambda state: self._update_status())
            status_layout.addWidget(check, 0, col)
            status_layout.setAlignment(check, Qt.AlignCenter)
            self._status_cmp_switches[stat] = check

            check = QCheckBox(status_frame)
            check.setFixedSize(30, 20)
            check.setStyleSheet(
                'QCheckBox::indicator{subcontrol-position:center;}')
            check.stateChanged.connect(lambda state: self._update_status())
            status_layout.addWidget(check, 1, col)
            status_layout.setAlignment(check, Qt.AlignCenter)
            self._status_ign_switches[stat] = check
Example #12
0
    def initUI(self):
        vb = QVBoxLayout()
        hbMid = QHBoxLayout()

        vb.addStretch()
        vb.addLayout(hbMid)
        vb.addStretch()

        gl = QGridLayout()
        hbMid.addStretch()
        hbMid.addLayout(gl)
        hbMid.addStretch()

        gl.setSpacing(100)
        x = 0
        y = 0
        z = 0
        r = 0
        d = 0

        self.text = "X:{0}, Y:{1}, R:{2}, G:{3}, B:{4}".format(x, y, z, r, d)
        self.lbl = QLabel(self.text, self)
        gl.addWidget(self.lbl, 0, 0, Qt.AlignTop)

        self.setLayout(vb)

        self.resize(350, 200)
        self.show()
        self.MouseTracking()
Example #13
0
    def __init__(self):
        # Call parent class's __init__()
        super().__init__()

        # Create board
        board = QGridLayout()
        board.setSpacing(12)
        # Loop for creating the cells
        for j in range(9):
            # Create cell
            cell = QPushButton(" ")
            cell.setSizePolicy(
                QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding
            )
            cell.setObjectName(f"{j % 3}|{j // 3}")
            # Add click callback
            cell.clicked.connect(self.conquer_cell)
            # Set cursor to be a pointer when on the cell
            cell.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
            # Add the cell to the board
            board.addWidget(cell, j // 3, j % 3)

        # Set the screen's layout to be the QGridLayout we created
        self.main_layout = board
        self.setLayout(self.main_layout)
        self.setObjectName("gameBoard")
        self.x_turn = True
        self.device = torch.device("cpu")
        self.policy_net = HAL9000().to(self.device)
        self.policy_net.load_state_dict(torch.load("HAL9000.pt")["policy_net"])
        self.policy_net.eval()
class QFactionsInfos(QGroupBox):
    """
    UI Component to display current turn and time info
    """

    def __init__(self, game):
        super(QFactionsInfos, self).__init__("Factions")

        self.player_name = QLabel("")
        self.enemy_name = QLabel("")
        self.setGame(game)

        self.layout = QGridLayout()
        self.layout.setSpacing(0)
        self.layout.addWidget(QLabel("<b>Player : </b>"), 0, 0)
        self.layout.addWidget(self.player_name, 0, 1)
        self.layout.addWidget(QLabel("<b>Enemy : </b>"), 1, 0)
        self.layout.addWidget(self.enemy_name, 1, 1)
        self.setLayout(self.layout)

    def setGame(self, game: Game):
        if game is not None:
            self.player_name.setText(game.blue.faction.name)
            self.enemy_name.setText(game.red.faction.name)
        else:
            self.player_name.setText("")
            self.enemy_name.setText("")
Example #15
0
    def initUI(self):
        grid = QGridLayout()
        self.setLayout(grid)

        self.setGeometry(300, 300, 400, 300)
        self.setWindowTitle('Grid')

        self.lcd = QLCDNumber()
        grid.addWidget(self.lcd, 0, 0, 3, 0)
        grid.setSpacing(10)

        names = [
            'Cls', 'Bc', '', 'Close', '7', '8', '9', '/', '4', '5', '6', '*',
            '1', '2', '3', '-', '0', '.', '=', '+'
        ]

        positions = [(i, j) for i in range(4, 9) for j in range(4, 8)]

        for position, name in zip(positions, names):
            if name == '':
                continue
            button = QPushButton(name)
            grid.addWidget(button, *position)
            button.clicked.connect(self.aa)

        self.show()
Example #16
0
    def initUI(self):
        title = QLabel('标题')
        author = QLabel('提交人')
        review = QLabel('申告内容')

        titleEdit = QLineEdit()
        authorEdit = QLineEdit()
        reviewEdit = QTextEdit()

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(title,1,0)
        grid.addWidget(titleEdit,1,1)

        grid.addWidget(author,2,0)
        grid.addWidget(authorEdit,2,1)

        grid.addWidget(review,3,0)
        grid.addWidget(reviewEdit,3,1,5,1)

        self.setLayout(grid)

        self.setGeometry(300,300,350,300)
        self.setWindowTitle("故障申告")

        self.show()
Example #17
0
    def initUI(self):
        """Create the main `QTextEdit`, the buttons and the `QProgressBar`"""
        self.setWindowTitle(self.title)

        grid = QGridLayout()
        self.grid = grid
        grid.setSpacing(1)

        if self.message is not None and self.message.strip() != "":
            grid.addWidget(PBLabel("%s" % self.message))

        self.textEdit = QTextEdit()
        grid.addWidget(self.textEdit)

        if self.setProgressBar:
            self.progressBar = QProgressBar(self)
            grid.addWidget(self.progressBar)

        # cancel button...should learn how to connect it with a thread kill
        if not self.noStopButton:
            self.cancelButton = QPushButton(dwstr.stop, self)
            self.cancelButton.clicked.connect(self.stopExec)
            self.cancelButton.setAutoDefault(True)
            grid.addWidget(self.cancelButton)
        self.closeButton = QPushButton(dwstr.close, self)
        self.closeButton.setDisabled(True)
        grid.addWidget(self.closeButton)

        self.setGeometry(100, 100, 600, 600)
        self.setLayout(grid)
        self.centerWindow()
Example #18
0
class Forecast:
    def __init__(self):
        self.layout = QGridLayout()
        self.wrapper = QFrame()
        self.wrapper.setLayout(self.layout)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.icon = QSvgWidget()
        self.day = QLabel()
        self.min_temp = QLabel()
        self.max_temp = QLabel()
        self.precip = QLabel()
        self.wind = QLabel()

        self.layout.addWidget(self.icon, 0, 0, 1, 1)
        self.layout.addWidget(self.day, 1, 0, 1, 1)
        self.layout.addWidget(self.min_temp, 1, 1, 1, 1)
        self.layout.addWidget(self.max_temp, 0, 1, 1, 1)
        self.layout.addWidget(self.wind, 0, 2, 1, 1)
        self.layout.addWidget(self.precip, 1, 2, 1, 1)

    def update(self, values):
        self.icon.load(values.icon)
        self.day.setText(values.day)
        self.min_temp.setText(values.min_temp)
        self.max_temp.setText(values.max_temp)
        self.precip.setText(values.precip)
        self.wind.setText(values.wind)
Example #19
0
	def initUI(self):

		grid_layout = QGridLayout()
		grid_layout.setSpacing(10)
		self.setLayout(grid_layout)

		#Tutorial
		self.tutorialLabel = QLabel()
		self.tutorialLabel.setText("Welcome to DeepCreamPy!\nIf you're new to DCP, please read the manual.")
		self.tutorialLabel.setAlignment(Qt.AlignCenter)
		self.tutorialLabel.setFont(QFont('Sans Serif', 13))

		#Censor type group
		self.censorTypeGroupBox = QGroupBox('Censor Type')

		barButton = QRadioButton('Bar censor')
		mosaicButton = QRadioButton('Mosaic censor')
		barButton.setChecked(True)

		censorLayout = QVBoxLayout()
		censorLayout.addWidget(barButton)
		censorLayout.addWidget(mosaicButton)
		# censorLayout.addStretch(1)
		self.censorTypeGroupBox.setLayout(censorLayout)

		#Variation count group
		self.variationsGroupBox = QGroupBox('Number of Decensor Variations')

		var1Button = QRadioButton('1')
		var2Button = QRadioButton('2')
		var3Button = QRadioButton('4')
		var1Button.setChecked(True)

		varLayout = QVBoxLayout()
		varLayout.addWidget(var1Button)
		varLayout.addWidget(var2Button)
		varLayout.addWidget(var3Button)
		# varLayout.addStretch(1)
		self.variationsGroupBox.setLayout(varLayout)

		#button
		decensorButton = QPushButton('Decensor Your Images')
		decensorButton.clicked.connect(self.decensorClicked)
		decensorButton.setSizePolicy(
    		QSizePolicy.Preferred,
    		QSizePolicy.Preferred)

		#put all groups into grid
		grid_layout.addWidget(self.tutorialLabel, 0, 0, 1, 2)
		grid_layout.addWidget(self.censorTypeGroupBox, 1, 0, 1, 1)
		grid_layout.addWidget(self.variationsGroupBox, 1, 1, 1, 1)
		grid_layout.addWidget(decensorButton, 2, 0, 1, 2)

		#window size settings
		self.resize(300, 300)
		self.center()
		self.setWindowTitle('DeepCreamPy v2.2.0')
		self.show()
Example #20
0
class PageAllegroMonitored(QWidget):
    def __init__(self, parent=None, shared_dict=None):
        QWidget.__init__(self)
        parent.addWidget(self)
        self.shared_dict = shared_dict
        self.parent = parent
        self.setLayoutDirection(Qt.LeftToRight)

        self.gridLayout = QGridLayout(self)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)

        self.scrollArea = QScrollArea(self)
        self.scrollArea.setStyleSheet("""QScrollArea{border: none;}""")
        self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.scrollArea.setSizeAdjustPolicy(QAbstractScrollArea.AdjustIgnored)
        self.scrollArea.setWidgetResizable(True)
        self.gridLayout.addWidget(self.scrollArea, 0, 0, 1, 1)

        self.scrollAreaWidgetContents = QWidget()
        self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 654, 479))
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        self.gridLayout_scroll_area = QGridLayout(
            self.scrollAreaWidgetContents)
        self.gridLayout_scroll_area.setSpacing(0)
        self.gridLayout_scroll_area.setContentsMargins(40, 0, 40, -1)

        self.label_title = QLabel("List of your monitored objects",
                                  self.scrollAreaWidgetContents)
        self.label_title.setStyleSheet(styles.label_title)
        self.label_title.setAlignment(Qt.AlignCenter)
        self.gridLayout_scroll_area.addWidget(self.label_title)

        self.spacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)

        self.load_list()

    def load_list(self):
        elements = data.read_monitored_elements()
        for element in elements:
            e = ElementAllegroMonitored(element['name'], element['link'],
                                        element['is_done'], element['price'],
                                        element['xpath'], element['time'],
                                        element['is_monitoring'],
                                        self.scrollAreaWidgetContents,
                                        self.shared_dict)
            self.gridLayout_scroll_area.addWidget(e)

        self.gridLayout_scroll_area.addItem(self.spacer)

    def add_to_list(self, name, link, is_done, price, xpath, time,
                    is_monitoring):
        self.gridLayout_scroll_area.removeItem(self.spacer)
        e = ElementAllegroMonitored(name, link, is_done, price, xpath, time,
                                    is_monitoring)
        self.gridLayout_scroll_area.addWidget(e)
        self.gridLayout_scroll_area.addItem(self.spacer)
    def set_layout(self):
        title = QLabel('Browse All Festivals')

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(title, 1, 1)

        self.setLayout(grid)
Example #22
0
    def change_frame_prop(self):
        """Change the properties of camera.
        """
        self.dialog = QDialog(self.parent)
        self.dialog.setWindowTitle("Change frame properties")

        text = QLabel()
        text.setText("Select fourcc, size and FPS.")

        fourcc, width, height, fps = self.parent.get_properties()
        size = "{}x{}".format(width, height)
        self.parent.fourcc_label = QLabel("Fourcc")
        self.parent.size_label = QLabel("Size")
        self.parent.fps_label = QLabel("FPS")
        self.parent.fourcc_result = QLabel(str(fourcc))
        self.parent.fourcc_result.setFrameShape(QFrame.StyledPanel)
        self.parent.size_result = QLabel(size)
        self.parent.size_result.setFrameShape(QFrame.Box)
        self.parent.size_result.setFrameStyle(QFrame.Panel | QFrame.Sunken)
        self.parent.fps_result = QLabel(str(fps))
        self.parent.fps_result.setFrameStyle(QFrame.Panel | QFrame.Sunken)

        fourcc_button = QPushButton("...")
        fourcc_button.clicked.connect(self.select_fourcc)
        size_button = QPushButton("...")
        size_button.clicked.connect(self.select_size)
        fps_button = QPushButton("...")
        fps_button.clicked.connect(self.select_fps)

        grid = QGridLayout()
        grid.addWidget(self.parent.fourcc_label, 0, 0)
        grid.addWidget(self.parent.fourcc_result, 0, 1)
        grid.addWidget(fourcc_button, 0, 2)
        grid.addWidget(self.parent.size_label, 1, 0)
        grid.addWidget(self.parent.size_result, 1, 1)
        grid.addWidget(size_button, 1, 2)
        grid.addWidget(self.parent.fps_label, 2, 0)
        grid.addWidget(self.parent.fps_result, 2, 1)
        grid.addWidget(fps_button, 2, 2)
        grid.setSpacing(5)

        self.button_box = QDialogButtonBox(QDialogButtonBox.Ok
                                           | QDialogButtonBox.Cancel)
        self.button_box.accepted.connect(self.dialog.accept)
        self.button_box.rejected.connect(self.dialog.reject)

        vbox = QVBoxLayout()
        vbox.addLayout(grid, 3)
        vbox.addWidget(self.button_box, 1)

        self.dialog.setLayout(vbox)
        self.dialog.resize(480, 270)
        if self.dialog.exec_():
            self.set_param()
            self.close()
        else:
            self.close()
Example #23
0
    def _setup_ui(self):
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        layout = QHBoxLayout(self)
        self.setLayout(layout)

        # Create a group box for the inhibit switches
        nh_group = QGroupBox('INH', self)
        nh_group.setAlignment(Qt.AlignCenter)
        layout.addWidget(nh_group)
        layout.setAlignment(nh_group, Qt.AlignTop)
        layout.setMargin(1)
        layout.setSpacing(1)

        # Set up a grid layout to hold the labels, switches, and indicators
        nh_layout = QGridLayout(nh_group)
        nh_group.setLayout(nh_layout)
        nh_layout.setMargin(1)
        nh_layout.setSpacing(1)

        # Construct the inhibit indicators and switches
        col = 0
        for switch, msg in INH_SWITCHES.items():
            self._create_inh_control(switch, nh_group, nh_layout, col)
            ind = self._inh_inds[-1]
            self._inh_switches[-1].stateChanged.connect(
                lambda on, ind=ind, msg=msg: self._set_inh(ind, msg, on))
            col += 1

        sl_group = QWidget(self)
        layout.addWidget(sl_group)
        sl_layout = QVBoxLayout(sl_group)
        sl_group.setLayout(sl_layout)
        sl_layout.setMargin(1)
        sl_layout.setSpacing(1)
        sl_layout.addSpacing(4)

        stat_group = QWidget(sl_group)
        sl_layout.addWidget(stat_group)
        stat_layout = QGridLayout(stat_group)
        stat_layout.setMargin(3)
        stat_layout.setSpacing(3)

        col = 0
        for name, label in STATUS_INDS.items():
            self._status_inds[name] = self._create_status_light(
                label, stat_group, stat_layout, col)
            col += 1

        label = QLabel('CONTROL', sl_group)
        font = label.font()
        font.setPointSize(12)
        font.setBold(True)
        label.setFont(font)
        label.setAlignment(Qt.AlignCenter)
        sl_layout.addWidget(label)
Example #24
0
    def set_layout(self):

        title = QLabel('Festival Ticket Program')
        company_logo = QLabel(self)

        username_label = QLabel('Username: '******'Password: '******'resources/festivity_logo.png')
        company_logo.setPixmap(pixmap)

        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(self.logIn_button)
        hbox.addWidget(self.register_button)

        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addLayout(hbox)

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(title, 1, 1)

        grid.addWidget(company_logo, 2, 1)

        grid.addWidget(username_label, 3, 0)
        grid.addWidget(self.username_edit, 3, 1)

        grid.addWidget(password_label, 4, 0)
        grid.addWidget(self.password_edit, 4, 1)

        grid.addLayout(vbox, 5, 1)

        self.setLayout(grid)
        self.window.show()
Example #25
0
    def initUI(self):
        self.setWindowTitle(self.tr("Minesweeper"))
        layout = QGridLayout()
        layout.setSpacing(5)
        self.setLayout(layout)

        for tile in self.mineSweeper:
            qTile = QMineSweeper.QTile(self, tile)
            layout.addWidget(qTile, tile.row, tile.column)
            qTile.clicked.connect(qTile.leftClick)
            qTile.customContextMenuRequested.connect(qTile.rightClick)
            tile.delegate = qTile
Example #26
0
    def initUI(self):
        self.setWindowTitle(self.tr("Minesweeper"))
        layout = QGridLayout()
        layout.setSpacing(5)
        self.setLayout(layout)

        for tile in self.mineSweeper:
            qTile = QMineSweeper.QTile(self, tile)
            layout.addWidget(qTile, tile.row, tile.column)
            qTile.clicked.connect(qTile.leftClick)
            qTile.customContextMenuRequested.connect(qTile.rightClick)
            tile.delegate = qTile
Example #27
0
class Funcoes:
    def limpa_formulario(self, frm):
        for i in reversed(range(len(frm.children()))):
            frm.children()[i].deleteLater()
            print(frm.layout())

    def set_grid_layout_conteudo(self, frame):
        self.grl_fra_conteudo = QGridLayout(frame)
        self.grl_fra_conteudo.setSpacing(0)
        self.grl_fra_conteudo.setObjectName(u"grl_fra_conteudo")
        self.grl_fra_conteudo.setSizeConstraint(QLayout.SetMinimumSize)
        self.grl_fra_conteudo.setContentsMargins(0, 0, 0, 0)
Example #28
0
class MainWidget(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.layout = QGridLayout(self)
        self.layout.addWidget(self.DrawNE555(), 0, 0, 2, 1)
        self.layout.setMargin(0)
        self.layout.setSpacing(0)
        self.OpWidget = Opreator()
        self.layout.addWidget(self.OpWidget)

    def DrawNE555(self):
        d = schemdraw.Drawing()
        IC555def = elm.Ic(pins=[
            elm.IcPin(name='TRG', side='left', pin='2'),
            elm.IcPin(name='THR', side='left', pin='6'),
            elm.IcPin(name='DIS', side='left', pin='7'),
            elm.IcPin(name='CTL', side='right', pin='5'),
            elm.IcPin(name='OUT', side='right', pin='3'),
            elm.IcPin(name='RST', side='top', pin='4'),
            elm.IcPin(name='Vcc', side='top', pin='8'),
            elm.IcPin(name='GND', side='bot', pin='1'),
        ],
                          edgepadW=.5,
                          edgepadH=1,
                          pinspacing=2,
                          leadlen=1,
                          label='555')
        T = d.add(IC555def)
        BOT = d.add(elm.Ground(xy=T.GND))
        d.add(elm.Dot)
        d.add(elm.Resistor(endpts=[T.DIS, T.THR], label='Rb'))
        d.add(elm.Resistor('u', xy=T.DIS, label='Ra', rgtlabel='+Vcc'))
        d.add(elm.Line(endpts=[T.THR, T.TRG]))
        d.add(
            elm.Capacitor('d',
                          xy=T.TRG,
                          toy=BOT.start,
                          label='C',
                          l=d.unit / 2))
        d.add(elm.Line('r', tox=BOT.start))
        d.add(elm.Capacitor('d', xy=T.CTL, toy=BOT.start,
                            botlabel='.01$\mu$F'))
        d.add(elm.Dot(xy=T.DIS))
        d.add(elm.Dot(xy=T.THR))
        d.add(elm.Dot(xy=T.TRG))
        d.add(elm.Line(endpts=[T.RST, T.Vcc]))
        d.add(elm.Dot)
        d.add(elm.Line('u', l=d.unit / 4, rgtlabel='+Vcc'))
        d.add(elm.Resistor('r', xy=T.OUT, label='330'))
        d.add(elm.LED(flip=True, d='down', toy=BOT.start))
        d.add(elm.Line('l', tox=BOT.start))
        return FigureCanvas(d.draw(show=False).getfig())
Example #29
0
    def _setup_ui(self):
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        # Set up our basic layout
        layout = QGridLayout(self)
        self.setLayout(layout)
        layout.setSpacing(1)
        layout.setMargin(1)

        for bank in range(0o10):
            sw = self._create_bank_switch('E%o' % bank, layout, 0, bank, 1)
            sw.stateChanged.connect(self._update_ems_banks)
            self._bank_switches.append(sw)

        for col in range(0o10, 0o22):
            s = QSpacerItem(20, 20)
            layout.addItem(s, 1, col)

        label = QLabel('EMS', self)
        font = label.font()
        font.setPointSize(12)
        font.setBold(True)
        label.setFont(font)
        label.setAlignment(Qt.AlignCenter)
        layout.addWidget(label, 5, 16, 2, 2, Qt.AlignCenter)

        b = self._create_button('ALL', layout, 5, 1, 3)
        b.pressed.connect(lambda: self._set_all(True))
        b = self._create_button('NONE', layout, 5, 3, 2)
        b.pressed.connect(lambda: self._set_all(False))

        self._ems_sel = QRadioButton('EMS', self)
        self._ems_sel.setLayoutDirection(Qt.RightToLeft)
        layout.addWidget(self._ems_sel, 5, 6, 2, 3)
        layout.setAlignment(self._ems_sel, Qt.AlignRight)

        self._agc_sel = QRadioButton('AGC', self)
        self._agc_sel.setChecked(True)
        layout.addWidget(self._agc_sel, 5, 8, 2, 3)
        layout.setAlignment(self._agc_sel, Qt.AlignCenter)

        font.setPointSize(7)
        self._ems_sel.setFont(font)
        self._agc_sel.setFont(font)

        b = self._create_button('PAD', layout, 5, 11, 2)
        b.pressed.connect(self._load_pad)
        b = self._create_button('LOAD', layout, 5, 12, 3)
        b.pressed.connect(self._load_core)
        b = self._create_button('DUMP', layout, 5, 14, 2)
        b.pressed.connect(self._dump_core)
Example #30
0
    def initUI(self):
        
        self.logo_label = QLabel(self)

        self.url_label = QLabel(self)
        self.url_label.setText('Url:')
        self.url_input = QLineEdit(self)
        
        self.location_label = QLabel(self)
        self.location_label.setText('Location:')
        self.location_input = QLineEdit(self)

        self.browse_btn = QPushButton("Browse")
        self.download_btn = QPushButton("Download")

        logo = QtGui.QPixmap("logo.png")
        self.logo_label.setPixmap(logo)

        logoBox = QHBoxLayout()
        logoBox.addStretch(1)
        logoBox.addWidget(self.logo_label)
        logoBox.addStretch(1)

        self.tableWidget = QTableWidget()
        self.tableWidget.setColumnCount(2)
        self.tableWidget.verticalHeader().setVisible(False)
        self.tableWidget.horizontalHeader().setSectionResizeMode(0, \
            QHeaderView.Stretch)
        self.tableWidget.setColumnWidth(1, 140)
        self.tableWidget.setShowGrid(False)
        self.tableWidget.setSelectionBehavior(QTableView.SelectRows)
        self.tableWidget.setHorizontalHeaderLabels(["Name", "Downloaded"])
        

        grid = QGridLayout()
        grid.setSpacing(10)
        grid.addWidget(self.url_label, 0, 0)
        grid.addWidget(self.url_input, 0, 1, 1, 2)
        
        grid.addWidget(self.location_label, 1, 0)
        grid.addWidget(self.location_input, 1, 1)
        grid.addWidget(self.browse_btn, 1, 2)        
        grid.addWidget(self.download_btn, 2, 0, 1, 3)

        vbox = QVBoxLayout()
        vbox.addLayout(logoBox)
        vbox.addLayout(grid)
        vbox.addWidget(self.tableWidget)

        self.setup_connections()
        self.setLayout(vbox)
    def _setup_ui(self):
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        # Set up our basic layout
        layout = QGridLayout(self)
        self.setLayout(layout)
        layout.setSpacing(1)
        layout.setMargin(1)

        for bank in range(0o44):
            col = bank % 18
            row = int(bank / 18) * 2
            sw = self._create_bank_switch('%o' % bank, layout, row, col, 1)
            sw.stateChanged.connect(
                lambda state, bank=bank: self._update_crs_bank(bank))
            self._bank_switches.append(sw)

        self._aux_switch = self._create_bank_switch('44-77', layout, 5, 0, 2)

        label = QLabel('CRS', self)
        font = label.font()
        font.setPointSize(12)
        font.setBold(True)
        label.setFont(font)
        label.setAlignment(Qt.AlignCenter)
        layout.addWidget(label, 5, 16, 2, 2, Qt.AlignCenter)

        b = self._create_button('ALL', layout, 5, 1, 3)
        b.pressed.connect(lambda: self._set_all(True))
        b = self._create_button('NONE', layout, 5, 3, 2)
        b.pressed.connect(lambda: self._set_all(False))

        self._crs_sel = QRadioButton('CRS', self)
        self._crs_sel.setLayoutDirection(Qt.RightToLeft)
        layout.addWidget(self._crs_sel, 5, 6, 2, 3)
        layout.setAlignment(self._crs_sel, Qt.AlignRight)

        self._agc_sel = QRadioButton('AGC', self)
        self._agc_sel.setChecked(True)
        layout.addWidget(self._agc_sel, 5, 8, 2, 3)
        layout.setAlignment(self._agc_sel, Qt.AlignCenter)

        font.setPointSize(7)
        self._crs_sel.setFont(font)
        self._agc_sel.setFont(font)

        b = self._create_button('LOAD', layout, 5, 12, 3)
        b.pressed.connect(self._load_rope)
        b = self._create_button('DUMP', layout, 5, 14, 2)
        b.pressed.connect(self._dump_rope)
Example #32
0
    def initUI(self):
        self.setWindowTitle(self.tr("Tic-Tac-Toe"))
        layout = QVBoxLayout()
        self.setLayout(layout)
        gridLayout = QGridLayout()
        gridLayout.setSpacing(3)
        aiComboBox = QComboBox(self)
        aiComboBox.addItems([self.tr(ai) for ai in self.AIs])
        aiComboBox.currentTextChanged.connect(self.selectAI)
        layout.addWidget(aiComboBox)
        layout.addLayout(gridLayout)

        for tile in self.ticTacToe:
            button = QTicTacToe.QTileButton(self, tile)
            gridLayout.addWidget(button, tile.row, tile.column)
            button.clicked.connect(button.clickEvent)
            tile.delegate = button
Example #33
0
    def initUI(self):
        self.setWindowTitle(self.tr("Fourplay"))
        layout = QVBoxLayout()
        self.setLayout(layout)
        discGridLayout = QGridLayout()
        discGridLayout.setSpacing(4)
        aiComboBox = QComboBox(self)
        aiComboBox.addItems([self.tr(ai) for ai in self.AIs])
        aiComboBox.currentTextChanged.connect(lambda: self.selectAI())
        layout.addWidget(aiComboBox)
        layout.addLayout(discGridLayout)

        for disc in self.fourPlay:
            qDisc = QFourPlay.QDiscButton(self)
            discGridLayout.addWidget(qDisc, disc.row, disc.column)
            qDisc.clicked.connect(lambda qDisc=qDisc, disc=disc: qDisc.clickEvent(disc))
            qDisc.marked(disc)
            disc.delegate = qDisc