~mmcg069/software-center/enum-style-idea

« back to all changes in this revision

Viewing changes to softwarecenter/utils.py

  • Committer: Matthew McGowan
  • Date: 2011-06-05 22:50:04 UTC
  • Revision ID: matthew.joseph.mcgowan@gmail.com-20110605225004-sp9z0c698qguud02
change enum style

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import time
32
32
import xml.sax.saxutils
33
33
 
34
 
from enums import MISSING_APP_ICON, APP_ICON_SIZE, APP_INSTALL_PATH_DELIMITER
 
34
from enums import Icons, APP_INSTALL_PATH_DELIMITER
35
35
 
36
36
from config import get_config
37
37
 
257
257
        LOG.exception("could not check for Unity dbus service")
258
258
    return unity_running
259
259
    
260
 
def get_icon_from_theme(icons, iconname=None, iconsize=APP_ICON_SIZE, missingicon=MISSING_APP_ICON):
 
260
def get_icon_from_theme(icons, iconname=None, iconsize=Icons.APP_ICON_SIZE, missingicon=Icons.MISSING_APP):
261
261
    """
262
262
    return the icon in the theme that corresponds to the given iconname
263
263
    """    
270
270
        icon = icons.load_icon(missingicon, iconsize, 0)
271
271
    return icon
272
272
    
273
 
def get_file_path_from_iconname(icons, iconname=None, iconsize=APP_ICON_SIZE):
 
273
def get_file_path_from_iconname(icons, iconname=None, iconsize=Icons.APP_ICON_SIZE):
274
274
    """
275
275
    return the file path of the icon in the theme that corresponds to the
276
276
    given iconname, or None if it cannot be determined
277
277
    """
278
278
    if (not iconname or
279
279
        not icons.has_icon(iconname)):
280
 
        iconname = MISSING_APP_ICON
 
280
        iconname = Icons.MISSING_APP
281
281
    try:
282
282
        icon_info = icons.lookup_icon(iconname, iconsize, 0)
283
283
    except Exception:
284
 
        icon_info = icons.lookup_icon(MISSING_APP_ICON, iconsize, 0)
 
284
        icon_info = icons.lookup_icon(Icons.MISSING_APP, iconsize, 0)
285
285
    if icon_info is not None:
286
286
        icon_file_path = icon_info.get_filename()
287
287
        icon_info.free()