Remove old theme mechanism

This commit is contained in:
Florian Mounier
2015-10-14 18:00:48 +02:00
parent 0337663059
commit e6f618ef52
4 changed files with 4 additions and 54 deletions

View File

@@ -61,12 +61,6 @@ tornado.options.define("generate_current_user_pkcs", default=False,
tornado.options.define("generate_user_pkcs", default='',
help="Generate user pfx for client authentication "
"(Must be root to create for another user)")
tornado.options.define("install_themes", default=False,
help="Install or update themes from butterfly-themes")
tornado.options.define("install_themes_from",
default='https://github.com/paradoxxxzero/'
'butterfly-themes/archive/master.zip',
help="Url to download themes from")
if os.getuid() == 0:
ev = os.getenv('XDG_CONFIG_DIRS', '/etc')
@@ -118,49 +112,6 @@ for logger in ('tornado.access', 'tornado.application',
log = logging.getLogger('butterfly')
if options.install_themes:
from io import BytesIO
from shutil import move, rmtree
from zipfile import ZipFile
from tempfile import mkdtemp
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
try:
import sass as _
_.CompileError
except Exception:
print('You must install libsass to use themes '
'(run: pip install libsass)')
sys.exit(1)
themes_url = options.install_themes_from
print('Downloading %s...' % themes_url)
zip_ = ZipFile(BytesIO(urlopen(themes_url).read()))
print('Extracting in %s' % butterfly_dir)
zip_.extractall(butterfly_dir)
zip_dest = os.path.join(butterfly_dir, 'butterfly-themes-master')
theme_dir = os.path.join(butterfly_dir, 'themes')
if not os.path.exists(theme_dir):
os.makedirs(theme_dir)
tmp_dir = mkdtemp()
for dir_ in os.listdir(zip_dest):
if dir_ == 'README.md':
continue
new_dir = os.path.join(theme_dir, dir_)
if os.path.exists(new_dir):
move(new_dir, tmp_dir)
print('Old theme %s has been backed up in %s' % (
new_dir, tmp_dir))
move(os.path.join(zip_dest, dir_), theme_dir)
rmtree(zip_dest)
print('%s extracted.' % theme_dir)
sys.exit(0)
host = options.host
port = options.port

View File

@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '2.0.10'
__version__ = '2.0.12'
import os

View File

@@ -38,9 +38,8 @@ Butterfly is a xterm compliant terminal built with python and javascript.
{title}Styling butterfly:{reset}
To style butterfly in sass, you need to have the libsass python library installed.
Install official themes with {code}butterfly.server.py --install-themes{reset}
Theming is done by overiding the default sass files located in {code}{main}{reset} in a theme directory.
Theming is done by overriding the default sass files located in {code}{main}{reset} in your theme directory.
This directory can include images and custom fonts.
Please take a look at official themes here: https://github.com/paradoxxxzero/butterfly-themes
and submit your best themes as pull request!

View File

@@ -29,8 +29,8 @@ options = dict(
package_data={
'butterfly': [
'sass/*.sass',
'themes/*',
'themes/**/*',
'themes/*.*',
'themes/**/*.*',
'static/fonts/*',
'static/images/favicon.png',
'static/main.css',