def handle(self, *args, **options):
        usage = "Example of theme creation: ./manage.py themestart mytheme"
        if len(sys.argv) < 3:
            print usage
        else:
            themestart="merengue/base/management/commands/themestart"
            theme_name = sys.argv[2]
            mediadir = os.path.join(settings.MEDIA_ROOT, 'themes')
            try:
                os.makedirs(os.path.join(mediadir, theme_name, 'css'))
            except OSError:
                raise CommandError("This theme already exists, please try another name")
            
            os.makedirs(os.path.join(mediadir, theme_name, 'img'))
            os.makedirs(os.path.join(mediadir, theme_name, 'js'))
            templatedir =  os.path.join(settings.BASEDIR, 'templates/themes')
            os.mkdir(os.path.join(templatedir, theme_name))
            shutil.copy2(themestart + '/base.html', templatedir + '/' + theme_name + '/base.html')
            shutil.copy2(themestart + '/layout.css', mediadir + '/' + theme_name + '/css/layout.css')
            valuesDic = {}
            valuesDic['portalwidth'] = int(input("Select portal width (0 = full screen, or a value for portal width tipical values are between 800 and 1024): "))
            if(valuesDic['portalwidth']==0):
                valuesDic['leftcolumn'] = int(input("Select left column percentaje width (0 = widthout left column, othercase (12 to 20 %)): "))
                valuesDic['rightcolumn'] = int(input("Select right column percentaje width (0 = widthout right column, othercase (12 to 20 %)): "))
                valuesDic['dpadding'] = 2
                valuesDic['dmargin'] = 2
                #valuesDic['dpadding'] = int(input("Select default main blocks paddings (between 0 and 3): "))
                #valuesDic['dmargin'] = int(input("Select default main blocks margin (between 0 and 3): "))
            else:
                valuesDic['leftcolumn'] = int(input("Select left column width (0 = widthout left column): "))
                valuesDic['rightcolumn'] = int(input("Select right column width (0 = widthout right column): "))
                valuesDic['dpadding'] = int(input("Select default main blocks paddings: "))
                valuesDic['dmargin'] = int(input("Select default main blocks margin: "))
            valuesDic['color1'] = raw_input("Select the main text color (black, blue, #dedede) :")
            valuesDic['color2'] = raw_input("Select the body background color :")
            valuesDic['color3'] = raw_input("Select link color: ")
            valuesDic['color4'] = raw_input("Select link hover color: ")

            
            create_default_css(themestart, mediadir, theme_name, templatedir, valuesDic)
            check_themes() #this line add the new theme to theming table in the project BD
            print 'To start using your new theme activate it in your admin'
            print 'To change your theme design you could edit css in: ' +  os.path.join(mediadir, theme_name) + '/css/'
            print 'To add or modify custom templates you could go: ' + os.path.join(templatedir, theme_name)
Beispiel #2
0
 def changelist_view(self, request, extra_context=None):
     check_themes()
     return super(ThemeAdmin, self).changelist_view(request, extra_context)
Beispiel #3
0
 def changelist_view(self, request, extra_context=None):
     check_themes()
     return super(ThemeAdmin, self).changelist_view(request, extra_context)
Beispiel #4
0
def check_for_themes(sender, **kwargs):
    from merengue.theming.checker import check_themes
    check_themes()