Ejemplo n.º 1
0
    def initUI(self):
        """
        initUI()
        """

        vbox = QVBoxLayout(self)
        grid1 = QGridLayout()
        grid1.setSpacing(10)

        self.text = QTextBrowser()
        self.text.setReadOnly(True)
        self.text.setOpenExternalLinks(True)
        self.text.append(self.message)
        self.text.moveCursor(QTextCursor.Start)
        self.text.ensureCursorVisible()

        vbox.addWidget(self.text)

        self.setLayout(vbox)
        self.setMinimumSize(550, 450)
        self.resize(550, 600)
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
        self.setWindowTitle(self.title)
        iconWT = QIcon()
        iconWT.addPixmap(QPixmap(":images/DXF2GCODE-001.ico"),
                         QIcon.Normal, QIcon.Off)
        self.setWindowIcon(QIcon(iconWT))

        self.exec_()
Ejemplo n.º 2
0
    def changeIcon(self):
        icon = QIcon()

        for row in range(self.imagesTable.rowCount()):
            item0 = self.imagesTable.item(row, 0)
            item1 = self.imagesTable.item(row, 1)
            item2 = self.imagesTable.item(row, 2)

            if item0.checkState() == Qt.Checked:
                if item1.text() == "Normal":
                    mode = QIcon.Normal
                elif item1.text() == "Active":
                    mode = QIcon.Active
                elif item1.text() == "Disabled":
                    mode = QIcon.Disabled
                else:
                    mode = QIcon.Selected

                if item2.text() == "On":
                    state = QIcon.On
                else:
                    state = QIcon.Off

                fileName = item0.data(Qt.UserRole)
                image = QImage(fileName)
                if not image.isNull():
                    icon.addPixmap(QPixmap.fromImage(image), mode, state)

        self.previewArea.setIcon(icon)
Ejemplo n.º 3
0
    def createTabWindowStyle(self):
        self.tabWindowStyle = QWidget()
        self.tabWindowStyle.setObjectName("tabWindowStyle")

        self.verticalLayout_6 = QVBoxLayout(self.tabWindowStyle)
        self.verticalLayout_6.setObjectName("verticalLayout_6")

        self.listWidgetWindowStyle = QListWidget(self.tabWindowStyle)
        self.listWidgetWindowStyle.setResizeMode(QListView.Adjust)
        self.listWidgetWindowStyle.setIconSize(QSize(340, 105))
        self.listWidgetWindowStyle.setViewMode(QListView.IconMode)
        self.listWidgetWindowStyle.setObjectName("listWidgetWindowStyle")

        item = QListWidgetItem(self.listWidgetWindowStyle)
        icon = QIcon()
        icon.addPixmap(QPixmap(":/data/images/breeze-window.png"))
        item.setIcon(icon)
        item.setText("Breeze")
        item.setStyleText = "org.kde.breeze"
        item = QListWidgetItem(self.listWidgetWindowStyle)
        icon1 = QIcon()
        icon1.addPixmap(QPixmap(":/data/images/oxygen-window.png"))
        item.setIcon(icon1)
        item.setText("Oxygen")
        item.setStyleText = "org.kde.oxygen"

        self.verticalLayout_6.addWidget(self.listWidgetWindowStyle)

        self.addTab(self.tabWindowStyle, self.tr("Window Style"))
Ejemplo n.º 4
0
 def run_case(self, devices):
     kw_case_list = []
     if not self.cases:
         return
     for case_id in self.cases:
         kw_case = KWCase()
         case = self.dBCommandLineHelper.query_case_by_id(case_id)
         kw_case.id = case.id
         kw_case.name = case.name
         kw_case.content = case.content
         kw_case.data = case.data
         kw_case_list.append(kw_case)
     # set icon
     stop_icon = QIcon()
     stop_icon.addPixmap(QPixmap(self.config.images + '/stop.png'), QIcon.Normal, QIcon.Off)
     self.run_stop_btn.setIcon(stop_icon)
     self.run_stop_btn.setText("Stop")
     self.running = True
     if not devices:
         return
     try:
         self.tester.select_devices(devices)
         self.tester.run(kw_case_list)
     except Exception as e:
         self.stop_case()
         self.add_log(str(e))
Ejemplo n.º 5
0
 def _setupUi(self):
     self.resize(259, 32)
     self.horizontalLayout = QHBoxLayout(self)
     self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
     self.prevButton = QPushButton(self)
     icon = QIcon()
     icon.addPixmap(QPixmap(":/nav_left_9"), QIcon.Normal, QIcon.Off)
     self.prevButton.setIcon(icon)
     self.horizontalLayout.addWidget(self.prevButton)
     self.typeButton = QPushButton("<date range>")
     sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.typeButton.sizePolicy().hasHeightForWidth())
     self.typeButton.setSizePolicy(sizePolicy)
     self.typeButton.setMinimumSize(QSize(0, 0))
     self.typeButton.setMaximumSize(QSize(16777215, 16777215))
     self.typeButton.setIconSize(QSize(6, 6))
     self.horizontalLayout.addWidget(self.typeButton)
     self.nextButton = QPushButton(self)
     icon1 = QIcon()
     icon1.addPixmap(QPixmap(":/nav_right_9"), QIcon.Normal, QIcon.Off)
     self.nextButton.setIcon(icon1)
     self.horizontalLayout.addWidget(self.nextButton)
     self.horizontalLayout.setStretch(1, 1)
Ejemplo n.º 6
0
    def __init__(self, config, *args, **kwargs):
        super().__init__(*args, **kwargs)
        ui_dir_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(ui_dir_path, 'tag_manage_widget.ui')
        uic.loadUi(ui_file_path, self)

        self.db_helper = DBCommandLineHelper()
        self.message_box = QMessageBox()

        self.tag_names_line_edit = TagNamesLineEdit()
        self.tag_names_line_edit.setPlaceholderText("Tag Names")
        self.cmp = None
        self.set_completer()
        self.selected_tag_names_layout.insertWidget(0, self.tag_names_line_edit)

        add_icon = QIcon()
        add_icon.addPixmap(QPixmap(config.images + '/add.png'), QIcon.Normal, QIcon.Off)
        self.new_tag_btn.setIcon(add_icon)
        self.tag_editor = None
        self.tag_list = None
        self.set_tag_list_widget()   # init data

        self.select_btn.clicked.connect(self.select_event)
        self.cancel_btn.clicked.connect(self.close)
        self.new_tag_btn.clicked.connect(self.new_tag_event)

        self.refresh_signal.connect(self.set_tag_list_widget, Qt.QueuedConnection)
    def load(self, name, size = 128, forceCache = False):
        icon = QIcon()
        size = int(size)
        self.pixmap = QPixmap()
        if not type(name) in (list, tuple):
            name = [str(name)]
        if forceCache or self._forceCache:
            for _name in name:
                for _size in self.iconSizes:
                    if (QPixmapCache.find('$qt'+str(_name)+str(_size),
                        self.pixmap)):
                        logging.debug('Icon %s returned from cache' % _name)
                        return self.pixmap

        logging.debug('Getting icon : %s size: %s' % (','.join(name), size))
        pix = self.findIcon(name, size)
        if pix.isNull():
            for _size in self.iconSizes:
                pix = self.findIcon(name, _size)
                if not pix.isNull():
                    if size == _size:
                        return pix
                    icon.addPixmap(pix)
            if icon.isNull():
                return self.pixmap
            return icon.pixmap(QSize(size, size))
        return pix
Ejemplo n.º 8
0
    def savePic(self):
        densityPic = ''.join([cwd,u'/bulletinTemp/',self.in_parameters[u'datetime'],u'/',
            self.in_parameters[u'target_area'],'.gdb',u'/',self.in_parameters[u'datetime'],
            self.in_parameters[u'target_area'],u'闪电密度空间分布.tif'])

        dayPic = ''.join([cwd,u'/bulletinTemp/',self.in_parameters[u'datetime'],u'/',
            self.in_parameters[u'target_area'],'.gdb',u'/',self.in_parameters[u'datetime'],
            self.in_parameters[u'target_area'],u'地闪雷暴日空间分布.tif'])

        directory = QFileDialog.getExistingDirectory(self,u'请选择图片保存位置',
                                                     u'E:/Documents/工作/雷电公报',
                                    QFileDialog.ShowDirsOnly|QFileDialog.DontResolveSymlinks)

        dest_density = os.path.join(directory,os.path.basename(densityPic))
        dest_day = os.path.join(directory,os.path.basename(dayPic))

        if os.path.isfile(dest_day) or os.path.isfile(dest_density):
            message = u"文件已经存在!"
            msgBox = QMessageBox()
            msgBox.setText(message)
            msgBox.setIcon(QMessageBox.Information)
            icon = QIcon()
            icon.addPixmap(QPixmap("./resource/weather-thunder.png"), QIcon.Normal, QIcon.Off)
            msgBox.setWindowIcon(icon)
            msgBox.setWindowTitle(" ")
            msgBox.exec_()
            return

        move(dayPic,directory)
        move(densityPic,directory)
Ejemplo n.º 9
0
 def setIcon(self, icon):
     super(RecordButton, self).setIcon(icon)
     on_icon = QIcon(icon)
     off_icon = QIcon(icon)
     for size in off_icon.availableSizes(QIcon.Normal, QIcon.On):
         pixmap = off_icon.pixmap(size, QIcon.Normal, QIcon.Off)
         off_icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
     self.animation_icons = [on_icon, off_icon]
Ejemplo n.º 10
0
class StreamButton(QToolButton):
    hidden = pyqtSignal()
    shown = pyqtSignal()

    def __init__(self, parent=None):
        super(StreamButton, self).__init__(parent)
        self.default_icon = QIcon()
        self.alternate_icon = QIcon()
        self.clicked.connect(self._clicked)

    def _clicked(self):
        super(StreamButton, self).setIcon(self.default_icon)

    def _get_accepted(self):
        return not self.isChecked()

    def _set_accepted(self, accepted):
        super(StreamButton, self).setIcon(self.alternate_icon)
        self.setChecked(not accepted)

    accepted = property(_get_accepted, _set_accepted)
    del _get_accepted, _set_accepted

    def _get_active(self):
        return self.isEnabled()

    def _set_active(self, active):
        self.setEnabled(bool(active))

    active = property(_get_active, _set_active)
    del _get_active, _set_active

    @property
    def in_use(self):
        return self.isVisibleTo(self.parent())

    def setVisible(self, visible):
        super(StreamButton, self).setVisible(visible)
        signal = self.shown if visible else self.hidden
        signal.emit()

    def setIcon(self, icon):
        self.default_icon = icon
        self.alternate_icon = QIcon(icon)
        normal_sizes = icon.availableSizes(QIcon.Normal, QIcon.On)
        selected_sizes = icon.availableSizes(QIcon.Selected, QIcon.On)
        selected_additional_sizes = [size for size in selected_sizes if size not in normal_sizes]
        for size in normal_sizes + selected_additional_sizes:
            pixmap = icon.pixmap(size, QIcon.Selected, QIcon.On)
            self.alternate_icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
        disabled_sizes = icon.availableSizes(QIcon.Disabled, QIcon.On)
        selected_additional_sizes = [size for size in selected_sizes if size not in disabled_sizes]
        for size in disabled_sizes + selected_additional_sizes:
            pixmap = icon.pixmap(size, QIcon.Selected, QIcon.On)
            self.alternate_icon.addPixmap(pixmap, QIcon.Disabled, QIcon.On)
        super(StreamButton, self).setIcon(icon)
Ejemplo n.º 11
0
 def setupStatusIcon(self):
     icon = QIcon()
     icon.addPixmap(QPixmap(":/clock.svg"), QIcon.Normal, QIcon.Off)
     self.statusIcon = QSystemTrayIcon(self)
     self.statusIcon.setIcon(icon)
     self.statusIcon.activated.connect(lambda: self.hide()
                                       if self.isVisible()
                                       else self.show())
     self.statusIcon.setToolTip("Mark's Time Tracker")
     self.statusIcon.show()
Ejemplo n.º 12
0
def _init_icon():
    """Initialize the icon of qutebrowser."""
    icon = QIcon()
    for size in (16, 24, 32, 48, 64, 96, 128, 256, 512):
        filename = ':/icons/qutebrowser-{}x{}.png'.format(size, size)
        pixmap = QPixmap(filename)
        qtutils.ensure_not_null(pixmap)
        icon.addPixmap(pixmap)
    qtutils.ensure_not_null(icon)
    qApp.setWindowIcon(icon)
Ejemplo n.º 13
0
    def initUI(self, haveAuto):

        vbox = QVBoxLayout(self)

        top = QFrame(self)
        top.setFrameShape(QFrame.StyledPanel)

        bottom = QFrame(self)
        bottom.setFrameShape(QFrame.StyledPanel)

        grid1 = QGridLayout()
        grid1.setSpacing(10)
        self.lineLabel = []
        self.lineEdit = []

        for i in range(len(self.label)):
            self.lineLabel.append(QLabel(self.label[i]))
            self.lineEdit.append(QLineEdit('%s' % self.value[i]))

            grid1.addWidget(self.lineLabel[i], i, 0)
            grid1.addWidget(self.lineEdit[i], i, 1)

        top.setLayout(grid1)

        grid2 = QGridLayout()
        grid2.setSpacing(5)

        autoButton = QPushButton(self.tr("Auto"))
        okButton = QPushButton(self.tr("OK"))
        cancelButton = QPushButton(self.tr("Cancel"))

        autoButton.clicked.connect(self.cbAuto)
        okButton.clicked.connect(self.cbOK)
        cancelButton.clicked.connect(self.cbCancel)

        if haveAuto:
            grid2.addWidget(autoButton, 0, 0)
        grid2.addWidget(okButton, 0, 1)
        grid2.addWidget(cancelButton, 0, 2)

        bottom.setLayout(grid2)

        vbox.addWidget(top)
        vbox.addWidget(bottom)

        self.setLayout(vbox)

        self.resize(50, 50)
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
        self.setWindowTitle(self.title)
        iconWT = QIcon()
        iconWT.addPixmap(QPixmap(":images/DXF2GCODE-001.ico"), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(QIcon(iconWT))

        self.exec_()
Ejemplo n.º 14
0
 def setupToolButton(self, actionText, shortcut, actionName, rc_path):
     toolbutton = QToolButton(self)
     toolbutton.setPopupMode(QToolButton.InstantPopup)
     if app().prefs.show_icon_labels:
         toolbutton.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
     # toolbutton.setText(QApplication.translate("MainWindow", actionText, None))
     icon = QIcon()
     icon.addPixmap(QPixmap(rc_path), QIcon.Normal, QIcon.Off)
     toolbutton.setIcon(icon)
     self.addWidget(toolbutton)
     return toolbutton
Ejemplo n.º 15
0
 def setup_help_button(self):
     size_policy = constants.default_size_policy(self.helpButton, QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.helpButton.setSizePolicy(size_policy)
     self.helpButton.setMinimumSize(QSize(80, 80))
     self.helpButton.setMaximumSize(QSize(80, 80))
     self.helpButton.setText("")
     icon3 = QIcon()
     icon3.addPixmap(QPixmap(self.battleWindow.config.theme_selected.get_help_button_pixmap()), QIcon.Normal, QIcon.Off)
     self.helpButton.setIcon(icon3)
     self.helpButton.setIconSize(QSize(75, 75))
     self.gridLayout.addWidget(self.helpButton, 0, 1, 2, 1)
Ejemplo n.º 16
0
 def draw_pions(self, mat_jeu):
     """
     :param jeu: type list contenant des types Pions
     :return:
     """
     for i in range(N):
         for j in range(N):
             icon = QIcon()
             # utilisation de la méthode get() de la classe python dictionnaire pour la fonctionnalité valeur par défaut
             icon.addPixmap(QPixmap(RESSOURCES + self.image_pion.get(mat_jeu[i][j], "")), QIcon.Normal, QIcon.Off)
             self.btn[(i, j)].setIcon(icon)
Ejemplo n.º 17
0
 def stop_case(self):
     run_icon = QIcon()
     run_icon.addPixmap(QPixmap(self.config.images + '/run.png'), QIcon.Normal, QIcon.Off)
     self.run_stop_btn.setIcon(run_icon)          # change icon
     self.run_stop_btn.setText("Run")
     self.running = False
     try:
         self.tester.stop()
         self.tester.stop_server()
     except Exception as e:
         self.add_log(str(e))
Ejemplo n.º 18
0
 def setup_end_unit_button(self):
     size_policy = constants.default_size_policy(self.endUnitTurnButton, QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.endUnitTurnButton.setSizePolicy(size_policy)
     self.endUnitTurnButton.setMinimumSize(QSize(45, 45))
     self.endUnitTurnButton.setMaximumSize(QSize(45, 45))
     self.endUnitTurnButton.setText("")
     icon1 = QIcon()
     icon1.addPixmap(self.battleWindow.config.theme_selected.get_end_button_pixmap(), QIcon.Normal, QIcon.Off)
     self.endUnitTurnButton.setIcon(icon1)
     self.endUnitTurnButton.setIconSize(QSize(40, 40))
     self.gridLayout.addWidget(self.endUnitTurnButton, 6, 1, 1, 1, Qt.AlignCenter)
Ejemplo n.º 19
0
 def setup_next_target_button(self):
     size_policy = constants.default_size_policy(self.nextTargetButton, QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.nextTargetButton.setSizePolicy(size_policy)
     self.nextTargetButton.setMinimumSize(QSize(45, 45))
     self.nextTargetButton.setMaximumSize(QSize(45, 45))
     self.nextTargetButton.setText("")
     icon = QIcon()
     icon.addPixmap(QPixmap(self.battleWindow.config.theme_selected.get_target_button_pixmap()), QIcon.Normal, QIcon.Off)
     self.nextTargetButton.setIcon(icon)
     self.nextTargetButton.setIconSize(QSize(40, 40))
     self.gridLayout.addWidget(self.nextTargetButton, 5, 1, 1, 1, Qt.AlignCenter)
Ejemplo n.º 20
0
 def setup_auto_combat_button(self):
     size_policy = constants.default_size_policy(self.autoCombatButton, QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.autoCombatButton.setSizePolicy(size_policy)
     self.autoCombatButton.setMinimumSize(QSize(90, 90))
     self.autoCombatButton.setMaximumSize(QSize(90, 90))
     self.autoCombatButton.setText("")
     icon4 = QIcon()
     icon4.addPixmap(QPixmap(self.battleWindow.config.theme_selected.get_autocombat_button_pixmap()), QIcon.Normal, QIcon.Off)
     self.autoCombatButton.setIcon(icon4)
     self.autoCombatButton.setIconSize(QSize(80, 80))
     self.gridLayout.addWidget(self.autoCombatButton, 12, 1, 1, 1)
Ejemplo n.º 21
0
 def stop_case(self):
     # set icon
     run_icon = QIcon()
     run_icon.addPixmap(QPixmap(self.config.images + '/run.png'), QIcon.Normal, QIcon.Off)
     self.run_btn.setIcon(run_icon)
     self.run_btn.setText("Run")
     self.is_running = False
     try:
         self.tester.stop()
         self.tester.stop_server()
     except Exception as e:
         self.add_info_console("<font color='red'>" + str(e) + "</font>")
Ejemplo n.º 22
0
 def button_style(self, button, image_path, text):
     icon = QIcon()
     config = Config()
     icon.addPixmap(QPixmap(config.images + image_path), QIcon.Normal, QIcon.Off)
     button.setIcon(icon)
     button.setText('')
     button.setToolTip(text)
     button.resize(50, 50)
     button.setStyleSheet(
         # 'QPushButton{border-width:0px; background:transparent;} '
         'border:none; '
     )
Ejemplo n.º 23
0
 def cambios_video(self, state):
     if self.media.state() == QMediaPlayer.PlayingState:
         icon = QIcon()
         icon.addPixmap(QPixmap(":/img/pausa.png"), QIcon.Normal, QIcon.Off)
         self.reproducir.setIcon(icon)
         self.reproducir.setToolTip(' Pausar Video o Audio ')
         QToolTip.setFont(QFont('Cascadia Code PL', 18))
     else:
         icon = QIcon()
         icon.addPixmap(QPixmap(":/img/play.svg"), QIcon.Normal, QIcon.Off)
         self.reproducir.setIcon(icon)
         self.reproducir.setToolTip(' Reproducir Video o Audio ')
         QToolTip.setFont(QFont('Cascadia Code PL', 18))
Ejemplo n.º 24
0
 def __init__(self, parent=None):
     super(MainDialog, self).__init__(parent)
     self.setupUi(self)
     self.setWindowIcon(QIcon(resource_path('assets/weather.ico')))
     icon = QIcon()
     icon.addPixmap(QPixmap(resource_path("assets/search.png")),
                    QIcon.Normal, QIcon.Off)
     self.pushButton.setIcon(icon)
     self.pushButton.setIconSize(QtCore.QSize(30, 30))
     self.pushButton.setAutoRepeatDelay(200)
     self.flag = 0
     self.gridLayout = QGridLayout(self.groupBox)
     self.pushButton.clicked.connect(self.push_info)
Ejemplo n.º 25
0
def _init_icon():
    """Initialize the icon of qutebrowser."""
    icon = QIcon()
    fallback_icon = QIcon()
    for size in (16, 24, 32, 48, 64, 96, 128, 256, 512):
        filename = ':/icons/qutebrowser-{}x{}.png'.format(size, size)
        pixmap = QPixmap(filename)
        qtutils.ensure_not_null(pixmap)
        fallback_icon.addPixmap(pixmap)
    qtutils.ensure_not_null(fallback_icon)
    icon = QIcon.fromTheme('qutebrowser', fallback_icon)
    qtutils.ensure_not_null(icon)
    qApp.setWindowIcon(icon)
Ejemplo n.º 26
0
    def run_case(self, devices, data_line_number):
        # change icon
        stop_icon = QIcon()
        stop_icon.addPixmap(QPixmap(self.config.images + '/stop.png'), QIcon.Normal, QIcon.Off)
        self.run_btn.setIcon(stop_icon)
        self.run_btn.setText("Stop")
        self.is_running = True
        if not devices:
            return
        self.tester.select_devices(devices)

        self.data_line = data_line_number
        self.run()  # run
Ejemplo n.º 27
0
 def __init__(self, processor, parent=None):
     """
         Имя должно быть уникальным!
     """
     super().__init__(parent)
     self.parent = parent
     if hasattr(self, 'settings'):
         icon = QIcon()
         icon.addPixmap(QPixmap(":/icons/cog_wheel.png"), QIcon.Normal)
         self.setIcon(icon)
     self.processor = processor
     self.name = 'Abstact' if not hasattr(self, 'name') else self.name
     self.setText(self.name)
Ejemplo n.º 28
0
 def setup_retreat_button(self):
     size_policy = constants.default_size_policy(self.retreatButton, QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.retreatButton.setSizePolicy(size_policy)
     self.retreatButton.setMinimumSize(QSize(45, 45))
     self.retreatButton.setMaximumSize(QSize(45, 45))
     self.retreatButton.setToolTip("")
     self.retreatButton.setWhatsThis("")
     self.retreatButton.setText("")
     icon2 = QIcon()
     icon2.addPixmap(QPixmap(self.battleWindow.config.theme_selected.get_retreat_button_pixmap()), QIcon.Normal, QIcon.Off)
     self.retreatButton.setIcon(icon2)
     self.retreatButton.setIconSize(QSize(42, 40))
     self.gridLayout.addWidget(self.retreatButton, 7, 1, 1, 1, Qt.AlignCenter)
Ejemplo n.º 29
0
 def on_cb(self): #Devin
     x=0
     for b in button_list:
         URL = random_keys[x]
         with urllib.request.urlopen(URL) as url:
             f = io.BytesIO(url.read())
         img = Image.open(f).convert('L')
         my_image = ImageQt(img)
         icon = QIcon()
         pixmap = QPixmap.fromImage(my_image)
         pixmap = pixmap.scaled(150, 150)
         icon.addPixmap(pixmap)
         b.setIcon(icon)
         x += 1
Ejemplo n.º 30
0
def load_icon(name: AutoKeyIcon) -> QIcon:
    file_path = ICON_PATH_PREFIX + "/" + name.value
    icon = QIcon(file_path)
    if not icon.availableSizes() and file_path.endswith(".svg"):
        # FIXME: Work around Qt Bug: https://bugreports.qt.io/browse/QTBUG-63187
        # Manually render the SVG to some common icon sizes.
        icon = QIcon()  # Discard the bugged QIcon
        renderer = QSvgRenderer(file_path)
        for size in (16, 22, 24, 32, 64, 128):
            pixmap = QPixmap(QSize(size, size))
            pixmap.fill(QColor(255, 255, 255, 0))
            renderer.render(QPainter(pixmap))
            icon.addPixmap(pixmap)
    return icon
Ejemplo n.º 31
0
    def slotAdvanced(self):
        icon_path = None
        if self.ui.scrollArea.isVisible():
            icon_path = ":/gui/pics/expand.png"
            self.time_line.start()
        else:
            self.ui.scrollArea.show()
            icon_path = ":/gui/pics/collapse.png"
            self.time_line.start()

        icon = QIcon()
        icon.addPixmap(QPixmap(icon_path), QIcon.Normal, QIcon.Off)
        self.ui.addMoreUsers.setIcon(icon)
        self.checkUsers()
Ejemplo n.º 32
0
    def initSettingGroups(self):
        '''
        Adds setting groups as ListItems and connects them to their specific
        widgets.
        '''
        # Server settings - Index 0
        item = QListWidgetItem()
        icon = QIcon()
        icon.addPixmap(QPixmap(':/icons/network.svg'), QIcon.Normal, QIcon.On)
        item.setIcon(icon)
        self.listWidget.addItem(item)

        self.widgetServerSettings = ServerSettingsWidget(self)
        self.stackedWidget.addWidget(self.widgetServerSettings)
Ejemplo n.º 33
0
 def icons(self, x, cb):
     URL = random_keys[x]
     with urllib.request.urlopen(URL) as url:
         f = io.BytesIO(url.read())
     if not cb:
         img = Image.open(f)
     else:
         img = Image.open(f).convert("L")  #Changes the colour - Anna
     my_image = ImageQt(img)
     pixmap = QPixmap.fromImage(my_image)
     pixmap = pixmap.scaled(150, 150)
     icon = QIcon()
     icon.addPixmap(pixmap)
     return icon
Ejemplo n.º 34
0
    def addToTable(self, fileData):
        nameColumn = QListWidgetItem(fileData['fileName'])
        iconPath = ':/icons/' + fileData['typ'] + '.png'
        itemIcon = QIcon()
        itemIcon.addPixmap(QPixmap(iconPath), QIcon.Normal, QIcon.Off)
        nameColumn.setIcon(itemIcon)
        fileData['status'] = '0'
        nameColumn.setData(Qt.UserRole, fileData)

        color = QColor(Qt.green)
        color.setAlpha(int(fileData['status']))
        nameColumn.setData(Qt.BackgroundRole, color)

        self.ui.listWidget.addItem(nameColumn)
Ejemplo n.º 35
0
    def __init__(self, principale=None):
        QMainWindow.__init__(self)
        self.principale = principale
        self.setupUi(self)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        try:
            icon = QIcon()
            icon.addPixmap(QPixmap(ICON_APP), QIcon.Normal, QIcon.Off)
            self.setWindowIcon(icon)
        except:
            print("Erreur de chargement de l'icone")

        self.navigator = Navigator(self)
        self.verticalLayout.addWidget(self.navigator, 1)
Ejemplo n.º 36
0
 def __init__(self, *args):
     super().__init__(*args)
     self.setToolTip("search case")
     search_icon = QIcon()
     config = Config()
     search_icon.addPixmap(QPixmap(config.images + '/search.png'), QIcon.Normal, QIcon.Off)
     self.setIcon(search_icon)
     # self.setText("Search")
     self.setCursor(Qt.PointingHandCursor)
     self.setFixedSize(22, 22)
     self.setStyleSheet(
         # "QPushButton{border-width:0px; background:transparent;} "
         "border:none; "
     )
Ejemplo n.º 37
0
 def open_pl_menu(self, position):
     menu = QMenu()
     # if len(self.combo_pl_names) > 0:
     play_now = menu.addAction("Play this playlist now")
     pl_now_icon = QIcon()
     pl_now_icon.addPixmap(QPixmap(":icons/play.png"), QIcon.Normal, QIcon.Off)
     play_now.setIcon(pl_now_icon)
     add_to_current = menu.addAction("Add this playlist to Now Playing")
     add_curr_icon = QIcon()
     add_curr_icon.addPixmap(QPixmap(":icons/add.png"), QIcon.Normal, QIcon.Off)
     add_to_current.setIcon(add_curr_icon)
     new_playlist = menu.addAction("Add New Playlist")
     new_pl_icon = QIcon()
     new_pl_icon.addPixmap(QPixmap(":icons/playlist_add.png"), QIcon.Normal, QIcon.Off)
     new_playlist.setIcon(new_pl_icon)
     create_from_albums = menu.addAction("Create play lists from Album names")
     create_icon = QIcon()
     create_icon.addPixmap(QPixmap(":icons/book_cd.png"), QIcon.Normal, QIcon.Off)
     create_from_albums.setIcon(create_icon)
     if len(self.combo_pl_names) <= 0:
         play_now.setEnabled(False)
         add_to_current.setEnabled(False)
     action = menu.exec_(self.combo_pl_names.mapToGlobal(position))
     if action == play_now:
         # print("Play this one now :- " + self.combo_pl_names.currentText())
         my_func.play_list_now(self)
     if action == add_to_current:
         # print("Add this one to Now Playing :- " + self.combo_pl_names.currentText())
         my_func.add_play_list_to_now(self)
     if action == new_playlist:
         # print("I want to add a new playlist")
         my_func.add_new_playlist(self)
     if action == create_from_albums:
         # print("Create play lists from Album names")
         my_func.make_playlists_from_albums(self)
Ejemplo n.º 38
0
 def createBtnMenu(self):
     btnMenu = QMenu()
     icon = QIcon()
     icon.addPixmap(QPixmap(":/icon/add_file.png"), QIcon.Normal, QIcon.Off)
     addNodeMemoAction = QAction(icon, '新增子备忘', self)
     addNodeMemoAction.triggered.connect(
         lambda: self.creatememo(self.treeWidget.currentItem(), "child"))
     icon.addPixmap(QPixmap(":/icon/add_file.png"), QIcon.Normal, QIcon.Off)
     addMemoAction = QAction(icon, '新增平级备忘', self)
     addMemoAction.triggered.connect(
         lambda: self.creatememo(self.treeWidget.currentItem(), "same"))
     icon.addPixmap(QPixmap(":/icon/add_dir.png"), QIcon.Normal, QIcon.Off)
     addNodeDirAction = QAction(icon, '新增子文件夹', self)
     addNodeDirAction.triggered.connect(
         lambda: self.createDir(self.treeWidget.currentItem(), "child"))
     icon.addPixmap(QPixmap(":/icon/add_dir.png"), QIcon.Normal, QIcon.Off)
     addDirAction = QAction(icon, '新增平级文件夹', self)
     addDirAction.triggered.connect(
         lambda: self.createDir(self.treeWidget.currentItem(), "same"))
     btnMenu.addAction(addNodeMemoAction)
     btnMenu.addAction(addMemoAction)
     btnMenu.addSeparator()  # 分割行
     btnMenu.addAction(addNodeDirAction)
     btnMenu.addAction(addDirAction)
     self.showMenuButton.setMenu(btnMenu)
Ejemplo n.º 39
0
def load_icon(name: AutoKeyIcon) -> QIcon:
    file_path = ICON_PATH_PREFIX + "/" + name.value
    icon = QIcon(file_path)
    if not icon.availableSizes() and file_path.endswith(".svg"):
        # FIXME: Work around Qt Bug: https://bugreports.qt.io/browse/QTBUG-63187
        # Manually render the SVG to some common icon sizes.
        icon = QIcon()  # Discard the bugged QIcon
        renderer = QSvgRenderer(file_path)
        for size in (16, 22, 24, 32, 64, 128):
            pixmap = QPixmap(QSize(size, size))
            pixmap.fill(QColor(255, 255, 255, 0))
            renderer.render(QPainter(pixmap))
            icon.addPixmap(pixmap)
    return icon
Ejemplo n.º 40
0
    def init_UI(self):

        self._label_path = QLabel('Path', self)
        self._label_URL = QLabel('URL', self)
        self._label_log = QLabel('Log', self)

        self._button_explore = QPushButton('Explore', self)
        self._button_download = QPushButton('Download', self)
        self._button_explore.setToolTip(
            'Press this button to select the save path')
        self._button_explore.clicked.connect(self._action_explore)
        self._button_download.setToolTip(
            'Press this button to download images')
        self._button_download.clicked.connect(self._action_download)

        self._text_path = QLineEdit(self)
        self._text_path.setToolTip('Enter the save path here')
        self._text_URL = QLineEdit(self)
        self._text_URL.setToolTip('Enter the Tieba URL here')
        self._text_log = QTextEdit(self)
        self._text_log.setToolTip('Logs are shown here')

        grid = QGridLayout(self)
        grid.setSpacing(10)

        grid.addWidget(self._label_path, 1, 0)
        grid.addWidget(self._text_path, 1, 1)
        grid.addWidget(self._button_explore, 1, 2)

        grid.addWidget(self._label_URL, 2, 0)
        grid.addWidget(self._text_URL, 2, 1)
        grid.addWidget(self._button_download, 2, 2)

        grid.addWidget(self._label_log, 3, 0)
        grid.addWidget(self._text_log, 3, 1, 5, 1)

        # 设置Icon 和背景图片
        icon = QIcon()
        # C++ reference
        # void QIcon::addPixmap(const QPixmap &pixmap, Mode mode = Normal, State state = Off)
        icon.addPixmap(QPixmap('icon.jpg'), mode=QIcon.Normal, state=QIcon.On)
        self.setWindowIcon(icon)
        palette = QPalette()
        palette.setBrush(QPalette.Background, QBrush(QPixmap("bg.jpg")))
        self.setPalette(palette)

        self.setLayout(grid)
        self.setGeometry(500, 300, 400, 300)
        self.setWindowTitle('Tieba Image Downloader')
        self.show()
Ejemplo n.º 41
0
 def loadIcon(self, iconName):
     """Load icon from iconPath, add to dictionary and return the icon.
     """
     icon = QIcon()
     for path in self.pathList:
         for ext in IconDict.iconExt:
             fileName = iconName + ext
             pixmap = QPixmap(os.path.join(path, fileName))
             if not pixmap.isNull():
                 icon.addPixmap(pixmap)
             if not icon.isNull():
                 self[iconName] = icon
                 return icon
     return None
Ejemplo n.º 42
0
    def init_game(self):
        self.interrupted = False
        self.n_pairs = 0
        self.previous = ''
        self.previous_btn = None
        self.last_one = None
        self.clicks = 0
        self.intentos = 0
        self.l_1 = QLabel('Intentos: {}'.format(self.intentos))
        self.l_count = QLabel('Tiempo:  ')
        self.hide_btn = QPushButton('Ocultar')
        self.matrix = [[], [], [], [], []]
        self.button_dict = {}
        self.folder_path = 'Imgs/'
        self.imgs_id = [str(i) for i in range(1, 13)] * 2 + ['b']
        grid = QGridLayout()
        for i in range(5):
            for j in range(5):
                btn = QPushButton()
                btn.setFixedSize(50, 50)
                grid.addWidget(btn, i, j)
                icon = QIcon()
                path = 'Imgs/back.png'
                pixmap = QPixmap(path)
                icon.addPixmap(pixmap)
                btn.setIcon(icon)
                btn.setIconSize(QSize(50, 50))

                img_id_chosen = random.choice(self.imgs_id)
                self.imgs_id.remove(img_id_chosen)
                self.matrix[i].append(img_id_chosen)
                self.button_dict[btn] = (i, j)

                btn.clicked.connect(self.click_btn)

        self.hide_btn.clicked.connect(self.hide_click_btn)

        v_box = QVBoxLayout()
        v_box.addWidget(self.l_1)
        v_box.addWidget(self.l_count)
        v_box.addLayout(grid)
        v_box.addWidget(self.hide_btn)

        self.setLayout(v_box)

        self.hide_btn.setShortcut('Ctrl+A')
        for btn in self.button_dict.keys():
            btn.blocked = False

        self.show()
Ejemplo n.º 43
0
    def player_state(self, event):
        ''' event handler that adjust the play/pause icon '''

        if event == QMediaPlayer.PlayingState:
            pauseIcon = QIcon()
            pauseIcon.addPixmap(
                QPixmap(os.path.join(RES_PATH, "pauseIcon.svg")), QIcon.Normal,
                QIcon.Off)
            self.playBtn.setIcon(pauseIcon)
        elif event == QMediaPlayer.PausedState:
            playIcon = QIcon()
            playIcon.addPixmap(QPixmap(os.path.join(RES_PATH, "playIcon.svg")),
                               QIcon.Normal, QIcon.Off)
            self.playBtn.setIcon(playIcon)
Ejemplo n.º 44
0
 def __init__(self, *args):
     super().__init__(*args)
     self.setToolTip("search case")
     search_icon = QIcon()
     config = Config()
     search_icon.addPixmap(QPixmap(config.images + '/search.png'),
                           QIcon.Normal, QIcon.Off)
     self.setIcon(search_icon)
     # self.setText("Search")
     self.setCursor(Qt.PointingHandCursor)
     self.setFixedSize(22, 22)
     self.setStyleSheet(
         # "QPushButton{border-width:0px; background:transparent;} "
         "border:none; ")
Ejemplo n.º 45
0
 def initData(self):
     # 初始化分组arrow图标
     icon = QIcon()
     icon.addPixmap(QPixmap("resources/arrow_right.png"), state=QIcon.Off)
     icon.addPixmap(QPixmap("resources/arrow_down.png"), state=QIcon.On)
     cache.item_icon = icon
     del icon
     groups = Groups.select()  # 查询所有分组
     print(groups.sql)
     for group in groups:
         print(group.id, group.name)
         # 根据数据动态生成item
         item = User_Item(self.groupTreeWidget, group.name)
         item.setUsers(Users.where(Users.gid == group.id).select())
Ejemplo n.º 46
0
 def windowSizeChange(self):
     icon = QIcon()
     if self.isMaximized():
         self.showNormal()
         icon.addPixmap(QPixmap(":/icon/maxSize.png"), QIcon.Normal,
                        QIcon.Off)
         self.sizePushButton.setIcon(icon)
         self.sizePushButton.setIconSize(QtCore.QSize(10, 10))
     else:
         self.showMaximized()
         icon.addPixmap(QPixmap(":/icon/norSize.png"), QIcon.Normal,
                        QIcon.Off)
         self.sizePushButton.setIcon(icon)
         self.sizePushButton.setIconSize(QtCore.QSize(10, 10))
Ejemplo n.º 47
0
    def update_toolbar(self):
        iconTextBold = QIcon()
        iconTextBold.addPixmap(QPixmap(":/images/icons/b.jpg"), QIcon.Normal,
                               QIcon.Off)
        iconTextItalic = QIcon()
        iconTextItalic.addPixmap(QPixmap(":/images/icons/i.jpg"), QIcon.Normal,
                                 QIcon.Off)
        iconTextUnderline = QIcon()
        iconTextUnderline.addPixmap(QPixmap(":/images/icons/u.jpg"),
                                    QIcon.Normal, QIcon.Off)
        self.chat.bold = QAction(iconTextBold, 'Bold', self.chat)
        self.chat.bold.setCheckable(True)
        self.chat.italic = QAction(iconTextItalic, 'Italic', self.chat)
        self.chat.italic.setCheckable(True)
        self.chat.underline = QAction(iconTextUnderline, 'Underline',
                                      self.chat)
        self.chat.underline.setCheckable(True)

        self.chat.bold.triggered.connect(self.set_text_format(self.chat.bold))
        self.chat.italic.triggered.connect(
            self.set_text_format(self.chat.italic))
        self.chat.underline.triggered.connect(
            self.set_text_format(self.chat.underline))

        smiles_icn = QIcon()
        smiles_icn.addPixmap(QPixmap(":/images/smiles/blum1.gif"))
        self.chat.smiles_btn = QToolButton()
        self.chat.smiles_btn.setIcon(smiles_icn)
        self.chat.smiles_btn.setMenu(self.get_smiles())
        self.chat.smiles_btn.clicked.connect(self.chat.smiles_btn.showMenu)

        self.chat.toolbar.addWidget(self.chat.smiles_btn)
        self.chat.toolbar.addAction(self.chat.bold)
        self.chat.toolbar.addAction(self.chat.italic)
        self.chat.toolbar.addAction(self.chat.underline)
Ejemplo n.º 48
0
        def __init__(self):
            QWidget.__init__(self)
            self.setFixedSize(800, 680)
            self.setWindowTitle('دفة')
            self.setStyleSheet("background-color: white")

            logoLabel = QLabel(self)
            pixmap = QPixmap("pic/logo_vsmall.png")
            pixmap.scaled(15, 10)
            logoLabel.setPixmap(pixmap)
            logoLabel.resize(250, 150)

            userLabel = QLabel(self)
            pixmap = QPixmap("pic/user1.png")
            pixmap.scaled(15, 10)
            userLabel.setPixmap(pixmap)
            userLabel.resize(250, 150)
            userLabel.move(570, 0)

            # define startButton
            startButton = QPushButton('', self)
            # set image to startButton
            icon = QIcon()
            icon.addPixmap(QPixmap('pic/start.png'))
            startButton.setIcon(icon)
            startButton.setStyleSheet("background-color: white")
            startButton.setStyleSheet("border: none")
            startButton.resize(226, 200)
            startButton.setIconSize(QSize(250, 190))
            # set startButton position
            startButton.move(100, 300)

            # define dashboardButton
            dashboardButton = QPushButton('', self)
            # set image to dashboardButton
            icon = QIcon()
            icon.addPixmap(QPixmap('pic/dashboard.png'))
            dashboardButton.setIcon(icon)
            dashboardButton.setStyleSheet("background-color: white")
            dashboardButton.setStyleSheet("border: none")
            dashboardButton.resize(226, 200)
            dashboardButton.setIconSize(QSize(250, 190))
            # set nextButton position
            dashboardButton.move(500, 300)

            self.timerInterface = activeTime.timerInterface()
            self.dashboardInterface = activeTime.dashboardInterface()
            startButton.clicked.connect(self.next)
            dashboardButton.clicked.connect(self.nextDashboard)
Ejemplo n.º 49
0
 def items_found(self):
     self.log.info('Tool button: btnSearchItems clicked')
     self.searchList.clear()
     criteria = self.parent.searchLine.text().upper().strip()
     found = False
     for item in self.item_service.list():
         if criteria in item.name.upper().strip() or criteria in item.category.upper().strip() \
                 or criteria in item.item_type.upper().strip() or criteria in item.attributes.upper().strip() \
                 or criteria in item.found_at.upper().strip() or criteria in item.dropped_by.upper().strip():
             self.log.info('Found: {} found with this criteria({})'.format(
                 item, criteria))
             self.searchList.setViewMode(QListView.ListMode)
             list_item = QListWidgetItem()
             item_icon = QIcon()
             item_image_right = item.image.replace('b"b', '').replace(
                 "'", '').replace('"', '')
             item_image = self.parent.itemInformationUi.str_to_rgb(
                 item_image_right)
             height, width, channel = item_image.shape
             bytes_per_line = 3 * width
             q_img = QImage(item_image.data, width, height, bytes_per_line,
                            QImage.Format_RGB888).rgbSwapped()
             item_icon.addPixmap(QPixmap(q_img), QIcon.Normal, QIcon.Off)
             list_item.setIcon(item_icon)
             list_item.setText(
                 f'{item.name} - {item.category} - {item.item_type}'
                 f' - {item.description} - {item.attributes} -'
                 f' {item.dropped_by} - {item.found_at}')
             list_item.setWhatsThis(item.entity_id)
             self.searchList.addItem(list_item)
             self.entities_id_list.append(f'{list_item.whatsThis()}')
             found = True
     if found is False:
         self.log.info(
             'Not found: No items are found with this criteria({})'.format(
                 criteria))
         message = QMessageBox()
         message.setStyleSheet("""
                                 background-color: rgb(0, 0, 0); 
                                 font: 12pt 'URW Bookman L'; 
                                 color: rgb(238, 238, 236); 
                                 gridline-color: rgb(46, 52, 54); 
                                 selection-color: rgb(0, 0, 0); 
                                 selection-background-color: rgb(181, 0, 0);
                                 """)
         message.setText('No items found matching these criteria')
         message.setWindowTitle('Sorry...')
         message.setStandardButtons(QMessageBox.Ok)
         message.exec_()
Ejemplo n.º 50
0
    def state_refresh(self):
        if self.statis.state == 1:
            self.statis.state = 0
            #print(self.statis.label_return)#标签
            start = QDate.currentDate()
            #print(start.toString(Qt.DefaultLocaleLongDate))#开始的年月日
            time_start = QTime.currentTime()
            print(time_start.toString(Qt.DefaultLocaleLongDate))  #开始的时分秒
            self.set_begin(
                start.toString(Qt.DefaultLocaleLongDate),  #zd
                time_start.toString(Qt.DefaultLocaleLongDate),
                self.statis.label_return)
            icon = QIcon()
            icon.addPixmap(QPixmap(":/over/over.png"))
            self.pushButton.setIcon(icon)
            icon1 = QIcon()
            icon1.addPixmap(QPixmap(":/stop/on.png"))
            self.pushButton_2.setIcon(icon1)
            self.label.setText(self.statis.label_return)

            if self.statis.time_button == 0:
                self.time_start_up = time_start
                self.lcd1.setVisible(True)
                self.lcd2.setVisible(False)
            else:
                hour = int(time_start.hour()) + int(
                    self.statis.hour_time_return)
                minute = int(time_start.minute()) + int(
                    self.statis.minute_time_return)
                second = int(time_start.second()) + int(
                    self.statis.second_time_return)
                msec = int(self.statis.hour_time_return) * 3600 * 1000 + int(
                    self.statis.minute_time_return) * 60 * 1000 + int(
                        self.statis.second_time_return) * 1000
                self.time_start_data = start
                if second >= 60:
                    minute += 1
                if minute >= 60:
                    hour += 1
                if hour >= 24:
                    self.time_start_data = start.addDays(1)
                self.time_start_up = time_start
                self.time_start_fall = time_start.addMSecs(msec)
                self.lcd1.setVisible(False)
                self.lcd2.setVisible(True)

        if self.statis.state == 2:
            self.statis.state = 0
            self.state_start_end += 1
Ejemplo n.º 51
0
    def layerOverlay(self):
        # self.messageBox = QMessageBox()
        # self.messageBox.setWindowTitle('图层叠加')
        # icon = QIcon()
        # icon.addPixmap(QtGui.QPixmap('../icon/mainWindow.ico'))
        # self.messageBox.setWindowIcon(icon)
        # self.messageBox.setText('是否将处理后的图层叠加到原图层上?')
        # self.messageBox.addButton(QPushButton('确定'), QMessageBox.YesRole)
        # self.messageBox.addButton(QPushButton('取消'), QMessageBox.NoRole)
        # self.messageBox.exec_()
        # print(self.messageBox.result())
        self.box = QMessageBox(QMessageBox.Question, "图层叠加",
                               "是否将处理后的图层叠加到原图层上?")
        icon = QIcon()
        icon.addPixmap(QtGui.QPixmap('../icon/mainWindow.ico'))
        self.box.setWindowIcon(icon)
        qyes = self.box.addButton(self.tr("确定"), QMessageBox.YesRole)
        qno = self.box.addButton(self.tr("取消"), QMessageBox.NoRole)
        self.box.exec_()
        if self.box.clickedButton() == qyes:
            if (self.OrImgPath == '' or self.BinaryImgPath == ''):
                QMessageBox.warning(self, "提示", "未读取图层照片或未处理照片",
                                    QMessageBox.Yes | QMessageBox.No,
                                    QMessageBox.Yes)
                return 0
            orImg = cv2.imread(self.OrImgPath)
            binbaryImg = cv2.imread(self.BinaryImgPath)
            #将二值化图片改成黄色
            np.where(binbaryImg[:, :, 1] > 0, binbaryImg[:, :, 1], 255)
            np.where(binbaryImg[:, :, 2] > 0, binbaryImg[:, :, 2], 255)
            binbaryImg[:, :, 0] = 0

            #保存图像半透明式覆盖原图层照片及其路径
            img = cv2.addWeighted(orImg, 0.95, binbaryImg, 0.05, 0)
            content, tempfilename = os.path.split(self.OrImgPath)
            filename, extension = os.path.splitext(tempfilename)
            filename = filename + str('_MergeImg') + extension
            filepath = os.path.join(content, filename)
            filepath = filepath.replace('\\', '/')
            self.MergeImgPath = filepath
            cv2.imwrite(filepath, img)
            #缩放尺寸,标签显示图片
            img = cv2.resize(
                img,
                (self.label_BinaryImg.height(), self.label_BinaryImg.width()))
            self.label_BinaryImg.setPixmap(
                QtGui.QPixmap.fromImage(self.cvimg_to_qtimg(img)))
        else:
            return 0
Ejemplo n.º 52
0
 def setup_auto_combat_button(self):
     size_policy = constants.default_size_policy(self.autoCombatButton,
                                                 QSizePolicy.Fixed,
                                                 QSizePolicy.Fixed)
     self.autoCombatButton.setSizePolicy(size_policy)
     self.autoCombatButton.setMinimumSize(QSize(90, 90))
     self.autoCombatButton.setMaximumSize(QSize(90, 90))
     self.autoCombatButton.setText("")
     icon4 = QIcon()
     icon4.addPixmap(
         QPixmap(self.battleWindow.config.theme_selected.
                 get_autocombat_button_pixmap()), QIcon.Normal, QIcon.Off)
     self.autoCombatButton.setIcon(icon4)
     self.autoCombatButton.setIconSize(QSize(80, 80))
     self.gridLayout.addWidget(self.autoCombatButton, 12, 1, 1, 1)
Ejemplo n.º 53
0
 def setup_help_button(self):
     size_policy = constants.default_size_policy(self.helpButton,
                                                 QSizePolicy.Fixed,
                                                 QSizePolicy.Fixed)
     self.helpButton.setSizePolicy(size_policy)
     self.helpButton.setMinimumSize(QSize(80, 80))
     self.helpButton.setMaximumSize(QSize(80, 80))
     self.helpButton.setText("")
     icon3 = QIcon()
     icon3.addPixmap(
         QPixmap(self.battleWindow.config.theme_selected.
                 get_help_button_pixmap()), QIcon.Normal, QIcon.Off)
     self.helpButton.setIcon(icon3)
     self.helpButton.setIconSize(QSize(75, 75))
     self.gridLayout.addWidget(self.helpButton, 0, 1, 2, 1)
Ejemplo n.º 54
0
def _init_icon():
    """Initialize the icon of qutebrowser."""
    fallback_icon = QIcon()
    for size in [16, 24, 32, 48, 64, 96, 128, 256, 512]:
        filename = ':/icons/qutebrowser-{size}x{size}.png'.format(size=size)
        pixmap = QPixmap(filename)
        if pixmap.isNull():
            log.init.warning("Failed to load {}".format(filename))
        else:
            fallback_icon.addPixmap(pixmap)
    icon = QIcon.fromTheme('qutebrowser', fallback_icon)
    if icon.isNull():
        log.init.warning("Failed to load icon")
    else:
        q_app.setWindowIcon(icon)
Ejemplo n.º 55
0
 def __init__(self, icon_name="", icon_size=60):
     self.status = True
     self.icon_name = icon_name
     self.icon_size = icon_size
     QPushButton.__init__(self)
     if icon_name != "":
         icon = QIcon()
         icon.addPixmap(QPixmap(self.icon_name + "_on.png"))
         self.setIcon(icon)
         self.setIconSize(QSize(self.icon_size, self.icon_size))
     self.setMinimumWidth(self.icon_size)
     self.setMinimumHeight(self.icon_size)
     # self.setCheckable(True)
     self.setStyleSheet(
         "QPushButton{ border: 0px;  background: none !important;}")
Ejemplo n.º 56
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(444, 383)
        icon = QIcon()
        icon.addPixmap(QPixmap("robotImages/small.png"), QIcon.Normal,
                       QIcon.Off)
        Form.setWindowIcon(icon)
        self.verticalLayout = QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")
        self.textEdit = QTextEdit(Form)
        self.textEdit.setObjectName("textEdit")
        self.verticalLayout.addWidget(self.textEdit)

        self.retranslateUi(Form)
        QMetaObject.connectSlotsByName(Form)
Ejemplo n.º 57
0
def MessageBox(title, text):
    error_stop()  # 停止翻译状态

    messageBox = QMessageBox()
    messageBox.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.WindowMaximizeButtonHint | Qt.MSWindowsFixedSizeDialogHint)
    # 窗口图标
    icon = QIcon()
    icon.addPixmap(QPixmap(folder_path + "/config/logo.ico"), QIcon.Normal, QIcon.On)
    messageBox.setWindowIcon(icon)
    # 设定窗口标题和内容
    messageBox.setWindowTitle(title)
    messageBox.setText(text)
    messageBox.addButton(QPushButton('好滴'), QMessageBox.YesRole)
    # 显示窗口
    messageBox.exec_()
Ejemplo n.º 58
0
def _init_icon():
    """Initialize the icon of qutebrowser."""
    icon = QIcon()
    fallback_icon = QIcon()
    for size in [16, 24, 32, 48, 64, 96, 128, 256, 512]:
        filename = ':/icons/qutebrowser-{}x{}.png'.format(size, size)
        pixmap = QPixmap(filename)
        if pixmap.isNull():
            log.init.warning("Failed to load {}".format(filename))
        else:
            fallback_icon.addPixmap(pixmap)
    icon = QIcon.fromTheme('qutebrowser', fallback_icon)
    if icon.isNull():
        log.init.warning("Failed to load icon")
    else:
        qApp.setWindowIcon(icon)
Ejemplo n.º 59
0
 def slotCheckCD(self):
     if self.check_media_stop:
         self.check_media_stop = False
         self.ui.progressBar.show()
         icon = QIcon()
         icon.addPixmap(QPixmap(":/gui/pics/dialog-error.png"), QIcon.Normal, QIcon.Off)
         self.ui.checkButton.setIcon(icon)
         self.ui.checkButton.setText("")
         self.checkMedia()
     else:
         self.check_media_stop = True
         self.ui.progressBar.show()
         icon = QIcon()
         icon.addPixmap(QPixmap(":/gui/pics/task-accepted.png"), QIcon.Normal, QIcon.Off)
         self.ui.checkButton.setIcon(icon)
         self.ui.checkButton.setText(_("Validate"))
    def getComboColor(self, index, curveName):
        combo_color = QComboBox()
        for i, colors in enumerate(self.color_tab):
            r, g, b = colors
            label = QIcon()
            color = QColor()
            color.setRgbF(r, g, b, 1.0)
            pixmap = QPixmap(20, 20)
            pixmap.fill(color)
            label.addPixmap(pixmap)
            combo_color.addItem("")
            combo_color.setItemIcon(i, label)
            combo_color.setFixedWidth(45)
        combo_color.setCurrentIndex(index % len(self.color_tab))
        combo_color.currentIndexChanged.connect(partial(self.graph.setColorLine, curveName))

        return combo_color