예제 #1
0
    def __init__(
        self,
        parent: Optional[QWidget] = None,
        *args: Tuple[Any, Any],
        **kwargs: Tuple[Any, Any],
    ) -> None:
        """
        The log layout consisting of, for each command:
            Left: Command name
            Right: Command result
        """
        super(VerticalLogLayout, self).__init__(parent=parent, *args, **kwargs)
        # set layout and add placeholder layouts to ensure they aren't automatically destroyed later
        layout = QHBoxLayout()

        self.__commandNames.append("Command name")
        self.__commandResults.append("Result")

        commandNamesBox = QVBoxLayout()
        commandResultsBox = QVBoxLayout()

        # add the human descriptions text to the layouts
        for i in range(0, len(self.__commandNames)):
            commandNamesBox.addWidget(QLabel(self.__commandNames[i]))
            commandResultsBox.addWidget(QLabel(self.__commandResults[i]))

        layout.addLayout(commandNamesBox)
        layout.addLayout(commandResultsBox)

        # remember to set the layout!
        self.setLayout(layout)
예제 #2
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
예제 #3
0
    def initUI(self):
        self.setWindowTitle("查看回收站文件夹内容")
        self.form = QVBoxLayout()
        for item in iter(self.files):
            ico = QPushButton(set_file_icon(item.name), item.name)
            ico.setStyleSheet(
                "QPushButton {border:none; background:transparent; color:black;}"
            )
            ico.adjustSize()
            it = QLabel(f"<font color='#CCCCCC'>({item.size})</font>")
            hbox = QHBoxLayout()
            hbox.addWidget(ico)
            hbox.addStretch(1)
            hbox.addWidget(it)
            self.form.addLayout(hbox)

        self.form.setSpacing(10)
        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Orientation.Horizontal)
        self.buttonBox.setStandardButtons(
            QDialogButtonBox.StandardButton.Close)
        self.buttonBox.button(
            QDialogButtonBox.StandardButton.Close).setText("关闭")
        self.buttonBox.setStyleSheet(btn_style)
        self.buttonBox.rejected.connect(self.reject)

        vbox = QVBoxLayout()
        vbox.addLayout(self.form)
        vbox.addStretch(1)
        vbox.addWidget(self.buttonBox)
        self.setLayout(vbox)
    def __init__(self, parent, directory, is_checked):
        """Simple modal Preferences dialog"""
        super().__init__(parent)
        self.setWindowTitle("Preferences")
        self.setModal(True)

        image_dir_label = QLabel(
            f"<b>Images Location:</b> {directory.absolutePath()}")

        self.delete_images_checkbox = QCheckBox("Delete Original Images")
        self.delete_images_checkbox.setToolTip(
            """<p>If checked, images that are copied to the 
            <b>Images Location</b> are also deleted from their original location.</p>"""
        )
        self.delete_images_checkbox.setChecked(is_checked)

        handling_v_box = QVBoxLayout()
        handling_v_box.addWidget(self.delete_images_checkbox)

        handling_group_box = QGroupBox("Image Handling:")
        handling_group_box.setLayout(handling_v_box)

        self.button_box = QDialogButtonBox(
            QDialogButtonBox.StandardButton.Save
            | QDialogButtonBox.StandardButton.Cancel)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

        # Add a layout to the dialog box
        dialog_v_box = QVBoxLayout()
        dialog_v_box.addWidget(image_dir_label)
        dialog_v_box.addWidget(handling_group_box)
        dialog_v_box.addStretch(1)
        dialog_v_box.addWidget(self.button_box)
        self.setLayout(dialog_v_box)
예제 #5
0
    def add_header_fields(self) -> None:
        layout: QLayout = QHBoxLayout()

        self.layout().addItem(layout)

        labels_layout: QLayout = QVBoxLayout()
        line_edits_layout: QLayout = QVBoxLayout()

        layout.addItem(labels_layout)
        layout.addItem(line_edits_layout)

        labels_layout.addWidget(QLabel("""Header File Name""", self))
        labels_layout.addWidget(
            QLabel("""Output Path (relative to root of project)""", self))

        line_edits_layout.addWidget(self.header_name_input)

        path_edit_layout: QLayout = QHBoxLayout()
        path_edit_layout.addWidget(self.header_output_path_input)
        path_edit_layout.addWidget(self.header_output_path_selector)

        path_edit_layout.setAlignment(self.header_output_path_selector,
                                      Qt.AlignmentFlag.AlignRight)

        self.header_output_path_selector.setFixedSize(QSize(25, 25))

        line_edits_layout.addItem(path_edit_layout)

        self.header_output_path_selector.clicked.connect(
            lambda: self.open_path_selection_dialog())
    def __init__(self, summary_plots=None):
        super(SummaryWindow, self).__init__()

        ## Create GUI Layout
        layout = QVBoxLayout()

        self.fig, self.axs = summary_plots()
        for axis in self.axs:
            axis.tick_params(axis='both', which='major', labelsize=9)
            axis.xaxis.label.set_fontsize(10)
            axis.yaxis.label.set_fontsize(10)
        self.fig.subplots_adjust(bottom=0.11)
        self.fig.subplots_adjust(hspace=0.3)
        self.canvas = FigureCanvas(self.fig)
        self.toolbar = NavigationToolbar(self.canvas, self)
        # Attach figure to the layout
        lf = QVBoxLayout()
        lf.addWidget(self.toolbar)
        lf.addWidget(self.canvas)
        layout.addLayout(lf)

        # add quit button
        bq = QPushButton("QUIT")
        bq.pressed.connect(self.close)
        lb = QVBoxLayout()  # Layout for buttons
        lb.addWidget(bq)
        layout.addLayout(lb)

        self.setLayout(layout)
        self.setGeometry(100, 150, 1500, 900)
        # self.adjustSize()
        self.show()
        self.setWindowTitle('Last experiment summary')
예제 #7
0
    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!")
    def __init__(self):
        super(MainWidget, self).__init__()
        self.resize(500, 600)
        self.setWindowTitle("喜马拉雅下载 by[Zero] " + __VERSION__)
        self.mainlayout = QVBoxLayout()
        self.setLayout(self.mainlayout)
        self.groupbox = QGroupBox("选择类型")
        self.groupbox.setFixedHeight(50)
        hlayout = QHBoxLayout(self.groupbox)
        self.signal_m4a = QRadioButton("单个下载")
        self.mut_m4a = QRadioButton("专辑下载")
        self.vip_signal_m4a = QRadioButton("VIP单个下载")
        self.vip_m4a = QRadioButton("VIP专辑下载")

        hlayout.addWidget(self.signal_m4a)
        hlayout.addWidget(self.mut_m4a)
        hlayout.addWidget(self.vip_signal_m4a)
        hlayout.addWidget(self.vip_m4a)
        self.mainlayout.addWidget(self.groupbox)

        frame01 = QFrame(self)
        child_layout = QVBoxLayout()
        print(self.width())
        label01 = QLabel("链   接", self)
        label02 = QLabel("下载目录", self)
        self.url_lineedit = QLineEdit(self)
        self.dir_lineedit = QLineEdit(self)
        hlayout01 = QHBoxLayout()
        hlayout01.addWidget(label01, 1)
        hlayout01.addWidget(self.url_lineedit, 9)
        hlayout02 = QHBoxLayout()
        hlayout02.addWidget(label02, 1)
        hlayout02.addWidget(self.dir_lineedit, 9)
        child_layout.addLayout(hlayout01)
        child_layout.addLayout(hlayout02)
        child_layout.setContentsMargins(
            5, 0, 5, 0)  #(int left, int top, int right, int bottom)
        frame01.setLayout(child_layout)
        self.download_progressbar = QProgressBar()
        self.download_progressbar.setAlignment(
            QtCore.Qt.Alignment.AlignCenter)  #文字居中
        self.download_progressbar.setValue(88)
        self.download_btn = QPushButton("开始下载")
        self.show_plaintextedit = QPlainTextEdit()
        self.show_plaintextedit.setMinimumHeight(400)
        self.mainlayout.addWidget(frame01)
        self.mainlayout.addWidget(self.download_progressbar)
        self.mainlayout.addWidget(self.download_btn)
        self.mainlayout.addWidget(self.show_plaintextedit)
        self.mainlayout.addStretch()
        ### 设置stylesheet
        self.download_btn.setStyleSheet(
            'QPushButton:pressed{ text-align: center;background-color:red;}')
예제 #9
0
    def __init__(self, parent=None):
        super(ConfigDialog, self).__init__(parent)
        self.classifyExercises = parent.classifyExercises
        self.setFixedSize(500, 400)
        self.setWindowTitle("Model Configurations")

        self.epochValue = QLabel()
        self.vbox = QVBoxLayout()
        self.label_maximum = QLabel()
        self.label_minimum = QLabel()
        self.slider_hbox = QHBoxLayout()
        self.slider_vbox = QVBoxLayout()
        self.batchSizeMenu = QComboBox()
        self.properties = QFormLayout()
        self.epochSlider = Slider(orientation=Qt.Orientations.Horizontal)

        self.trainButton = QPushButton('Train Model')
        self.resultButton = QPushButton('Show result image')
        self.progress = QProgressBar()

        self.batchSizeMenu.addItems(['2', '4', '8', '16', '32', '64', '128'])
        self.batchSizeMenu.setCurrentIndex(3)
        self.batchSizeMenu.setMaximumWidth(100)

        self.initSlider()

        self.properties.addRow('Batch Size', self.batchSizeMenu)

        self.resultButton.setEnabled(False)
        self.actionsLayout = QHBoxLayout()

        self.actionsLayout.addWidget(self.trainButton)
        self.actionsLayout.addWidget(self.resultButton)

        self.optionsLayout = QVBoxLayout()
        self.optionsLayout.addWidget(QLabel('Model properties'))
        self.optionsLayout.addLayout(self.vbox)
        self.optionsLayout.addLayout(self.properties)
        self.optionsLayout.addLayout(self.actionsLayout)
        self.progress.setAlignment(QtCore.Qt.Alignment.AlignCenter)
        self.optionsLayout.addWidget(self.progress)
        # self.options_layout.addWidget(self.label)
        # self.options_layout.addWidget(self.list_widget)

        self.setLayout(self.optionsLayout)

        self.trainThread = TrainThread(self.classifyExercises)
        self.connections()
        print("init config")
예제 #10
0
파일: test.py 프로젝트: alvii147/MangoUI
    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()
예제 #11
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle("File Hash Checker")
        self.setGeometry(0, 0, 600, 300)

        self.labelFileDropper = FileDropper("Datei auswählen")
        #self.selectFileButton.clicked.connect(self.get_file_to_check)
        self.labelFileDropper.setAcceptDrops(True)
        self.labelFileDropper.setStyleSheet(
            "border: 1px solid black; border-radius: 15px; text-align: center; "
            "height: 200px")
        self.labelFileDropper.move(0, 0)
        self.labelFileDropper.resize(500, 150)

        self.labelMD5Hash = QLabel(
            "Bitte zu vergleichenden MD5 Hash eingeben:")

        self.textMD5Hash = QLineEdit()

        self.buttonCompareMD5 = QPushButton('MD5 Vergleichen')
        self.buttonCompareMD5.clicked.connect(self.compare_md5)

        self.labelIsSame = QLabel()

        layout = QVBoxLayout()
        layout.addWidget(self.labelFileDropper)
        layout.addWidget(self.labelMD5Hash)
        layout.addWidget(self.textMD5Hash)
        layout.addWidget(self.buttonCompareMD5)
        layout.addWidget(self.labelIsSame)

        self.setLayout(layout)
예제 #12
0
    def initUI(self):

        OVER_CAPACITY = 750

        sld = QSlider(Qt.Orientations.Horizontal, self)
        sld.setFocusPolicy(Qt.FocusPolicy.NoFocus)
        sld.setRange(1, OVER_CAPACITY)
        sld.setValue(75)
        sld.setGeometry(30, 40, 150, 30)

        self.c = Communicate()
        self.wid = BurningWidget()
        self.c.updateBW[int].connect(self.wid.setValue)

        sld.valueChanged[int].connect(self.changeValue)
        hbox = QHBoxLayout()
        hbox.addWidget(self.wid)
        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addLayout(hbox)
        self.setLayout(vbox)

        self.setGeometry(300, 300, 390, 210)
        self.setWindowTitle('Burning widget')
        self.show()
예제 #13
0
파일: gui.py 프로젝트: kovidgoyal/vise
 def setup_ui(self):
     self.l = l = QVBoxLayout(self)
     self.splitter = s = QSplitter(self)
     l.addWidget(s)
     self.ab = b = self.bb.addButton(_('Add new account'),
                                     QDialogButtonBox.ButtonRole.ActionRole)
     b.clicked.connect(self.add_account)
     l.addWidget(self.bb)
     self.accounts = a = QListWidget(self)
     a.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
     self.edit_account = e = EditAccount(self)
     e.changed.connect(self.data_changed)
     e.delete_requested.connect(self.delete_requested)
     s.addWidget(a), s.addWidget(e)
     for n, account in enumerate(self.db[self.key]['accounts']):
         if n == 0:
             e.data = account
         i = QListWidgetItem(account['username'], a)
         i.setData(Qt.ItemDataRole.UserRole, account)
     if a.count() < 1:
         na = {'username': '', 'password': '', 'notes': ''}
         i = QListWidgetItem('', a)
         i.setData(Qt.ItemDataRole.UserRole, na)
     a.setCurrentRow(0)
     a.currentItemChanged.connect(self.current_item_changed)
예제 #14
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())
예제 #15
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()
    def setUpMainWindow(self):
        """Set up the GUI's main window."""
        search_line_edit = QLineEdit()
        search_line_edit.setPlaceholderText(
            "Enter text to search for a word below")

        list_of_words = self.loadWordsFromFile()

        list_view = QListView()
        # Create a model instance and pass the list of words to the model
        model = ListModel(list_view, list_of_words)
        list_view.setModel(model)

        # Create QCompleter object that shares the same model as the QListView
        completer = QCompleter(list_of_words)
        completer.setFilterMode(Qt.MatchFlag.MatchStartsWith)
        completer.setModel(model)
        search_line_edit.setCompleter(
            completer)  # Set the completer for the QLineEdit

        # Create a layout and organize all of the objects
        # into a QGroupBox
        main_v_box = QVBoxLayout()
        main_v_box.addWidget(search_line_edit)
        main_v_box.addWidget(list_view)

        word_group_box = QGroupBox("Keywords")
        word_group_box.setLayout(main_v_box)
        self.setCentralWidget(word_group_box)
예제 #17
0
    def __init__(
        self,
        onLoadLastMazePressed: Callable[[], None],
        onMazeLoadedFromPath: Callable[[str], None],
        onMazeSpecificationChosen: Callable[[MazeGenerationSpecification],
                                            None],
        parent: Optional[QWidget] = None,
        *args: Tuple[Any, Any],
        **kwargs: Tuple[Any, Any],
    ) -> None:
        """
        The view used for prompting the user to load, generate or load last maze.
        """
        super(MazeLoaderView, self).__init__(parent=parent, *args, **kwargs)
        self.setContentsMargins(0, 0, 0, 0)
        self.setWindowTitle("Load a Maze")

        self.__onLoadLastMazeChosen = onLoadLastMazePressed
        self.__onMazeFilePathChosen = onMazeLoadedFromPath
        self.__onMazeSpecificationChosen = onMazeSpecificationChosen

        # create layout
        layout = QVBoxLayout()

        # add all the buttons to the layout
        for button in self.__getButtons():
            layout.addWidget(button)

        self.setLayout(layout)
예제 #18
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()
예제 #19
0
 def setActionsBox(self, TrainPanel):
     hLayout = QVBoxLayout()
     hLayout.addWidget(self.calibrateButton)
     hLayout.addWidget(self.sessionButton)
     hLayout.setAlignment(self.calibrateButton, Qt.Alignment.AlignCenter)
     hLayout.setAlignment(self.sessionButton, Qt.Alignment.AlignCenter)
     self.box2.setLayout(hLayout)
예제 #20
0
    def __init__(
        self,
        icon: QStyle.StandardPixmap,
        labelText: str,
        parent: Optional[QWidget] = None,
        *args: Tuple[Any, Any],
        **kwargs: Tuple[Any, Any],
    ) -> None:
        """
        An icon button with a text label.
        """
        super(LabelledIconButton, self).__init__(parent=parent,
                                                 *args,
                                                 **kwargs)
        self.setContentsMargins(0, 0, 0, 0)

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

        button = QToolButton(self)
        button.setIcon(self.style().standardIcon(icon), )

        # connect the button to the onButtonPressed signal
        self.onButtonPressed = button.clicked

        label = QLabel(labelText, self)

        verticalLayout.addWidget(button)
        verticalLayout.addWidget(label)
        verticalLayout.setAlignment(label, Qt.Alignment.AlignHCenter)
        verticalLayout.setAlignment(button, Qt.Alignment.AlignHCenter)

        self.setLayout(verticalLayout)
예제 #21
0
    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)
예제 #22
0
 def __init__(self):
     super(MainUi, self).__init__()
     self.setFixedSize(600,500)
     self.setWindowTitle("妹子图爬虫工具  version: 1.0.0 ")
     self.download_progressbar = QProgressBar()
     self.download_progressbar.setAlignment(QtCore.Qt.Alignment.AlignCenter)#文字居中
     self.download_progressbar.setStyleSheet(".QProgressBar::chunk { background-color: red;}")#背景
     self.download_progressbar.setValue(100)
     label01 = QLabel("下载URL:")
     label02 = QLabel("下载目录:")
     self.url_input    = QLineEdit()
     self.url_input.setText("https://www.mzitu.com/221746")
     self.url_input.setContentsMargins(0,0,0,0)
     self.download_dir = QLineEdit()
     self.download_dir.setContentsMargins(0,0,0,0)
     self.start_btn    = QPushButton("开始爬虫")
     self.start_btn.setFixedHeight(50)
     self.start_btn.setContentsMargins(0,0,0,0)
     inputlayout = QGridLayout()
     inputlayout.addWidget(label01, 0, 0) #第0行 0列
     inputlayout.addWidget(label02, 1, 0)
     inputlayout.addWidget(self.url_input, 0, 1)
     inputlayout.addWidget(self.download_dir, 1, 1)
     inputlayout.addWidget(self.start_btn, 0, 2, 2,1,QtCore.Qt.Alignment.AlignRight) #起始行,起始列, 占行数,占列数
     inputlayout.setColumnStretch(0, 1)  #设置每一列比例
     inputlayout.setColumnStretch(1, 10)
     inputlayout.setColumnStretch(2, 1)
     vlayout = QVBoxLayout()
     vlayout.addLayout(inputlayout)
     vlayout.addWidget(self.download_progressbar)
     self.frame = QFrame()
     self.frame.setFixedHeight(400)
     vlayout.addWidget(self.frame)
     vlayout.addStretch()
     inputlayout.setContentsMargins(0,0,0,0)
     vlayout01 = QVBoxLayout()
     self.frame.setLayout(vlayout01)
     self.qtablewidget = QTableWidget(1,3)
     self.qtablewidget.setHorizontalHeaderLabels(['目录','下载图片总数目', '删除'])
     vlayout01.addWidget(self.qtablewidget)
     self.qtablewidget.setColumnWidth(0, 358)  # 将第0列的单元格,设置成300宽度
     self.qtablewidget.setColumnWidth(1, 100 )  # 将第0列的单元格,设置成50宽度
     self.qtablewidget.verticalHeader().setVisible(False) #隐藏水平表头
     #self.qtablewidget.setDisabled(True) #设置不可编辑
     self.setLayout(vlayout)
     self.current_index = 0
    def __init__(self, parent, selected_image):
        """Modeless dialog that displays file information for images"""
        super().__init__(parent)
        metadata = self.collectImageMetaData(selected_image)

        self.setWindowTitle(f"{metadata['file_name']} Info")

        # Create widgets for displaying information
        image_label = QLabel(f"<b>{metadata['base_name']}</b>")
        date_created = QLabel(
            f"Created: {metadata['date_created'].toString('MMMM d, yyyy h:mm:ss ap')}"
        )
        image_type = QLabel(f"Type: {metadata['extension']}")
        image_size = QLabel(f"Size: {metadata['size']:,} bytes")
        image_location = QLabel(f"Location: {metadata['file_path']}")
        date_modified = QLabel(
            f"""Modified: {metadata['last_modified'].toString('MMMM d, yyyy h:mm:ss ap')}"""
        )

        # Organize widgets that display metadata using containers/layouts
        general_v_box = QVBoxLayout()
        general_v_box.addWidget(image_type)
        general_v_box.addWidget(image_size)
        general_v_box.addWidget(image_location)

        general_group_box = QGroupBox("General:")
        general_group_box.setLayout(general_v_box)

        extra_v_box = QVBoxLayout()
        extra_v_box.addWidget(date_modified)

        extra_group_box = QGroupBox("Extra Info:")
        extra_group_box.setLayout(extra_v_box)

        self.button_box = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok)
        self.button_box.accepted.connect(self.accept)

        # Add a layout to the dialog box
        dialog_v_box = QVBoxLayout()
        dialog_v_box.addWidget(image_label)
        dialog_v_box.addWidget(date_created)
        dialog_v_box.addWidget(general_group_box)
        dialog_v_box.addWidget(extra_group_box)
        dialog_v_box.addStretch(1)
        dialog_v_box.addWidget(self.button_box)
        self.setLayout(dialog_v_box)
예제 #24
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
예제 #25
0
    def __init__(self, parent=None):
        """Initializer"""
        super().__init__(parent=parent)
        self.setWindowTitle("Add Contact")
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)
        self.data = None

        self.setupUI()
예제 #26
0
파일: screenoverlay.py 프로젝트: Opexy/priv
 def __init__(form, parent=None):
   super(AppForm, form).__init__(parent)
   layout = QVBoxLayout()
   form.setLayout(layout)
   toolbar = form.toolbar = QToolBar(form)
   iconRect = toolbar.addAction("Rect")
   iconRect.setCheckable(True)
   iconRect.triggered.connect(form.startDrawRect)
   form.resize(form.sizeHint())
예제 #27
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()
예제 #28
0
    def setup_layout(self):
        lay = QtWidgets.QHBoxLayout(self)

        selectedLayout = QVBoxLayout()
        self.mInput = QListWidget()
        selectedLayout.addWidget(QLabel("Selected:"))
        selectedLayout.addWidget(self.mInput)

        availableLayout = QVBoxLayout()
        self.mOuput = QListWidget()
        availableLayout.addWidget(QLabel("Available"))
        availableLayout.addWidget(self.mOuput)

        self.mButtonToSelected = QtWidgets.QPushButton(">>")
        self.mBtnMoveToAvailable = QtWidgets.QPushButton(">")
        self.mBtnMoveToSelected = QtWidgets.QPushButton("<")
        self.mButtonToAvailable = QtWidgets.QPushButton("<<")

        vlay = QtWidgets.QVBoxLayout()
        vlay.addStretch()
        vlay.addWidget(self.mButtonToSelected)
        vlay.addWidget(self.mBtnMoveToAvailable)
        vlay.addWidget(self.mBtnMoveToSelected)
        vlay.addWidget(self.mButtonToAvailable)
        vlay.addStretch()

        self.mBtnUp = QtWidgets.QPushButton("Up")
        self.mBtnDown = QtWidgets.QPushButton("Down")

        vlay2 = QtWidgets.QVBoxLayout()
        vlay2.addStretch()
        vlay2.addWidget(self.mBtnUp)
        vlay2.addWidget(self.mBtnDown)
        vlay2.addStretch()

        lay.addLayout(selectedLayout)
        lay.addLayout(vlay)
        lay.addLayout(availableLayout)
        lay.addLayout(vlay2)

        self.update_buttons_status()
        self.connections()
예제 #29
0
    def InitWindow(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        self.createCheckBox()
        vbox = QVBoxLayout()
        vbox.addWidget(self.groupBox)
        vbox.addWidget(self.label)
        self.setLayout(vbox)

        self.show()
예제 #30
0
    def InitWindow(self):
        self.setWindowIcon(QtGui.QIcon("home.png"))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        self.createLayout()
        vbox = QVBoxLayout()
        vbox.addWidget(self.groupBox)
        self.setLayout(vbox)

        self.show()