Python PyQt5.QtGui.QPixmap() Examples

The following are code examples for showing how to use PyQt5.QtGui.QPixmap(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: Micchinetta   Author: SqrtPapere   File: DialogWidget.py    MIT License 6 votes vote down vote up
def activate(self, user):
        """Method called to start and activate the dialog Thread"""
        self.dialog.clear()
        self.clear_table()
        db = FaceDatabase()

        img = db.get_image_for_ID(user)

        self.speech_dialog_manager.set_username(db.get_nickname(user));

        self.name.setText(db.get_nickname(user))

        self.image.resize(200, 400)
        
        if img is not None:
            qpix = QPixmap(img)

            self.image.setPixmap(qpix.scaled(self.image.size(), Qt.KeepAspectRatio, Qt.FastTransformation))
        else:
            self.image.setText("None")
        self.active.emit() 
Example 2
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    GNU General Public License v2.0 6 votes vote down vote up
def get_tray_icon(self):
        base64_data = '''iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHN
                         CSVQICAgIfAhkiAAAAQNJREFUOI3t1M9KAlEcxfHPmP0xU6Ogo
                         G0teoCiHjAIfIOIepvKRUE9R0G0KNApfy0c8hqKKUMrD9zVGc4
                         9nPtlsgp5n6qSVSk7cBG8CJ6sEX63UEcXz4jE20YNPbygPy25Q
                         o6oE+fEPXFF7A5yA9Eg2sQDcU3sJd6k89O4iiMcYKVol3rH2Mc
                         a1meZ4hMdNPCIj+SjHHfFZU94/0Nwlv4rWoY7vhrdeLNoO86bG
                         lym/ge3lsHDdI2fojbBG6sUtzOiQ1wQOwk6GwWKHeJyHtxOcFi
                         0TpFaxmnhNcyIW45bQ6RS3Hq4MeB7Ltyahki9Gd2xidWiwG9va
                         nCZqi7xlZGVHfwN6+5nU/ccBUYAAAAASUVORK5CYII='''

        pm = Qg.QPixmap()
        pm.loadFromData(base64.b64decode(base64_data))
        i = Qg.QIcon()
        i.addPixmap(pm)
        return i

    # OFF BY DEFAULT
    # 0.2 SEC DELAY TO LET USER FINISH TYPING BEFORE INPUT BECOMES A DB QUERY 
Example 3
Project: dcc   Author: amimo   File: DisasmViewMode.py    Apache License 2.0 6 votes vote down vote up
def draw(self, refresh=False):
        if self.dataModel.getOffset() in self.Paints:
            self.refresh = False
            self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
            self.drawAdditionals()
            return

        if self.refresh or refresh:
            qp = QtGui.QPainter()
            qp.begin(self.qpix)

            self.drawTextMode(qp)
            self.refresh = False
            qp.end()

        #        self.Paints[self.dataModel.getOffset()] = QtGui.QPixmap(self.qpix)
        self.drawAdditionals() 
Example 4
Project: dcc   Author: amimo   File: BinViewMode.py    Apache License 2.0 6 votes vote down vote up
def draw(self, refresh=False, row=0, howMany=0):
        if self.dataModel.getOffset() in self.Paints:
            self.refresh = False
            self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
            self.drawAdditionals()
            return

        if self.refresh or refresh:
            qp = QtGui.QPainter()
            qp.begin(self.qpix)
            start = time()
            if not howMany:
                howMany = self.ROWS

            self.drawTextMode(qp, row=row, howMany=howMany)
            end = time() - start
            log.debug('draw Time ' + str(end))
            self.refresh = False
            qp.end()

        #        self.Paints[self.dataModel.getOffset()] = QtGui.QPixmap(self.qpix)
        self.drawAdditionals() 
Example 5
Project: Dolphin-Updater   Author: nbear3   File: dolphinapp.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, user_data_control):
        super().__init__()
        sys.excepthook = self._displayError
        self._udc = user_data_control

        self.check = QPixmap("res/check.png")
        self.cancel = QPixmap("res/cancel.png")

        self.setGeometry(500, 500, 500, 465)
        self.init_ui()
        self.init_window()
        self.init_user_data()

        self.setWindowTitle(self.APP_TITLE)
        self.setWindowIcon(QIcon('res/rabbit.png'))
        center(self)
        self.show()

    # PyQt Error Handling 
Example 6
Project: Dolphin-Updater   Author: nbear3   File: dolphinapp.py    GNU General Public License v3.0 6 votes vote down vote up
def download_new(self):
        dolphin_dir = self.dolphin_dir.text()
        version = self.version.text()

        if self.current.text() == version:
            self.show_warning('You already have the most recent version.')
            return
        elif not os.path.isdir(dolphin_dir):
            self.show_warning('Your dolphin folder path is invalid.')
            self.dolphin_dir_status.setPixmap(QPixmap("res/cancel.png"))
            return

        if not self.download_thread.isRunning():
            if dir == 'Please Select a Dolphin Directory':
                self.show_warning('Please select a dolphin folder.')

            self.version.setText('')
            self.download_thread.update(dolphin_dir, version)
            self.download_thread.start() 
Example 7
Project: kucher   Author: Zubax   File: model.py    GNU General Public License v3.0 6 votes vote down vote up
def _data_decoration(self, index: QModelIndex) -> typing.Union[QPixmap, QVariant]:
        row, column = index.row(), index.column()
        node = self._unwrap(index)

        if node.register is not None:
            if column == self.ColumnIndices.VALUE:
                try:
                    return get_icon_pixmap({
                        _Node.State.PENDING: 'process',
                        _Node.State.SUCCESS: 'ok',
                        _Node.State.ERROR:   'error',
                    }[node.state], self._icon_size)
                except KeyError:
                    pass

            if column == self.ColumnIndices.FLAGS:
                return _draw_flags_icon(mutable=node.register.mutable,
                                        persistent=node.register.persistent,
                                        icon_size=self._icon_size)

        return QVariant() 
Example 8
Project: kucher   Author: Zubax   File: model.py    GNU General Public License v3.0 6 votes vote down vote up
def _draw_flags_icon(mutable: bool, persistent: bool, icon_size: int) -> QPixmap:
    """
    Combines icons into a single large icon and renders it into a pixmap of specified size.
    This operation is quite resource-consuming (we're drawing pictures after all, ask Picasso),
    so we cache the results in a LRU cache.
    """
    icon_name = 'edit' if mutable else 'lock'
    mutability = get_icon_pixmap(icon_name, icon_size)

    # https://youtu.be/AX2uz2XYkbo?t=21s
    icon_name = 'save' if persistent else 'random-access-memory'
    persistence = get_icon_pixmap(icon_name, icon_size)

    icon_size_rect = QRect(0, 0, icon_size, icon_size)

    pixmap = QPixmap(icon_size * 2, icon_size)
    mask = QBitmap(pixmap.width(), pixmap.height())
    mask.clear()
    pixmap.setMask(mask)

    painter = QPainter(pixmap)
    painter.drawPixmap(icon_size_rect, mutability, icon_size_rect)
    painter.drawPixmap(QRect(icon_size, 0, icon_size, icon_size),
                       persistence, icon_size_rect)
    return pixmap 
Example 9
Project: pyweed   Author: iris-edu   File: WaveformDialog.py    GNU Lesser General Public License v3.0 6 votes vote down vote up
def setWaveform(self, waveform):
        if waveform and waveform.error:
            self.setForeground(self.errorForeground)
        else:
            self.setForeground(self.defaultForeground)
        if waveform:
            if waveform.loading or waveform.error or not waveform.image_exists:
                self.imagePath = None
                self.setData(QtCore.Qt.DecorationRole, None)
                if waveform.loading:
                    self.setText('Loading waveform data...')
                elif waveform.error:
                    self.setText(waveform.error)
                else:
                    self.setText('')
            else:
                if waveform.image_path != self.imagePath:
                    self.imagePath = waveform.image_path
                    pic = QtGui.QPixmap(waveform.image_path)
                    self.setData(QtCore.Qt.DecorationRole, pic)
                    self.setText('')
        else:
            self.imagePath = None
            self.setText('') 
Example 10
Project: cct   Author: awacha   File: beamstop.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def checkBeamStop(self, x=None, y=None):
        logger.debug('checkBeamStop({}, {})'.format(x, y))
        assert isinstance(self.credo, Instrument)
        try:
            bsstate = self.credo.get_beamstop_state(bsx=x, bsy=y)
        except KeyError:
            bsstate = 'unknown'
        self.beamstopInToolButton.setEnabled((bsstate != 'in') and (not self._moving) and (not self._movetargets))
        self.beamstopOutToolButton.setEnabled((bsstate != 'out') and (not self._moving) and (not self._movetargets))
        logger.debug('')
        if bsstate == 'in':
            iconfile = 'beamstop-in.svg'
        elif bsstate == 'out':
            iconfile = 'beamstop-out.svg'
        else:
            iconfile = 'beamstop-inconsistent.svg'
        logger.debug('Beamstop state: {}'.format(bsstate))
        self.beamstopIconLabel.setPixmap(QtGui.QPixmap(":/icons/{}".format(iconfile)).scaled(48, 48))
        self.beamstopIconLabel.setToolTip('Beamstop is currently {}'.format(bsstate)) 
Example 11
Project: PyQt-multifunctional-uart-helper   Author: IronSublimate   File: widgetpainter.py    MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(WidgetPainter, self).__init__(parent)
        # self.painter3 = QPainter(self)
        self.qpix = QPixmap()
        # self.parentUi = None
        self.imgWidth = 80
        self.imgHeight = 60
        self.label_position = None  #: QLabel
        self.label_pause = None  #: QLabel
        self.grid_points = []
        self.enable_grid = False
        self.pause = False
        self.enable_extra_14_bytes = False
        self.extra_bytes_len = 0
        self.extra_data = None  # tuple
        # [0]中心点的行数
        # [1]中心点的列数
        # [2]列左极限
        # [3]列右极限
        # [4]控制中心的列数 
Example 12
Project: PyQt-multifunctional-uart-helper   Author: IronSublimate   File: uart.py    MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(Uart, self).__init__(parent)
        # Qt 串口类
        # self.com = QSerialPort()
        self.comParity = (QSerialPort.NoParity, QSerialPort.EvenParity, QSerialPort.OddParity, QSerialPort.SpaceParity,
                          QSerialPort.MarkParity)
        self.list_of_msg = list()
        # 图像类
        self.img = QPixmap()
        self.imgHeight = 80
        self.imgWidth = 60
        self.img_rx_data = QByteArray()
        self.totalImgSize = self.imgHeight * self.imgWidth
        # 上位机改参数类
        self.ready_to_get_paras = False

        # self.imgrxData = bytearray()
        # self.pararxData = bytearray()
        # 标准模式类
        self.standard_rx_data = QByteArray()
        self.change_paras = dict()  # 上位机改参数字典
        self.watch_paras = dict()  # 上位机看参数
        self.wave_paras = dict()  # 波形字典

        # 串口普通模式发送数据 
Example 13
Project: mega.syno   Author: john-shine   File: tray.py    GNU General Public License v3.0 6 votes vote down vote up
def initUI(self): 
        width = QDesktopWidget().screenGeometry(-1).width()

        self.setWindowTitle('system tray')
        self.setWindowFlags(Qt.CustomizeWindowHint)
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setWindowFlag(Qt.WindowCloseButtonHint, False)
        self.setWindowFlag(Qt.WindowMinimizeButtonHint, False)     
        
        self.button = QPushButton('', self)
        self.button.setGeometry(QRect(width - self.icon_size - 1, 0, self.icon_size, self.icon_size))
        ico = QtGui.QPixmap(':/mega.ico')
        self.button.setIcon(QtGui.QIcon(ico))
        self.button.clicked.connect(self.launch_mega)
        
        self.setGeometry(0, 0, width, self.icon_size)
        self.setFixedSize(self.width(), self.height())

        self.show() 
Example 14
Project: eddy   Author: obdasystems   File: splash.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None, mtime=2):
        """
        Initialize Eddy's splash screen.
        :type parent: QWidget
        :type mtime: float
        """
        super().__init__(parent, QtGui.QPixmap(), QtCore.Qt.WindowStaysOnTopHint)
        pixmap = QtGui.QIcon(':/images/im_eddy_splash').pixmap(380 * self.devicePixelRatio())
        pixmap.setDevicePixelRatio(self.devicePixelRatio())
        self.setPixmap(pixmap)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.mtime = time() + mtime
        self.font1 = Font('Roboto', 40, Font.Light)
        self.font1.setCapitalization(Font.SmallCaps)
        self.font2 = Font('Roboto', 18, Font.Light)
        self.font2.setCapitalization(Font.SmallCaps)
        self.font3 = Font('Roboto', 11, Font.Light)
        self.__spaceX = 0
        self.__spaceY = 0

    #############################################
    #   INTERFACE
    ################################# 
Example 15
Project: eddy   Author: obdasystems   File: qt.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, width, height, color, border=None):
        """
        Initialize the icon.
        :type width: T <= int | float
        :type height: T <= int | float
        :type color: str
        :type border: str
        """
        pixmap = QtGui.QPixmap(width, height)
        painter = QtGui.QPainter(pixmap)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        path = QtGui.QPainterPath()
        path.addRect(QtCore.QRectF(QtCore.QPointF(0, 0), QtCore.QPointF(width, height)))
        painter.fillPath(path, QtGui.QBrush(QtGui.QColor(color)))
        if border:
            painter.setPen(QtGui.QPen(QtGui.QColor(border), 0, QtCore.Qt.SolidLine))
            painter.drawPath(path)
        painter.end()
        super().__init__(pixmap) 
Example 16
Project: pdash   Author: CPChain   File: login.py    GNU General Public License v3.0 6 votes vote down vote up
def ui(self, layout):
        # Logo
        path = abs_path('icons/[email protected]')
        pixm = QPixmap(path)
        scale = 1.3
        pixm = pixm.scaled(168 * scale, 214 * scale)
        logo = Builder().name('logo').pixmap(pixm).build()
        logoLayout = QHBoxLayout()
        logoLayout.setAlignment(Qt.AlignCenter)
        logoLayout.addWidget(logo)
        self.add(logoLayout, 70)

        create = Builder(widget=Button).text('Create New Account')\
                                       .name('create')\
                                       .click(lambda _: self.to(self.createWnd)).build()
        _import = Builder(widget=Button).text('Import Account')\
                                        .name('_import')\
                                        .click(lambda _: self.to(self.importWnd)).build()
        self.add(create, 15)
        self.add(_import) 
Example 17
Project: pdash   Author: CPChain   File: picture.py    GNU General Public License v3.0 6 votes vote down vote up
def ui(self):
        self.setContentsMargins(0, 0, 0, 0)
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        if os.path.exists(self.path):
            photo = QPixmap(self.path)
            photo = photo.scaled(self.width, self.height)

            label = QLabel()
            label.setPixmap(photo)
            self.photo = photo
            layout.addWidget(label)
        else:
            self.get_picture()
            gif = LoadingGif()
            self.gif = gif
            layout.addWidget(gif)
        self.layout = layout
        return layout 
Example 18
Project: Micchinetta   Author: SqrtPapere   File: DialogWidget.py    MIT License 5 votes vote down vote up
def mic_on(self):
        """Method to change the microphone icon to the active one"""
        qpix = QPixmap("Resources/mic_green.png")
        self.microphone.setPixmap(qpix.scaled(self.microphone.size(), Qt.KeepAspectRatio, Qt.FastTransformation)) 
Example 19
Project: Micchinetta   Author: SqrtPapere   File: DialogWidget.py    MIT License 5 votes vote down vote up
def mic_off(self):
        """Method to change the microphone icon to the non active one"""
        qpix = QPixmap("Resources/mic_grey.png")
        self.microphone.setPixmap(qpix.scaled(self.microphone.size(), Qt.KeepAspectRatio, Qt.FastTransformation)) 
Example 20
Project: idasec   Author: RobinDavid   File: MainWidget.py    GNU Lesser General Public License v2.1 5 votes vote down vote up
def OnCreate(self, _):
        self.setupUi(self)
        self.binsec_connect_button.clicked.connect(self.connect_binsec)
        self.dba_decode_button.clicked.connect(self.decode_button_clicked)
        self.here_decode_button.clicked.connect(self.decode_here_clicked)
        self.pinsec_ip_field.setText("192.168.56.101")
        self.pinsec_port_field.setText("5555")
        self.binsec_port_field.setValidator(QtGui.QIntValidator(0, 65535))
        self.pinsec_port_field.setValidator(QtGui.QIntValidator(0, 65535))
        self.ok = QtGui.QPixmap(":/icons/icons/oxygen/22x22/ok.png")
        self.ko = QtGui.QPixmap(":/icons/icons/oxygen/22x22/ko.png")
        self.prev_modules = sys.modules.keys()
        self.set_pinsec_visible(False) 
Example 21
Project: dcc   Author: amimo   File: DisasmViewMode.py    Apache License 2.0 5 votes vote down vote up
def _getNewPixmap(self, width, height):
        return QtGui.QPixmap(width, height) 
Example 22
Project: dcc   Author: amimo   File: SourceViewMode.py    Apache License 2.0 5 votes vote down vote up
def _getNewPixmap(self, width, height):
        return QtGui.QPixmap(width, height) 
Example 23
Project: dcc   Author: amimo   File: SourceViewMode.py    Apache License 2.0 5 votes vote down vote up
def draw(self, refresh=False):
        if self.dataModel.getOffset() in self.Paints:
            self.refresh = False
            self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
            self.drawAdditionals()
            return

        if self.refresh or refresh:
            qp = QtGui.QPainter()
            qp.begin(self.qpix)
            self.drawTextMode(qp)
            self.refresh = False
            qp.end()

        self.drawAdditionals() 
Example 24
Project: dcc   Author: amimo   File: HexViewMode.py    Apache License 2.0 5 votes vote down vote up
def _getNewPixmap(self, width, height):
        return QtGui.QPixmap(width, height) 
Example 25
Project: dcc   Author: amimo   File: Banners.py    Apache License 2.0 5 votes vote down vote up
def _getNewPixmap(self, width, height):
        return QtGui.QPixmap(width, height) 
Example 26
Project: dcc   Author: amimo   File: Banners.py    Apache License 2.0 5 votes vote down vote up
def _getNewPixmap(self, width, height):
        return QtGui.QPixmap(width, height) 
Example 27
Project: dcc   Author: amimo   File: Banners.py    Apache License 2.0 5 votes vote down vote up
def _getNewPixmap(self, width, height):
        return QtGui.QPixmap(width, height) 
Example 28
Project: dcc   Author: amimo   File: BinViewMode.py    Apache License 2.0 5 votes vote down vote up
def _getNewPixmap(self, width, height):
        return QtGui.QPixmap(width, height) 
Example 29
Project: raspiblitz   Author: rootzoll   File: main.py    MIT License 5 votes vote down vote up
def check_invoice(self, flag, tick=0):
        log.info("checking invoice paid (Tick: {})".format(tick))
        self.invoice_to_check_flag = flag

        if tick >= INVOICE_CHECK_TIMEOUT:
            log.debug("canceled checking invoice paid")
            flag.set()

        if IS_DEV_ENV:
            res = False
            amt_paid_sat = 123123402

            if tick == 5:
                res = True

        else:
            stub_readonly = ReadOnlyStub(network=self.rb_cfg.network, chain=self.rb_cfg.chain)
            res, amt_paid_sat = check_invoice_paid(stub_readonly, self.invoice_to_check)
            log.debug("result of invoice check: {}".format(res))

        if res:
            log.debug("paid!")
            self.ui_qr_code.qcode.setMargin(8)
            self.ui_qr_code.qcode.setPixmap(QPixmap(":/RaspiBlitz/images/Paid_Stamp.png"))

            if amt_paid_sat:
                self.ui_qr_code.status_value.setText("Paid")
                self.ui_qr_code.amt_paid_value.setText("{}".format(amt_paid_sat))
            else:
                self.ui_qr_code.status_value.setText("Paid")

            flag.set() 
Example 30
Project: raspiblitz   Author: rootzoll   File: main.py    MIT License 5 votes vote down vote up
def generate_qr_code_finished(self, img):
        buf = BytesIO()
        img.save(buf, "PNG")

        qt_pixmap = QPixmap()
        qt_pixmap.loadFromData(buf.getvalue(), "PNG")
        self.ui_qr_code.spinner.stop()
        self.ui_qr_code.qcode.setMargin(2)
        self.ui_qr_code.qcode.setPixmap(qt_pixmap) 
Example 31
Project: Dolphin-Updater   Author: nbear3   File: dolphinapp.py    GNU General Public License v3.0 5 votes vote down vote up
def select_dolphin_folder(self):
        folder = str(QFileDialog.getExistingDirectory(self, 'Select Dolphin Directory'))
        if folder:
            self.dolphin_dir.setText(folder)
            self.dolphin_dir_status.setPixmap(QPixmap("res/check.png"))
            self._udc.set_user_path(folder) 
Example 32
Project: kucher   Author: Zubax   File: utils.py    GNU General Public License v3.0 5 votes vote down vote up
def get_icon_pixmap(icon_name: str, width: int, height: int = None) -> QPixmap:
    """
    Caching wrapper around get_icon(...).pixmap(...).
    Every generated pixmap is cached permanently.
    """
    begun = time.monotonic()
    height = height or width
    output = get_icon(icon_name).pixmap(width, height)
    elapsed = time.monotonic() - begun
    _logger.info('Pixmap %r has been rendered with size %rx%r in %.6f seconds', icon_name, width, height, elapsed)
    return output 
Example 33
Project: kucher   Author: Zubax   File: value_display_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(_Comment, self).__init__(parent)
        self.setAlignment(Qt.AlignCenter)
        self._icon_size = QFontMetrics(QFont()).height()        # As large as font
        self._pixmap_cache: typing.Dict[str, QPixmap] = {}
        self._current_icon_name: typing.Optional[str] = None
        # Initializing defaults
        self.reset() 
Example 34
Project: MovieHeavens   Author: lt94   File: movies.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, resources, title):
        super(ImageWindow, self).__init__()
        self.setWindowTitle(title)

        self.central_widget = QWidget()
        self.setCentralWidget(self.central_widget)
        layout = QVBoxLayout(self.central_widget)

        image = QImage(resources)
        pixmap = QPixmap(resources)
        image_label = QLabel(self)
        image_label.setPixmap(pixmap)
        image_label.resize(pixmap.width(), pixmap.height())
        layout.addWidget(image_label) 
Example 35
Project: PornHub_downloader   Author: QuantumLiu   File: Ui_gui.py    MIT License 5 votes vote down vote up
def show_cover(self,cover_url):
        print(cover_url)
        data=requests.get(cover_url,headers=self.headers,proxies=self.proxies).content
        qp = QtGui.QPixmap()
        qp.loadFromData(data)
        self.lb_cover.setPixmap(qp) 
Example 36
Project: openeo-qgis-plugin   Author: Open-EO   File: openeo_connector_dialog.py    Apache License 2.0 5 votes vote down vote up
def user_manual(self):
        self.umWindow = QDialog(parent=self)
        self.grid = QGridLayout()

        # User Manual Text
        self.text = QLabel()
        user_manual_text = open(os.path.join(os.path.dirname(__file__), './user_manual_text.txt')).read()
        self.text.setText(str(user_manual_text))
        # Title
        self.title = QLabel()
        self.title.setText("User Manual \n ")
        self.startText = QLabel()
        self.startText.setText("1. At first, please focus on the upper part (header) of the openEO Plugin. "
                               "There, you can choose a back-end and enter your login credentials. \nBy clicking"
                               "the “Connect”-Button, you will be connected with the chosen back-end. \nIf the connection "
                               "was successful you will see it in the Status text. \n")
        # openEO Header Image
        self.image = QLabel()
        self.image.setPixmap(QPixmap(os.path.join(os.path.dirname(__file__), 'openEO_plugin_header.png')))

        self.grid.setSpacing(4)
        self.grid.addWidget(self.title, 0, 0)
        self.grid.addWidget(self.startText, 1, 0)
        self.grid.addWidget(self.image, 2, 0)
        self.grid.addWidget(self.text, 4, 0)
        self.umWindow.setLayout(self.grid)
        self.umWindow.setWindowTitle('User Manual')
        self.umWindow.show()

        self.jobsTableWidget.setColumnCount(7)
        self.jobsTableWidget.setHorizontalHeaderLabels(['Job Id', 'Description/Error', 'Submission Date', 'Status',
                                                        'Execute', 'Display', 'Information'])
        header = self.jobsTableWidget.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) 
Example 37
Project: pytentiostat   Author: juami   File: GUI_load_config.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(640, 480)
        file = self.openFileNameDialog()
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("../pics/icon_pytentiostat.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        return file 
Example 38
Project: pytentiostat   Author: juami   File: GUI_load_config.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi_save(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(640, 480)
        folder = self.saveFileDialog()
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("../pics/icon_pytentiostat.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        return folder 
Example 39
Project: pytentiostat   Author: juami   File: warning_GUI.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def warning(text):
   """
   Initializes the warning window.

   Parameters
   ------
   text : string

   Return
   ------
   Boolean : True if 'OK' is clicked, False if 'cancel'.

   """

   msg = QtWidgets.QMessageBox()
   icon = QtGui.QIcon()
   icon.addPixmap(QtGui.QPixmap("../pics/icon_pytentiostat.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
   msg.setWindowIcon(icon)
   msg.setIcon(QtWidgets.QMessageBox.Warning)
   msg.setText(text)
   msg.setWindowTitle("Warning")
   msg.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
   msg.show()
   reply = msg.exec_()
   if reply == QtWidgets.QMessageBox.Ok:
      return True
   elif reply == QtWidgets.QMessageBox.Cancel:
      return False
   return msg 
Example 40
Project: pyweed   Author: iris-edu   File: SplashScreenHandler.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self,):
        super(SplashScreenHandler, self).__init__(level=logging.INFO)
        pixmap = QtGui.QPixmap(":qrc/splash.png")
        self.splash = QtWidgets.QSplashScreen(pixmap, QtCore.Qt.WindowStaysOnTopHint)

        # Attach as handler to the root logger
        logger = logging.getLogger()
        logger.addHandler(self)

        self.splash.showMessage("Welcome to %s %s" % (pyweed.__app_name__, pyweed.__version__))
        self.splash.show()
        logger.info("Splash screen should be visible") 
Example 41
Project: pyweed   Author: iris-edu   File: MyTableWidgetImageWidget.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None, imagePath=None):
        super(MyTableWidgetImageWidget, self).__init__(parent)
        pic = QtGui.QPixmap(imagePath)
        # NOTE:  From QPixmap we could use scaledToWidth() but the resulting images aren't so pretty
        # pic = pic.scaledToWidth(500)
        self.setPixmap(pic)
        # NOTE:  From QLabel we could use setScaledContents() but this doesn't preserve the aspect ratio
        # self.setScaledContents(True) 
Example 42
Project: pyweed   Author: iris-edu   File: MyTableWidgetImageItem.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, imagePath=None):
        super(MyTableWidgetImageItem, self).__init__()
        pic = QtGui.QPixmap(imagePath)
        # NOTE:  From QPixmap we could use scaledToWidth() but the resulting images aren't so pretty
        # pic = pic.scaledToWidth(500)
        self.setData(QtCore.Qt.DecorationRole, pic)
        # NOTE:  From QLabel we could use setScaledContents() but this doesn't preserve the aspect ratio
        # self.setScaledContents(True) 
Example 43
Project: cct   Author: awacha   File: scan.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setIdle(self):
        super().setIdle()
        self.inputForm.setEnabled(True)
        self.startStopPushButton.setText('Start')
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/scan.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.startStopPushButton.setIcon(icon)
        try:
            self._scangraph.truncateScan()
        except AttributeError:
            pass
        self._scangraph = None
        self.adjustSize() 
Example 44
Project: cct   Author: awacha   File: singleexposure.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setIdle(self):
        super().setIdle()
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/exposure.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.exposePushButton.setIcon(icon)
        self.exposePushButton.setText('Expose')
        self.entryWidget.setEnabled(True) 
Example 45
Project: cct   Author: awacha   File: plotcurve.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        self.figure = Figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.axes = self.figure.add_subplot(1, 1, 1)
        self.figureContainer.setLayout(QtWidgets.QVBoxLayout())
        self.figureContainer.layout().addWidget(self.canvas)
        self.figureToolbar = NavigationToolbar2QT(self.canvas, self.figureContainer)
        self.figureContainer.layout().addWidget(self.figureToolbar)
        assert isinstance(self.figureToolbar, QtWidgets.QToolBar)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/legend.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.legendAction = QtWidgets.QAction(icon, 'Show legend', None)
        self.legendAction.setCheckable(True)
        self.legendAction.setChecked(True)
        self.legendAction.triggered.connect(self.onLegendTriggered)
        icon = QtGui.QIcon.fromTheme("edit-clear-all")
        self.clearAxesAction = QtWidgets.QAction(icon, 'Clear all curves', None)
        self.clearAxesAction.triggered.connect(self.onClearAxes)
        toolbutton = QtWidgets.QToolButton()
        toolbutton.setDefaultAction(self.legendAction)
        self.figureToolbar.insertWidget(self.figureToolbar.actions()[0], toolbutton)
        toolbutton = QtWidgets.QToolButton()
        toolbutton.setDefaultAction(self.clearAxesAction)
        self.figureToolbar.insertWidget(self.figureToolbar.actions()[0], toolbutton)
        self.legendAction.setVisible(True)
        self.clearAxesAction.setVisible(True)
        self.figureToolbar.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
        self.canvas.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        self.canvas.mpl_connect('resize_event', self.onCanvasResize) 
Example 46
Project: cct   Author: awacha   File: plotimage.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        #self.colourScaleComboBox.addItems(['linear', 'logarithmic', 'square', 'square root'])
        self.colourScaleComboBox.setCurrentIndex(self.colourScaleComboBox.findText('logarithmic'))
        self.paletteComboBox.addItems(get_colormaps())
        self.paletteComboBox.setCurrentIndex(self.paletteComboBox.findText(matplotlib.rcParams['image.cmap']))
        #self.axesComboBox.addItems(['abs. pixel', 'rel. pixel', 'detector radius', 'twotheta', 'q'])
        self.axesComboBox.setCurrentIndex(self.axesComboBox.findText('q'))
        layout = QtWidgets.QVBoxLayout(self.figureContainer)
        self.figure = Figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.axes = self.figure.add_subplot(1, 1, 1)
        assert isinstance(self.axes, Axes)
        self.axes.set_facecolor('black')
        layout.addWidget(self.canvas)
        self.figtoolbar = NavigationToolbar2QT(self.canvas, self.figureContainer)
        layout.addWidget(self.figtoolbar)
        assert isinstance(self.figtoolbar, QtWidgets.QToolBar)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/plotimage_config.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.showToolbarButton = QtWidgets.QToolButton(self.figtoolbar)
        self.showToolbarButton.setIcon(icon)
        self.showToolbarButton.setText('Plot setup')
        self.showToolbarButton.setCheckable(True)
        self.showToolbarButton.setChecked(False)
        self.toolbar.setVisible(False)
        self.showToolbarButton.toggled.connect(self.toolbarVisibility)
        self.figtoolbar.insertWidget(self.figtoolbar.actions()[-1], self.showToolbarButton).setVisible(True)
        self.colourScaleComboBox.currentIndexChanged.connect(self.colourScaleChanged)
        self.axesComboBox.currentIndexChanged.connect(self.axesTypeChanged)
        self.paletteComboBox.currentIndexChanged.connect(self.paletteChanged)
        self.showColourBarToolButton.toggled.connect(self.showColourBarChanged)
        self.showMaskToolButton.toggled.connect(self.showMaskChanged)
        self.showBeamToolButton.toggled.connect(self.showBeamChanged)
        self.equalAspectToolButton.toggled.connect(self.replot)
        self._testimage()
        self.figtoolbar.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
        self.canvas.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        self.canvas.mpl_connect('resize_event', self.onCanvasResize) 
Example 47
Project: cct   Author: awacha   File: movemotor.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setIdle(self):
        super().setIdle()
        self.movePushButton.setText('Move')
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/motor.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.movePushButton.setIcon(icon)
        self.targetDoubleSpinBox.setEnabled(True)
        self.motorComboBox.setEnabled(True)
        self.relativeCheckBox.setEnabled(True)
        self.movePushButton.setEnabled(True)
        self._start_requested = False 
Example 48
Project: cct   Author: awacha   File: autocalibration.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, self)
        self.addMotorComboBox.currentIndexChanged.connect(self.onAddMotor)
        self.removeMotorPushButton.clicked.connect(self.onRemoveMotor)
        self.executePushButton.clicked.connect(self.onExecute)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/motorconfig.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.executePushButton.setIcon(icon)
        with self._updating:
            self.addMotorComboBox.clear()
            self.addMotorComboBox.addItems(sorted([m.name for m in self.credo.motors.values()]))
            self.addMotorComboBox.setCurrentIndex(-1)
        self.model = MotorAutoCalibrationModel(self.credo)
        self.motorTreeView.setModel(self.model) 
Example 49
Project: cct   Author: awacha   File: autocalibration.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setIdle(self):
        super().setIdle()
        self.addMotorComboBox.setEnabled(True)
        self.bufferDistanceDoubleSpinBox.setEnabled(True)
        self.motorTreeView.setEnabled(True)
        self.removeMotorPushButton.setEnabled(True)
        self.executePushButton.setText('Execute')
        self.executePushButton.setEnabled(True)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/motorconfig.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.executePushButton.setIcon(icon) 
Example 50
Project: PyQt-multifunctional-uart-helper   Author: IronSublimate   File: widgetpainter.py    MIT License 5 votes vote down vote up
def setPixmap(self, pix: QPixmap):
        if not self.pause:
            self.qpix = pix
            # self.draw_pixmap()
            self.repaint()