boris-behav-obs 8.26.1__py2.py3-none-any.whl → 8.27.1__py2.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.
boris/core.py CHANGED
@@ -53,6 +53,8 @@ import gzip
53
53
  from collections import deque
54
54
 
55
55
  import matplotlib
56
+ import zipfile
57
+ import shutil
56
58
 
57
59
  matplotlib.use("Qt5Agg")
58
60
 
@@ -1360,28 +1362,81 @@ class MainWindow(QMainWindow, Ui_MainWindow):
1360
1362
  def actionCheckUpdate_activated(self, flagMsgOnlyIfNew=False):
1361
1363
  """
1362
1364
  check BORIS web site for updates
1365
+ ask user for updating
1363
1366
  """
1364
1367
 
1368
+ versionURL = "https://www.boris.unito.it/static/ver4.dat"
1365
1369
  try:
1366
- versionURL = "https://www.boris.unito.it/static/ver4.dat"
1367
1370
  last_version = urllib.request.urlopen(versionURL).read().strip().decode("utf-8")
1368
- if util.versiontuple(last_version) > util.versiontuple(__version__):
1369
- msg = (
1370
- f"A new version is available: v. <b>{last_version}</b><br>"
1371
- 'Go to <a href="https://www.boris.unito.it">'
1372
- "https://www.boris.unito.it</a> to install it."
1371
+ except Exception:
1372
+ QMessageBox.warning(self, cfg.programName, "Can not check for updates...")
1373
+ return
1374
+
1375
+ # record check timestamp
1376
+ config_file.save(self, lastCheckForNewVersion=int(time.mktime(time.localtime())))
1377
+
1378
+ if util.versiontuple(last_version) > util.versiontuple(__version__):
1379
+ if (
1380
+ dialog.MessageDialog(
1381
+ cfg.programName,
1382
+ (
1383
+ f"A new version is available: v. {last_version}.<br><br>"
1384
+ 'For updating manually go to <a href="https://www.boris.unito.it">https://www.boris.unito.it</a>.<br>'
1385
+ ),
1386
+ (cfg.CANCEL, "Update automatically"),
1373
1387
  )
1374
- # https://github.com/olivierfriard/BORIS/archive/refs/tags/v{last_version}.zip
1375
- else:
1376
- msg = f"The version you are using is the last one: <b>{__version__}</b>"
1388
+ == cfg.CANCEL
1389
+ ):
1390
+ return
1391
+
1392
+ else:
1393
+ msg = f"The version you are using is the last one: <b>{__version__}</b>"
1394
+ QMessageBox.information(self, cfg.programName, msg)
1395
+
1396
+ # any news?
1377
1397
  newsURL = "https://www.boris.unito.it/static/news.dat"
1378
1398
  news = urllib.request.urlopen(newsURL).read().strip().decode("utf-8")
1379
- config_file.save(self, lastCheckForNewVersion=int(time.mktime(time.localtime())))
1380
- QMessageBox.information(self, cfg.programName, msg)
1381
1399
  if news:
1382
1400
  QMessageBox.information(self, cfg.programName, news)
1401
+ return
1402
+
1403
+ # check if a .git is present
1404
+ if (pl.Path(__file__).parent.parent / pl.Path(".git")).is_dir():
1405
+ QMessageBox.critical(self, cfg.programName, "A .git directory is present, BORIS cannot be automatically updated.")
1406
+ return
1407
+
1408
+ # download zip archive
1409
+ try:
1410
+ zip_content = urllib.request.urlopen(f"https://github.com/olivierfriard/BORIS/archive/refs/tags/v{last_version}.zip").read()
1383
1411
  except Exception:
1384
- QMessageBox.warning(self, cfg.programName, "Can not check for updates...")
1412
+ QMessageBox.critical(self, cfg.programName, "Cannot download the new version")
1413
+ return
1414
+
1415
+ temp_zip = tempfile.NamedTemporaryFile(suffix=".zip")
1416
+ try:
1417
+ with open(temp_zip.name, "wb") as f_out:
1418
+ f_out.write(zip_content)
1419
+ except Exception:
1420
+ QMessageBox.critical(self, cfg.programName, "A problem occurred during saving the new version of BORIS.")
1421
+ return
1422
+
1423
+ # extract to temp dir
1424
+ try:
1425
+ temp_dir = tempfile.TemporaryDirectory()
1426
+ with zipfile.ZipFile(temp_zip.name, "r") as zip_ref:
1427
+ zip_ref.extractall(temp_dir.name)
1428
+ except Exception:
1429
+ QMessageBox.critical(self, cfg.programName, "A problem occurred during the unzip of the new version.")
1430
+ return
1431
+
1432
+ # copy from temp dir to current BORIS dir
1433
+ try:
1434
+ shutil.copytree(f"{temp_dir.name}/BORIS-{last_version}", pl.Path(__file__).parent.parent, dirs_exist_ok=True)
1435
+ except Exception:
1436
+ QMessageBox.critical(self, cfg.programName, "A problem occurred during the copy the new version of BORIS.")
1437
+ return
1438
+
1439
+ QMessageBox.information(self, cfg.programName, f"BORIS was updated to v. {last_version}. Restart the program to apply the changes.")
1385
1440
 
1386
1441
  def seek_mediaplayer(self, new_time: dec, player=0) -> int:
1387
1442
  """
boris/preferences.py CHANGED
@@ -54,7 +54,6 @@ class Preferences(QDialog, Ui_prefDialog):
54
54
  self.pbCancel.clicked.connect(self.reject)
55
55
 
56
56
  self.flag_refresh = False
57
- self.flag_reset_frames_memory = False
58
57
 
59
58
  def refresh_preferences(self):
60
59
  """
boris/select_modifiers.py CHANGED
@@ -75,12 +75,13 @@ class ModifiersList(QDialog):
75
75
 
76
76
  self.modifiersSetNumber += 1
77
77
 
78
- lb = QLabel()
79
- lb.setText(f"Modifier <b>{self.modifiers_dict[idx]['name']}</b>")
80
- V2layout.addWidget(lb)
78
+ if self.modifiers_dict[idx].get("name", ""):
79
+ lb1 = QLabel(f"Modifier <b>{self.modifiers_dict[idx].get('name', '')}</b>")
80
+ V2layout.addWidget(lb1)
81
81
 
82
- lb = QLabel(f"<small>{self.modifiers_dict[idx]['description']}</small>")
83
- V2layout.addWidget(lb)
82
+ if self.modifiers_dict[idx].get("description", ""):
83
+ lb2 = QLabel(f"<small>{self.modifiers_dict[idx].get('description', '')}</small>")
84
+ V2layout.addWidget(lb2)
84
85
 
85
86
  if self.modifiers_dict[idx]["type"] in (
86
87
  cfg.SINGLE_SELECTION,
boris/version.py CHANGED
@@ -20,5 +20,5 @@ This file is part of BORIS.
20
20
 
21
21
  """
22
22
 
23
- __version__ = "8.26.1"
24
- __version_date__ = "2024-06-06"
23
+ __version__ = "8.27.1"
24
+ __version_date__ = "2024-06-11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boris-behav-obs
3
- Version: 8.26.1
3
+ Version: 8.27.1
4
4
  Summary: BORIS - Behavioral Observation Research Interactive Software
5
5
  Author-email: Olivier Friard <olivier.friard@unito.it>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -16,7 +16,7 @@ boris/connections.py,sha256=RIQsaooiz6pzc2jJMHw9CQSyX39TgbM5JAwifCu5eWQ,19280
16
16
  boris/converters.py,sha256=FymqUxLEVLQwsUv6EVF7MRPowN1e87aVT2d3XjZJgAM,11771
17
17
  boris/converters_ui.py,sha256=firMWVgS3c492FF-YFv3FehOBLsbBHKaLEaVcoVctgc,8745
18
18
  boris/cooccurence.py,sha256=scazxKCmFQjBvv7oS9h7ylB8GJdkSmwy1LJZeUv5DOY,9824
19
- boris/core.py,sha256=y_7xvlLojM-Jdu3FlAwzWLQoiiGtHIC2Eo6Qm2SaHhk,222161
19
+ boris/core.py,sha256=xkgkxUjAg-mqXORTQUKKPH8FMRMUkAH7UY8QC1NHeJQ,224211
20
20
  boris/core_qrc.py,sha256=5YMpr7ckI4TbXaeSyCMhNJBAlrGPeLes62RedU3EbWs,865287
21
21
  boris/core_ui.py,sha256=Z_6Ehp93fRVnPGyKRtgX2GcXRXb8QZojXipHSpJ_f3M,69854
22
22
  boris/db_functions.py,sha256=YyI2LMSFn772aMGdkOIpfXbPuoSWEvDckZZKevwvB-4,13326
@@ -58,7 +58,7 @@ boris/plot_events.py,sha256=HAKrdS3qf0A_PG1pGo0FRyk62femDxfxGss3w8CrlUw,23541
58
58
  boris/plot_events_rt.py,sha256=UfO1NKSqBR7j-vnfG8CKuOcdg5o8QQI_0eYdcz29Ufc,8358
59
59
  boris/plot_spectrogram_rt.py,sha256=yc8ifg9HCl-v_upMHkH_rmIZLhWBYkWBOhtKftvRvh0,8394
60
60
  boris/plot_waveform_rt.py,sha256=kNk6NVjM3wT3MpAw5zE9ktH94Pkd2AJ4ppv6uM6BVBc,7502
61
- boris/preferences.py,sha256=5KxUwP10mnsAk8CH3eSlzvd8mtsHsFJfWhzot3QOy3Y,11540
61
+ boris/preferences.py,sha256=W_BHck8lxODvZ9NzIgfvhvXAwUI5A66aJVmdTRTxZMo,11494
62
62
  boris/preferences_ui.py,sha256=LQ46jW9kltJBQD85EHd5cCmlHG4c9N6v6YQLQvUisGM,21935
63
63
  boris/project.py,sha256=i9XT744HoJhlV93C0QuEMD8tNmzIHL0E-iZ4PIOSadc,82219
64
64
  boris/project_functions.py,sha256=R3DS_faDuMGKTpMnV0OhqgZp9yO1ojoA5wUIXdtHNIE,70972
@@ -66,7 +66,7 @@ boris/project_import_export.py,sha256=lCL4fOZuG5MaEf_wfDSHiE7-M2ZQsIbUR7KpHZjb1U
66
66
  boris/project_ui.py,sha256=TRJlsqq4XbIl8k2f20BKr2PtKa0QNjFNr6UnMieZYqU,35915
67
67
  boris/qrc_boris.py,sha256=4U2cD_fIBTtsTPhirOl9I3kTArOhXWYvfuO_A0M9N0I,675001
68
68
  boris/qrc_boris5.py,sha256=6bwT8OVtIr84nVIYp2ldUL7XL6WJi9zgJow6kgRxuIQ,161601
69
- boris/select_modifiers.py,sha256=TAo7xi5bhiMp9WOAwEPq9xc8i4Nsa2QrcpoCrUgPwhE,13178
69
+ boris/select_modifiers.py,sha256=Oo3AVEAQO3N0Zmdl0o6BsDojUAzXry2d_aswmXiTzvw,13310
70
70
  boris/select_observations.py,sha256=snMC23nYD_qi88q95rXqV-NqbGO5BrLrC-CKlmVR3ok,14441
71
71
  boris/select_subj_behav.py,sha256=bX-YCeysK5QowYgoxQyy-9qeZmhzWM4SwArXxSAa5ho,10342
72
72
  boris/state_events.py,sha256=AcZmD0pIJ4AszTQe9conWlh8gJhwdBjZiGm1KOXt804,7768
@@ -76,7 +76,7 @@ boris/time_budget_functions.py,sha256=L-0PuPWYR33UMfqmxpcCVH-w4mLLrtZ8b8kBTmBwls
76
76
  boris/time_budget_widget.py,sha256=9WV-iKYSl1f3HBrGcL-eHDjUswrFQh6-WUcffTtce1Y,42852
77
77
  boris/transitions.py,sha256=2zucdoa2jTpWtM6nWHr8lOvjXkrQmo9j71fz_fMLALU,11998
78
78
  boris/utilities.py,sha256=07qXAQ6aGyiSC2h6RMJ031OlXYy05-KTLJtnQtXn6FU,48724
79
- boris/version.py,sha256=p1Eo1rAKt4WoBUXddzmCG41ZVzlVjIetATyhD0XQVaI,788
79
+ boris/version.py,sha256=R7Vu_FZD5RCunuUR3wOvNACUfSHW1T5IU3fDM8QjtIM,788
80
80
  boris/video_equalizer.py,sha256=QpVgmdqX_E4HnMa2f_Qo_fKJTl9nBoTQd_ykv9RWlIQ,5862
81
81
  boris/video_equalizer_ui.py,sha256=A2_Sz9AAVnJygTRUeK_YXxf-WWQpxSSlFw0MjkxiwSg,9762
82
82
  boris/video_operations.py,sha256=96jR-3snNn9VeEURRD6rCwvOL2sSHXoqlP_gYFwgO8A,9379
@@ -105,9 +105,9 @@ boris/qdarkstyle/utils/__init__.py,sha256=Nlma8-zbHoJc5n2NVT7OvwxPG5765JnsmMeGzr
105
105
  boris/qdarkstyle/utils/__main__.py,sha256=J1biUyDzfutKU1n9NdH9WnD0gFHaF-OJA4Q-n6Q2ehs,3309
106
106
  boris/qdarkstyle/utils/images.py,sha256=af-BJllzWgVoVz6QMvhFcKqvF3mo44AThaBjuAuHtNE,14444
107
107
  boris/qdarkstyle/utils/scss.py,sha256=n7WNo6pPRft8-dU7_gfjB_jA-JZAy50-S792RwR7Ri0,9366
108
- boris_behav_obs-8.26.1.dist-info/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
109
- boris_behav_obs-8.26.1.dist-info/METADATA,sha256=38_OR718pDduPAAmZi8ixtl_iH1zyPE4T38USEQALBY,45543
110
- boris_behav_obs-8.26.1.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
111
- boris_behav_obs-8.26.1.dist-info/entry_points.txt,sha256=fuO7JxKFLOm6xp6m3JHRA1UO_QW1dYU-F0IooA1NqQs,37
112
- boris_behav_obs-8.26.1.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
113
- boris_behav_obs-8.26.1.dist-info/RECORD,,
108
+ boris_behav_obs-8.27.1.dist-info/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
109
+ boris_behav_obs-8.27.1.dist-info/METADATA,sha256=kvogMP1-NaGnbJB8Du4NFjuqk3X4kM8JPx3at8IXZqw,45543
110
+ boris_behav_obs-8.27.1.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
111
+ boris_behav_obs-8.27.1.dist-info/entry_points.txt,sha256=fuO7JxKFLOm6xp6m3JHRA1UO_QW1dYU-F0IooA1NqQs,37
112
+ boris_behav_obs-8.27.1.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
113
+ boris_behav_obs-8.27.1.dist-info/RECORD,,