Icon server app updates

This commit is contained in:
Roberto Rosario
2012-09-05 13:39:23 -04:00
parent 08cd41cd20
commit 88e9856a72
4853 changed files with 104 additions and 99 deletions

View File

@@ -1,10 +1,8 @@
from django.utils.translation import ugettext_lazy as _
from __future__ import absolute_import
from app_registry.models import App
#from django.utils.translation import ugettext_lazy as _
#from django.conf import settings
try:
app = App.register('icons', _(u'Icons'))
except App.UnableToRegister:
pass
else:
app.set_dependencies(['app_registry'])
from .classes import Icon
#from storage.backends.filebasedstorage import FileBasedStorage
#afrom app_registry.models import App

View File

@@ -1,22 +0,0 @@
from __future__ import absolute_import
from .conf import settings
from .sets import ICON_THEMES
from .literals import ERROR
def get_icon_name(icon):
try:
return ICON_THEMES[settings.ICON_SET][icon]
except KeyError:
return ICON_THEMES[settings.ICON_SET][ERROR]
except AttributeError:
pass
def get_sprite_name(sprite):
try:
return ICON_THEMES[settings.ICON_SET][sprite]
except KeyError:
return ICON_THEMES[settings.ICON_SET][ERROR]
except AttributeError:
pass

38
apps/icons/classes.py Normal file
View File

@@ -0,0 +1,38 @@
from __future__ import absolute_import
from django.utils.safestring import mark_safe
from django.conf import settings
from .settings import ICON_SET
from .sets import ICON_THEMES
from .literals import ERROR
SIZE_SMALL = '16x16'
SIZE_BIG = '32x32'
class Icon(object):
_registry = {}
def __init__(self, literal):
self.literal = literal
self.__class__._registry[literal] = self
def get_file_name(self, size):
# TODO: Move name + size resolution to sets to support size/name and
# name_size filename conventions
try:
return '%s/%s/%s' % (ICON_THEMES[ICON_SET].path, size, ICON_THEMES[ICON_SET].dictionary[self.literal])
except KeyError:
return '%s/%s/%s' % (ICON_THEMES[ICON_SET].path, size, ICON_THEMES[ICON_SET].dictionary[ERROR])
except AttributeError:
pass
def display(self, size): # TODO: move to widgets?
return mark_safe(u'<img src="%sicons/%s" />' % (settings.STATIC_URL, self.get_file_name(self.literal)))
def display_small(self):
return self.display(SIZE_SMALL)
def display_big(self):
return self.display(SIZE_BIG)

View File

@@ -1,24 +0,0 @@
"""
Configuration options for the documents app
"""
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from storage.backends.filebasedstorage import FileBasedStorage
from smart_settings.api import Setting, SettingNamespace
from ..literals import DEFAULT_ICON_SET
from .. import app
print '__file__', __file__
namespace = SettingNamespace(app.name, app.label, module='icons.conf.settings', sprite='page')
# Saving
Setting(
namespace=namespace,
name='ICON_SET',
global_name='ICONS_ICON_SET',
default=DEFAULT_ICON_SET,
)

View File

@@ -3,8 +3,27 @@
#DEFAULT_ICON_SET = fat_cow.ID
DEFAULT_ICON_SET = 'fat_cow'
APP = 'app'
BACKUPS = 'backups'
#APP = 'app'
#BACKUPS = 'backups'
#ERROR = 'error'
#ICONS = 'icons'
#SETTINGS = 'settings'
APPLICATION_VIEW_ICONS = 'application_view_icons'
CD_BURN = 'cd_burn'
COG = 'cog'
ERROR = 'error'
ICONS = 'icons'
GROUP = 'user',
GROUP_ADD = 'user_add'
GROUP_EDIT = 'user_edit'
GROUP_DELETE = 'user_delete'
LOCK = 'lock'
MEDAL_GOLD = 'medal_gold'
MEDAL_GOLD_ADD = 'medal_gold_add'
MEDAL_GOLD_DELETE = 'medal_gold_delete'
PLUGIN = 'plugin'
USER = 'user'
USER_ADD = 'user_add'
USER_EDIT = 'user_edit'
USER_DELETE = 'user_delete'

5
apps/icons/registry.py Normal file
View File

@@ -0,0 +1,5 @@
from django.utils.translation import ugettext_lazy as _
name = 'icons'
label = _(u'Icons')
#app.set_dependencies(['app_registry'])

View File

@@ -11,8 +11,8 @@ SET_CHOICES = (
)
ICON_THEMES = {
fat_cow.ID: fat_cow.DICTIONARY,
famfamfam.ID: famfamfam.DICTIONARY
fat_cow.ID: fat_cow,
famfamfam.ID: famfamfam,
}

View File

@@ -6,6 +6,6 @@ ID = 'famfamfam'
LABEL = _(u'FamFamFam')
DICTIONARY = {
APP: 'plugin',
BACKUPS: 'cd_burn',
PLUGIN: 'plugin',
CD_BURN: 'cd_burn',
}

View File

@@ -4,13 +4,21 @@ from django.utils.translation import ugettext_lazy as _
from icons.literals import *
PATH = os.path.join('Fat Cow', '32x32')
PATH = os.path.join('fat_cow')
ID = 'fat_cow'
LABEL = _(u'Fat cow')
DICTIONARY = {
APP: 'plugin.png',
BACKUPS: 'cd_burn.png',
APPLICATION_VIEW_ICONS: 'application_view_icons.png',
CD_BURN: 'cd_burn.png',
COG: 'cog.png',
ERROR: 'error.png',
ICONS: 'application_view_icons.png',
GROUP: 'group.png',
GROUP_ADD: 'group_add.png',
GROUP_EDIT: 'group_edit.png',
GROUP_DELETE: 'group_delete.png',
MEDAL_GOLD: 'medal_gold_1.png',
MEDAL_GOLD_ADD: 'medal_gold_add.png',
MEDAL_GOLD_DELETE: 'medal_gold_delete.png',
PLUGIN: 'plugin.png',
}

13
apps/icons/settings.py Normal file
View File

@@ -0,0 +1,13 @@
from __future__ import absolute_import
from .literals import DEFAULT_ICON_SET
#
# #print '__file__', __file__
# ICON_SET = app.add_setting(
# name='ICON_SET',
# default=literals.DEFAULT_ICON_SET,
# )
ICON_SET = DEFAULT_ICON_SET

View File

Before

Width:  |  Height:  |  Size: 825 B

After

Width:  |  Height:  |  Size: 825 B

View File

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 445 B

View File

Before

Width:  |  Height:  |  Size: 838 B

After

Width:  |  Height:  |  Size: 838 B

View File

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 686 B

View File

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 712 B

View File

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 450 B

View File

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 885 B

View File

Before

Width:  |  Height:  |  Size: 674 B

After

Width:  |  Height:  |  Size: 674 B

View File

Before

Width:  |  Height:  |  Size: 670 B

After

Width:  |  Height:  |  Size: 670 B

View File

Before

Width:  |  Height:  |  Size: 698 B

After

Width:  |  Height:  |  Size: 698 B

View File

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 685 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 659 B

View File

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 722 B

View File

Before

Width:  |  Height:  |  Size: 775 B

After

Width:  |  Height:  |  Size: 775 B

View File

Before

Width:  |  Height:  |  Size: 737 B

After

Width:  |  Height:  |  Size: 737 B

View File

Before

Width:  |  Height:  |  Size: 437 B

After

Width:  |  Height:  |  Size: 437 B

View File

Before

Width:  |  Height:  |  Size: 433 B

After

Width:  |  Height:  |  Size: 433 B

View File

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 531 B

View File

Before

Width:  |  Height:  |  Size: 481 B

After

Width:  |  Height:  |  Size: 481 B

View File

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View File

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 452 B

View File

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 563 B

View File

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 532 B

View File

Before

Width:  |  Height:  |  Size: 809 B

After

Width:  |  Height:  |  Size: 809 B

View File

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 605 B

View File

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 525 B

View File

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 831 B

View File

Before

Width:  |  Height:  |  Size: 583 B

After

Width:  |  Height:  |  Size: 583 B

View File

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 714 B

View File

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 777 B

View File

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 749 B

View File

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 716 B

View File

Before

Width:  |  Height:  |  Size: 665 B

After

Width:  |  Height:  |  Size: 665 B

View File

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 636 B

View File

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 661 B

View File

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 366 B

View File

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 584 B

View File

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

View File

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 249 B

View File

Before

Width:  |  Height:  |  Size: 580 B

After

Width:  |  Height:  |  Size: 580 B

View File

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View File

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

View File

Before

Width:  |  Height:  |  Size: 657 B

After

Width:  |  Height:  |  Size: 657 B

View File

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 525 B

View File

Before

Width:  |  Height:  |  Size: 688 B

After

Width:  |  Height:  |  Size: 688 B

View File

Before

Width:  |  Height:  |  Size: 689 B

After

Width:  |  Height:  |  Size: 689 B

View File

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 759 B

View File

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 713 B

View File

Before

Width:  |  Height:  |  Size: 694 B

After

Width:  |  Height:  |  Size: 694 B

View File

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View File

Before

Width:  |  Height:  |  Size: 664 B

After

Width:  |  Height:  |  Size: 664 B

View File

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

View File

Before

Width:  |  Height:  |  Size: 663 B

After

Width:  |  Height:  |  Size: 663 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 599 B

After

Width:  |  Height:  |  Size: 599 B

View File

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 468 B

View File

Before

Width:  |  Height:  |  Size: 575 B

After

Width:  |  Height:  |  Size: 575 B

View File

Before

Width:  |  Height:  |  Size: 650 B

After

Width:  |  Height:  |  Size: 650 B

View File

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 483 B

View File

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

View File

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 538 B

View File

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

View File

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 394 B

View File

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 564 B

View File

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 587 B

View File

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 628 B

View File

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 588 B

View File

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 554 B

View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

View File

Before

Width:  |  Height:  |  Size: 494 B

After

Width:  |  Height:  |  Size: 494 B

View File

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 538 B

View File

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 598 B

View File

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 651 B

View File

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

View File

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 593 B

View File

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 570 B

View File

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

View File

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 371 B

View File

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 508 B

Some files were not shown because too many files have changed in this diff Show More