Search code examples
fiwarefiware-wirecloud

Wirecloud icon customization


I'm working on FITMAN Smart-Factory trial 5 demo (http://www.fitman-fi.eu/), and i need to customize WireCloud logo icons to change them with the factory ones.

Is there any documentation on how to do that?


Solution

  • Currently the best way is to use the STATICFILES_DIRS and STATICFILES_FINDERS settings for overriding some files in your current theme. For example, if you're using the default configuration, you can add the following lines into your settings.py file:

    STATICFILES_FINDERS = ('django.contrib.staticfiles.finders.FileSystemFinder',) + STATICFILES_FINDERS
    STATICFILES_DIRS = (path.join(BASEDIR, 'static'),)
    

    Take into account that the FileSystemFinder should be the first value of the STATICFILES_FINDERS setting, so things like STATICFILES_FINDERS += ('django.contrib.staticfiles.finders.FileSystemFinder',) won't work.

    Once updated the settings.py, you'll have to create a static folder in the same place where your setting.py is located . Every file created in this folder will override the one provided by WireCloud. In your case, the interesting files are:

    • images/wirecloud_logo.png for the wirecloud.defaulttheme and images/header-logo.png for wirecloud.fiwaretheme and wirecloud.oiltheme.
    • css/wirecloud_core.css if you need to change any CSS rules related with the logo.

    You can obtain the original version of the file from the static folder at the root of the instance (that is the place where the static files are collected to by default). You'll need to run the collectstatic command if you want to update any overridden file:

    $ python manage.py collectstatic
    

    Example

    If your have a WireCloud instance at /opt/wirecloud_instance you can run the following commands:

    $ cd /opt/wirecloud_instance
    $ <your_editor_of_choice> wirecloud_instance/settings.py
    # Change the STATICFILES_FINDERS and STATICFILES_DIRS settings and close the editor
    $ mkdir -p wirecloud_instance/static/images
    $ cp <your_logo> wirecloud_instance/static/images/wirecloud_logo.png
    $ python manage.py collectstatic