# -*- coding: utf-8 -*-
# ***************************************************************************
# *                                                                         *
# *   Copyright (c) 2017 - Amritpal Singh <amrit3701@gmail.com>             *
# *                                                                         *
# *   This program is free software; you can redistribute it and/or modify  *
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
# *   as published by the Free Software Foundation; either version 2 of     *
# *   the License, or (at your option) any later version.                   *
# *   for detail see the LICENCE text file.                                 *
# *                                                                         *
# *   This program is distributed in the hope that it will be useful,       *
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
# *   GNU Library General Public License for more details.                  *
# *                                                                         *
# *   You should have received a copy of the GNU Library General Public     *
# *   License along with this program; if not, write to the Free Software   *
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
# *   USA                                                                   *
# *                                                                         *
# ***************************************************************************

__title__ = "RebarCommands"
__author__ = "Amritpal Singh"
__url__ = "https://www.freecadweb.org"

from pathlib import Path

import FreeCADGui, FreeCAD
from PySide import QtGui, QtCore
from PySide.QtCore import QT_TRANSLATE_NOOP
from PVPlantResources import DirIcons as DirIcons
import os


class CommandExportToPVSyst:
    "Export to PVSyst"
    @staticmethod
    def GetResources():
        return {'Pixmap': str(os.path.join(DirIcons, "PVsyst.png")),
                'Accel': "E, P",
                'MenuText': QT_TRANSLATE_NOOP("Outputs", "Export to PVSyst"),
                'ToolTip': QT_TRANSLATE_NOOP("Outputs", "Exportar a PVSyst")}

    @staticmethod
    def Activated():
        from Export import exportPVSyst
        taskd = exportPVSyst.PVSystTaskPanel()
        # taskd.show()
        FreeCADGui.Control.showDialog(taskd)

    @staticmethod
    def IsActive():
        if FreeCAD.ActiveDocument:
            return True
        else:
            return False

if FreeCAD.GuiUp:
    from Export import PVPlantBOQMechanical, PVPlantBOQElectrical, PVPlantBOQCivil
    from Export import exportDXF, exportKMZ
    FreeCADGui.addCommand('BOQMechanical', PVPlantBOQMechanical.CommandBOQMechanical())
    FreeCADGui.addCommand('BOQElectrical', PVPlantBOQElectrical.CommandBOQElectrical())
    FreeCADGui.addCommand('BOQCivil', PVPlantBOQCivil.CommandBOQCivil())
    FreeCADGui.addCommand('exportDXF', exportDXF.CommandExportDXF())
    FreeCADGui.addCommand('exportToPVSyst', CommandExportToPVSyst())
    FreeCADGui.addCommand('exportKMZ', exportKMZ.CommandExportKMZ())

Exportlist = ["BOQCivil",
              "BOQMechanical",
              "BOQElectrical",
              "Separator",
              "exportDXF",
              # "importDXF",
              "exportToPVSyst",
              "exportKMZ",
              ]