# Path: modules/mylib_get_data.py
# def games_info(data_dir):
# def get_info(games_list, mylib_dir):
# 
# Path: modules/goglib_get_data.py
# def games_info(data_dir):
# 
# Path: modules/get_banner.py
# def get_banner(game_name, url, banner_path, lib):
# 
#     banner_req = urllib_request(url)
# 
#     try:
# 
#         if not os.path.exists(banner_path):
#             os.makedirs(banner_path)
# 
#         banner_data = urllib_urlopen(banner_req).read()
#         banner_file = open(banner_path + '/' + game_name + '.jpg', 'wb')
#         banner_file.write(banner_data)
#         banner_file.close()
# 
#         pic_src = Image.open(banner_path + '/' + game_name + '.jpg')
#         pic = pic_src.resize((518, 240), PIL.Image.ANTIALIAS)
#         pic.save(banner_path + '/' + game_name + '.jpg')
# 
#         if lib == 'goglib':
# 
#             if not os.path.exists(banner_path + '/unavailable/'):
#                 os.makedirs(banner_path + '/unavailable/')
# 
#             new_pic = Image.open(banner_path + '/' + game_name + '.jpg')
#             pic_grey = new_pic.convert('L')
#             pic_grey.save(banner_path + '/unavailable/' + game_name + '.jpg')
# 
#     except urllib_urlerror as e:
#         print(e.reason)
#     except urllib_httperror as e:
#         print(e.code)
#         print(e.read())


import os, sys, subprocess, shutil
import gi
import gettext
    import sys
from gi.repository import Gtk, Gdk
    from urllib2 import Request as urllib_request
    from urllib2 import urlopen as urllib_urlopen
    from urllib2 import URLError as urllib_urlerror
    from urllib2 import HTTPError as urllib_httperror
    from urllib.request import Request as urllib_request
    from urllib.request import urlopen as urllib_urlopen
    from urllib.request import URLError as urllib_urlerror
    from urllib.request import HTTPError as urllib_httperror
    from ConfigParser import ConfigParser as ConfigParser
    from configparser import ConfigParser as ConfigParser
from modules import mylib_get_data, goglib_get_data, get_banner
            )

        textbuffer1 = Gtk.TextBuffer()

        for i in range(len(new_scripts)):
            iter1 = textbuffer1.get_end_iter()
            textbuffer1.insert(iter1, name_to_title[new_scripts[i]] + '\n')

        textview1 = Gtk.TextView(
            buffer = textbuffer1,
            editable = False,
            cursor_visible = False
            )

        scrolled_window1.add(textview1)
        expander_new_all.add(scrolled_window1)

        content_area.pack_start(expander_new_all, True, True, 0)

        if self.lib == 'goglib':

            expander_new_own = Gtk.Expander(
                label = _("Scripts for games you own (" + str(len(new_own_scripts)) + "):")
                )

            if len(new_own_scripts) == 0:
                expander_new_own.set_property('no-show-all', True)

            scrolled_window_new_own = Gtk.ScrolledWindow(
                height_request = 240

# Path: modules/mylib_get_data.py
# def games_info(data_dir):
# def get_info(games_list, mylib_dir):
# 
# Path: modules/goglib_get_data.py
# def games_info(data_dir):
# 
# Path: modules/get_banner.py
# def get_banner(game_name, url, banner_path, lib):
# 
#     banner_req = urllib_request(url)
# 
#     try:
# 
#         if not os.path.exists(banner_path):
#             os.makedirs(banner_path)
# 
#         banner_data = urllib_urlopen(banner_req).read()
#         banner_file = open(banner_path + '/' + game_name + '.jpg', 'wb')
#         banner_file.write(banner_data)
#         banner_file.close()
# 
#         pic_src = Image.open(banner_path + '/' + game_name + '.jpg')
#         pic = pic_src.resize((518, 240), PIL.Image.ANTIALIAS)
#         pic.save(banner_path + '/' + game_name + '.jpg')
# 
#         if lib == 'goglib':
# 
#             if not os.path.exists(banner_path + '/unavailable/'):
#                 os.makedirs(banner_path + '/unavailable/')
# 
#             new_pic = Image.open(banner_path + '/' + game_name + '.jpg')
#             pic_grey = new_pic.convert('L')
#             pic_grey.save(banner_path + '/unavailable/' + game_name + '.jpg')
# 
#     except urllib_urlerror as e:
#         print(e.reason)
#     except urllib_httperror as e:
#         print(e.code)
#         print(e.read())


# Path: get_scripts.py
import os, sys, subprocess, shutil
import gi
import gettext
    import sys
from gi.repository import Gtk, Gdk
    from urllib2 import Request as urllib_request
    from urllib2 import urlopen as urllib_urlopen
    from urllib2 import URLError as urllib_urlerror
    from urllib2 import HTTPError as urllib_httperror
    from urllib.request import Request as urllib_request
    from urllib.request import urlopen as urllib_urlopen
    from urllib.request import URLError as urllib_urlerror
    from urllib.request import HTTPError as urllib_httperror
    from ConfigParser import ConfigParser as ConfigParser
    from configparser import ConfigParser as ConfigParser
from modules import mylib_get_data, goglib_get_data, get_banner

            )

        textbuffer1 = Gtk.TextBuffer()

        for i in range(len(new_scripts)):
            iter1 = textbuffer1.get_end_iter()
            textbuffer1.insert(iter1, name_to_title[new_scripts[i]] + '\n')

        textview1 = Gtk.TextView(
            buffer = textbuffer1,
            editable = False,
            cursor_visible = False
            )

        scrolled_window1.add(textview1)
        expander_new_all.add(scrolled_window1)

        content_area.pack_start(expander_new_all, True, True, 0)

        if self.lib == 'goglib':

            expander_new_own = Gtk.Expander(
                label = _("Scripts for games you own (" + str(len(new_own_scripts)) + "):")
                )

            if len(new_own_scripts) == 0:
                expander_new_own.set_property('no-show-all', True)

            scrolled_window_new_own = Gtk.ScrolledWindow(
                height_request = 240

                )