# Path: implementation/primaries/GUI/helpers.py
# def get_base_dir(return_this_dir=False):
#     if getattr(sys, "frozen", False):
#         # If this is running in the context of a frozen (executable) file,
#         # we return the path of the main application executable
#         return os.path.dirname(os.path.abspath(sys.executable))
#     else:
#         # If we are running in script or debug mode, we need
#         # to inspect the currently executing frame. This enable us to always
#         # derive the directory of main.py no matter from where this function
#         # is being called
#         thisdir = os.path.dirname(inspect.getfile(inspect.currentframe()))
#         parent = os.path.abspath(os.path.join(thisdir, os.pardir))
#         if return_this_dir:
#             return thisdir
#         else:
#             return parent
# 
# Path: implementation/primaries/GUI/MessageBox.py
# class MessageBox(QtGui.QDialog):
# 
#     def __init__(self, parent=None, message="", title="mbox"):
#         QtGui.QWidget.__init__(self, parent)
# 
#         self.setGeometry(300, 300, 250, 150)
#         self.setWindowTitle(title)
#         designer_file = os.path.join(
#             get_base_dir(
#                 return_this_dir=True),
#             'designer_files',
#             'MessageBox.ui')
#         uic.loadUi(designer_file, self)
#         self.errorLabel.setText(message)
#         self.okBtn.clicked.connect(self.close)
# 
# Path: implementation/primaries/scripts/setup_script.py
# def do_setup(path=None):
#     defaults = {'darwin': "/Applications/Lilypond.app/Contents/Resources/bin",
#                 'win32': "C:/Program Files (x86)/LilyPond/usr/bin"}
#     n_path = path
#     if n_path is None:
#         n_path = defaults[sys.platform]
#     filename = {'darwin': 'LilyPond', 'win32': 'lilypond.exe'}
#     filepath = os.path.join(n_path, filename[sys.platform])
#     if os.path.exists(filepath):
#         setupLilypond(n_path)
#     else:
#         raise LilypondNotInstalledException(
#             'ERROR! Lilypond not installed or filepath incorrect. Please provide the folder which contains ' +
#             filename[
#                 sys.platform])
# 
# Path: implementation/primaries/exceptions.py
# class LilypondNotInstalledException(BaseException):
# 
#     '''ERROR! LILYPOND NOT FOUND'''
# 
# Path: implementation/primaries/GUI/themedWindow.py
# class ThemedWindow(object):
#     def __init__(self, theme, themes_folder):
#     def applyTheme(self):
#     def setTheme(self, theme):


from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtGui import QFileDialog
from implementation.primaries.GUI.helpers import get_base_dir
from implementation.primaries.GUI import MessageBox
from implementation.primaries.scripts.setup_script import do_setup
from implementation.primaries.exceptions import LilypondNotInstalledException
from sys import platform
from implementation.primaries.GUI import themedWindow
import os


class SetupWindow(QtGui.QDialog, themedWindow.ThemedWindow):

    def __init__(self, parent, theme, themes, design_folder):
        self.parent = parent
        QtGui.QDialog.__init__(self)

# Path: implementation/primaries/GUI/helpers.py
# def get_base_dir(return_this_dir=False):
#     if getattr(sys, "frozen", False):
#         # If this is running in the context of a frozen (executable) file,
#         # we return the path of the main application executable
#         return os.path.dirname(os.path.abspath(sys.executable))
#     else:
#         # If we are running in script or debug mode, we need
#         # to inspect the currently executing frame. This enable us to always
#         # derive the directory of main.py no matter from where this function
#         # is being called
#         thisdir = os.path.dirname(inspect.getfile(inspect.currentframe()))
#         parent = os.path.abspath(os.path.join(thisdir, os.pardir))
#         if return_this_dir:
#             return thisdir
#         else:
#             return parent
# 
# Path: implementation/primaries/GUI/MessageBox.py
# class MessageBox(QtGui.QDialog):
# 
#     def __init__(self, parent=None, message="", title="mbox"):
#         QtGui.QWidget.__init__(self, parent)
# 
#         self.setGeometry(300, 300, 250, 150)
#         self.setWindowTitle(title)
#         designer_file = os.path.join(
#             get_base_dir(
#                 return_this_dir=True),
#             'designer_files',
#             'MessageBox.ui')
#         uic.loadUi(designer_file, self)
#         self.errorLabel.setText(message)
#         self.okBtn.clicked.connect(self.close)
# 
# Path: implementation/primaries/scripts/setup_script.py
# def do_setup(path=None):
#     defaults = {'darwin': "/Applications/Lilypond.app/Contents/Resources/bin",
#                 'win32': "C:/Program Files (x86)/LilyPond/usr/bin"}
#     n_path = path
#     if n_path is None:
#         n_path = defaults[sys.platform]
#     filename = {'darwin': 'LilyPond', 'win32': 'lilypond.exe'}
#     filepath = os.path.join(n_path, filename[sys.platform])
#     if os.path.exists(filepath):
#         setupLilypond(n_path)
#     else:
#         raise LilypondNotInstalledException(
#             'ERROR! Lilypond not installed or filepath incorrect. Please provide the folder which contains ' +
#             filename[
#                 sys.platform])
# 
# Path: implementation/primaries/exceptions.py
# class LilypondNotInstalledException(BaseException):
# 
#     '''ERROR! LILYPOND NOT FOUND'''
# 
# Path: implementation/primaries/GUI/themedWindow.py
# class ThemedWindow(object):
#     def __init__(self, theme, themes_folder):
#     def applyTheme(self):
#     def setTheme(self, theme):


# Path: implementation/primaries/GUI/SetupWindow.py
from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtGui import QFileDialog
from implementation.primaries.GUI.helpers import get_base_dir
from implementation.primaries.GUI import MessageBox
from implementation.primaries.scripts.setup_script import do_setup
from implementation.primaries.exceptions import LilypondNotInstalledException
from sys import platform
from implementation.primaries.GUI import themedWindow
import os



class SetupWindow(QtGui.QDialog, themedWindow.ThemedWindow):

    def __init__(self, parent, theme, themes, design_folder):
        self.parent = parent
        QtGui.QDialog.__init__(self)

        themedWindow.ThemedWindow.__init__(self, theme, themes)