示例#1
0
    def initUI(self):
        title = QLabel('标题')
        author = QLabel('提交人')
        review = QLabel('申告内容')

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

        grid = QGridLayout()
        grid.setSpacing(10)

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

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

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

        self.setLayout(grid)

        self.setGeometry(300, 300, 350, 300)
        self.setWindowTitle('故障申告')
示例#2
0
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(480, 150)
        self.buttonBox = QDialogButtonBox(Dialog)
        self.buttonBox.setObjectName(u"buttonBox")
        self.buttonBox.setGeometry(QRect(0, 100, 461, 32))
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Apply|QDialogButtonBox.Cancel)
        self.label = QLabel(Dialog)
        self.label.setObjectName(u"label")
        self.label.setGeometry(QRect(10, 20, 81, 16))
        self.label_2 = QLabel(Dialog)
        self.label_2.setObjectName(u"label_2")
        self.label_2.setGeometry(QRect(240, 20, 57, 14))
        self.key = QLineEdit(Dialog)
        self.key.setObjectName(u"key")
        self.key.setGeometry(QRect(10, 40, 211, 22))
        font = QFont()
        font.setFamilies([u"Monospace"])
        self.key.setFont(font)
        self.val = QLineEdit(Dialog)
        self.val.setObjectName(u"val")
        self.val.setGeometry(QRect(240, 40, 211, 22))
        font1 = QFont()
        self.val.setFont(font1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)

        QMetaObject.connectSlotsByName(Dialog)
    def __init__(self):
        super(AboutDialog, self).__init__()
        self.resize(200, 200)

        # Label
        self.label = QLabel(self)
        self.label.setObjectName(u"label")
        self.label.setLineWidth(1)
        self.label.setTextFormat(Qt.RichText)

        # Image
        self.pixmap = QPixmap("Icons/about.png")
        self.image_label = QLabel()
        self.image_label.setPixmap(self.pixmap)

        # Buttons
        button = QDialogButtonBox.Ok
        self.buttonBox = QDialogButtonBox(button)
        self.buttonBox.accepted.connect(self.accept)

        # VBox for whole content
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.addWidget(self.label)
        self.verticalLayout.addWidget(self.image_label)
        self.verticalLayout.addWidget(self.buttonBox)

        # Texts
        self.text_ui()
示例#4
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)
示例#5
0
    def __init__(self):
        super().__init__()

        # Create Widgets
        self.dropdown_quest = QComboBox()
        self.dropdown_quest.addItems(MODES)
        self.dropdown_quest.setCurrentText("Romaji")
        self.dropdown_ans = QComboBox()
        self.dropdown_ans.addItems(MODES)
        self.dropdown_also = QComboBox()
        self.dropdown_also.addItem("----")
        self.dropdown_also.addItems(MODES)
        self.spinbox_level = QSpinBox(Minimum=1, Maximum=2)

        self.list_groups = QListWidget(FixedWidth=W * .6)
        for group_name in GROUPS:
            item = QListWidgetItem(group_name)
            item.setCheckState(QtCore.Qt.Unchecked)
            self.list_groups.addItem(item)

        # Make Layout
        self.sub_layout = QVBoxLayout()
        self.sub_layout.addWidget(QLabel('Question:'))
        self.sub_layout.addWidget(self.dropdown_quest)
        self.sub_layout.addWidget(QLabel('Answer:'))
        self.sub_layout.addWidget(self.dropdown_ans)
        self.sub_layout.addWidget(QLabel('Also:'))
        self.sub_layout.addWidget(self.dropdown_also)
        self.sub_layout.addWidget(QLabel('Level:'))
        self.sub_layout.addWidget(self.spinbox_level)

        self.layout = QHBoxLayout(self)
        self.layout.addLayout(self.sub_layout)
        self.layout.addWidget(self.list_groups)
    def __init__(self, parent=None):
        super(AddDialogWidget, self).__init__(parent)

        nameLabel = QLabel("Name")
        addressLabel = QLabel("Address")
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)

        self.nameText = QLineEdit()
        self.addressText = QTextEdit()

        grid = QGridLayout()
        grid.setColumnStretch(1, 2)
        grid.addWidget(nameLabel, 0, 0)
        grid.addWidget(self.nameText, 0, 1)
        grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop)
        grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft)

        layout = QVBoxLayout()
        layout.addLayout(grid)
        layout.addWidget(buttonBox)

        self.setLayout(layout)

        self.setWindowTitle("Add a Contact")

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
示例#7
0
    def __init__(self, persepolis_setting):
        super().__init__(persepolis_setting)

        # status_tab
        self.status_tab = QWidget()
        status_tab_verticalLayout = QVBoxLayout(self.status_tab)

        # video_status_label
        self.video_status_label = QLabel(self.status_tab)
        status_tab_verticalLayout.addWidget(self.video_status_label)

        # audio_status_label
        self.audio_status_label = QLabel(self.status_tab)
        status_tab_verticalLayout.addWidget(self.audio_status_label)

        # muxing_status_label
        self.muxing_status_label = QLabel(self.status_tab)
        status_tab_verticalLayout.addWidget(self.muxing_status_label)

        self.progress_tabWidget.addTab(self.status_tab, "")

        # set status_tab as default tab
        self.progress_tabWidget.setCurrentIndex(2)

        # labels

        self.video_status_label.setText(QCoreApplication.translate(
            "video_finder_progress_ui_tr", "<b>Video file status: </b>"))
        self.audio_status_label.setText(QCoreApplication.translate(
            "video_finder_progress_ui_tr", "<b>Audio file status: </b>"))
        self.muxing_status_label.setText(QCoreApplication.translate(
            "video_finder_progress_ui_tr", "<b>Mixing status: </b>"))

        self.progress_tabWidget.setTabText(self.progress_tabWidget.indexOf(
            self.status_tab),  QCoreApplication.translate("setting_ui_tr", "Status"))
示例#8
0
 def __init__(self, app, path):
     super(MainWindow, self).__init__()
     self.app = app
     self.path = path
     self.settings_path = self.path / 'config'
     self.settings_data = self.load_settings()
     self.game_path = Path(self.settings_data.get('game_directory', ''))
     self.log_parser = None
     self.log_thread = self.create_log_parser()
     self.log_filter = LogParserFilter()
     self.log_view = ParseView(self, self.log_filter.get_config())
     self.tabs_widget = QTabWidget()
     self.create_trigger_view()
     self.filters = []
     self.create_parse_filters()
     self.views = []
     self.create_parse_views()
     self.zone_filter = ZoningFilter()
     self.server_label = QLabel('Server: {}'.format(
         self.settings_data.get('server_name', '')))
     self.character_label = QLabel('Character: {}'.format(
         self.settings_data.get('character', '')))
     self.zone_label = QLabel('Current Zone: {}'.format(None))
     self.log_thread.start()
     self.create_menu_bar()
     self.create_status_bar()
     self.create_gui()
    def initUI(self):
        """
        Init widget

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

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

        # 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)
        # Header of this widget
        self._headWidget = QLabel("About game")
        hbox.addWidget(self._headWidget, 1, QtCore.Qt.AlignCenter)

        vbox.addLayout(hbox, 0)

        # Create text about game
        text = ABOUT_GAME_STR
        self.textAboutGame = QLabel(text)
        self.textAboutGame.setWordWrap(True)
        self.setFont(QFont("Times", 12, QFont.Bold))
        vbox.addWidget(self.textAboutGame, 1, QtCore.Qt.AlignCenter)

        self.setLayout(vbox)
        self.setWindowTitle("About game")
示例#10
0
    def __init__(self, dose, notes):
        super(Dialog_Dose, self).__init__()

        # Class variables
        self.dose = dose
        self.notes = notes
        self.setWindowIcon(
            QtGui.QIcon("res/images/btn-icons/onkodicom_icon.png"))
        buttonBox = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        self.iso_dose = QLineEdit()
        self.iso_dose.setText(self.dose)
        self.iso_unit = QComboBox()
        self.iso_unit.addItems(["cGy", "%"])
        self.iso_notes = QLineEdit()
        self.iso_notes.setText(self.notes)

        # Input dialog layout
        layout = QFormLayout(self)
        layout.addRow(QLabel("Isodose Level:"), self.iso_dose)
        layout.addRow(QLabel("Unit:"), self.iso_unit)
        layout.addRow(QLabel("Notes:"), self.iso_notes)
        layout.addWidget(buttonBox)
        buttonBox.accepted.connect(self.accepting)
        buttonBox.rejected.connect(self.reject)
        self.setWindowTitle("Isodose Levels")
示例#11
0
    def addChapter(self, row, chapter):

        if self.downloader.downloaded(chapter):
            icon = utils.icon("eye")
        else:
            icon = utils.icon("download")

        button = QToolButton()
        button.setStyleSheet("border: none;")
        button.setIcon(icon)
        button.clicked.connect(functools.partial(self.onClicked, chapter))
        self.buttons[chapter.id] = button
        self.setCellWidget(row, 0, button)

        volume = QLabel(chapter.volume or "(empty)")
        volume.setAlignment(Qt.AlignCenter)
        self.setCellWidget(row, 1, volume)

        id = QLabel(chapter.id)
        id.setAlignment(Qt.AlignCenter)
        self.setCellWidget(row, 2, id)

        title = QLabel(
            f'<a href="{chapter.url}">{chapter.title or "(empty)"}</a>')
        title.setOpenExternalLinks(True)
        self.setCellWidget(row, 3, title)
示例#12
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"))
示例#13
0
    def PreviewWindow(self):

        self.statusBar().showMessage('Tablecloth preview generated.')
        self.statusBar().removeWidget(self.progress_bar)
        # Now you can go back to rigging
        self.ChangeAppStatus(True)

        self.preview_wid = QWidget()
        self.preview_wid.resize(600, 600)
        self.preview_wid.setWindowTitle("Tablecloth preview")

        tablecloth = QPixmap(tempfile.gettempdir()+"\\Table_Dif.jpg")

        tablecloth_preview_title = QLabel(self)
        tablecloth_preview_title.setText("Tablecloth preview (1/4 scale)")
        tablecloth_preview = QLabel(self)
        tablecloth_preview.setPixmap(tablecloth.scaled(512,512))
        confirm = QPushButton(self)
        confirm.setText("Confirm")
        confirm.clicked.connect(self.GenerateImage)
        confirm.clicked.connect(self.preview_wid.close)

        vbox = QVBoxLayout()
        vbox.setAlignment(QtCore.Qt.AlignCenter)
        vbox.addWidget(tablecloth_preview_title)
        vbox.addWidget(tablecloth_preview)
        vbox.addWidget(confirm)
        self.preview_wid.setLayout(vbox)

        self.preview_wid.setWindowModality(QtCore.Qt.ApplicationModal)
        self.preview_wid.activateWindow()
        self.preview_wid.raise_()
        self.preview_wid.show()
示例#14
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        #Configure the window
        self.setWindowTitle("EightyFive")
        self.setGeometry(100, 100, 300, 50)

        #Font set
        self.font = QFont("FIRACODE-REGULAR")
        self.font.setPointSize(14)
        self.font.setStyleStrategy(QFont.PreferAntialias)

        #Window style
        self.setStyleSheet("background-color: #2E3440")

        # Create label
        self.time_cnt_lbl_log_on = QLabel("00:00:00", self)

        self.time_cnt_lbl_log_on.setStyleSheet("color: #ECEFF4")
        self.time_cnt_lbl_log_on.show()
        self.time_cnt_lbl_log_on.setFont(self.font)
        self.time_cnt_lbl_log_on.setGeometry(10, 5, 300, 20)

        self.time_cnt_lbl_log_off = QLabel("00:00:00", self)
        self.time_cnt_lbl_log_off.setStyleSheet("color: #ECEFF4")
        self.time_cnt_lbl_log_off.show()
        self.time_cnt_lbl_log_off.setFont(self.font)
        self.time_cnt_lbl_log_off.setGeometry(10, 25, 300, 20)

        #Set window icon
        app_icon = QIcon("app_icon.png")
        self.setWindowIcon(app_icon)

        self.show()
示例#15
0
    def __init__(self, win_name, scan, upper_level, lower_level):
        super(Dialog_Windowing, self).__init__()

        # Passing the current values if it is an existing option or empty if its a new one
        self.win_name = win_name
        self.setWindowIcon(
            QtGui.QIcon(
                resource_path("res/images/btn-icons/onkodicom_icon.png")))
        self.scan = scan
        self.upper_level = upper_level
        self.lower_level = lower_level

        # Create the ui components for the inputs
        button_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        self.name = QLineEdit()
        self.name.setText(self.win_name)
        self.scan_text = QLineEdit()
        self.scan_text.setText(self.scan)
        self.upper_level_text = QLineEdit()
        self.upper_level_text.setText(self.upper_level)
        self.lower_level_text = QLineEdit()
        self.lower_level_text.setText(self.lower_level)
        layout = QFormLayout(self)
        layout.addRow(QLabel("Window Name:"), self.name)
        layout.addRow(QLabel("Scan:"), self.scan_text)
        layout.addRow(QLabel("Upper Value:"), self.upper_level_text)
        layout.addRow(QLabel("Lower Value:"), self.lower_level_text)
        layout.addWidget(button_box)
        button_box.accepted.connect(self.accepting)
        button_box.rejected.connect(self.reject)
        self.setWindowTitle("Image Windowing")
示例#16
0
    def __init__(self, standard_name, fma_id, organ, url):
        super(Dialog_Organ, self).__init__()

        # Passing the current values if it is an existing option or empty if its a new one
        self.standard_name = standard_name
        self.setWindowIcon(
            QtGui.QIcon(
                resource_path("res/images/btn-icons/onkodicom_icon.png")))
        self.fma_id = fma_id
        self.organ = organ
        self.url = url

        # Creating the UI components
        button_box = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        self.standard_name_header = QLineEdit()
        self.standard_name_header.setText(self.standard_name)
        self.fma_id_header = QLineEdit()
        self.fma_id_header.setText(self.fma_id)
        self.organ_header = QLineEdit()
        self.organ_header.setText(self.organ)
        self.url_header = QLineEdit()
        self.url_header.setText(self.url)
        layout = QFormLayout(self)
        layout.addRow(QLabel("Standard Name:"), self.standard_name_header)
        layout.addRow(QLabel("FMA ID:"), self.fma_id_header)
        layout.addRow(QLabel("Organ:"), self.organ_header)
        layout.addRow(QLabel("Url:"), self.url_header)
        layout.addWidget(button_box)
        button_box.accepted.connect(self.accepting)
        button_box.rejected.connect(self.reject)
        self.setWindowTitle("Standard Organ Names")
示例#17
0
        def __init__(self, parent=None):
            super(WindowSelectionWidget, self).__init__(parent)

            self.start_dt: QDateTimeEdit = QDateTimeEdit()
            self.end_dt: QDateTimeEdit = QDateTimeEdit()

            now: datetime.datetime = datetime.datetime.now()
            fifteen_minutes_ago: datetime.datetime = now - datetime.timedelta(
                minutes=15)
            date_fmt: str = "yyyy-MM-dd HH:mm UTC"

            self.start_dt.setDisplayFormat(date_fmt)
            self.start_dt.setTimeSpec(PySide6.QtCore.Qt.UTC)
            self.end_dt.setDisplayFormat(date_fmt)
            self.end_dt.setTimeSpec(PySide6.QtCore.Qt.UTC)
            self.start_dt.setCalendarPopup(True)
            self.end_dt.setCalendarPopup(True)
            self.start_dt.setDateTime(fifteen_minutes_ago)
            self.end_dt.setDateTime(now)

            layout: QHBoxLayout = QHBoxLayout()

            layout.addWidget(QLabel("Start"))
            layout.addWidget(self.start_dt)
            layout.addWidget(QLabel("End"))
            layout.addWidget(self.end_dt)

            self.setLayout(layout)
    def _init_options_group_box(self) -> None:
        """Creates the group of training options."""
        self._options_group_box = QGroupBox("Options")

        options_layout = QGridLayout()
        left_options = QGridLayout()
        right_options = QGridLayout()

        self._lists['data'] = QListWidget()
        self._lists['data'].setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        self._lists['data'].currentTextChanged.connect(self._refresh_pandas)

        self._lists['type'] = QComboBox()
        for dt in IngestTypes:
            self._lists['type'].addItem(dt.value)

        self._refresh_lists()

        self._lists['type'].currentTextChanged.connect(self._type_changed)

        validator = QRegularExpressionValidator(r'^[\w\-. ]+$')
        cat_validator = QRegularExpressionValidator(r'^[0-9]\d*$')

        dataset_label = QLabel("Avaliable Datasets:")
        search_type_label = QLabel("Symbol/Search Type:")
        search_label = QLabel("Symbol/Search Term:")
        name_label = QLabel("Dataset Name:")
        cat_label = QLabel("Trends Category Code:")

        left_options.addWidget(dataset_label, 0, 0)
        left_options.addWidget(self._lists['data'], 1, 0)

        right_options.addWidget(search_type_label, 0, 0)
        right_options.addWidget(self._lists['type'], 1, 0)

        self._txt_var['ds_name'] = QLineEdit()
        self._txt_var['data_search'] = QLineEdit()
        self._txt_var['search_cat'] = QLineEdit()
        self._txt_var['ds_name'].setValidator(validator)
        self._txt_var['data_search'].setValidator(validator)
        self._txt_var['search_cat'].setValidator(cat_validator)

        self._txt_var['search_cat'].setPlaceholderText('0')

        right_options.addWidget(search_label, 2, 0)
        right_options.addWidget(self._txt_var['data_search'], 3, 0)

        right_options.addWidget(name_label, 4, 0)
        right_options.addWidget(self._txt_var['ds_name'], 5, 0)

        right_options.addWidget(cat_label, 6, 0)
        right_options.addWidget(self._txt_var['search_cat'], 7, 0)

        options_layout.addLayout(left_options, 0, 0)
        options_layout.addLayout(right_options, 0, 1)

        options_layout.setColumnStretch(0, 1)

        self._options_group_box.setLayout(options_layout)
示例#19
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)
示例#20
0
    def init_ui(self):
        self.setFixedSize(400, 180)
        self.move2center()

        content = ([] if 'darwin' not in sys.platform else [
            'Press Cmd + r to speed up(refresh)',
            'Press Cmd + , to open settings',
            'Press Cmd + q to quit',
        ])

        content.append(f'Version {VERSION}')

        grid = QGridLayout()
        grid.setSpacing(10)

        a_tag = '''
        <a href="https://ukiyoesoragoto.com" style="color:Black">
            By UkiyoESoragoto (๑•̀ㅂ•́)و✧
        </a>
        '''
        lab = QLabel(a_tag)
        lab.setOpenExternalLinks(True)
        grid.addWidget(lab, 0, 0)
        for index, line in enumerate(content):
            grid.addWidget(QLabel(line), index + 1, 0)

        self.setLayout(grid)

        self.setWindowTitle('About')
示例#21
0
    def initTimes(self):        
        # Create the local and elapsed times labels
        self.counter = 0
        self.elapsedTime = QLabel()
        self.localTime = QLabel()

        # Base font for colours
        font = QFont()
        font.setBold(True)
        font.setItalic(True)

        # Center labels, transparent backgrounds, fonts, and colours
        for x in [self.elapsedTime, self.localTime]:
            # TODO: Scale times with app resize
            x.setFixedWidth(100)
            x.setAlignment(Qt.AlignCenter)
            x.setFont(font)
            x.setStyleSheet("color: rgb(255, 255, 255)")

        # Start the elapsedTime timer
        timer = QTimer(self)
        timer.timeout.connect(self.updateTimes)
        # Call updateTimes first to get the times displayed on startUp
        self.updateTimes()
        timer.start(500)
示例#22
0
        def __init__(self, parent=None):
            QToolButton.__init__(self)
            self.setParent(parent)\

            # Set the layout of the button
            layout = QGridLayout()

            # Button formatting
            self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            self.setAutoRaise(True)

            # Icon part of the button
            self.icon = QLabel()
            self.icon.setAlignment(Qt.AlignCenter)
            self.icon.setSizePolicy(QSizePolicy.Expanding,
                                    QSizePolicy.Expanding)
            self.iconPixmap = QPixmap()

            # Text part of the button
            # Initialise label
            self.text = QLabel()
            self.text.setAlignment(Qt.AlignBottom)
            # TODO: Change colour with universal theme
            self.text.setStyleSheet("color: white")
            # Add font styling
            font = QFont()
            font.setPixelSize(15)
            self.text.setFont(font)

            # Add components to the layer
            layout.addWidget(self.icon, 0, 0, 3, 3)
            layout.addWidget(self.text, 2, 0, 1, 3)
            self.setLayout(layout)
    def __init__(self, show_time=True):
        """Opens a progress bar widget
        :type show_time: bool
        :param show_time: If the time should be shown below the progress bar"""
        super().__init__()
        # Setup parameters
        self._show_time: bool = show_time
        self._timer_start: float = 0

        # General layout
        self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        self._layout = QVBoxLayout()
        self.setLayout(self._layout)
        # The progress bar itself
        self._progress_bar = QProgressBar(self)
        self._progress_bar.setMaximum(100)
        self._progress_bar.setGeometry(0, 0, 350, 25)
        self._progress_bar.setValue(0)
        self._layout.addWidget(self._progress_bar)
        # Setup time display
        self._time_wrapper = QHBoxLayout()
        self._time_expired_label = QLabel("")
        self._time_expired_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        self._time_left_label = QLabel("")
        self._time_left_label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
        self._time_wrapper.addWidget(self._time_expired_label)
        self._time_wrapper.addWidget(self._time_left_label)
        self._layout.addLayout(self._time_wrapper)
        # Set Size
        self.resize(500, 80)
        # Register progress update handler
        # noinspection PyUnresolvedReferences
        self.set_progress.connect(self._set_progress)
示例#24
0
    def initUI(self):
        title = QLabel("Title")
        author = QLabel("Author")
        review = QLabel("Review")

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

        grid = QGridLayout()
        grid.setSpacing(10)

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

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

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

        self.setLayout(grid)

        self.setGeometry(300, 300, 400, 500)
        self.setWindowTitle("Review")
示例#25
0
    def __init__(self, step: Steps.KeyPress, timeline):
        super(KeyPressWidget, self).__init__(step, timeline)

        detail_layout = self.ui.detailFrame.layout()

        # Key input
        self.key_label = QLabel("Key: ", self)
        self.key_line_edit = QLineEdit(self)
        self.key_line_edit.setMaxLength(1)
        self.key_line_edit.setText(self.step.key)
        self.key_line_edit.textChanged.connect(self.update_key)

        # Mod Input
        self.mod_label = QLabel("Mod: ", self)
        self.mod_combo = QComboBox(self)
        mod_list = ["None", "Ctrl", "Shift", "Alt", "Super"]
        self.mod_combo.addItems(mod_list)

        if self.step.mod:
            current_mod_index = mod_list.index(self.step.mod.capitalize())
            self.mod_combo.setCurrentIndex(current_mod_index)

        self.mod_combo.currentIndexChanged.connect(self.update_mod)

        # Add to layout
        detail_layout.addWidget(self.key_label)
        detail_layout.addWidget(self.key_line_edit)
        detail_layout.addWidget(self.mod_label)
        detail_layout.addWidget(self.mod_combo)
示例#26
0
    def __init__(self, valve: Valve):
        super().__init__()

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

        self._valve = valve

        self.valveToggleButton = QToolButton()
        self.valveNumberLabel = QLabel("Number")
        self.valveNumberDial = QSpinBox()
        self.valveNumberDial.setMinimum(0)
        self.valveNumberDial.setValue(self._valve.solenoidNumber)
        self.valveNumberDial.setMaximum(9999)
        self.valveNumberDial.valueChanged.connect(self.UpdateValve)

        self.valveNameLabel = QLabel("Name")
        self.valveNameField = QLineEdit(self._valve.name)
        self.valveNameField.textChanged.connect(self.UpdateValve)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.valveToggleButton, alignment=Qt.AlignCenter)

        layout = QGridLayout()
        layout.addWidget(self.valveNameLabel, 0, 0)
        layout.addWidget(self.valveNameField, 0, 1)
        layout.addWidget(self.valveNumberLabel, 1, 0)
        layout.addWidget(self.valveNumberDial, 1, 1)

        mainLayout.addLayout(layout)
        self.containerWidget.setLayout(mainLayout)
        self.valveToggleButton.clicked.connect(self.Toggle)

        self.Update()
        self.Move(QPointF())
示例#27
0
    def grid_layout_creation_1(self) -> None:
        self.group_box_1 = QGroupBox("Image info")

        layout = QGridLayout()
        layout.addWidget(QLabel(bold("Local file?")), 0, 0)
        layout.addWidget(QLabel("Yes" if self.img.local_file else "No"), 0, 1)

        layout.addWidget(QLabel(bold("Path:")), 1, 0)
        text = self.img.get_absolute_path_or_url()
        layout.addWidget(QLabel(text), 1, 1)
        icon = QtGui.QIcon(str(Path(cfg.ASSETS_DIR, "clipboard.png")))
        btn = QPushButton()
        btn.setIcon(icon)
        btn.setIconSize(QtCore.QSize(ICON_SIZE, ICON_SIZE))
        btn.setToolTip("copy to clipboard")
        btn.clicked.connect(partial(self.copy_to_clipboard, text))
        layout.addWidget(btn, 1, 2)

        layout.addWidget(QLabel(bold("Resolution:")), 2, 0)
        text = "{w} x {h} pixels".format(w=self.img.original_img.width(),
                                         h=self.img.original_img.height())
        layout.addWidget(QLabel(text), 2, 1)

        layout.addWidget(QLabel(bold("Size:")), 3, 0)
        file_size_hr = self.img.get_file_size(human_readable=True)
        text = "{0} ({1} bytes)".format(
            file_size_hr, helper.pretty_num(self.img.get_file_size()))
        layout.addWidget(QLabel(text), 3, 1)

        layout.addWidget(QLabel(bold("Flags:")), 4, 0)
        text = self.img.get_flags()
        layout.addWidget(QLabel(text), 4, 1)

        self.group_box_1.setLayout(layout)
示例#28
0
    def setup_ui(self):
        super(SettingUI, self).setup_ui()
        max_width_label = QLabel(text="最大宽度",
                                 alignment=QtCore.Qt.AlignRight
                                 | QtCore.Qt.AlignVCenter)
        max_width_combo = QComboBox()
        max_width_combo.addItems(Globals.max_width_arr)
        max_width_combo.setCurrentIndex(self.max_width_index)
        max_width_combo.currentIndexChanged.connect(self.on_combo_changed)

        size_label = QLabel(text="输出字号",
                            alignment=QtCore.Qt.AlignRight
                            | QtCore.Qt.AlignVCenter)
        size_spin = QSpinBox()
        size_spin.setRange(10, 64)
        size_spin.setValue(Globals.config.get(Globals.UserData.font_size))
        size_spin.valueChanged.connect(self.on_save_font_size)

        output_name_label = QLabel(text="输出名称",
                                   alignment=QtCore.Qt.AlignRight
                                   | QtCore.Qt.AlignVCenter)
        output_name_edit = QLineEdit(
            Globals.config.get(Globals.UserData.font_save_name))
        output_name_edit.textEdited.connect(self.on_output_name_edited)

        output_label = QLabel(text="输出目录",
                              alignment=QtCore.Qt.AlignRight
                              | QtCore.Qt.AlignVCenter)
        output_line_edit = QLineEdit(
            Globals.config.get(Globals.UserData.output_dir))
        output_line_edit.setReadOnly(True)
        output_line_edit.cursorPositionChanged.connect(
            self.on_output_choose_clicked)

        mode_1_radio = QRadioButton("图集模式")
        mode_2_radio = QRadioButton("字体模式")
        mode_1_radio.setChecked(True)
        mode_1_radio.toggled.connect(self.on_mode_1_radio_toggled)
        mode_radio_group = QButtonGroup(self)
        mode_radio_group.addButton(mode_1_radio, 0)
        mode_radio_group.addButton(mode_2_radio, 1)

        self.main_layout.setColumnStretch(1, 1)
        self.main_layout.setColumnStretch(3, 1)
        self.main_layout.addWidget(mode_1_radio, 0, 0, 1, 1)
        self.main_layout.addWidget(mode_2_radio, 0, 1, 1, 1)
        self.main_layout.addWidget(output_name_label, 1, 0, 1, 1)
        self.main_layout.addWidget(output_name_edit, 1, 1, 1, 1)
        self.main_layout.addWidget(max_width_label, 1, 2, 1, 1)
        self.main_layout.addWidget(max_width_combo, 1, 3, 1, 1)
        self.main_layout.addWidget(output_label, 2, 0, 1, 1)
        self.main_layout.addWidget(output_line_edit, 2, 1, 1, 1)
        self.main_layout.addWidget(size_label, 2, 2, 1, 1)
        self.main_layout.addWidget(size_spin, 2, 3, 1, 1)

        self.max_width_combo = max_width_combo
        self.size_spin = size_spin
        self.output_name_edit = output_name_edit
        self.output_line_edit = output_line_edit
示例#29
0
    def change_settings(self, settings):

        # First clean up all previous items
        for i in range(self.layout.count()):
            self.layout.removeItem(self.layout.takeAt(0))
        for w in self.widgets:
            w.deleteLater()
        self.widgets = []

        if not settings:
            label = QLabel(self.parentWidget())
            label.setObjectName("settings_empty_label")
            label.setText("Для данной операции настройки отсутствуют")
            label.setWordWrap(True)
            self.widgets.append(label)
            self.layout.addWidget(label, 0, 0)

        else:
            x = 0
            for s in settings:
                if isinstance(s.type, range):
                    label = QLabel(self.parentWidget())
                    label.setText(s.text)
                    label.setWordWrap(True)
                    self.widgets.append(label)
                    self.layout.addWidget(label, x, 0)

                    slider = QSlider(self.parentWidget())
                    slider.setOrientation(Qt.Horizontal)
                    slider.setMinimum(s.type.start // s.type.step)
                    slider.setMaximum(s.type.stop // s.type.step - 1)
                    slider.setValue(s.value // s.type.step)
                    self.layout.addWidget(slider, x + 1, 0)

                    line_edit = QLineEdit(self.parentWidget())
                    line_edit.setText(str(s.value))
                    self.layout.addWidget(line_edit, x + 1, 1)

                    slider.valueChanged.connect(
                        partial(self.slider_change, line_edit, s))
                    line_edit.returnPressed.connect(
                        partial(self.line_edit_change, slider, line_edit, s))

                    self.widgets.append(slider)
                    self.widgets.append(line_edit)
                    x += 2

                elif s.type == bool:
                    checkbox = QCheckBox(self.parentWidget())
                    checkbox.setText('\n'.join(wrap(s.text, 40)))
                    checkbox.setChecked(s.value)
                    checkbox.clicked.connect(
                        partial(self.checkbox_changed, checkbox, s))

                    self.layout.addWidget(checkbox, x, 0)
                    self.widgets.append(checkbox)
                    x += 1
                elif s.type in (int, float, str):
                    pass
    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()