Esempio n. 1
1
    def __init__(self):
        super().__init__()

        # Declare Widgets
        self.edit_label = QLabel('Change your image')

        # set up list and combo box option
        self.my_list = ["Pick a value", "Luminosity", "Contrast", "Colorize", "Sepia", "Negative", "Grayscale", "None"]
        self.my_combo_box = QComboBox()
        self.my_combo_box.addItems(self.my_list)

        self.edit_btn = QPushButton("Edit")
        self.cancel_btn = QPushButton("Back")

        # Create U.I. Layout
        vbox = QVBoxLayout()
        vbox.addWidget(self.edit_label)
        vbox.addWidget(self.my_combo_box)
        vbox.addWidget(self.edit_btn)
        vbox.addWidget(self.cancel_btn)
        self.setLayout(vbox) # apply layout to this class

        # when button is clicked send lineedit and combo box info to on_submit
        self.edit_btn.clicked.connect(self.on_edit)
        self.cancel_btn.clicked.connect(self.on_back)
Esempio n. 2
0
    def __init__(self, programInstance: ProgramInstance, uniqueRun):
        super().__init__()

        AppGlobals.Instance().onChipModified.connect(self.UpdateParameterItems)

        self.editingParameterVisibility = False

        self.programInstance = programInstance
        self.uniqueRun = uniqueRun

        self._programNameWidget = QLabel()

        layout = QVBoxLayout()
        self.setLayout(layout)

        self.runButton = QPushButton("Run")
        self.runButton.clicked.connect(self.RunProgram)

        self._stopButton = QPushButton("Stop")
        self._stopButton.clicked.connect(self.StopProgram)

        self.parameterItems: List[ProgramParameterItem] = []

        self._parametersLayout = QVBoxLayout()

        layout.addWidget(self._programNameWidget)
        layout.addLayout(self._parametersLayout)
        layout.addWidget(self.runButton)
        layout.addWidget(self._stopButton)
        timer = QTimer(self)
        timer.timeout.connect(self.UpdateInstanceView)
        timer.start(30)

        self.UpdateInstanceView()
        self.UpdateParameterItems()
Esempio n. 3
0
    def __init__(self) -> None:
        super().__init__()
        self.resize(500, 300)

        # 非组件对象
        self.values = {}
        self.ut = UpdateValues()
        # 界面组件对象

        self.centralwidget = QWidget(self)
        self.table = QTableWidget(self.centralwidget)
        self.startButton = QPushButton(self.centralwidget, text='开始')
        self.stopButton = QPushButton(self.centralwidget, text='停止')
        self.stopButton.setDisabled(True)
        self.table.setColumnCount(3)
        self.table.setHorizontalHeaderItem(0, QTableWidgetItem('GID'))
        self.table.setHorizontalHeaderItem(2, QTableWidgetItem('name'))
        self.table.setHorizontalHeaderItem(1, QTableWidgetItem('speed'))
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.setRowCount(1)

        self.layout = QGridLayout(self.centralwidget)

        self.layout.addWidget(self.startButton)
        self.layout.addWidget(self.stopButton)
        self.layout.addWidget(self.table)

        self.setCentralWidget(self.centralwidget)

        self.ut.resultReady.connect(self.on_changeValue)
        self.startButton.clicked.connect(self.changeValue)
        self.stopButton.clicked.connect(self.stopUpdate)
Esempio n. 4
0
    def initUI(self):

        self.cam = CamImage()
        self.start_button = QPushButton("Start")
        self.quit_button = QPushButton("Quit")
        controls = ControlWidget()
        self.combo = QComboBox(self)
        for it in self.MainProcess.list_of_filters:
            self.combo.addItem(it[0])

        hbox = QHBoxLayout()
        hbox.addWidget(controls)
        hbox.addStretch(1)
        hbuttons = QHBoxLayout()
        hbuttons.addWidget(self.combo)
        hbuttons.addWidget(self.start_button)
        hbuttons.addWidget(self.quit_button)
        vbutton = QVBoxLayout()
        vbutton.addLayout(hbuttons)
        vbutton.addWidget(self.fps_label)
        hbox.addLayout(vbutton)
        vbox = QVBoxLayout()
        vbox.addWidget(self.cam)
        vbox.addStretch(1)
        vbox.addLayout(hbox)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 300, 150)
        self.setWindowTitle('Buttons')

        self.show()
Esempio n. 5
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.model = None
        self.table_name = ''
        self.mapper = None
        self.modified = False
        self.name = "N/A"
        self.operation_type = None

        self.layout = QGridLayout(self)
        self.layout.setContentsMargins(2, 2, 2, 2)

        self.bold_font = QFont()
        self.bold_font.setBold(True)

        self.main_label = QLabel(self)
        self.main_label.setFont(self.bold_font)
        self.layout.addWidget(self.main_label, 0, 0, 1, 1, Qt.AlignLeft)

        self.commit_button = QPushButton(load_icon("accept.png"), '', self)
        self.commit_button.setToolTip(self.tr("Commit changes"))
        self.commit_button.setEnabled(False)
        self.revert_button = QPushButton(load_icon("cancel.png"), '', self)
        self.revert_button.setToolTip(self.tr("Cancel changes"))
        self.revert_button.setEnabled(False)

        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                          QSizePolicy.Expanding)
        self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                            QSizePolicy.Minimum)
Esempio n. 6
0
    def __init__(self, persepolis_setting):
        super().__init__()
        icon = QIcon()

        self.persepolis_setting = persepolis_setting

        # add support for other languages
        locale = str(self.persepolis_setting.value('settings/locale'))
        QLocale.setDefault(QLocale(locale))
        self.translator = QTranslator()
        if self.translator.load(':/translations/locales/ui_' + locale, 'ts'):
            QCoreApplication.installTranslator(self.translator)

        self.setWindowIcon(
            QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg')))
        self.setWindowTitle(
            QCoreApplication.translate("setting_ui_tr", 'Preferences'))

        # set ui direction
        ui_direction = self.persepolis_setting.value('ui_direction')

        if ui_direction == 'rtl':
            self.setLayoutDirection(Qt.RightToLeft)

        elif ui_direction in 'ltr':
            self.setLayoutDirection(Qt.LeftToRight)

        global icons
        icons = ':/' + str(
            self.persepolis_setting.value('settings/icons')) + '/'

        window_verticalLayout = QVBoxLayout(self)

        self.pressKeyLabel = QLabel(self)
        window_verticalLayout.addWidget(self.pressKeyLabel)

        self.capturedKeyLabel = QLabel(self)
        window_verticalLayout.addWidget(self.capturedKeyLabel)

        # window buttons
        buttons_horizontalLayout = QHBoxLayout()
        buttons_horizontalLayout.addStretch(1)

        self.cancel_pushButton = QPushButton(self)
        self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))
        buttons_horizontalLayout.addWidget(self.cancel_pushButton)

        self.ok_pushButton = QPushButton(self)
        self.ok_pushButton.setIcon(QIcon(icons + 'ok'))
        buttons_horizontalLayout.addWidget(self.ok_pushButton)

        window_verticalLayout.addLayout(buttons_horizontalLayout)

        # labels
        self.pressKeyLabel.setText(
            QCoreApplication.translate("setting_ui_tr", "Press new keys"))
        self.cancel_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "Cancel"))
        self.ok_pushButton.setText(
            QCoreApplication.translate("setting_ui_tr", "OK"))
Esempio n. 7
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.setWindowTitle('PySide6 WebEngineWidgets Example')

        self.toolBar = QToolBar()
        self.addToolBar(self.toolBar)
        self.backButton = QPushButton()
        self.backButton.setIcon(QIcon(':/qt-project.org/styles/commonstyle/images/left-32.png'))
        self.backButton.clicked.connect(self.back)
        self.toolBar.addWidget(self.backButton)
        self.forwardButton = QPushButton()
        self.forwardButton.setIcon(QIcon(':/qt-project.org/styles/commonstyle/images/right-32.png'))
        self.forwardButton.clicked.connect(self.forward)
        self.toolBar.addWidget(self.forwardButton)

        self.addressLineEdit = QLineEdit()
        self.addressLineEdit.returnPressed.connect(self.load)
        self.toolBar.addWidget(self.addressLineEdit)

        self.webEngineView = QWebEngineView()
        self.setCentralWidget(self.webEngineView)
        initialUrl = 'http://qt.io'
        self.addressLineEdit.setText(initialUrl)
        self.webEngineView.load(QUrl(initialUrl))
        self.webEngineView.page().titleChanged.connect(self.setWindowTitle)
        self.webEngineView.page().urlChanged.connect(self.urlChanged)
Esempio n. 8
0
    def __init__(self, parent=None):
        super().__init__(parent=parent)

        layout = QtWidgets.QVBoxLayout(self)
        label1 = QLabel('입력', self)
        label1.setAlignment(Qt.AlignVCenter)
        label1.move(200, 30)

        label2 = QLabel('결과', self)
        label2.setAlignment(Qt.AlignVCenter)
        label2.move(710, 30)

        self.text_box1 = QTextEdit(self)
        self.text_box1.resize(350, 350)
        self.text_box1.move(50, 60)

        self.text_box2 = QTextBrowser(self)
        self.text_box2.append('')
        self.text_box2.setGeometry(550, 60, 350, 350) 

        self.ok_base64 = QPushButton("OK", self)	
        self.ok_base64.setGeometry(50, 420, 850, 45) 
        self.ok_base64.clicked.connect(self.base64_conversion)

        self.back = QPushButton(self)
        self.back.setStyleSheet(
            '''
            QPushButton{image:url(./img/back_img.png); border:0px;}
            QPushButton:hover{image:url(./img/back_img_ev_1.png); border:0px;}
            ''') 
        self.back.setGeometry(0, 0, 50, 50) 
        self.back.clicked.connect(self.change_stack1)
Esempio n. 9
0
    def __init__(self):
        super().__init__()

        btn1 = QPushButton(self)
        btn2 = QPushButton(self)
        btn3 = QPushButton(self)
        btn1.setText('button 1')
        btn2.setText('button 2')
        btn3.setText('button 3')

        hbox = QHBoxLayout()
        # 设置伸缩量为1
        hbox.addStretch(1)
        hbox.addWidget(btn1)
        # 设置伸缩量为1
        hbox.addStretch(1)
        hbox.addWidget(btn2)
        # 设置伸缩量为1
        hbox.addStretch(1)
        hbox.addWidget(btn3)
        # 设置伸缩量为1
        hbox.addStretch(1)

        self.setLayout(hbox)
        self.setWindowTitle("addStretch 例子")
 def init_ui(self):
     self.tuple_method = ("Connect to Server", "Connect to /dev")
     self.combobox = QComboBox()
     self.combobox.addItems(self.tuple_method)
     self.addr_edit = QLineEdit()
     self.port_edit = QLineEdit()
     self.btn_open_conn = QPushButton("Connect/Open")
     self.btn_close_conn = QPushButton("Close Conn")
     self.fd = None
     self.method_layout = QVBoxLayout()
     self.method_layout.addWidget(self.combobox)
     self.method_layout.addWidget(self.addr_edit)
     self.method_layout.addWidget(self.port_edit)
     self.method_layout.addWidget(self.btn_open_conn)
     self.method_layout.addWidget(self.btn_close_conn)
     self.btn_status = QPushButton("Send Status Packet")
     self.btn_head = QPushButton("Send Head Packet")
     self.btn_motion = QPushButton("Send Motion Packet")
     self.packet_layout = QVBoxLayout()
     self.packet_layout.addWidget(self.btn_status)
     self.packet_layout.addWidget(self.btn_head)
     self.packet_layout.addWidget(self.btn_motion)
     self.main_layout = QVBoxLayout()
     self.main_layout.addLayout(self.method_layout)
     self.main_layout.addLayout(self.packet_layout)
     self.setLayout(self.main_layout)
     self.set_send_btn_statu(False)
Esempio n. 11
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.setWindowTitle("My App")
        pagelayout = QVBoxLayout()
        button_layout = QHBoxLayout()
        self.stacklayout = QStackedLayout()

        pagelayout.addLayout(button_layout)
        pagelayout.addLayout(self.stacklayout)

        btn = QPushButton("red")
        btn.pressed.connect(self.activate_tab_1)
        button_layout.addWidget(btn)
        self.stacklayout.addWidget(Color("red"))

        btn = QPushButton("green")
        btn.pressed.connect(self.activate_tab_2)
        button_layout.addWidget(btn)
        self.stacklayout.addWidget(Color("green"))

        btn = QPushButton("yellow")
        btn.pressed.connect(self.activate_tab_3)
        button_layout.addWidget(btn)
        self.stacklayout.addWidget(Color("yellow"))

        widget = QWidget()
        widget.setLayout(pagelayout)
        self.setCentralWidget(widget)
Esempio n. 12
0
    def grid_layout_creation_1(self) -> None:
        self.group_box_1 = QGroupBox("Files")
        row = -1

        d = cfg.PLATFORM_SETTINGS

        # pprint(d)

        layout = QGridLayout()
        row += 1
        layout.addWidget(QLabel(bold("preferences.ini:")), row, 0)
        fname = cfg.PREFERENCES_INI
        layout.addWidget(QLabel(fname), row, 1)
        btn = QPushButton("Open")
        btn.clicked.connect(partial(opener.open_file_with_editor, self, fname))
        layout.addWidget(btn, row, 2)

        row += 1
        layout.addWidget(QLabel(bold("categories.yaml:")), row, 0)
        fname = cfg.categories_file()
        layout.addWidget(QLabel(fname), row, 1)
        btn = QPushButton("Open")
        btn.clicked.connect(partial(opener.open_file_with_editor, self, fname))
        layout.addWidget(btn, row, 2)

        row += 1
        layout.addWidget(QLabel(bold("settings.json:")), row, 0)
        fname = cfg.SETTINGS_FILE
        layout.addWidget(QLabel(fname), row, 1)
        btn = QPushButton("Open")
        btn.clicked.connect(partial(opener.open_file_with_editor, self, fname))
        layout.addWidget(btn, row, 2)

        self.group_box_1.setLayout(layout)
Esempio n. 13
0
    def __init__(self, parent=None):

        super(Pryme2, self).__init__(parent)

        self.timer_instances = (SimpleTimer(), AlarmClock(), PomoTimer())
        self.timer_selection = QComboBox(self)
        for t in self.timer_instances:
            self.timer_selection.addItem(t.name)
        self.timer = self.timer_instances[0]
        self.commitment_textbox = QLineEdit(self)
        self.commitment_textbox.setPlaceholderText(
            'What do you want to commit?')
        self.commitment_textbox.setClearButtonEnabled(True)
        self.commit_done_btn = QPushButton('&Done', self)
        self.start_btn = QPushButton('&Start', self)
        self.abort_btn = QPushButton('&Abort', self)
        self.abort_btn.hide()
        self.pause_btn = QPushButton('&Pause', self)
        self.pause_btn.hide()
        self.resume_btn = QPushButton('&Resume', self)
        self.resume_btn.hide()

        self.tray = QSystemTrayIcon(self)
        self.tray.setIcon(QIcon('pryme-logo.svg'))
        self.tray.show()

        self.set_ui()
        self.set_connection()
        self.show()
Esempio n. 14
0
    def __init__(self):
        super().__init__()

        layout = QVBoxLayout(self)
        layout.setAlignment(Qt.AlignCenter)

        self.file_selector = Path_selector('file')
        self.folder_selector = Path_selector('folder')
        self.file_selector.setFixedSize(500, 40)
        self.folder_selector.setFixedSize(500, 40)

        layout.addWidget(self.file_selector)
        layout.addWidget(self.folder_selector)

        button = QPushButton("Execute")
        button.clicked.connect(self.handleExecute)
        button.setFixedSize(100, 40)

        layout.addWidget(button, alignment=Qt.AlignCenter)

        button_rev = QPushButton("Backwards")
        button_rev.clicked.connect(self.handleBackwards)
        button_rev.setFixedSize(100, 40)

        layout.addWidget(button_rev, alignment=Qt.AlignCenter)
Esempio n. 15
0
    def __init__(self, previewImage, fileName):
        super(ImageView, self).__init__()

        self.fileName = fileName

        mainLayout = QVBoxLayout(self)
        self.imageLabel = QLabel()
        self.imageLabel.setPixmap(QPixmap.fromImage(previewImage))
        mainLayout.addWidget(self.imageLabel)

        topLayout = QHBoxLayout()
        self.fileNameLabel = QLabel(QDir.toNativeSeparators(fileName))
        self.fileNameLabel.setTextInteractionFlags(Qt.TextBrowserInteraction)

        topLayout.addWidget(self.fileNameLabel)
        topLayout.addStretch()
        copyButton = QPushButton("Copy")
        copyButton.setToolTip("Copy file name to clipboard")
        topLayout.addWidget(copyButton)
        copyButton.clicked.connect(self.copy)
        launchButton = QPushButton("Launch")
        launchButton.setToolTip("Launch image viewer")
        topLayout.addWidget(launchButton)
        launchButton.clicked.connect(self.launch)
        mainLayout.addLayout(topLayout)
Esempio n. 16
0
    def EditTeamsWindow(self):

        self.teamedit_wid = EditionWidget()
        self.teamedit_wid.resize(400, 320)
        self.teamedit_wid.setWindowTitle("Edit Teams")

        self.teams_list = QComboBox(self)
        self.teams_list.addItem("--- Select a team ---")
        for team in self.teams:
            self.teams_list.addItem(team)
        self.teams_list.currentIndexChanged.connect(self.UpdateTeamInfo)

        team_id_label = QLabel(self)
        team_id_label.setText("Team ID: ")
        self.config_team_id = QLabel(self)
        team_name_label = QLabel(self)
        team_name_label.setText("Team name: ")
        self.config_team_name = QLabel(self)
        team_members_label = QLabel(self)
        team_members_label.setText("Team members: ")
        self.config_team_members = QListWidget(self)
        add_member_label = QLabel(self)
        add_member_label.setText("Add new member: ")
        add_member_input = QLineEdit(self)
        add_member_input.editingFinished.connect(self.AddNewMember)

        delete_member = QPushButton(self)
        delete_member.setText("Delete member")
        delete_member.clicked.connect(self.DeleteMember)
        delete_team = QPushButton(self)
        delete_team.setText("Delete Team")
        delete_team.clicked.connect(self.DeleteTeam)
        save_changes = QPushButton(self)
        save_changes.setText("Save changes")
        save_changes.clicked.connect(self.SaveEdits)
        export_config = QPushButton(self)
        export_config.setText("Export Configuration")
        export_config.clicked.connect(self.ExportTeams)

        config_lay = QGridLayout()
        config_lay.addWidget(self.teams_list, 1, 0)
        config_lay.addWidget(team_id_label, 2, 0)
        config_lay.addWidget(self.config_team_id, 2, 1)
        config_lay.addWidget(team_name_label, 3, 0)
        config_lay.addWidget(self.config_team_name, 3, 1, 1, 2)
        config_lay.addWidget(team_members_label, 4, 0)
        config_lay.addWidget(self.config_team_members, 5, 0)
        config_lay.addWidget(add_member_label, 6, 0)
        config_lay.addWidget(add_member_input, 6, 1, 1, 2)
        config_lay.addWidget(delete_member, 7, 0)
        config_lay.addWidget(delete_team, 7, 1)
        config_lay.addWidget(save_changes, 8, 0)
        config_lay.addWidget(export_config, 8, 1)

        self.teamedit_wid.setLayout(config_lay)
        self.teamedit_wid.setWindowModality(QtCore.Qt.ApplicationModal)
        self.teamedit_wid.activateWindow()
        self.teamedit_wid.raise_()
        self.teamedit_wid.show()
Esempio n. 17
0
    def initUI(self):
        """
        Init widget

        """
        vbox = QVBoxLayout()
        vbox.addSpacing(2)

        # Head
        hbox = QHBoxLayout()
        hbox.addSpacing(3)

        # Create button which returns to the menu
        self._buttonBack = QPushButton(QIcon(PATH_IMAGE_BACK_NEDDLE), "", self)
        self._buttonBack.clicked.connect(self.signalController.back2menu)
        hbox.addWidget(self._buttonBack, 0, QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)

        # Header of this widget
        self._headWidget = QLabel("Add new figure")
        hbox.addWidget(self._headWidget, 1, QtCore.Qt.AlignCenter | QtCore.Qt.AlignTop)

        # Create button to choose color of new figure
        self._pickColorButton = QPushButton('Pick color')
        self._pickColorButton.clicked.connect(self.update_color_name)
        hbox.addWidget(self._pickColorButton, 2, QtCore.Qt.AlignRight | QtCore.Qt.AlignTop)

        # Create button to save figure
        self._saveFigureButton = QPushButton('Save')
        self._saveFigureButton.clicked.connect(self.save_figure_shape)
        hbox.addWidget(self._saveFigureButton, 2, QtCore.Qt.AlignRight | QtCore.Qt.AlignTop)

        vbox.addLayout(hbox, 0)

        grid = QGridLayout()
        self._sheet = []
        self._choosenFigureList = []
        self._proposedFiguresList = []
        self._savedColor = 'black'

        for i in range(self.MAX_X):
            row = []
            for j in range(self.MAX_Y):
                single = DrawBlockQFrame(self.signalPressedFrames, j, i)
                if i == 3 and j == 3:
                    # Button in the center - must be with blur color
                    # Save figure - possible only if blue button also clicked
                    # This magic stuff are made in order to simplify saving figure
                    single.COLOR_DEFAULT = 'blue'
                    single.default_color()
                    self.centerSheet = single
                row.append(single)
                grid.addWidget(single, i, j)

            self._sheet.append(row)

        vbox.addLayout(grid, 1)

        self.setLayout(vbox)
        self.setWindowTitle("Add new figure")
Esempio n. 18
0
    def setup_ui(self, win: QMainWindow) -> None:
        # ui widgets
        self.toolbar = QToolBar("main", parent=win)
        self.port_combobox1 = PortCombobox("")
        self.port_combobox2 = PortCombobox("")
        self.baudrate_combobox = QComboBox()
        self.monitor1 = QPlainTextEdit("")
        self.monitor2 = QPlainTextEdit("")
        self.btn_clear_monitor1 = QPushButton("Clear")
        self.btn_clear_monitor2 = QPushButton("Clear")
        self.group_monitor1 = QGroupBox("Monitor 1")
        self.group_monitor2 = QGroupBox("Monitor 2")

        # setup widgets
        self.monitor1.setReadOnly(True)
        self.monitor1.setLineWrapMode(QPlainTextEdit.NoWrap)
        self.monitor1.setUndoRedoEnabled(False)
        self.monitor2.setReadOnly(True)
        self.monitor2.setLineWrapMode(QPlainTextEdit.NoWrap)
        self.monitor2.setUndoRedoEnabled(False)
        self.baudrate_combobox.addItems([
            "300",
            "1200",
            "2400",
            "4800",
            "9600",
            "19200",
            "38400",
            "57600",
            "74880",
            "115200",
            "230400",
            "250000",
            "500000",
            "1000000",
            "2000000",
        ])
        self.baudrate_combobox.setCurrentText("9600")

        # setup layout
        win.addToolBar(self.toolbar)

        v_layout = QVBoxLayout()  # type:ignore
        v_layout.addWidget(self.monitor1)
        v_layout.addWidget(self.btn_clear_monitor1)
        self.group_monitor1.setLayout(v_layout)

        v_layout = QVBoxLayout()  # type:ignore
        v_layout.addWidget(self.monitor2)
        v_layout.addWidget(self.btn_clear_monitor2)
        self.group_monitor2.setLayout(v_layout)

        h_layout = QHBoxLayout()  # type:ignore
        h_layout.addWidget(self.group_monitor1)
        h_layout.addWidget(self.group_monitor2)
        central_widget = QWidget()
        central_widget.setLayout(h_layout)
        win.setCentralWidget(central_widget)
Esempio n. 19
0
    def initUI(self):
        """
        Init app

        """
        vbox = QVBoxLayout()

        # Label with name of the game (i.e. TetrisView in our case)
        self._label_widget = DanceText("Tetris", self)
        #self._label_widget.setMaximumHeight(50)
        self._label_widget.setFrameStyle(QFrame.Panel)
        self._label_widget.setStyleSheet(
            "background-color: rgb(200, 160, 160)")

        vbox.addWidget(self._label_widget)

        # Create button and widget for game
        self._game_button = QPushButton("Play game")
        pal = self._game_button.palette()
        pal.setColor(QPalette.Button, QColor(Qt.green))
        self._game_button.setAutoFillBackground(True)
        self._game_button.setPalette(pal)
        vbox.addWidget(self._game_button)

        # Create button and widget for settings
        self._settings_button = QPushButton("Settings")
        pal = self._settings_button.palette()
        pal.setColor(QPalette.Button, QColor(Qt.blue))
        self._settings_button.setAutoFillBackground(True)
        self._settings_button.setPalette(pal)
        vbox.addWidget(self._settings_button)

        self._add_custom_figure_button = QPushButton("Add new figure")
        pal = self._add_custom_figure_button.palette()
        pal.setColor(QPalette.Button, QColor(Qt.green))
        self._add_custom_figure_button.setAutoFillBackground(True)
        self._add_custom_figure_button.setPalette(pal)
        vbox.addWidget(self._add_custom_figure_button)

        # Create button and widget about_game
        self._about_game_button = QPushButton("About game")
        pal = self._about_game_button.palette()
        pal.setColor(QPalette.Button, QColor(Qt.yellow))
        self._about_game_button.setAutoFillBackground(True)
        self._about_game_button.setPalette(pal)
        vbox.addWidget(self._about_game_button)

        # Create quit button
        self._exit_button = QPushButton("Exit")
        pal = self._exit_button.palette()
        pal.setColor(QPalette.Button, QColor(Qt.red))
        self._exit_button.setAutoFillBackground(True)
        self._exit_button.setPalette(pal)
        self._exit_button.clicked.connect(QApplication.quit)
        vbox.addWidget(self._exit_button)

        self.setLayout(vbox)
        self.setWindowTitle("Main menu")
    def __init__(self, parent=None):
        super(BlockingClient, self).__init__(parent)

        self.thread = FortuneThread()
        self.currentFortune = ''

        hostLabel = QLabel("&Server name:")
        portLabel = QLabel("S&erver port:")

        for ipAddress in QNetworkInterface.allAddresses():
            if ipAddress != QHostAddress.LocalHost and ipAddress.toIPv4Address(
            ) != 0:
                break
        else:
            ipAddress = QHostAddress(QHostAddress.LocalHost)

        ipAddress = ipAddress.toString()

        self.hostLineEdit = QLineEdit(ipAddress)
        self.portLineEdit = QLineEdit()
        self.portLineEdit.setValidator(QIntValidator(1, 65535, self))

        hostLabel.setBuddy(self.hostLineEdit)
        portLabel.setBuddy(self.portLineEdit)

        self.statusLabel = QLabel(
            "This example requires that you run the Fortune Server example as well."
        )
        self.statusLabel.setWordWrap(True)

        self.getFortuneButton = QPushButton("Get Fortune")
        self.getFortuneButton.setDefault(True)
        self.getFortuneButton.setEnabled(False)

        quitButton = QPushButton("Quit")

        buttonBox = QDialogButtonBox()
        buttonBox.addButton(self.getFortuneButton, QDialogButtonBox.ActionRole)
        buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole)

        self.getFortuneButton.clicked.connect(self.requestNewFortune)
        quitButton.clicked.connect(self.close)
        self.hostLineEdit.textChanged.connect(self.enableGetFortuneButton)
        self.portLineEdit.textChanged.connect(self.enableGetFortuneButton)
        self.thread.newFortune.connect(self.showFortune)
        self.thread.error.connect(self.displayError)

        mainLayout = QGridLayout()
        mainLayout.addWidget(hostLabel, 0, 0)
        mainLayout.addWidget(self.hostLineEdit, 0, 1)
        mainLayout.addWidget(portLabel, 1, 0)
        mainLayout.addWidget(self.portLineEdit, 1, 1)
        mainLayout.addWidget(self.statusLabel, 2, 0, 1, 2)
        mainLayout.addWidget(buttonBox, 3, 0, 1, 2)
        self.setLayout(mainLayout)

        self.setWindowTitle("Blocking Fortune Client")
        self.portLineEdit.setFocus()
Esempio n. 21
0
    def __init__(self):
        self.db = ClientesDB()
        QWidget.__init__(self)
        font = QFont()
        font.setBold(True)  # Labels em Negrito

        # Labels:
        self.label_title = QLabel("Novo Cliente")
        self.label_title.setFont(font)
        self.label_nome = QLabel("Nome Completo:")
        self.label_nome.setFont(font)
        self.label_endereco = QLabel("Endereço:")
        self.label_endereco.setFont(font)
        self.label_numero = QLabel("Número:")
        self.label_numero.setFont(font)
        self.label_cpf = QLabel("CPF:")
        self.label_cpf.setFont(font)

        # Entries:
        self.entry_nome = QLineEdit()
        self.entry_endereco = QTextEdit()
        self.entry_numero = QLineEdit()
        self.entry_cpf = QLineEdit()

        # Botões;
        self.button_salvar = QPushButton("&Salvar")
        self.button_salvar.clicked.connect(self.salvar_cliente)
        self.button_salvar.setShortcut("Ctrl+S")
        self.button_cancelar = QPushButton("Cancelar")
        self.button_cancelar.clicked.connect(self.limpar)
        self.button_cancelar.setShortcut("ESC")

        # Linha
        self.line = QFrame()
        self.line.setFrameShape(QFrame.HLine)
        self.line.setFrameShadow(QFrame.Sunken)
        self.line.setLineWidth(0)
        self.line.setMidLineWidth(1)

        # Leiaute:
        self.layout = QVBoxLayout()
        self.layout_buttons = QHBoxLayout()
        self.layout.addWidget(self.label_title)
        self.layout.addWidget(self.line)
        self.layout.addWidget(self.label_nome)
        self.layout.addWidget(self.entry_nome)
        self.layout.addWidget(self.label_numero)
        self.layout.addWidget(self.entry_numero)
        self.layout.addWidget(self.label_cpf)
        self.layout.addWidget(self.entry_cpf)
        self.layout.addWidget(self.label_endereco)
        self.layout.addWidget(self.entry_endereco)
        self.layout_buttons.addWidget(self.button_salvar)
        self.layout_buttons.addWidget(self.button_cancelar)
        self.layout.addStretch(2)
        self.layout.addLayout(self.layout_buttons)
        self.setLayout(self.layout)
Esempio n. 22
0
 def __init__(self, title, parent):
     super().__init__(title, parent)
     self.setLayout(QHBoxLayout(self))
     self.button_new = QPushButton("New Database", self)
     self.layout().addWidget(self.button_new)
     self.button_load = QPushButton("Load Database", self)
     self.layout().addWidget(self.button_load)
     self.button_close = QPushButton("Close Database", self)
     self.layout().addWidget(self.button_close)
Esempio n. 23
0
    def __init__(self):
        QWidget.__init__(self)
        self.items = 0

        # Example data
        self._data = {
            "Water": 24.5,
            "Electricity": 55.1,
            "Rent": 850.0,
            "Supermarket": 230.4,
            "Internet": 29.99,
            "Spätkauf": 21.85,
            "BVG Ticket": 60.0,
            "Coffee": 22.45,
            "Meetup": 0.0
        }

        # Left
        self.table = QTableWidget()
        self.table.setColumnCount(2)
        self.table.setHorizontalHeaderLabels(["Description", "Quantity"])
        self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        # Right
        self.description = QLineEdit()
        self.quantity = QLineEdit()
        self.add = QPushButton("Add")
        self.clear = QPushButton("Clear")
        self.quit = QPushButton("Quit")

        self.right = QVBoxLayout()
        self.right.setContentsMargins(10, 10, 10, 10)
        self.right.addWidget(QLabel("Description"))
        self.right.addWidget(self.description)
        self.right.addWidget(QLabel("Quantity"))
        self.right.addWidget(self.quantity)
        self.right.addWidget(self.add)
        self.right.addStretch()
        self.right.addWidget(self.quit)

        # QWidget Layout
        self.layout = QHBoxLayout()

        self.layout.addWidget(self.table)
        self.layout.addLayout(self.right)

        # Set the layout to the QWidget
        self.setLayout(self.layout)

        # Signals and Slots
        self.add.clicked.connect(self.add_element)
        self.quit.clicked.connect(self.quit_application)
        self.clear.clicked.connect(self.clear_table)

        # Fill example data
        self.fill_table()
Esempio n. 24
0
 def __init__(self, title, parent):
     super().__init__(title, parent)
     self.setLayout(QHBoxLayout(self))
     self.button_start = QPushButton("Start Workout", self)
     self.button_start.clicked.connect(self.switch_button_ability)
     self.layout().addWidget(self.button_start)
     self.button_finish = QPushButton("Finish Workout", self)
     self.button_finish.setDisabled(True)
     self.button_finish.clicked.connect(self.switch_button_ability)
     self.layout().addWidget(self.button_finish)
Esempio n. 25
0
    def __init__(self):
        QDialog.__init__(self)

        if platform.system() == 'Darwin':
            self.stylesheet_path = "res/stylesheet.qss"
        else:
            self.stylesheet_path = "res/stylesheet-win-linux.qss"
        stylesheet = open(resource_path(self.stylesheet_path)).read()
        self.setStyleSheet(stylesheet)
        self.standard_names = []
        self.init_standard_names()

        self.setWindowTitle("Select A Region of Interest To Draw")
        self.setMinimumSize(350, 180)

        self.icon = QtGui.QIcon()
        self.icon.addPixmap(
            QtGui.QPixmap(resource_path("res/images/icon.ico")),
            QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.setWindowIcon(self.icon)

        self.explanation_text = QLabel("Search for ROI:")

        self.input_field = QLineEdit()
        self.input_field.textChanged.connect(self.on_text_edited)

        self.button_area = QWidget()
        self.cancel_button = QPushButton("Cancel")
        self.cancel_button.clicked.connect(self.on_cancel_clicked)
        self.begin_draw_button = QPushButton("Begin Draw Process")

        self.begin_draw_button.clicked.connect(self.on_begin_clicked)

        self.button_layout = QHBoxLayout()
        self.button_layout.addWidget(self.cancel_button)
        self.button_layout.addWidget(self.begin_draw_button)
        self.button_area.setLayout(self.button_layout)

        self.list_label = QLabel()
        self.list_label.setText("Select a Standard Region of Interest")

        self.list_of_ROIs = QListWidget()
        for standard_name in self.standard_names:
            self.list_of_ROIs.addItem(standard_name)

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.explanation_text)
        self.layout.addWidget(self.input_field)
        self.layout.addWidget(self.list_label)
        self.layout.addWidget(self.list_of_ROIs)
        self.layout.addWidget(self.button_area)
        self.setLayout(self.layout)

        self.list_of_ROIs.clicked.connect(self.on_roi_clicked)
Esempio n. 26
0
 def __init__(self, title, parent):
     super().__init__(title, parent)
     self.setLayout(QHBoxLayout(self))
     self.button_perform = QPushButton("Perform Exercise", self)
     self.layout().addWidget(self.button_perform)
     self.button_new = QPushButton("New Exercise", self)
     self.button_new.clicked.connect(
         self.super_parent().show_window_new_exercise)
     self.layout().addWidget(self.button_new)
     self.button_edit = QPushButton("Edit Exercise", self)
     self.layout().addWidget(self.button_edit)
Esempio n. 27
0
    def CreateTeamsWindow(self):

        self.teamcreation_wid = EditionWidget()
        self.teamcreation_wid.resize(400, 200)
        self.teamcreation_wid.setWindowTitle("Teams configuration")

        self.new_config = {}

        id_label = QLabel(self)
        id_label.setText("Team ID: ")
        self.num_id = QLabel(self)
        current_id = str(self.config["total_teams"] + 1)
        self.num_id.setText(current_id)
        name_label = QLabel(self)
        name_label.setText("Team Name:")
        name_label.setFocus()
        self.name_input = QLineEdit(self)
        members_label = QLabel(self)
        members_label.setText("Members (write and press enter):")
        members_input = QLineEdit(self)
        members_input.editingFinished.connect(
            lambda: self.AddMember(members_input))
        self.members_list = QListWidget(self)

        import_image = QPushButton(self)
        import_image.setText("Import Team Image")
        import_image.clicked.connect(self.ImportTeamImage)

        add_team = QPushButton(self)
        add_team.setText("Add Team")
        add_team.clicked.connect(
            lambda: self.addTeamFunction(self.name_input.text(),
                self.members_list))
        import_config = QPushButton(self)
        import_config.setText("Import configuration")
        import_config.clicked.connect(self.importTeamFunction)

        config_lay = QGridLayout()
        config_lay.addWidget(id_label, 1, 0)
        config_lay.addWidget(self.num_id, 1, 1)
        config_lay.addWidget(name_label, 2, 0)
        config_lay.addWidget(self.name_input, 2, 1)
        config_lay.addWidget(members_label, 3, 0)
        config_lay.addWidget(members_input, 3, 1)
        config_lay.addWidget(self.members_list, 4, 0, 2, 2)
        config_lay.addWidget(add_team, 6, 0)
        config_lay.addWidget(import_image, 6, 1)
        config_lay.addWidget(import_config, 7, 0, 1, 2)
        self.teamcreation_wid.setLayout(config_lay)

        self.teamcreation_wid.setWindowModality(QtCore.Qt.ApplicationModal)
        self.teamcreation_wid.activateWindow()
        self.teamcreation_wid.raise_()
        self.teamcreation_wid.show()
Esempio n. 28
0
    def __init__(self, base, *args, **kwargs):
        TritonWidget.__init__(self, base, *args, **kwargs)
        self.sharedSecret = None
        self.identitySecret = None
        self.steamId = None
        self.type = Globals.SteamAuth

        self.setWindowTitle('Add Steam')
        self.setBackgroundColor(self, Qt.white)

        self.boxLayout = QVBoxLayout(self)
        self.boxLayout.setContentsMargins(20, 20, 20, 20)

        self.nameWidget = TextboxWidget(base, 'Name:')
        self.steamIdWidget = TextboxWidget(base, 'Steam ID:')
        self.sharedWidget = TextboxWidget(base, 'Shared Secret:')
        self.identityWidget = TextboxWidget(base, 'Identity Secret:')

        self.verifyLabel = QLabel()
        self.verifyLabel.setText('Click the Verify button to check the first code.')
        self.verifyLabel.setFont(QFont('Helvetica', 10))

        self.verifyBox = QLineEdit()
        self.verifyBox.setFixedWidth(150)
        self.verifyBox.setFont(QFont('Helvetica', 10))
        self.verifyBox.setEnabled(False)

        palette = QPalette()
        palette.setColor(QPalette.Text, Qt.black)
        self.verifyBox.setPalette(palette)
        self.verifyBox.setAlignment(Qt.AlignCenter)

        self.verifyButton = QPushButton('Verify')
        self.verifyButton.clicked.connect(self.checkVerify)
        self.verifyButton.setFixedWidth(150)

        self.addButton = QPushButton('OK')
        self.addButton.clicked.connect(self.add)

        self.boxLayout.addWidget(self.nameWidget)
        self.boxLayout.addWidget(self.steamIdWidget)
        self.boxLayout.addWidget(self.sharedWidget)
        self.boxLayout.addWidget(self.identityWidget)
        self.boxLayout.addSpacing(10)
        self.boxLayout.addWidget(self.verifyLabel)
        self.boxLayout.addWidget(self.verifyBox, 0, Qt.AlignCenter)
        self.boxLayout.addWidget(self.verifyButton, 0, Qt.AlignCenter)
        self.boxLayout.addSpacing(10)
        self.boxLayout.addWidget(self.addButton, 0, Qt.AlignRight)

        self.setFixedSize(self.sizeHint())
        self.center()
        self.show()
Esempio n. 29
0
 def __init__(self):
     super().__init__()
     self.layout = QHBoxLayout()
     i = 0
     self.names = []
     self.ebutons = []
     self.dbutons = []
     folder = './saved'
     #-------------Loading saved images from ./saved------------
     if (len(os.listdir(folder)) == 0):
         #print oput nothing saved
         self.label = QLabel("Nothing Saved")
         self.layout.addWidget(self.label)
     else:
         for filename in os.listdir(folder):
             self.names.append(filename)
             self.ebutons.append(i)
             self.dbutons.append(i)
             lay = QVBoxLayout()
             gbox = QGroupBox('Result' + str(i + 1))
             path = folder + "/" + filename
             with open(path, 'rb') as thefile:
                 imag = pickle.load(thefile)
             path += ".jpg"
             im = Image.open(
                 requests.get(imag['urls']['thumb'], stream=True).raw)
             im.save(path)
             self.ebutons[i] = QPushButton("Edit")
             self.ebutons[i].clicked.connect(
                 lambda state=i, a=i: self.editme(state))
             self.dbutons[i] = QPushButton("Delete")
             self.dbutons[i].clicked.connect(
                 lambda state=i, a=i: self.deleteme(state))
             pixmap = QPixmap(path)
             self.image = QLabel()
             self.image.setPixmap(pixmap)
             lay.addWidget(self.image)
             buts = QHBoxLayout()
             buts.addWidget(self.ebutons[i])
             buts.addWidget(self.dbutons[i])
             lay.addLayout(buts)
             gbox.setLayout(lay)
             self.layout.addWidget(gbox)
             try:
                 if os.path.isfile(path) or os.path.islink(path):
                     os.unlink(path)
                 elif os.path.isdir(path):
                     shutil.rmtree(path)
             except Exception as e:
                 print('Failed to delete %s. Reason: %s' % (file_path, e))
             i += 1
     print("done")
     self.setLayout(self.layout)
Esempio n. 30
0
    def __init__(self, parent=None):
        super(Winform, self).__init__(parent)
        self.setWindowTitle("水平布局管理例子")

        # 水平布局按照从左到右的顺序进行添加按钮部件。
        hlayout = QHBoxLayout()
        hlayout.addWidget(QPushButton(str(1)))
        hlayout.addWidget(QPushButton(str(2)))
        hlayout.addWidget(QPushButton(str(3)))
        hlayout.addWidget(QPushButton(str(4)))
        hlayout.addWidget(QPushButton(str(5)))
        self.setLayout(hlayout)