gismap 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gismap/lab/graph.py CHANGED
@@ -210,7 +210,7 @@ def lab2graph(lab):
210
210
  True
211
211
  >>> html = lab2graph(lab)
212
212
  >>> html[:80] # doctest: +ELLIPSIS
213
- '\\n<div id="mynetwork_..."></div>\\n<div id="modal_..." class="modal">\\n <'
213
+ '\\n<div class="gismap-content">\\n<div id="mynetwork_..."></div>\\n<a\\n href="htt'
214
214
  """
215
215
  node_pubs = {k: [] for k in lab.authors}
216
216
  edges_dict = defaultdict(list)
gismap/lab/vis.py CHANGED
@@ -4,21 +4,37 @@ import json
4
4
 
5
5
 
6
6
  vis_template = Template("""
7
+ <div class="gismap-content">
7
8
  <div id="${container_id}"></div>
9
+ <a
10
+ href="https://balouf.github.io/gismap/"
11
+ target="_blank"
12
+ id="gismap-brand"
13
+ style="position: absolute; left: 10px; bottom: 10px; text-decoration: none; color: #888; font-size: min(2vw, 10px);
14
+ z-index: 10; pointer-events: auto;"
15
+ >
16
+ &copy; Gismap 2025
17
+ </a>
8
18
  <div id="${modal_id}" class="modal">
9
- <div class="modal-content">
19
+ <div class="modal-content">
10
20
  <span class="close" id="${modal_close_id}">&times;</span>
11
21
  <div id="${modal_body_id}"></div>
12
22
  </div>
13
23
  </div>
24
+ </div>
14
25
  <style>
26
+ .gismap-content {
27
+ position: relative;
28
+ width: 100%;
29
+ height: 80vh !important;
30
+ max-width: 100vw;
31
+ max-height: 100vh !important;
32
+ }
15
33
  /* Styles adaptatifs pour dark/light */
16
34
  /* Default: dark mode styles */
17
35
  #${container_id} {
18
36
  width: 100%;
19
- height: 80vh !important;
20
- max-width: 100vw;
21
- max-height: 100vh !important;
37
+ height: 100%;
22
38
  box-sizing: border-box;
23
39
  border: 1px solid #444;
24
40
  background: #181818;
@@ -111,20 +127,6 @@ body[data-jp-theme-light="true"] .close:hover, body[data-jp-theme-light="true"]
111
127
  }
112
128
  </style>
113
129
  <script type="text/javascript">
114
- if (typeof vis === 'undefined') {
115
- var script = document.createElement('script');
116
- script.src = "https://unpkg.com/vis-network/standalone/umd/vis-network.min.js";
117
- script.type = "text/javascript";
118
- script.onload = function() {
119
- console.log("vis-network loaded dynamically");
120
- // You can trigger your graph init here if needed
121
- };
122
- document.head.appendChild(script);
123
- } else {
124
- console.log("vis-network already loaded");
125
- }
126
- </script>
127
- <script type="text/javascript">
128
130
  (function() {
129
131
  // Détection du thème
130
132
  function getTheme() {
@@ -191,10 +193,6 @@ function getTheme() {
191
193
  };
192
194
  }
193
195
  };
194
- const nodes = new vis.DataSet(${nodes_json});
195
- const edges = new vis.DataSet(${edges_json});
196
- const container = document.getElementById('${container_id}');
197
- let network = null;
198
196
 
199
197
  var physics = {
200
198
  physics: {
@@ -221,6 +219,10 @@ function getTheme() {
221
219
  };
222
220
 
223
221
  function renderNetwork() {
222
+ const nodes = new vis.DataSet(${nodes_json});
223
+ const edges = new vis.DataSet(${edges_json});
224
+ const container = document.getElementById('${container_id}');
225
+ let network = null;
224
226
  const theme = getTheme();
225
227
  const options = getVisOptions(theme);
226
228
  network = new vis.Network(container, { nodes: nodes, edges: edges }, options);
@@ -262,20 +264,36 @@ function getTheme() {
262
264
  if (event.target == modal) { modal.style.display = "none"; }
263
265
  };
264
266
  };
265
- renderNetwork();
267
+
268
+ function loadVisAndRender() {
269
+ if (typeof vis === 'undefined') {
270
+ var script = document.createElement('script');
271
+ script.src = "https://unpkg.com/vis-network/standalone/umd/vis-network.min.js";
272
+ script.type = "text/javascript";
273
+ script.onload = function() {
274
+ console.log("vis-network loaded dynamically");
275
+ renderNetwork(); // Graph init after vis is loaded
276
+ };
277
+ document.head.appendChild(script);
278
+ } else {
279
+ console.log("vis-network already loaded");
280
+ renderNetwork(); // Graph init immediately
281
+ }
282
+ }
283
+ loadVisAndRender();
266
284
 
267
285
  // Adapter dynamiquement si le thème change
268
- window.addEventListener("theme-changed", () => renderNetwork());
286
+ window.addEventListener("theme-changed", () => loadVisAndRender());
269
287
  const observer = new MutationObserver(mutations => {
270
288
  for (const mutation of mutations) {
271
289
  if (mutation.type === "attributes" && mutation.attributeName === "data-jp-theme-name") {
272
- renderNetwork();
290
+ loadVisAndRender();
273
291
  }
274
292
  }
275
293
  });
276
294
  observer.observe(document.body, { attributes: true });
277
295
  if (window.matchMedia) {
278
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => renderNetwork());
296
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => loadVisAndRender());
279
297
  };
280
298
  })();
281
299
  </script>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gismap
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: GISMAP leverages DBLP and HAL databases to provide cartography tools for you and your lab.
5
5
  Project-URL: Repository, https://github.com/balouf/gismap
6
6
  Project-URL: Documentation, https://balouf.github.io/gismap
@@ -49,11 +49,11 @@ Use GISMAP to produce a collaboration graph (HTML):
49
49
 
50
50
  ```pycon
51
51
  >>> from gismap.sources.hal import HAL
52
- >>> from gismap.lab import ListLab, lab2graph
53
- >>> lab = ListLab(["Mathilde Labbé", "Anne Reverseau", "David Martens", "Marcela Scibiorska", "Nathalie Grande"], dbs=[HAL])
52
+ >>> from gismap.lab import ListLab
53
+ >>> lab = ListLab(["Fabien Mathieu", "François Baccelli", "Ludovic Noirie", "Céline Comte", "Sébastien Tixeuil"], dbs="hal")
54
54
  >>> lab.update_authors()
55
55
  >>> lab.update_publis()
56
- >>> collabs = lab2graph(lab)
56
+ >>> lab.show_html()
57
57
  ```
58
58
 
59
59
  ## Credits
@@ -7,12 +7,12 @@ gismap/lab/__init__.py,sha256=WeJkoNZmFnLoEgK_nwXqZrA4nQtpeTLPf6PPMFIGb4k,415
7
7
  gismap/lab/egomap.py,sha256=L5OKeZR7RCfX3EPm859-jZ1jnqlC3kpa0jybofhLPPc,1328
8
8
  gismap/lab/expansion.py,sha256=fYcUvkGi3W1GTx2gnFT1z3cI-jlZFFAicDM99wi2wzE,6186
9
9
  gismap/lab/filters.py,sha256=LL3jeCqLBpLeaz1lz5IvduV4G1xBPaty9SHiBxoYgak,486
10
- gismap/lab/graph.py,sha256=UTmuJsUXC9ntmAWoH46cBW3CTIGKus5z1G045yBLzAQ,6673
10
+ gismap/lab/graph.py,sha256=8fzxohyUWqayLKaOC7CpBaKDN63eZK6oYp7nrfDDosw,6680
11
11
  gismap/lab/lab.py,sha256=Uc9Qg7Okf3L5K8gHTlnOv7lPbeA9OBfivCmZwRPwzp8,5331
12
12
  gismap/lab/lab_author.py,sha256=jQhq1spZP5P-Bpzr5E_OP73gWy3SG6UjiVCGotjm57s,2439
13
13
  gismap/lab/lip6.py,sha256=LLLjV8zNqwdkvtuV4nfmScCDlaeeGw79I0KQuOQ1_Yo,1443
14
14
  gismap/lab/toulouse.py,sha256=Ex3lBPdYhAzAnPQw9Driho7joJNTHLpE_nNMooQH_nc,1495
15
- gismap/lab/vis.py,sha256=j92WFmYZ0Szg10tq332PT5jQn3YbJSIOkYraVcmxiNk,8293
15
+ gismap/lab/vis.py,sha256=YwMkoSa3-IsoNooQgZbluvIrQsYRbti1dlVRewypBNY,8734
16
16
  gismap/sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  gismap/sources/dblp.py,sha256=_AgPgDbHYYaeJVam43eExv1VsglvAV46eP77RL7o9Fo,5278
18
18
  gismap/sources/hal.py,sha256=3VjiUH5amNfJYV5uAtX-JcGWMNKUkmjfXU0Osca9CC8,10021
@@ -23,7 +23,7 @@ gismap/utils/common.py,sha256=nx1f60yNwFpl1oz08h-R5o0xK9CbJv9tmYLDk61dwYA,2898
23
23
  gismap/utils/logger.py,sha256=1YALIaNYKTqeIyyCnYxzvZTK7x4FTSfYYl5CP9IMw8E,86
24
24
  gismap/utils/requests.py,sha256=DA-ifVMdcOtipDSqYdVRQi-7CGR5WCTYiGyZ7Xu78q0,1291
25
25
  gismap/utils/text.py,sha256=1_9DlduAYh7Nz-yAg-MaCTmdKbPPmuIY20bb87t7JAQ,3810
26
- gismap-0.2.0.dist-info/METADATA,sha256=XvYw05O-XgvC_5Ormcwjt4FOkbaJHHn-1pvwkV_ma8Q,2560
27
- gismap-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
- gismap-0.2.0.dist-info/licenses/AUTHORS.md,sha256=oDR4mptVUBMq0WKIpt19Km1Bdfz3cO2NAOVgwVfTO8g,131
29
- gismap-0.2.0.dist-info/RECORD,,
26
+ gismap-0.2.1.dist-info/METADATA,sha256=ZKER11xqoYCNSMmLpe-E7BdBbiLRMrAQuFEqct3ofuk,2542
27
+ gismap-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
+ gismap-0.2.1.dist-info/licenses/AUTHORS.md,sha256=oDR4mptVUBMq0WKIpt19Km1Bdfz3cO2NAOVgwVfTO8g,131
29
+ gismap-0.2.1.dist-info/RECORD,,
File without changes