Beispiel #1
0
 def getCrossIcon2(self):
     if hasattr(self, '_cross2'):
         pm = self._cross2
     else:
         pm = self._createCrossPixmap(240)
     # Set
     return QtGui.QIcon(pm)
Beispiel #2
0
def loadIcons():
    """ loadIcons()
    Load all icons in the icon dir.
    """
    # Get directory containing the icons
    iconDir = os.path.join(iep.iepDir, 'resources', 'icons')

    # Construct other icons
    dummyIcon = IconArtist().finish()
    iep.icons = ssdf.new()
    for fname in os.listdir(iconDir):
        if fname.startswith('iep'):
            continue
        if fname.endswith('.png'):
            try:
                # Short and full name
                name = fname.split('.')[0]
                ffname = os.path.join(iconDir, fname)
                # Create icon
                icon = QtGui.QIcon()
                icon.addFile(ffname, QtCore.QSize(16, 16))
                # Store
                iep.icons[name] = icon
            except Exception as err:
                iep.icons[name] = dummyIcon
                print('Could not load icon %s: %s' % (fname, str(err)))
Beispiel #3
0
def loadAppIcons():
    """ loadAppIcons()
    Load the application iconsr.
    """
    # Get directory containing the icons
    appiconDir = os.path.join(iep.iepDir, 'resources', 'appicons')

    # Determine template for filename of the application icon-files.
    # Use the Pyzo logo if in pyzo_mode.
    if iep.pyzo_mode:
        fnameT = 'pyzologo{}.png'
    else:
        fnameT = 'ieplogo{}.png'

    # Construct application icon. Include a range of resolutions. Note that
    # Qt somehow does not use the highest possible res on Linux/Gnome(?), even
    # the logo of qt-designer when alt-tabbing looks a bit ugly.
    iep.icon = QtGui.QIcon()
    for sze in [16, 32, 48, 64, 128, 256]:
        fname = os.path.join(appiconDir, fnameT.format(sze))
        if os.path.isfile(fname):
            iep.icon.addFile(fname, QtCore.QSize(sze, sze))

    # Set as application icon. This one is used as the default for all
    # windows of the application.
    QtGui.qApp.setWindowIcon(iep.icon)

    # Construct another icon to show when the current shell is busy
    artist = IconArtist(iep.icon)  # extracts the 16x16 version
    artist.setPenColor('#0B0')
    for x in range(11, 16):
        d = x - 11  # runs from 0 to 4
        artist.addLine(x, 6 + d, x, 15 - d)
    pm = artist.finish().pixmap(16, 16)
    #
    iep.iconRunning = QtGui.QIcon(iep.icon)
    iep.iconRunning.addPixmap(pm)  # Change only 16x16 icon
Beispiel #4
0
    def _addOverlays(self, icon, *overlays):

        # Get pixmap
        pm0 = icon.pixmap(16, 16)

        # Create painter
        painter = QtGui.QPainter()
        painter.begin(pm0)

        for overlay in overlays:
            pm1 = overlay.pixmap(16, 16)
            painter.drawPixmap(0, 0, pm1)

        # Finish
        painter.end()

        # Done (return resulting icon)
        return QtGui.QIcon(pm0)
Beispiel #5
0
 def finish(self, icon=None):
     """ finish()
     Finish the drawing and return the resulting icon.
     """
     self._painter.end()
     return QtGui.QIcon(self._pm)
Beispiel #6
0
 def getCrossIcon1(self):
     if hasattr(self, '_cross1'):
         pm = self._cross1
     else:
         pm = self._createCrossPixmap(80)
     return QtGui.QIcon(pm)