# Path: orangecontrib/spark/base/shared_spark_context.py
# class SharedSparkContext:
#     _sc = None
#     _hc = None
# 
#     @property
#     def sc(self):
#         return SharedSparkContext._sc
# 
#     @sc.setter
#     def sc(self, val):
#         SharedSparkContext._sc = val
# 
#     @property
#     def hc(self):
#         return SharedSparkContext._hc
# 
#     @hc.setter
#     def hc(self, val):
#         SharedSparkContext._hc = val


import pandas
import pyspark
from Orange.widgets import widget, gui, settings
from PyQt4.QtGui import QSizePolicy
from orangecontrib.spark.base.shared_spark_context import SharedSparkContext
__author__ = 'jamh'




class OWSparkToPandas(SharedSparkContext, widget.OWWidget):
    priority = 8
    name = "from Pandas"
    description = "Convert Pandas dataframe to Spark DataFrame."
    icon = "../icons/spark.png"

    inputs = [("DataFrame", pandas.DataFrame, "get_input", widget.Default)]
    outputs = [("DataFrame", pyspark.sql.DataFrame, widget.Dynamic)]
    settingsHandler = settings.DomainContextHandler()

    def __init__(self):
        super().__init__()

# Path: orangecontrib/spark/base/shared_spark_context.py
# class SharedSparkContext:
#     _sc = None
#     _hc = None
# 
#     @property
#     def sc(self):
#         return SharedSparkContext._sc
# 
#     @sc.setter
#     def sc(self, val):
#         SharedSparkContext._sc = val
# 
#     @property
#     def hc(self):
#         return SharedSparkContext._hc
# 
#     @hc.setter
#     def hc(self, val):
#         SharedSparkContext._hc = val


# Path: orangecontrib/spark/widgets/data/spark_from_pandas.py
import pandas
import pyspark
from Orange.widgets import widget, gui, settings
from PyQt4.QtGui import QSizePolicy
from orangecontrib.spark.base.shared_spark_context import SharedSparkContext

__author__ = 'jamh'




class OWSparkToPandas(SharedSparkContext, widget.OWWidget):
    priority = 8
    name = "from Pandas"
    description = "Convert Pandas dataframe to Spark DataFrame."
    icon = "../icons/spark.png"

    inputs = [("DataFrame", pandas.DataFrame, "get_input", widget.Default)]
    outputs = [("DataFrame", pyspark.sql.DataFrame, widget.Dynamic)]
    settingsHandler = settings.DomainContextHandler()

    def __init__(self):
        super().__init__()

        gui.label(self.controlArea, self, "Pandas->Spark:")