Skip to content

Commit

Permalink
clean version
Browse files Browse the repository at this point in the history
  • Loading branch information
Nour-Cheour10 committed May 15, 2024
1 parent f656eb4 commit 6ecf2b8
Show file tree
Hide file tree
Showing 5 changed files with 998 additions and 1,050 deletions.
1 change: 0 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.1.cjs
52 changes: 26 additions & 26 deletions examples/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e859d057cbf6408b963ab3f9d054919a",
"model_id": "757d5de3cec24c4e83d186b710dcfa59",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -44,26 +44,26 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"m.zoom=2\n",
"m.zoom=4\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"m.center=[3.0,5.0]"
"m.center=[10.0,5.0]"
]
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -73,7 +73,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 7,
"metadata": {
"scrolled": true
},
Expand All @@ -84,16 +84,16 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[TileLayer()]"
"[TileLayer(url='https://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png')]"
]
},
"execution_count": 10,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -104,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -113,16 +113,16 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[TileLayer(), TileLayer()]"
"[]"
]
},
"execution_count": 24,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -133,11 +133,11 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"m.clear_layer()"
"m.clear_layers()"
]
},
{
Expand All @@ -162,21 +162,21 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "98a20f2762f3428585069cda1d7b0b8b",
"model_id": "59aea50b07f14f028e2fb5e01c43a461",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[0.0, 0.0], zoom=2.0)"
"Map(center=[0.0, 0.0])"
]
},
"execution_count": 19,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -188,16 +188,16 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0"
"2.0"
]
},
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -208,16 +208,16 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[34.6252978589571, -77.34580993652344]"
"[0.0, 0.0]"
]
},
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
53 changes: 3 additions & 50 deletions ipyopenlayers/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""

from ipywidgets import DOMWidget, Widget, widget_serialization
from traitlets import Unicode, List, Instance, Enum,default, CFloat
from traitlets import Unicode, List, Instance, CFloat
from ._frontend import module_name, module_version
def_loc = [0.0, 0.0]

Expand All @@ -25,10 +25,6 @@ class TileLayer(Widget):


class Map(DOMWidget):
"""TODO: Add docstring here
"""


_model_name = Unicode('MapModel').tag(sync=True)
_model_module = Unicode(module_name).tag(sync=True)
_model_module_version = Unicode(module_version).tag(sync=True)
Expand All @@ -38,9 +34,9 @@ class Map(DOMWidget):

value = Unicode('Hello World').tag(sync=True)
center = List(def_loc).tag(sync=True, o=True)
zoom = CFloat(12).tag(sync=True, o=True)
zoom = CFloat(2).tag(sync=True, o=True)
layers = List(Instance(TileLayer)).tag(sync=True, **widget_serialization)

def __init__(self, center=None, zoom=None, **kwargs):
super().__init__(**kwargs)

Expand All @@ -51,7 +47,6 @@ def __init__(self, center=None, zoom=None, **kwargs):
self.zoom = zoom

def add_layer(self, layer):
# Copy layers (workaround ipywidgets issue)
self.layers = self.layers + [layer]

def remove_layer(self, layer):
Expand All @@ -61,45 +56,3 @@ def clear_layers(self):
self.layers = []









class Control(Widget):

_view_name = Unicode("OpenLayersControlView").tag(sync=True)
_model_name = Unicode("OpenLayersControlModel").tag(sync=True)
_view_module = Unicode("jupyter-openlayers").tag(sync=True)
_model_module = Unicode("jupyter-openlayers").tag(sync=True)

options = List(trait=Unicode()).tag(sync=True)

position = Enum(
["topright", "topleft", "bottomright", "bottomleft"],
default_value="topleft",
help="""Possible values are topleft, topright, bottomleft
or bottomright""",
).tag(sync=True, o=True)

@default("options")
def _default_options(self):
return [name for name in self.traits(o=True)]


class ZoomControl(Control):

_view_name = Unicode("OpenLayersZoomControlView").tag(sync=True)
_model_name = Unicode("OpenLayersZoomControlModel").tag(sync=True)

zoom_in_text = Unicode("+").tag(sync=True, o=True)
zoom_in_title = Unicode("Zoom in").tag(sync=True, o=True)
zoom_out_text = Unicode("-").tag(sync=True, o=True)
zoom_out_title = Unicode("Zoom out").tag(sync=True, o=True)





3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,5 @@
"singleton": true
}
}
},
"packageManager": "[email protected]"
}
}
Loading

0 comments on commit 6ecf2b8

Please sign in to comment.