def __init__(self):
        super().__init__()
        self.FILE_EXTENSION_PLAYERACCOUNT = ".playerAccount"
        self.FILE_EXTENSION_FACILACCOUNT = ".facilAccount"
        self.setWindowTitle("Blok Kayu!")
        self.resize(1200, 1000)

        self.pageStack = QStackedWidget(self)
        self.readyPlayerDict = {}
        self.readyPlayerNameList = []
        self.currPlayerIndex = 0
        self.currPlayerName = ""
        self.currPlayerDict = {}
        self.localQuestionList = {}
        self.definedCorrectAnswerStore = 0
        self.newQuestionCodeStore = QuestionCode("A")
        self.currQuestionDict = {}
        self.currCorrectAnswerIndex = ""
        self.tempPlayerPointsDict = {}
        self.enterQuestionInput = ""

        self.lockPage = QWidget()
        self.facilStartPage = QWidget()
        self.facilAuthPage = QWidget()
        self.questionBankPage = QWidget()
        self.playerAdmissionsPage = QWidget()
        self.accountCreationPage = QWidget()
        self.loginPage = QWidget()
        self.enterQuestionCodePage = QWidget()
        self.questionPlayPage = QWidget()
        self.collapsePage = QWidget()

        self.lockPageUI()
        self.facilStartPageUI()
        self.facilAuthPageUI()
        self.questionBankPageUI()
        self.playerAdmissionsPageUI()
        self.accountCreationPageUI()
        self.loginPageUI()
        self.enterQuestionCodePageUI()
        self.questionPlayPageUI()
        self.collapsePageUI()

        self.refreshQuestionList()

        self.pageStack.addWidget(self.lockPage)
        self.pageStack.addWidget(self.facilStartPage)
        self.pageStack.addWidget(self.facilAuthPage)
        self.pageStack.addWidget(self.questionBankPage)
        self.pageStack.addWidget(self.playerAdmissionsPage)
        self.pageStack.addWidget(self.accountCreationPage)
        self.pageStack.addWidget(self.loginPage)
        self.pageStack.addWidget(self.enterQuestionCodePage)
        self.pageStack.addWidget(self.questionPlayPage)
        self.pageStack.addWidget(self.collapsePage)
        self.show()
Exemple #2
0
def App():
    app = QApplication(sys.argv)
    win = QWidget()

    win.setWindowTitle("PyQt6 QLabel Example")
    win.left = 100
    win.top = 100

    l1 = QLabel("Hello World")
    l2 = QLabel("Welcome to Python GUI Programming")
    #
    # Because you can't instantiate a QLable directly with a QPixmap.
    #
    l3 = QLabel()
    l3.setPixmap(QPixmap("python-small.png"))

    l1.setAlignment(Qt.Alignment.AlignCenter)
    l2.setAlignment(Qt.Alignment.AlignCenter)
    l3.setAlignment(Qt.Alignment.AlignCenter)

    vbox = QVBoxLayout()
    vbox.addWidget(l1)
    vbox.addStretch()
    vbox.addWidget(l2)
    vbox.addStretch()
    vbox.addWidget(l3)
    vbox.addStretch()

    win.setLayout(vbox)
    win.show()
    sys.exit(app.exec())
Exemple #3
0
    def initUI(self):
        self.setGeometry(self.xPos, self.yPos, self.width, self.height)
        self.vBoxLayout = QVBoxLayout()

        self.tagbox = TagBox()
        self.tagbox.addTag('Homelander')
        self.tagbox.addTag('Queen Maeve')
        self.tagbox.addTag('Black Noir')
        self.tagbox.addTag('Transluscent')
        self.tagbox.addTag('A-Train')
        self.tagbox.addTag('The Deep')
        self.vBoxLayout.addWidget(self.tagbox)

        self.tagEdit = QLineEdit()
        self.vBoxLayout.addWidget(self.tagEdit)

        self.addButton = QPushButton()
        self.addButton.setText('Add New Tag')
        self.addButton.clicked.connect(self.addNewTag)
        self.vBoxLayout.addWidget(self.addButton)

        self.centralWidget = QWidget(self)
        self.centralWidget.setLayout(self.vBoxLayout)
        self.setCentralWidget(self.centralWidget)
        self.show()
Exemple #4
0
    def __init__(self, parent, item_type, floating_widget=None):
        super(CustomScrollableList, self).__init__()
        self.parent = parent
        self.item_type = item_type
        self.floating_widget = floating_widget

        self.layout = QVBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.list_widget = QWidget()
        self.list_layout = QVBoxLayout(self.list_widget)
        self.list_layout.setContentsMargins(0, 0, 0, 0)
        self.list_layout.setSpacing(10)
        self.list_layout.setAlignment(Qt.AlignmentFlag.AlignTop)

        self.scroll_area = QScrollArea()
        self.scroll_area.setWidgetResizable(True)
        self.scroll_area.setFrameStyle(0)
        self.scroll_area.setWidget(self.list_widget)
        self.layout.addWidget(self.scroll_area)

        if self.floating_widget is not None:
            self.list_layout.addWidget(self.floating_widget)

        self.item_widgets = []
        self.num_visible_item_widgets = 0
Exemple #5
0
 def execute(self):
     app = QApplication([])
     tab1 = 20
     tab2 = 110
     yStart = 10
     yInc = 20
     w = QWidget()
     w.setGeometry(100, 100, 320, 240)
     w.setWindowTitle('World Clock')
     self._utc_label = self._create_label(w, 'UTC:', yStart, tab1, tab2)
     self._eastern_label = self._create_label(w, 'US/Eastern:',
                                              yStart + yInc * 2, tab1, tab2)
     self._central_label = self._create_label(w, 'US/Central:',
                                              yStart + yInc * 3, tab1, tab2)
     self._mountain_label = self._create_label(w, 'US/Mountain:',
                                               yStart + yInc * 4, tab1,
                                               tab2)
     self._pacific_label = self._create_label(w, 'US/Pacific:',
                                              yStart + yInc * 5, tab1, tab2)
     self._berlin_label = self._create_label(w, 'Berlin:',
                                             yStart + yInc * 7, tab1, tab2)
     self._london_label = self._create_label(w, 'London:',
                                             yStart + yInc * 8, tab1, tab2)
     self._paris_label = self._create_label(w, 'Paris:', yStart + yInc * 9,
                                            tab1, tab2)
     w.show()
     self._timer.start(1000)
     exit(app.exec())
Exemple #6
0
    def initUI(self):
        self.setGeometry(self.xPos, self.yPos, self.width, self.height)
        self.vBoxLayout = QVBoxLayout()
        
        self.button = Button(
            borderWidth = 1,
            borderRadius = 4,
        )
        self.button.setText('Default Button')
        self.vBoxLayout.addWidget(self.button)

        self.blueButton = Button(
            primaryColor  = (17, 46, 133),
            secondaryColor = (202, 209, 232),
            borderWidth = 1,
            borderRadius = 4,
        )
        self.blueButton.setText('Blue Button')
        self.vBoxLayout.addWidget(self.blueButton)

        self.redButton = Button(
            primaryColor  = (171, 3, 3),
            secondaryColor = (247, 173, 173),
            borderWidth = 1,
            borderRadius = 4,
        )
        self.redButton.setText('Red Button')
        self.vBoxLayout.addWidget(self.redButton)

        self.centralWidget = QWidget(self)
        self.centralWidget.setLayout(self.vBoxLayout)
        self.setCentralWidget(self.centralWidget)
        self.show()
    def __init__(self, interactive_matching_widget):
        super(NuggetListWidget, self).__init__(interactive_matching_widget)
        self.interactive_matching_widget = interactive_matching_widget

        self.layout = QVBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(10)

        # top widget
        self.top_widget = QWidget()
        self.top_layout = QHBoxLayout(self.top_widget)
        self.top_layout.setContentsMargins(0, 0, 0, 0)
        self.top_layout.setSpacing(10)
        self.layout.addWidget(self.top_widget)

        self.description = QLabel(
            "Below you see a list of guessed matches for you to confirm or correct."
        )
        self.description.setFont(LABEL_FONT)
        self.top_layout.addWidget(self.description)

        self.stop_button = QPushButton("Continue With Next Attribute")
        self.stop_button.setFont(BUTTON_FONT)
        self.stop_button.clicked.connect(self._stop_button_clicked)
        self.stop_button.setMaximumWidth(240)
        self.top_layout.addWidget(self.stop_button)

        # nugget list
        self.nugget_list = CustomScrollableList(self, NuggetListItemWidget)
        self.layout.addWidget(self.nugget_list)
Exemple #8
0
def startGUI():
    app = QApplication([])
    app.setStyle('Fusion')
    if opts.timeclockOpts["darkTheme"]:
        pass
    window = QWidget()
    window.setWindowTitle(opts.timeclockOpts["title"])
    window.setWindowIcon(
        QtGui.QIcon("../data/assets/" + opts.timeclockOpts["logo"]))
    mainLayout = QVBoxLayout()
    mainLayout.setSpacing(20)

    mainLayout.addLayout(makeTitle())

    global tabsObject
    tabsObject = makeNameArea()
    mainLayout.addWidget(tabsObject)
    updateNamesTable()

    mainLayout.addLayout(makeActions(app))

    window.setLayout(mainLayout)
    window.show()
    print("1024  x  768")
    print(window.width(), " x ", window.height())
    print("", 1024 - window.width(), "\t", 768 - window.height())
    app.exec()
Exemple #9
0
 def setupTasksTab(self):
     settings = QSettings()
     """ Create vertical tasks container """
     self.tasksWidget = QWidget(self.tabWidget)
     self.tasksWidgetLayout = QVBoxLayout(self.tasksWidget)
     self.tasksWidget.setLayout(self.tasksWidgetLayout)
     """ Create horizontal input container """
     self.inputContainer = QWidget()
     self.inputContainer.setFixedHeight(50)
     self.inputContainerLayout = QHBoxLayout(self.inputContainer)
     self.inputContainerLayout.setContentsMargins(0, 0, 0, 0)
     self.inputContainer.setLayout(self.inputContainerLayout)
     """ Create text edit """
     self.taskTextEdit = QTextEdit(
         placeholderText="Describe your task briefly.",
         undoRedoEnabled=True)
     """ Create vertical buttons container """
     self.inputButtonContainer = QWidget()
     self.inputButtonContainerLayout = QVBoxLayout(
         self.inputButtonContainer)
     self.inputButtonContainerLayout.setContentsMargins(0, 0, 0, 0)
     self.inputButtonContainer.setLayout(self.inputButtonContainerLayout)
     """ Create buttons """
     self.acceptTaskButton = QToolButton(icon=makeIcon("check"))
     self.deleteTaskButton = QToolButton(icon=makeIcon("trash"))
     """ Create tasks tablewidget """
     self.tasksTableWidget = QTableWidget(0, 1)
     self.tasksTableWidget.setHorizontalHeaderLabels(["Tasks"])
     self.tasksTableWidget.horizontalHeader().setStretchLastSection(True)
     self.tasksTableWidget.verticalHeader().setVisible(False)
     self.tasksTableWidget.setWordWrap(True)
     self.tasksTableWidget.setTextElideMode(Qt.TextElideMode.ElideNone)
     self.tasksTableWidget.setEditTriggers(
         QAbstractItemView.EditTriggers.NoEditTriggers)
     self.tasksTableWidget.setSelectionMode(
         QAbstractItemView.SelectionMode.SingleSelection)
     self.insertTasks(*settings.value(tasksKey, []))
     """ Add widgets to container widgets """
     self.inputButtonContainerLayout.addWidget(self.acceptTaskButton)
     self.inputButtonContainerLayout.addWidget(self.deleteTaskButton)
     self.inputContainerLayout.addWidget(self.taskTextEdit)
     self.inputContainerLayout.addWidget(self.inputButtonContainer)
     self.tasksWidgetLayout.addWidget(self.inputContainer)
     self.tasksWidgetLayout.addWidget(self.tasksTableWidget)
     return self.tasksWidget
Exemple #10
0
    def configure_gui(self):
        
        self.center = QWidget(self)
        self.layout = QHBoxLayout()

        self.center.setLayout(self.layout)
        self.setCentralWidget(self.center)
        self.layout.setContentsMargins(5, 0, 5, 0)
        self.layout.setSpacing(0)
Exemple #11
0
 def __addInputAndRadio__(self, input, radio):
     hbox = QHBoxLayout()
     hbox.setContentsMargins(0, 0, 0, 0)
     hbox.addWidget(input)
     hbox.addWidget(radio)
     widget = QWidget(self)
     widget.setLayout(hbox)
     self.layout.addWidget(widget, self.row, 0, 1, -1)
     self.row += 1
    def __init__(self):
        super(MyWidget, self).__init__()
        self.setFixedSize(620, 600)
        self.setWindowTitle("自动画流程图工具 version:1.0.0 ")
        self.laytout = QVBoxLayout(self)
        headwidget = QWidget(self)
        headlayout = QHBoxLayout()
        label01 = QLabel(" ID ")
        label02 = QLabel("流程图内容")
        label03 = QLabel("节点类型")
        label04 = QLabel("X坐标")
        label05 = QLabel("Y坐标")
        label06 = QLabel("link1")
        label07 = QLabel('link2')
        headlayout.addWidget(label01, 3)
        headlayout.addWidget(label02, 40)
        headlayout.addWidget(label03, 8)
        headlayout.addWidget(label04, 3)
        headlayout.addWidget(label05, 3)
        headlayout.addWidget(label06, 3)
        headlayout.addWidget(label07, 3)
        headlayout.addStretch()
        headlayout.setContentsMargins(0, 0, 0, 0)
        headwidget.setLayout(headlayout)
        btnwidget = QWidget()
        btnlayout = QHBoxLayout()
        self.add_btn = QPushButton("添加节点")
        self.start_btn = QPushButton("开始画图")
        btnlayout.addWidget(self.add_btn)
        btnlayout.addWidget(self.start_btn)
        btnwidget.setLayout(btnlayout)
        btnlayout.setContentsMargins(0, 0, 0, 0)

        self.laytout.addStretch()
        self.laytout.addWidget(btnwidget)
        self.laytout.addWidget(headwidget)
        #self.laytout.addStretch()

        self.add_btn.clicked.connect(self.add_node)
        self.start_btn.clicked.connect(self.start_draw_visiflow)

        self.nodes = []
        self.id = 0
Exemple #13
0
    def initUI(self):
        self.setGeometry(self.xPos, self.yPos, self.width, self.height)
        self.vBoxLayout = QVBoxLayout()

        self.slider = Slider(
            direction=Qt.Orientation.Horizontal,
            duration=750,
            animationType=QEasingCurve.Type.OutQuad,
            wrap=False,
        )

        self.label1 = QLabel()
        self.label1.setText('First Slide')
        self.label1.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.label1.setStyleSheet(
            'QLabel{background-color: rgb(245, 177, 66); color: rgb(21, 21, 21); font: 25pt;}'
        )
        self.slider.addWidget(self.label1)

        self.label2 = QLabel()
        self.label2.setText('Second Slide')
        self.label2.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.label2.setStyleSheet(
            'QLabel{background-color: rgb(21, 21, 21); color: rgb(245, 177, 66); font: 25pt;}'
        )
        self.slider.addWidget(self.label2)

        self.label3 = QLabel()
        self.label3.setText('Third Slide')
        self.label3.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.label3.setStyleSheet(
            'QLabel{background-color: rgb(93, 132, 48); color: rgb(245, 177, 66); font: 25pt;}'
        )
        self.slider.addWidget(self.label3)

        self.buttonPrevious = QPushButton()
        self.buttonPrevious.setText('Previous Slide')
        self.buttonPrevious.clicked.connect(self.slider.slidePrevious)

        self.buttonNext = QPushButton()
        self.buttonNext.setText('Next Slide')
        self.buttonNext.clicked.connect(self.slider.slideNext)

        self.buttonLayout = QHBoxLayout()
        self.buttonLayout.addWidget(self.buttonPrevious)
        self.buttonLayout.addWidget(self.buttonNext)

        self.vBoxLayout.addWidget(self.slider)
        self.vBoxLayout.addLayout(self.buttonLayout)

        self.centralWidget = QWidget(self)
        self.centralWidget.setLayout(self.vBoxLayout)
        self.setCentralWidget(self.centralWidget)

        self.show()
    def __init__(
        self,
        parent=None,
        buttons=None,
        exercises=None,
        index: int = None,
    ):
        super(ChangeKeyDialog, self).__init__(parent)
        layout = QVBoxLayout(self)
        self.setLayout(layout)
        widget = QWidget()
        keyLayout = QVBoxLayout()
        widget.setStyleSheet("""
        QWidget{
            border-radius: 12px;
            border: 1px solid grey;
            background-color: #b5b5b5;
            color: white;
            font-size: 40px;
        }
        """)
        # widget.setFixedSize(100, 100)
        self.currentKeyLabel = QLabel('W')
        keyLayout.addWidget(self.currentKeyLabel)
        keyLayout.setAlignment(self.currentKeyLabel, Qt.Alignment.AlignCenter)
        widget.setLayout(keyLayout)

        label = QLabel("Press a key to swap")
        emptyKey = QPushButton('Use empty slot')
        emptyKey.setFocusPolicy(Qt.FocusPolicy.ClickFocus)
        emptyKey.clicked.connect(self.useEmpty)

        acceptKey = QPushButton('Accept')
        acceptKey.clicked.connect(self.accept)
        acceptKey.setFocusPolicy(Qt.FocusPolicy.ClickFocus)

        layout.addWidget(label)
        layout.addWidget(widget)
        actions = QHBoxLayout()
        actions.addWidget(emptyKey)
        actions.addWidget(acceptKey)
        layout.addLayout(actions)
        layout.setAlignment(widget, Qt.Alignment.AlignCenter)
        self.buttons = buttons
        self.exercises = exercises
        self.index = index

        self.monitor = KeyMonitor()
        self.monitor.start_monitoring()
        self.currentKey = self.monitor.currentKey

        self.timer = QTimer()
        self.timer.timeout.connect(self.onTimeout)
        self.timer.start()
        print("Dialog init done!")
Exemple #15
0
 def __addInputAndSelect__(self, input, top):
     hbox = QHBoxLayout()
     hbox.setContentsMargins(0, 0, 0, 0)
     hbox.addWidget(input)
     browseButton = BrowseButton(self, input, top)
     browseButton.adjustSize()
     hbox.addWidget(browseButton)
     widget = QWidget(self)
     widget.setLayout(hbox)
     self.layout.addWidget(widget, self.row, 0, 1, -1)
     self.row += 1
    def __init__(self, parent=None):
        """Initializer."""
        super().__init__(parent)
        self.setWindowTitle("RP Contacts")
        self.resize(550, 250)
        self.centralWidget = QWidget()
        self.setCentralWidget(self.centralWidget)
        self.layout = QHBoxLayout()
        self.centralWidget.setLayout(self.layout)

        self.ContactsModel = ContactsModel()
        self.setupUI()
Exemple #17
0
def main():

    app = QApplication(sys.argv)

    w = QWidget()
    w.resize(250, 200)
    w.move(300, 300)

    w.setWindowTitle('Simple')
    w.show()

    sys.exit(app.exec())
Exemple #18
0
    def __init__(self, parent):
        super().__init__()
        self.layout = QVBoxLayout(self)
        self.classifyExercises = parent.classifyExercises
        self.infoLabel = parent.informationLabel

        self.tabs = QTabWidget()
        self.tabs.setContentsMargins(10, 10, 10, 10)
        self.tabs.setStyleSheet(CustomQStyles.tabStyle)
        self.tab1 = QWidget()
        self.tab2 = QWidget()
        self.tab3 = QWidget()
        self.tabs.resize(300, 200)
        self.tabs.addTab(self.tab1, "Train")
        self.tabs.addTab(self.tab2, "Test")
        self.tabs.addTab(self.tab3, "Keys")
        self.tabs.setFocusPolicy(Qt.FocusPolicy.NoFocus)

        self.layout.addWidget(self.tabs)
        self.setLayout(self.layout)
        self.layout.setContentsMargins(10, 10, 10, 10)
        self.setTabWidgets()
    def setUpMainWindow(self):
        """Set up the GUI's main window."""
        header_label = QLabel("List of Users")

        # Create model and table objects
        model = QStandardItemModel()
        model.setColumnCount(3)
        model.setHorizontalHeaderLabels(["Name", "Birthdate", "Actions"])

        table_view = QTableView()
        table_view.setEditTriggers(
            QAbstractItemView.EditTrigger.NoEditTriggers)
        # NOTE: Uncomment for table cells to be unselectable
        #table_view.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection)
        table_view.setModel(model)
        table_view.horizontalHeader().setSectionResizeMode(
            0, QHeaderView.ResizeMode.Stretch)

        names_list = ["Willman, Joshua", "Davis, Scott", "Garcia, Sky"]

        # Add items to each row in the table by looping over
        # the names_list and adding the date edit and button widgets
        for row, name in enumerate(names_list):
            model.setItem(row, QStandardItem(name))
            # Setting the widget at an index in a QTableView involves
            # acquiring the QModelIndex values of the current position.
            # One way to do this is to use the QAbstractItemModel.sibling()
            # method to retrieve the QModelIndex index from the specified
            # row and column (here the column is 1)
            index = table_view.model().sibling(row, 1, QModelIndex())
            date_edit = QDateEdit(QDate.currentDate(
            ))  # Create QDateEdit object that starts at current date
            date_edit.setDateRange(QDate(1900, 1, 1), QDate.currentDate())
            date_edit.setDisplayFormat("MM/dd/yyyy")
            date_edit.setAlignment(
                Qt.AlignmentFlag.AlignRight)  # Align the text
            date_edit.setAutoFillBackground(True)
            table_view.setIndexWidget(index, date_edit)
            # Set the widgets in the final column for each row
            index = table_view.model().sibling(row, 2, QModelIndex())
            table_view.setIndexWidget(index, EditCellWidget(table_view))

        # Set up main layout and container object for main window
        main_v_box = QVBoxLayout()
        main_v_box.addWidget(header_label)
        main_v_box.addWidget(table_view)

        container = QWidget()
        container.setLayout(main_v_box)
        self.setCentralWidget(container)
Exemple #20
0
 def __init__(self):
     """View initializer."""
     super().__init__()
     # Set some main window's properties
     self.setWindowTitle("PyCalc")
     self.setFixedSize(235, 235)
     # Set the central widget and the general layout
     self.generalLayout = QVBoxLayout()
     self._centralWidget = QWidget(self)
     self.setCentralWidget(self._centralWidget)
     self._centralWidget.setLayout(self.generalLayout)
     # Create the display and the buttons
     self._createDisplay()
     self._createButtons()
    def __init__(self):
        super().__init__()

        self.setWindowTitle('Editor de Tags')
        self.setFixedSize(700, 480)

        self._central_widget = QWidget(self)
        self.setCentralWidget(self._central_widget)

        self.left_widget = QWidget(self._central_widget)
        self.left_widget.setGeometry(0, 80, 300, 380)
        self.right_widget = QWidget(self._central_widget)
        self.right_widget.setGeometry(305, 50, 400, 480)

        self.left_widget_top = QWidget(self.left_widget)
        self.left_widget_top.setGeometry(21, 10, 300, 50)
        self.left_widget_bot = QWidget(self.left_widget)
        self.left_widget_bot.setGeometry(0, 40, 300, 300)

        self._create_file_path_display()
        self._create_metadata_display()
        self._create_buttons()
        self._create_tool_bar()
        self._create_status_bar()
Exemple #22
0
    def __init__(self, parent):
        super(QTabWidget, self).__init__(parent)

        # Enable the ability to move tabs and reorganize them, as well
        # as close them. Setting tabs as closable displays a close button
        # on each tab.
        #
        self.setTabsClosable(True)
        self.setMovable(True)

        # Create tabs in tab container
        #
        self.tab1 = QWidget()
        self.tab2 = QWidget()
        self.tab3 = QWidget()
        self.tab4 = QWidget()
        self.tab5 = QWidget()

        # Add tabs
        #
        self.addTab(self.tab1, "Tab 1")
        self.addTab(self.tab2, "Tab 2")
        self.addTab(self.tab3, "Long Tab 3")
        self.addTab(self.tab4, "Longer Tab 4")
        self.addTab(self.tab5, "Longest Tab 5")
        self.currentChanged.connect(self.tabSelected)
        self.tabCloseRequested.connect(self.closeRequest)

        # Add test content to a few tabs
        #
        self.tab1.setLayout(QVBoxLayout(self))
        self.tab2.setLayout(QVBoxLayout(self))
        self.pushButton1 = QPushButton("PyQt6 Button 1")
        self.tab1.layout().addWidget(self.pushButton1)
        self.pushButton2 = QPushButton("PyQt6 Button 2")
        self.tab2.layout().addWidget(self.pushButton2)
Exemple #23
0
    def add_generation_inputs(self) -> None:
        right_widget = QWidget(self)
        self.layout().addWidget(right_widget)

        # noinspection PyTypeChecker
        self.layout().setAlignment(
            right_widget,
            Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignBottom)

        right_widget.setLayout(QHBoxLayout())

        generate_button = QPushButton("Generate Header", right_widget)
        right_widget.layout().addWidget(generate_button)

        generate_button.clicked.connect(lambda: self.generate())
    def __init__(self, interactive_matching_widget):
        super(DocumentWidget, self).__init__(interactive_matching_widget)
        self.interactive_matching_widget = interactive_matching_widget

        self.layout = QVBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(10)
        self.setLayout(self.layout)

        self.document = None
        self.current_nugget = None
        self.base_formatted_text = ""
        self.idx_mapper = {}
        self.nuggets_in_order = []

        self.text_edit = QTextEdit()
        self.layout.addWidget(self.text_edit)
        self.text_edit.setReadOnly(True)
        self.text_edit.setFrameStyle(0)
        self.text_edit.setFont(CODE_FONT)
        self.text_edit.setHorizontalScrollBarPolicy(
            Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
        self.text_edit.setText("")

        self.buttons_widget = QWidget()
        self.buttons_widget_layout = QHBoxLayout(self.buttons_widget)
        self.layout.addWidget(self.buttons_widget)

        self.left_button = QPushButton("Skip Left")
        self.left_button.setFont(BUTTON_FONT)
        self.left_button.clicked.connect(self._left_button_clicked)
        self.buttons_widget_layout.addWidget(self.left_button)

        self.right_button = QPushButton("Skip Right")
        self.right_button.setFont(BUTTON_FONT)
        self.right_button.clicked.connect(self._right_button_clicked)
        self.buttons_widget_layout.addWidget(self.right_button)

        self.match_button = QPushButton("Confirm Match")
        self.match_button.setFont(BUTTON_FONT)
        self.match_button.clicked.connect(self._match_button_clicked)
        self.buttons_widget_layout.addWidget(self.match_button)

        self.no_match_button = QPushButton("There Is No Match")
        self.no_match_button.setFont(BUTTON_FONT)
        self.no_match_button.clicked.connect(self._no_match_button_clicked)
        self.buttons_widget_layout.addWidget(self.no_match_button)
Exemple #25
0
    def __init__(self):
        app = QApplication(sys.argv)
        super().__init__()
        self.setWindowTitle('Generic Configuration Tool')
        self.setGeometry(100, 100, 640, 480)
        self.isEdited = False
        self.saveAndClose = SaveAndCloseActions(self)

        centralWidget = QWidget()
        vbox = QVBoxLayout()
        centralWidget.setLayout(vbox)
        vbox.addWidget(TabContainer(self))
        vbox.addStretch(1)
        vbox.addWidget(self.saveAndClose)
        self.setCentralWidget(centralWidget)
        self.show()
        sys.exit(app.exec())
Exemple #26
0
    def initUI(self):
        self.setGeometry(self.xPos, self.yPos, self.width, self.height)
        self.vBoxLayout = QVBoxLayout()

        self.canvas = Canvas(width=150,
                             height=150,
                             penColor=(21, 21, 21),
                             canvasColor=(245, 177, 66),
                             strokeWidth=5,
                             borderWidth=2,
                             borderColor=(21, 21, 21))
        self.vBoxLayout.addWidget(self.canvas,
                                  alignment=Qt.AlignmentFlag.AlignCenter)

        self.centralWidget = QWidget(self)
        self.centralWidget.setLayout(self.vBoxLayout)
        self.setCentralWidget(self.centralWidget)
        self.show()
Exemple #27
0
    def __init__(self, document_base_viewer):
        super(AttributeWidget, self).__init__(document_base_viewer)
        self.document_base_viewer = document_base_viewer
        self.attribute = None

        self.setFixedHeight(40)
        self.setStyleSheet("background-color: white")

        self.layout = QHBoxLayout(self)
        self.layout.setContentsMargins(20, 0, 20, 0)
        self.layout.setSpacing(40)

        self.attribute_name = QLabel()
        self.attribute_name.setFont(CODE_FONT_BOLD)
        self.layout.addWidget(self.attribute_name,
                              alignment=Qt.AlignmentFlag.AlignLeft)

        self.num_matched = QLabel("matches: -")
        self.num_matched.setFont(CODE_FONT)
        self.layout.addWidget(self.num_matched,
                              alignment=Qt.AlignmentFlag.AlignLeft)

        self.buttons_widget = QWidget()
        self.buttons_layout = QHBoxLayout(self.buttons_widget)
        self.buttons_layout.setContentsMargins(0, 0, 0, 0)
        self.buttons_layout.setSpacing(10)
        self.layout.addWidget(self.buttons_widget,
                              alignment=Qt.AlignmentFlag.AlignRight)

        self.forget_matches_button = QPushButton()
        self.forget_matches_button.setIcon(QIcon("aset_ui/resources/redo.svg"))
        self.forget_matches_button.setToolTip(
            "Forget matches for this attribute.")
        self.forget_matches_button.setFlat(True)
        self.forget_matches_button.clicked.connect(
            self._forget_matches_button_clicked)
        self.buttons_layout.addWidget(self.forget_matches_button)

        self.remove_button = QPushButton()
        self.remove_button.setIcon(QIcon("aset_ui/resources/trash.svg"))
        self.remove_button.setToolTip("Remove this attribute.")
        self.remove_button.setFlat(True)
        self.remove_button.clicked.connect(self._remove_button_clicked)
        self.buttons_layout.addWidget(self.remove_button)
    def setUpMainWindow(self):
        """Set up the GUI's main window."""
        header_label = QLabel("List of Users")

        # Create model and table objects
        model = QStandardItemModel()
        model.setColumnCount(3)
        model.setHorizontalHeaderLabels(["Name", "Birthdate", "Actions"])

        table_view = QTableView()
        # NOTE: setEditTriggers() is not used so that the user
        # can double-click and edit cells
        table_view.setModel(model)
        table_view.horizontalHeader().setSectionResizeMode(
            0, QHeaderView.ResizeMode.Stretch)
        # Set the item delegate for a specific column, in this case column 1
        table_view.setItemDelegateForColumn(1, DateEditDelegate())

        names_list = ["Willman, Joshua", "Davis, Scott", "Garcia, Sky"]

        # Add items to each row in the table by looping over
        # the names_list and adding the date edit and button widgets
        for row, name in enumerate(names_list):
            model.setItem(row, QStandardItem(name))
            # Create an item and set the initial value for the second column.
            # Here the QDate values are converted to strings to make it easier
            # to align the text without having to subclass a model class
            date_item = QStandardItem(
                QDate.currentDate().toString("MM/dd/yyyy"))
            date_item.setTextAlignment(Qt.AlignmentFlag.AlignVCenter
                                       | Qt.AlignmentFlag.AlignRight)
            model.setItem(row, 1, date_item)
            # Set the widgets in the final column for each row
            index = model.index(row, 2, QModelIndex())
            table_view.setIndexWidget(index, EditCellWidget(table_view))

        # Set up main layout and container object for main window
        main_v_box = QVBoxLayout()
        main_v_box.addWidget(header_label)
        main_v_box.addWidget(table_view)

        container = QWidget()
        container.setLayout(main_v_box)
        self.setCentralWidget(container)
Exemple #29
0
 def setupStatisticsTab(self):
     """ Create statistics container """
     self.statisticsContainer = QWidget()
     self.statisticsContainerLayout = QVBoxLayout(self.statisticsContainer)
     self.statisticsContainer.setLayout(self.statisticsContainerLayout)
     """ Create work time groupbox """
     self.statisticsWorkTimeGroupBox = QGroupBox("Work Time")
     self.statisticsWorkTimeGroupBoxLayout = QHBoxLayout()
     self.statisticsWorkTimeGroupBox.setLayout(
         self.statisticsWorkTimeGroupBoxLayout)
     self.statisticsWorkTimeDisplay = QLCDNumber(8)
     self.statisticsWorkTimeDisplay.display("00:00:00")
     self.statisticsWorkTimeGroupBoxLayout.addWidget(
         self.statisticsWorkTimeDisplay)
     """ Create rest time groupbox """
     self.statisticsRestTimeGroupBox = QGroupBox("Rest Time")
     self.statisticsRestTimeGroupBoxLayout = QHBoxLayout()
     self.statisticsRestTimeGroupBox.setLayout(
         self.statisticsRestTimeGroupBoxLayout)
     self.statisticsRestTimeDisplay = QLCDNumber(8)
     self.statisticsRestTimeDisplay.display("00:00:00")
     self.statisticsRestTimeGroupBoxLayout.addWidget(
         self.statisticsRestTimeDisplay)
     """ Create total time groupbox """
     self.statisticsTotalTimeGroupBox = QGroupBox("Total Time")
     self.statisticsTotalTimeGroupBoxLayout = QHBoxLayout()
     self.statisticsTotalTimeGroupBox.setLayout(
         self.statisticsTotalTimeGroupBoxLayout)
     self.statisticsTotalTimeDisplay = QLCDNumber(8)
     self.statisticsTotalTimeDisplay.display("00:00:00")
     self.statisticsTotalTimeGroupBoxLayout.addWidget(
         self.statisticsTotalTimeDisplay)
     """ Add widgets to container """
     self.statisticsContainerLayout.addWidget(
         self.statisticsTotalTimeGroupBox)
     self.statisticsContainerLayout.addWidget(
         self.statisticsWorkTimeGroupBox)
     self.statisticsContainerLayout.addWidget(
         self.statisticsRestTimeGroupBox)
     return self.statisticsContainer
Exemple #30
0
 def show_qr(self, qr: bytes):
     title_label = QLabel("请使用微信扫描小程序码完成登陆")
     title_label.setStyleSheet(
         "QLabel{color:#ffe3ed;border:none;background-color:transparent;border-radius:5px;}"
     )
     title_label.setAlignment(Qt.Alignment.AlignCenter)
     title_label.setFixedHeight(20)
     qr_label = QLabel()
     pixmap = QPixmap()
     pixmap.loadFromData(qr)
     qr_label.setPixmap(pixmap)
     qr_label.setStyleSheet(
         "QLabel{color:#ffe3ed;border:none;background-color:transparent;border-radius:5px;}"
     )
     layout_ = QVBoxLayout()
     layout_.addWidget(title_label, 1)
     layout_.addWidget(qr_label, 9)
     self.qr_dialog = QWidget(self)
     self.qr_dialog.setLayout(layout_)
     self.main_layout.addWidget(self.qr_dialog, 1, 1,
                                Qt.Alignment.AlignCenter)
     self.qr_dialog.show()