# Path: kano_login/templates/template.py
# class Template(Gtk.Box):
# 
#     def __init__(self, img_filename, title, description, kano_button_text, orange_button_text):
#         Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
# 
#         if img_filename:
#             self.image = Gtk.Image.new_from_file(img_filename)
#             self.pack_start(self.image, False, False, 0)
# 
#         self.heading = Heading(title, description)
#         self.kano_button = KanoButton(kano_button_text)
# 
#         self.pack_start(self.heading.container, False, False, 0)
# 
#         self.button_box = Gtk.ButtonBox(spacing=10)
#         self.button_box.set_layout(Gtk.ButtonBoxStyle.SPREAD)
#         self.button_box.set_margin_bottom(30)
#         self.pack_start(self.button_box, False, False, 0)
# 
#         if not orange_button_text == "":
#             self.orange_button = OrangeButton(orange_button_text)
#             self.button_box.pack_start(self.orange_button, False, False, 0)
#             self.button_box.pack_start(self.kano_button, False, False, 0)
#             # The empty label is to centre the kano_button
#             label = Gtk.Label("    ")
#             self.button_box.pack_start(label, False, False, 0)
#         else:
#             self.button_box.pack_start(self.kano_button, False, False, 0)
# 
# Path: kano_profile_gui/images.py
# def get_image(category, subcategory, name, subfolder_str):
#     # The online badge image files are stored in the home directory.
#     # The function bellow gets the corrects path.
#     if category == 'badges' and subcategory == 'online':
#         return get_online_badge_path(name)
# 
#     folder = os.path.join(image_dir, category, subfolder_str, subcategory)
#     filename = '{name}.png'.format(name=name)
#     fullpath = os.path.join(folder, filename)
#     if not os.path.exists(fullpath):
#         logger.error("missing image: {}".format(fullpath))
#         return os.path.join(image_dir, 'icons/50/_missing.png')
#         #ensure_dir(folder)
#         #open(fullpath, 'w').close()
#         #print '{} created'.format(fullpath)
#         # try:
#         #     from randomavatar.randomavatar import Avatar
#         #     ensure_dir(folder)
#         #     avatar = Avatar(rows=10, columns=10)
#         #     image_byte_array = avatar.get_image(string=filename, width=width, height=width, pad=10)
#         #     avatar.save(image_byte_array=image_byte_array, save_location=fullpath)
#         #     print '{} created'.format(fullpath)
#         # except Exception:
#         #     return os.path.join(image_dir, 'icons/50/_missing.png')
#     return fullpath
# 
# Path: kano_world/functions.py
# def is_registered():
#     import mercury  # Lazy import to avoid dynamically linking with global import
#     kw = mercury.KanoWorld(kw_url)
#     return kw.is_logged_in()


import sys
from kano_login.templates.template import Template
from kano_profile_gui.images import get_image
from kano_world.functions import is_registered
#!/usr/bin/env python

# swag_screen.py
#
# Copyright (C) 2014, 2015 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
# Shows profile created
#



class SwagScreen(Template):
    def __init__(self, win):

        # Set window
        self.win = win
        self.win.set_decorated(False)
        self.win.set_resizable(True)

        # Set text depending on login

# Path: kano_login/templates/template.py
# class Template(Gtk.Box):
# 
#     def __init__(self, img_filename, title, description, kano_button_text, orange_button_text):
#         Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
# 
#         if img_filename:
#             self.image = Gtk.Image.new_from_file(img_filename)
#             self.pack_start(self.image, False, False, 0)
# 
#         self.heading = Heading(title, description)
#         self.kano_button = KanoButton(kano_button_text)
# 
#         self.pack_start(self.heading.container, False, False, 0)
# 
#         self.button_box = Gtk.ButtonBox(spacing=10)
#         self.button_box.set_layout(Gtk.ButtonBoxStyle.SPREAD)
#         self.button_box.set_margin_bottom(30)
#         self.pack_start(self.button_box, False, False, 0)
# 
#         if not orange_button_text == "":
#             self.orange_button = OrangeButton(orange_button_text)
#             self.button_box.pack_start(self.orange_button, False, False, 0)
#             self.button_box.pack_start(self.kano_button, False, False, 0)
#             # The empty label is to centre the kano_button
#             label = Gtk.Label("    ")
#             self.button_box.pack_start(label, False, False, 0)
#         else:
#             self.button_box.pack_start(self.kano_button, False, False, 0)
# 
# Path: kano_profile_gui/images.py
# def get_image(category, subcategory, name, subfolder_str):
#     # The online badge image files are stored in the home directory.
#     # The function bellow gets the corrects path.
#     if category == 'badges' and subcategory == 'online':
#         return get_online_badge_path(name)
# 
#     folder = os.path.join(image_dir, category, subfolder_str, subcategory)
#     filename = '{name}.png'.format(name=name)
#     fullpath = os.path.join(folder, filename)
#     if not os.path.exists(fullpath):
#         logger.error("missing image: {}".format(fullpath))
#         return os.path.join(image_dir, 'icons/50/_missing.png')
#         #ensure_dir(folder)
#         #open(fullpath, 'w').close()
#         #print '{} created'.format(fullpath)
#         # try:
#         #     from randomavatar.randomavatar import Avatar
#         #     ensure_dir(folder)
#         #     avatar = Avatar(rows=10, columns=10)
#         #     image_byte_array = avatar.get_image(string=filename, width=width, height=width, pad=10)
#         #     avatar.save(image_byte_array=image_byte_array, save_location=fullpath)
#         #     print '{} created'.format(fullpath)
#         # except Exception:
#         #     return os.path.join(image_dir, 'icons/50/_missing.png')
#     return fullpath
# 
# Path: kano_world/functions.py
# def is_registered():
#     import mercury  # Lazy import to avoid dynamically linking with global import
#     kw = mercury.KanoWorld(kw_url)
#     return kw.is_logged_in()


# Path: kano_login/swag_screen.py
import sys
from kano_login.templates.template import Template
from kano_profile_gui.images import get_image
from kano_world.functions import is_registered

#!/usr/bin/env python

# swag_screen.py
#
# Copyright (C) 2014, 2015 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
# Shows profile created
#



class SwagScreen(Template):
    def __init__(self, win):

        # Set window
        self.win = win
        self.win.set_decorated(False)
        self.win.set_resizable(True)

        # Set text depending on login

        login = is_registered()