# 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
# 
# def merge_clefs_and_keys(clef_or_key_dict):
#     result = ''
#     for instrument in clef_or_key_dict:
#         result += ", ".join(clef_or_key_dict[instrument])
#     return result
# 
# def merge_instruments(instrument_list):
#     return ", ".join([instrument["name"] for instrument in instrument_list])
# 
# def fit_columns_to_widget(widget, columns):
#     for column in range(columns):
#         widget.setColumnWidth(column, widget.width() / (columns - 1))


from PyQt4 import uic, QtCore, QtGui
from implementation.primaries.GUI.helpers import get_base_dir, merge_clefs_and_keys, merge_instruments, fit_columns_to_widget
import os

    def __init__(self, parent, design_folder):
        Window.__init__(
            self,
            parent,
            "BasicListWidget.ui",
            "Piece Information",
            design_folder)
        self.loadInfo()

    def loadInfo(self):
        if self.main_window.current_piece != "":
            self.listWidget.clear()
            data = self.application.getFileInfo(
                self.main_window.current_piece)[0]

            datastring = "title: " + data["title"]
            title = QtGui.QListWidgetItem(datastring)
            self.listWidget.addItem(title)
            keys = (
                "composer",
                "lyricist",
                "instruments",
                "clefs",
                "keys",
                "tempos",
                "time_signatures")

            alternate_methods = {"instruments": merge_instruments,
                                 "clefs": merge_clefs_and_keys,

# 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
# 
# def merge_clefs_and_keys(clef_or_key_dict):
#     result = ''
#     for instrument in clef_or_key_dict:
#         result += ", ".join(clef_or_key_dict[instrument])
#     return result
# 
# def merge_instruments(instrument_list):
#     return ", ".join([instrument["name"] for instrument in instrument_list])
# 
# def fit_columns_to_widget(widget, columns):
#     for column in range(columns):
#         widget.setColumnWidth(column, widget.width() / (columns - 1))


# Path: implementation/primaries/GUI/Widgets.py
from PyQt4 import uic, QtCore, QtGui
from implementation.primaries.GUI.helpers import get_base_dir, merge_clefs_and_keys, merge_instruments, fit_columns_to_widget
import os


    def __init__(self, parent, design_folder):
        Window.__init__(
            self,
            parent,
            "BasicListWidget.ui",
            "Piece Information",
            design_folder)
        self.loadInfo()

    def loadInfo(self):
        if self.main_window.current_piece != "":
            self.listWidget.clear()
            data = self.application.getFileInfo(
                self.main_window.current_piece)[0]

            datastring = "title: " + data["title"]
            title = QtGui.QListWidgetItem(datastring)
            self.listWidget.addItem(title)
            keys = (
                "composer",
                "lyricist",
                "instruments",
                "clefs",
                "keys",
                "tempos",
                "time_signatures")

            alternate_methods = {"instruments": merge_instruments,
                                 "clefs": merge_clefs_and_keys,

                                 "keys": merge_clefs_and_keys,