Пример #1
0
def loadAppIcons():
    """ loadAppIcons()
    Load the application iconsr.
    """
    # Get directory containing the icons
    appiconDir = os.path.join(pyzo.pyzoDir, 'resources', 'appicons')

    # Determine template for filename of the application icon-files.
    fnameT = 'pyzologo{}.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.
    pyzo.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):
            pyzo.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(pyzo.icon)

    # Construct another icon to show when the current shell is busy
    artist = IconArtist(pyzo.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)
    #
    pyzo.iconRunning = QtGui.QIcon(pyzo.icon)
    pyzo.iconRunning.addPixmap(pm)  # Change only 16x16 icon
Пример #2
0
 def getCrossIcon2(self):
     if hasattr(self, '_cross2'):
         pm = self._cross2
     else:
         pm = self._createCrossPixmap(240)
     # Set
     return QtGui.QIcon(pm)
Пример #3
0
def loadIcons():
    """ loadIcons()
    Load all icons in the icon dir.
    """
    # Get directory containing the icons
    iconDir = os.path.join(pyzo.pyzoDir, 'resources', 'icons')

    # Construct other icons
    dummyIcon = IconArtist().finish()
    pyzo.icons = ssdf.new()
    for fname in os.listdir(iconDir):
        if fname.startswith('pyzo'):
            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
                pyzo.icons[name] = icon
            except Exception as err:
                pyzo.icons[name] = dummyIcon
                print('Could not load icon %s: %s' % (fname, str(err)))
Пример #4
0
 def finish(self, icon=None):
     """ finish()
     Finish the drawing and return the resulting icon.
     """
     self._painter.end()
     return QtGui.QIcon(self._pm)
Пример #5
0
 def getCrossIcon1(self):
     if hasattr(self, '_cross1'):
         pm = self._cross1
     else:
         pm = self._createCrossPixmap(80)
     return QtGui.QIcon(pm)