示例#1
0
def initialize():
    """Initialize support for the icons. Called on app startup."""
    QDir.setSearchPaths("icons", __path__)
    
    # use our icon theme (that builds on Tango) if there are no system icons
    if (not QIcon.themeName() or QIcon.themeName() == "hicolor"
        or not QSettings().value("system_icons", True, bool)):
        QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__)
        QIcon.setThemeName("TangoExt")
示例#2
0
    def __init__(self, *args, **kwargs):

        try:
            appdir = kwargs.pop('appdir')
        except KeyError:
            pass

        CadAppQt.__init__(self)

        # set application directory
        appdata.set('APPDIR', appdir)

        # Search for icons in './icons/kubos'.
        if appdata.get('APPDIR') is not None:
            ip = _QIcon.themeSearchPaths() + [
                _path.join(appdata.get('APPDIR'), 'icons')
            ]
            _QIcon.setThemeSearchPaths(ip)
            _QIcon.setThemeName('kubos')
        if appdata.get('mode'):
            if _QIcon.hasThemeIcon('kubos-' + appdata.get('mode')):
                appdata.set('icon',
                            _QIcon.fromTheme('kubos-' + appdata.get('mode')))
            else:
                appdata.set('icon', _QIcon.fromTheme('kubos'))
        else:
            appdata.set('icon', _QIcon.fromTheme('kubos'))

        appdata.set('AUTHORS', 'Marko Knöbl')
        appdata.set('VERSION', '0.2b2')
        self.doc = doc_ctrl
        # 'win' cannot be imported before creating a QApplication
        from gui import win
        self.win = win
        self.update_title()
        self.viewer = win.viewer_3d
        self._menu_bar = self.win.menuBar()
        self._menus = {}
        self._actiongroups = {}

        self._toolbars = {}
示例#3
0
def initialize():
    """Initialize support for the icons. Called on app startup."""

    # find the icons in this directory, after that also search in the included
    # icon theme folders (this fallback is used if the "Use system icons"
    # setting is enabled, but the system does not provide a certain icon.
    d = __path__[0]
    path = []
    path.extend(__path__)
    for p in (os.path.join(d, 'TangoExt',
                           'scalable'), os.path.join(d, 'TangoExt'),
              os.path.join(d, 'Tango', 'scalable'), os.path.join(d, 'Tango')):
        if os.path.isdir(p):
            path.append(p)
    QDir.setSearchPaths("icons", path)

    # use our icon theme (that builds on Tango) if there are no system icons
    if (not QIcon.themeName() or QIcon.themeName() == "hicolor"
            or not QSettings().value("system_icons", True, bool)):
        QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__)
        QIcon.setThemeName("TangoExt")
示例#4
0
def initialize():
    """Initialize support for the icons. Called on app startup."""
    
    # find the icons in this directory, after that also search in the included
    # icon theme folders (this fallback is used if the "Use system icons"
    # setting is enabled, but the system does not provide a certain icon.
    d = __path__[0]
    path = []
    path.extend(__path__)
    for p in (os.path.join(d, 'TangoExt', 'scalable'),
              os.path.join(d, 'TangoExt'),
              os.path.join(d, 'Tango', 'scalable'),
              os.path.join(d, 'Tango')):
        if os.path.isdir(p):
            path.append(p)
    QDir.setSearchPaths("icons", path)
    
    # use our icon theme (that builds on Tango) if there are no system icons
    if (not QIcon.themeName() or QIcon.themeName() == "hicolor"
        or not QSettings().value("system_icons", True, bool)):
        QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__)
        QIcon.setThemeName("TangoExt")
示例#5
0
    def __init__(self):

        super().__init__()

        self.setWindowTitle('Yabai')

        QIcon.setThemeName('oxygenNOT') # TEST
        if not QIcon.hasThemeIcon('document-open'):
            QIcon.setThemeSearchPaths(['gui/icons'])
            QIcon.setThemeName('oxygen_parts')
        # TODO: This way of checking for the theme's existence is ugly
        # as f**k, so you'd better think of a better way to do it.

        self.createActions()
        self.createMenus()
        self.createToolBars()
        self.createStatusBar()

        for action in Config.checkedActions:
            if action in View.fitModes:
                fitMode = action
                break
        else:
            fitMode = 'view_fitBest'

        self.view = View('core/black.ori', fitMode)
        self.setCentralWidget(self.view)

        # Add all the action to the view, so that they can be
        # triggered even when there are no menus/toolbars
        # visible as it is in fullscreen mode:
        for action in self.actions.values():
            if not isinstance(action, QActionGroup):
                self.view.addAction(action)

        self.show()
示例#6
0
from __future__ import unicode_literals

import os

from PyQt4.QtCore import QDir, QFile, QFileInfo, QSettings, QSize
from PyQt4.QtGui import QFileIconProvider, QIcon

_cache = {}

QDir.setSearchPaths("icons", __path__)


# use our icon theme (that builds on Tango) if there are no system icons
if (not QIcon.themeName() or QIcon.themeName() == "hicolor"
    or QSettings().value("system_icons", True) in (False, "false")):
    QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__)
    QIcon.setThemeName("TangoExt")


def get(name):
    """Returns an icon with the specified name."""
    if QIcon.hasThemeIcon(name):
        return QIcon.fromTheme(name)
    try:
        return _cache[name]
    except KeyError:
        icon = _cache[name] = QIcon()
        # first try SVG
        fname = 'icons:{0}.svg'.format(name)
        if QFile(fname).exists():
            icon.addFile(fname)
示例#7
0
from __future__ import unicode_literals

import os

from PyQt4.QtCore import QDir, QFile, QFileInfo, QSettings, QSize
from PyQt4.QtGui import QFileIconProvider, QIcon

_cache = {}

QDir.setSearchPaths("icons", __path__)

# use our icon theme (that builds on Tango) if there are no system icons
if (not QIcon.themeName() or QIcon.themeName() == "hicolor"
        or not QSettings().value("system_icons", True, bool)):
    QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + __path__)
    QIcon.setThemeName("TangoExt")


def get(name):
    """Returns an icon with the specified name."""
    if QIcon.hasThemeIcon(name):
        return QIcon.fromTheme(name)
    try:
        return _cache[name]
    except KeyError:
        icon = _cache[name] = QIcon()
        # first try SVG
        fname = 'icons:{0}.svg'.format(name)
        if QFile(fname).exists():
            icon.addFile(fname)