Example #1
0
    def __init__(self):
        super().__init__()
        MANGA_ITEMS.itemClicked.connect(self.onSelectedManga)
        self.deletedManga.connect(self.onDeletedManga)

        self.selected = None

        self.summaries = {}

        for method_name, icon_path in self.BUTTONS:

            method = getattr(self, method_name)
            tooltip = f"{method_name.title()} a manga..."

            action = QAction()
            action.setToolTip(tooltip)
            action.setIcon(utils.icon(icon_path))
            action.triggered.connect(method)

            button = QToolButton()
            button.setDefaultAction(action)

            self.addWidget(button)

        # spacer
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
        self.addWidget(spacer)

        # text below the manga preview
        self.summary = QLabel()
        self.addWidget(self.summary)

        self.show()
Example #2
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')
    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)
Example #4
0
class Ex(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        vbox = QVBoxLayout()

        btn = QPushButton('Dialog', self)
        btn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        btn.move(20, 20)
        vbox.addWidget(btn)

        btn.clicked.connect(self.show_dialog)

        self.lbl = QLabel('Knowledge only matters', self)
        self.lbl.move(130, 20)

        vbox.addWidget(self.lbl)
        self.setLayout(vbox)

        self.setGeometry(300, 300, 250, 250)
        self.setWindowTitle("Font dialog")

    def show_dialog(self):
        ok, font = QFontDialog.getFont(self)
        if ok:
            self.lbl.setFont(font)
Example #5
0
    def addNewMessage(self):
        name = self.ui.txt_name.text()
        text = self.ui.txt_message.text()
        now = datetime.now().strftime('%H')

        if name != "" and text != "":
            for message in self.messages:
                if name == message[1]:
                    if int(now) - int(message[3][11:12]) <= 0:
                        self.msgBox("Your message should be for 1 hour ago or more")
                        break
            else:
                response = Database.insert(name, text)
                if response:
                    self.length += 1
                    label = QLabel()
                    label.setText(name + ": " + text)
                    self.ui.gl_messages.addWidget(label, self.length, 1, alignment=Qt.Alignment())
                    
                    btn = QPushButton()
                    btn.setText('×')
                    btn.setStyleSheet('max-width: 18px; min-height: 18px; background-color: red; color: white; border: 0px; border-radius: 5px;')
                    self.ui.gl_messages.addWidget(btn, self.length, 0, alignment=Qt.Alignment())
                    btn.clicked.connect(partial(self.deleteMessage, self.messages[-1][0], btn, label))
                
                    self.ui.txt_name.setText("")
                    self.ui.txt_message.setText("")

                    self.msgBox("Your message sent successfully!")
                else:
                    self.msgBox("Database error!")                
        else:
            self.msgBox("Error: feilds are empty!")
Example #6
0
        def __init__(self, parent=None):
            QScrollArea.__init__(self)
            self.setParent(parent)
            self.text = ""

            # Set the background colour of the marquee text to white
            self.setStyleSheet("QScrollArea { background-color: rgba(255, 255, 255, 1)}")

            # Initialise the base label and text
            self.label = QLabel()

            # Set the font for marquee
            font = QFont()
            font.setItalic(True)
            font.setBold(True)
            font.setPixelSize(25)
            self.label.setFont(font)

            # Set the base label as the base widget of QScrollArea
            self.setWidget(self.label)

            # Set QScrollBar Policies
            self.setWidgetResizable(True)
            self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

            # Initialise timer and associated variables, used for marquee effect
            self.timer = QTimer(self)
            self.x = 0
            self.speed = 0
            
            # Connect a function to the timer, which controls the marquee effect
            self.timer.timeout.connect(self.updatePos)

            # TODO: Set a nominal speed
            self.setSpeed(33)
Example #7
0
class Ui_Form(object):
    def setupUi(self, audioOp):
        if not audioOp.objectName():
            audioOp.setObjectName(u"audioOp")
        self.formLayout_8 = QFormLayout(audioOp)
        self.formLayout_8.setObjectName(u"formLayout_8")
        self.comboBox = QComboBox(audioOp)
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.setObjectName(u"comboBox")

        self.formLayout_8.setWidget(0, QFormLayout.FieldRole, self.comboBox)

        self.label_8 = QLabel(audioOp)
        self.label_8.setObjectName(u"label_8")

        self.formLayout_8.setWidget(0, QFormLayout.LabelRole, self.label_8)


        self.retranslateUi(audioOp)

        QMetaObject.connectSlotsByName(audioOp)
    # setupUi

    def retranslateUi(self, audioOp):
        self.comboBox.setItemText(0, QCoreApplication.translate("Form", u"Mixed section and step audio", None))
        self.comboBox.setItemText(1, QCoreApplication.translate("Form", u"Section audio only", None))
        self.comboBox.setItemText(2, QCoreApplication.translate("Form", u"Step audio only", None))

        self.label_8.setText(QCoreApplication.translate("Form", u"Audio attachment behavior", None))
        pass
Example #8
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")
Example #9
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")
    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)
    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()
Example #12
0
    def _add_widget_for_requirement_array(self, requirement: Requirement):
        self.grid_layout.setAlignment(Qt.AlignTop)

        parents: List[Tuple[QGroupBox,
                            QVBoxLayout]] = [(self.parent, self.grid_layout)]

        for depth, text in randovania.game_description.pretty_print.pretty_print_requirement(
                requirement):
            if "of the following" in text:
                parent = parents[depth]
                group_box = QGroupBox(parent[0])
                group_box.setContentsMargins(8, 0, 2, 6)
                group_box.setTitle(text)
                self._elements.append(group_box)
                vertical_layout = QVBoxLayout(group_box)
                vertical_layout.setAlignment(Qt.AlignTop)
                parent[1].addWidget(group_box)
                if len(parents) <= depth + 1:
                    parents.append(None)
                parents[depth + 1] = (group_box, vertical_layout)
            else:
                label = QLabel(parents[depth][0])

                # This is a comment!
                if text.startswith("# "):
                    text = re.sub(r"(https?://[^\s]+)", r'<a href="\1">\1</a>',
                                  text[2:])
                    label.setStyleSheet("font-weight: bold; color: green")
                    label.setOpenExternalLinks(True)

                label.setText(text)
                label.setWordWrap(True)
                self._elements.append(label)
                parents[depth][1].addWidget(label)
    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")
Example #14
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()
Example #15
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")
Example #16
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)
Example #17
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)
Example #18
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())
Example #19
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)
Example #20
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)
Example #21
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.model = None
        self.table_name = ''
        self.mapper = None
        self.modified = False
        self.name = "N/A"
        self.operation_type = None

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

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

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

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

        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                          QSizePolicy.Expanding)
        self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                            QSizePolicy.Minimum)
Example #22
0
    def __init__(self, step: Steps.WaitForImage):
        super(WaitForImageWidget, self).__init__(step)

        detail_layout: QFormLayout = self.ui.detailFrame.layout()

        # Image selection
        self.image_label = QLabel()
        self.image_button = QPushButton("Select Image")

        # Timeout Input
        self.timeout_spin = QSpinBox()

        # Signal/Slots
        self.timeout_spin.valueChanged.connect(self.update_timeout)
        self.image_button.clicked.connect(self.update_image)

        # Widget insert
        detail_layout.addRow("Image: ", self.image_label)
        detail_layout.addRow("", self.image_button)
        detail_layout.addRow("Timeout: ", self.timeout_spin)

        # Init
        self.image_label.setText(self.step.image)
        self.timeout_spin.setValue(self.step.timeout)

        if not self.image_label.text():
            self.image_label.setText("No image selected")
Example #23
0
class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.counter = 0

        layout = QVBoxLayout()
        self.l = QLabel("Start")
        b = QPushButton("DANGER!")
        b.pressed.connect(self.oh_no)

        layout.addWidget(self.l)
        layout.addWidget(b)

        w = QWidget()
        w.setLayout(layout)

        self.setCentralWidget(w)
        self.show()

        self.timer = QTimer()
        self.timer.setInterval(1000)
        self.timer.timeout.connect(self.recurring_timer)
        self.timer.start()

    def oh_no(self):
        time.sleep(5)

    def recurring_timer(self):
        self.counter += 1
        self.l.setText("Count: %d" % self.counter)
Example #24
0
    def __init__(self, programInstance: ProgramInstance, uniqueRun):
        super().__init__()

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

        self.editingParameterVisibility = False

        self.programInstance = programInstance
        self.uniqueRun = uniqueRun

        self._programNameWidget = QLabel()

        layout = QVBoxLayout()
        self.setLayout(layout)

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

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

        self.parameterItems: List[ProgramParameterItem] = []

        self._parametersLayout = QVBoxLayout()

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

        self.UpdateInstanceView()
        self.UpdateParameterItems()
Example #25
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.completer = None
        self.p_selected_id = 0

        self.layout = QHBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.name = QLineEdit()
        self.name.setText("")
        self.layout.addWidget(self.name)
        self.details = QLabel()
        self.details.setText("")
        self.details.setVisible(False)
        self.layout.addWidget(self.details)
        self.button = QPushButton("...")
        self.button.setFixedWidth(
            self.button.fontMetrics().horizontalAdvance("XXXX"))
        self.layout.addWidget(self.button)
        self.setLayout(self.layout)

        self.setFocusProxy(self.name)

        self.button.clicked.connect(self.on_button_clicked)

        if self.details_field:
            self.name.setFixedWidth(
                self.name.fontMetrics().horizontalAdvance("X") * 15)
            self.details.setVisible(True)
        self.completer = QCompleter(self.dialog.model.completion_model)
        self.completer.setCompletionColumn(
            self.dialog.model.completion_model.fieldIndex(self.selector_field))
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.name.setCompleter(self.completer)
        self.completer.activated[QModelIndex].connect(self.on_completion)
    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)
Example #27
0
    def __init__(self):
        super().__init__()

        layout = QVBoxLayout()

        self.progress = QProgressBar()

        button = QPushButton("START IT UP")
        button.pressed.connect(self.execute)

        self.status = QLabel("0 workers")

        layout.addWidget(self.progress)
        layout.addWidget(button)
        layout.addWidget(self.status)

        w = QWidget()
        w.setLayout(layout)

        # Dictionary holds the progress of current workers.
        self.worker_progress = {}

        self.setCentralWidget(w)

        self.show()

        self.threadpool = QThreadPool()
        print("Multithreading with maximum %d threads" %
              self.threadpool.maxThreadCount())

        self.timer = QTimer()
        self.timer.setInterval(100)
        self.timer.timeout.connect(self.refresh_progress)
        self.timer.start()
Example #28
0
    def __init__(self, *args, **kwargs):
        super(ProgressWindow, self).__init__(*args, **kwargs)

        # Setting up progress bar
        self.progress_bar = QtWidgets.QProgressBar()
        self.progress_bar.setGeometry(10, 50, 230, 20)
        self.progress_bar.setMaximum(100)

        self.setWindowTitle("Loading")
        self.setFixedSize(248, 80)

        self.text_field = QLabel("Loading")

        if platform.system() == 'Darwin':
            self.stylesheet_path = "res/stylesheet.qss"
        else:
            self.stylesheet_path = "res/stylesheet-win-linux.qss"

        self.stylesheet = open(resource_path(self.stylesheet_path)).read()

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

        self.setWindowIcon(window_icon)
        self.progress_bar.setStyleSheet(self.stylesheet)

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.text_field)
        self.layout.addWidget(self.progress_bar)
        self.setLayout(self.layout)

        self.threadpool = QThreadPool()
        self.interrupt_flag = threading.Event()
Example #29
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)
Example #30
0
class PageView(QScrollArea):
    def __init__(self, parent, pages):
        super().__init__(parent)
        self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.setStyleSheet("background-color: #000000")
        self.setWidgetResizable(True)

        self.pages = pages

        self.label = QLabel()
        self.label.setScaledContents(True)

        self.setWidget(self.label)

        self.toolbar = PageViewToolBar(len(self.pages))
        self.toolbar.setPage.connect(self.onSetPage)

        self._height = self.label.height() + self.toolbar.height() / 2

        self.toolbar.start()

    def onSetPage(self, pageno):
        pixmap = QPixmap(self.pages[pageno - 1])

        self.label.setPixmap(pixmap)