# Path: qad_msg.py
# class QadMsgClass():
#    def __init__(self):
#    def translate(self, context, sourceText, disambiguation = None, encoding = QCoreApplication.UnicodeUTF8, n = -1):
# def qadShowPluginHelp(section = "", filename = "index", packageName = None):


from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.core import QgsApplication
from qgis.utils import *
from qgis.gui import *
from qad_variables import *
from qad_msg import QadMsg, qadShowPluginHelp
import qad_windowcolor_ui
import qad_utils
      variables = []
      contexts = self.contextList.items() # lista dei contesti
      for context in contexts:
         # context = (<contextEnum>, (<contextDescr>, <elementDict>))
         elementDict = context[1][1]
         elements = elementDict.items() # lista degli elementi
         for element in elements:
            # element = (<elementEnum>, (<elementDescr>, <sys var name>))
            varName = element[1][1]
            varValue = self.tempQadVariables.get(varName)
            variables.append(QadVariable(varName, varValue, QadVariableTypeEnum.COLOR))
      return variables


   def Button_ApplyClose_Pressed(self):
      # copio i valori dei colori in QadVariables e li salvo
      variables = self.getSysVariableList()
      for variable in variables:
         QadVariables.set(variable.name, variable.value)
      QadVariables.save()
      self.plugIn.TextWindow.refreshColors()
      
      QDialog.accept(self)


   def Button_Cancel_Pressed(self):
      QDialog.reject(self)


   def ButtonHELP_Pressed(self):

# Path: qad_msg.py
# class QadMsgClass():
#    def __init__(self):
#    def translate(self, context, sourceText, disambiguation = None, encoding = QCoreApplication.UnicodeUTF8, n = -1):
# def qadShowPluginHelp(section = "", filename = "index", packageName = None):


# Path: qad_windowcolor_dlg.py
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.core import QgsApplication
from qgis.utils import *
from qgis.gui import *
from qad_variables import *
from qad_msg import QadMsg, qadShowPluginHelp
import qad_windowcolor_ui
import qad_utils

      variables = []
      contexts = self.contextList.items() # lista dei contesti
      for context in contexts:
         # context = (<contextEnum>, (<contextDescr>, <elementDict>))
         elementDict = context[1][1]
         elements = elementDict.items() # lista degli elementi
         for element in elements:
            # element = (<elementEnum>, (<elementDescr>, <sys var name>))
            varName = element[1][1]
            varValue = self.tempQadVariables.get(varName)
            variables.append(QadVariable(varName, varValue, QadVariableTypeEnum.COLOR))
      return variables


   def Button_ApplyClose_Pressed(self):
      # copio i valori dei colori in QadVariables e li salvo
      variables = self.getSysVariableList()
      for variable in variables:
         QadVariables.set(variable.name, variable.value)
      QadVariables.save()
      self.plugIn.TextWindow.refreshColors()
      
      QDialog.accept(self)


   def Button_Cancel_Pressed(self):
      QDialog.reject(self)


   def ButtonHELP_Pressed(self):

      qadShowPluginHelp(QadMsg.translate("Help", ""))