예제 #1
0
파일: Polygon.py 프로젝트: d3vgru/pyjs
def PolygonOptions(adict):
    """Accepts a dictionary of options. If necessary, transforms "paths" from
    python list or encoded string to javascript array."""
    if adict.has_key("paths"):
        try:
            if isinstance(adict["paths"], (list, tuple)):
                adict["paths"] = listToJs(adict["paths"])
            elif isinstance(adict["paths"], basestring):  #Gmaps
                adict["paths"] = decodePoly(adict["paths"])
        except:  #isinstance throws exception for raw javascript objects.
            pass  #That means it's already good.
    return dictToJs(adict)
예제 #2
0
def PolygonOptions(adict):
    """Accepts a dictionary of options. If necessary, transforms "paths" from
    python list or encoded string to javascript array."""
    if adict.has_key("paths"):
        try:
            if isinstance(adict["paths"], (list, tuple)):
                adict["paths"] = listToJs(adict["paths"])
            elif isinstance(adict["paths"], basestring):  # Gmaps
                adict["paths"] = decodePoly(adict["paths"])
        except:  # isinstance throws exception for raw javascript objects.
            pass  # That means it's already good.
    return dictToJs(adict)
def GeocoderRequest(**params):
    return dictToJs(params)
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __pyjamas__ import JS

from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs #, gmapsPyObjectToJs


GeocoderStatus = JS("$wnd.google.maps.GeocoderStatus")
GeocoderLocationType = JS("$wnd.google.maps.GeocoderLocationType")


geocoderResultsFields = dictToJs(
    {"results": 'l', "types": 'l', "address_components": 'l',
     "results[]": 'd', "address_components[]": 'd', "geometry": 'd',
     "result": 'd'})


# translates a geocoderResults structure from js to python
# and vice-versa

def translateGeocoderResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    geocoderResultsFields, pyToJs)


# translates just one element of the geocoderResults
# (because it is used inside directionsResults...)
def translateGeocoderResult(jsResult, pyToJs=False):
    return translateGmapsObject(jsResult, "result", \
예제 #5
0
def InfoWindowOptions(**params):
    return dictToJs(params)
예제 #6
0
파일: Map.py 프로젝트: anandology/pyjamas
def NavigationControlOptions(**params):
    return dictToJs(params)
예제 #7
0
def DirectionsRequest(**params):
    return dictToJs(params)
예제 #8
0
파일: Marker.py 프로젝트: Afey/pyjs
def MarkerOptions(**params):
    return dictToJs(params)
예제 #9
0
def DirectionsRendererOptions(**params):
    return dictToJs(params)
예제 #10
0
def ScaleControlOptions(**params):
    return dictToJs(params)
예제 #11
0
def NavigationControlOptions(**params):
    return dictToJs(params)
예제 #12
0
def MapTypeControlOptions(**params):
    return dictToJs(params)
예제 #13
0
def MapOptions(**params):
    return dictToJs(params)
예제 #14
0
파일: Map.py 프로젝트: anandology/pyjamas
def ScaleControlOptions(**params):
    return dictToJs(params)
예제 #15
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __pyjamas__ import JS

from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs  #, gmapsPyObjectToJs

GeocoderStatus = JS("$wnd['google']['maps']['GeocoderStatus']")
GeocoderLocationType = JS("$wnd['google']['maps']['GeocoderLocationType']")

geocoderResultsFields = dictToJs({
    "results": 'l',
    "types": 'l',
    "address_components": 'l',
    "results[]": 'd',
    "address_components[]": 'd',
    "geometry": 'd',
    "result": 'd'
})

# translates a geocoderResults structure from js to python
# and vice-versa


def translateGeocoderResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    geocoderResultsFields, pyToJs)


# translates just one element of the geocoderResults
예제 #16
0
def GeocoderRequest(**params):
    return dictToJs(params)
예제 #17
0
from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs
from pyjamas.gmaps.Geocoder import translateGeocoderResult

DirectionsStatus = JS("$wnd.google.maps.DirectionsStatus")

DirectionsTravelMode = JS("$wnd.google.maps.DirectionsTravelMode")

DirectionsUnitSystem = JS("$wnd.google.maps.DirectionsUnitSystem")

directionsResultsFields = dictToJs({
    "trips": 'l',
    "warnings": 'l',
    "routes": 'l',
    "steps": 'l',
    "results": 'd',
    "trips[]": 'd',
    "routes[]": 'd',
    "steps[]": 'd',
    "start_geocode": translateGeocoderResult,
    "end_geocode": translateGeocoderResult
})

# translates a directions results structure from js to python
# and vice-versa


def translateDirectionsResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    directionsResultsFields, pyToJs)

예제 #18
0
from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs
from pyjamas.gmaps.Geocoder import translateGeocoderResult


DirectionsStatus = JS("$wnd.google.maps.DirectionsStatus")


DirectionsTravelMode = JS("$wnd.google.maps.DirectionsTravelMode")


DirectionsUnitSystem = JS("$wnd.google.maps.DirectionsUnitSystem")


directionsResultsFields = dictToJs(
    {"trips": 'l', "warnings": 'l', "routes": 'l', "steps": 'l',
    "results": 'd', "trips[]": 'd', "routes[]": 'd', "steps[]": 'd',

    "start_geocode": translateGeocoderResult,
    "end_geocode": translateGeocoderResult})


# translates a directions results structure from js to python
# and vice-versa


def translateDirectionsResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    directionsResultsFields, pyToJs)


class DirectionsService:
예제 #19
0
def DirectionsRequest(**params):
    return dictToJs(params)
예제 #20
0
def DirectionsRendererOptions(**params):
    return dictToJs(params)
예제 #21
0
파일: Map.py 프로젝트: anandology/pyjamas
def MapTypeControlOptions(**params):
    return dictToJs(params)