Skip to content

Commit

Permalink
re-introduce update notice
Browse files Browse the repository at this point in the history
  • Loading branch information
bimac authored Sep 25, 2023
1 parent 6ed33e2 commit 9ebfe07
Show file tree
Hide file tree
Showing 17 changed files with 1,142 additions and 155 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ exclude =
scratch_*.py,
Bonsai,
venv*
_version.py
ui_*.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ app.log
/.idea/*
/venv/
*.autosave
iblrig/_version.py
*.code-workspace
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Changelog
---------

-------------------------------


8.9.3
-----
* re-implemented update notice

8.9.2
-----
* hot-fix for disabling the update-check - this will need work

8.9.1
-----
* hot-fix for missing live-plots

8.9.0
-----
* major rework of the GUI
* task-specific settings
* new dialogs for weight & droppings
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from importlib.metadata import version
from datetime import date

from iblrig import __version__

project = 'iblrig'
copyright = f'2018 – {date.today().year} International Brain Laboratory'
author = 'International Brain Laboratory'
release = version('iblrig')
version = '.'.join(release.split('.')[:3])
version = '.'.join(__version__.split('.')[:3])

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
20 changes: 12 additions & 8 deletions docs/source/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ Its version string (currently "|version|") is a combination of three fields, sep
* The ``MINOR`` field will be incremented upon adding new, backwards compatible features.
* The ``PATCH`` field will be incremented with each new, backwards compatible bugfix release that does not implement a new feature.

On the developer side, these 3 fields are manually controlled by adding the respective version string to a commit as a `git tag <https://git-scm.com/book/en/v2/Git-Basics-Tagging>`_, for instance:
On the developer side, these 3 fields are manually controlled by, both

.. code-block:: console
1. adjusting the variable ``__version__`` in ``iblrig/__init__.py``, and
2. adding the corresponding version string to a commit as a `git tag <https://git-scm.com/book/en/v2/Git-Basics-Tagging>`_,
for instance:

.. code-block:: console
git tag 8.8.4
git push origin --tags
git tag 8.8.4
git push origin --tags
The version string displayed by IBLRIG *may* include additional fields, such as in "|version|.post3+dirty".
The version string displayed by IBLRIG *may* include additional fields, such as in "|version|-post3.dirty".
Here,

* ``.post3`` indicates the third unversioned commit after the latest versioned release, and
* ``+dirty`` indicates the presence of uncommited changes in your local repository of IBLRIG.
* ``post3`` indicates the third unversioned commit after the latest versioned release, and
* ``dirty`` indicates the presence of uncommited changes in your local repository of IBLRIG.

Both of these fields are inferred by `setuptools_scm <https://pypi.org/project/setuptools-scm/>`_ and do not require manual interaction from the developer.
Both of these fields are inferred by means of git describe and do not require manual interaction from the developer.


Running Tests Locally
Expand Down
17 changes: 12 additions & 5 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,29 @@ To initiate a task through the graphical user interface, open a Windows PowerShe
These commands activate the necessary environment and launch the IBL
Rig Wizard GUI window, as shown below:

.. image:: gui.png
:alt: The IBLRIG GUI
.. figure:: gui.png
:alt: A screenshot of IBL Rig Wizard
:align: center

Complete the following actions within the GUI:
A screenshot of IBL Rig Wizard


Starting a Task
---------------

1. Enter your Alyx username, then click on the *Connect* button. This
action will automatically populate the GUI fields with information
pertinent to your lab.

2. Select the desired values from the provided options. Utilize the
*Filter* field to swiftly narrow down the list of displayed subjects.
Note that selections for *Project* and *Procedure* are mandatory.

3. Click the *Start* button to initiate the task.

Additionally, there are supplementary controls located in the “Flow”
section::

Supplementary Controls
----------------------

- If you check the *Append* option before clicking *Start*, the task
you initiate will be linked to the preceding task, creating a
Expand Down
15 changes: 8 additions & 7 deletions iblrig/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from pathlib import Path
from setuptools_scm import get_version
from importlib.metadata import version
# PLEASE REMEMBER TO:
# 1) update CHANGELOG.md
# 2) git tag the release in accordance to the version number below (after merge!)
__version__ = '8.9.3'

if Path('.github').exists():
__version__ = get_version(version_scheme='post-release', local_scheme='dirty-tag')
else:
__version__ = version('iblrig')
# The following method call will try to get post-release information (i.e. the number of commits since the last tagged
# release corresponding to the one above), plus information about the state of the local repository (dirty/broken)
from iblrig.version_management import get_detailed_version_string
__version__ = get_detailed_version_string(__version__)
21 changes: 0 additions & 21 deletions iblrig/base_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import iblrig.spacer
import iblrig.alyx
import iblrig.graphic as graph
from iblrig.version_management import check_for_updates
import ibllib.io.session_params as ses_params
from iblrig.transfer_experiments import BehaviorCopier

Expand Down Expand Up @@ -75,26 +74,6 @@ def __init__(self, subject=None, task_parameter_file=None, file_hardware_setting
self.logger = None
self._setup_loggers(level=log_level)
self.logger.info(f"Running iblrig {iblrig.__version__}, pybpod version {pybpodapi.__version__}")

# check for update
if not wizard and not BaseSession.checked_for_update:
BaseSession.checked_for_update = True
update_status, remote_version = check_for_updates()
if update_status is True:
print(f"\nUpdate to iblrig {remote_version} is available!\n"
f"Please update by issuing:\n\n"
f" upgrade_iblrig\n")
while True:
print("- Press [Enter] to exit IBL Rig and perform the update right away.\n"
"- Enter 'I will update later' to continue without updating.")
response = input('Your response: ')
if response == '':
print("\nEnter 'git pull' - then restart iblrig. Thanks for keeping iblrig up to date!")
exit()
elif response == 'I will update later':
print("\nPlease do so!")
break

self.interactive = False if append else interactive
self._one = one
self.init_datetime = datetime.datetime.now()
Expand Down
5 changes: 5 additions & 0 deletions iblrig/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pathlib import Path
from shutil import which

BASE_DIR = str(Path(__file__).parents[1])
IS_GIT = Path(BASE_DIR).joinpath('.git').exists() and which('git') is not None
107 changes: 107 additions & 0 deletions iblrig/gui/ui_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'iblrig/gui/ui_update.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_update(object):
def setupUi(self, update):
update.setObjectName("update")
update.resize(353, 496)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(update.sizePolicy().hasHeightForWidth())
update.setSizePolicy(sizePolicy)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/images/wizard.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
update.setWindowIcon(icon)
update.setModal(True)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(update)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.uiLayoutLogo = QtWidgets.QVBoxLayout()
self.uiLayoutLogo.setContentsMargins(-1, -1, 6, -1)
self.uiLayoutLogo.setObjectName("uiLayoutLogo")
self.uiLabelLogo = QtWidgets.QLabel(update)
self.uiLabelLogo.setMaximumSize(QtCore.QSize(64, 64))
self.uiLabelLogo.setText("")
self.uiLabelLogo.setPixmap(QtGui.QPixmap("iblrig/gui\\wizard.png"))
self.uiLabelLogo.setScaledContents(True)
self.uiLabelLogo.setObjectName("uiLabelLogo")
self.uiLayoutLogo.addWidget(self.uiLabelLogo)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.uiLayoutLogo.addItem(spacerItem)
self.horizontalLayout_2.addLayout(self.uiLayoutLogo)
self.uiLayoutRight = QtWidgets.QVBoxLayout()
self.uiLayoutRight.setObjectName("uiLayoutRight")
self.uiLabelHeader = QtWidgets.QLabel(update)
self.uiLabelHeader.setObjectName("uiLabelHeader")
self.uiLayoutRight.addWidget(self.uiLabelHeader)
self.uiTextBrowserChanges = QtWidgets.QTextBrowser(update)
self.uiTextBrowserChanges.setStyleSheet("")
self.uiTextBrowserChanges.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.uiTextBrowserChanges.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.uiTextBrowserChanges.setDocumentTitle("")
self.uiTextBrowserChanges.setMarkdown("")
self.uiTextBrowserChanges.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.uiTextBrowserChanges.setObjectName("uiTextBrowserChanges")
self.uiLayoutRight.addWidget(self.uiTextBrowserChanges)
self.uiLabelFooter = QtWidgets.QLabel(update)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiLabelFooter.sizePolicy().hasHeightForWidth())
self.uiLabelFooter.setSizePolicy(sizePolicy)
self.uiLabelFooter.setAlignment(QtCore.Qt.AlignJustify|QtCore.Qt.AlignVCenter)
self.uiLabelFooter.setWordWrap(True)
self.uiLabelFooter.setObjectName("uiLabelFooter")
self.uiLayoutRight.addWidget(self.uiLabelFooter)
spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
self.uiLayoutRight.addItem(spacerItem1)
self.uiLayoutCommand = QtWidgets.QHBoxLayout()
self.uiLayoutCommand.setObjectName("uiLayoutCommand")
spacerItem2 = QtWidgets.QSpacerItem(1, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.uiLayoutCommand.addItem(spacerItem2)
self.uiLineEditCommand = QtWidgets.QLineEdit(update)
self.uiLineEditCommand.setAlignment(QtCore.Qt.AlignCenter)
self.uiLineEditCommand.setReadOnly(True)
self.uiLineEditCommand.setObjectName("uiLineEditCommand")
self.uiLayoutCommand.addWidget(self.uiLineEditCommand)
spacerItem3 = QtWidgets.QSpacerItem(1, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.uiLayoutCommand.addItem(spacerItem3)
self.uiLayoutRight.addLayout(self.uiLayoutCommand)
spacerItem4 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
self.uiLayoutRight.addItem(spacerItem4)
self.uiLine = QtWidgets.QFrame(update)
self.uiLine.setFrameShape(QtWidgets.QFrame.HLine)
self.uiLine.setFrameShadow(QtWidgets.QFrame.Sunken)
self.uiLine.setObjectName("uiLine")
self.uiLayoutRight.addWidget(self.uiLine)
self.uiLayoutButton = QtWidgets.QHBoxLayout()
self.uiLayoutButton.setObjectName("uiLayoutButton")
spacerItem5 = QtWidgets.QSpacerItem(1, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.uiLayoutButton.addItem(spacerItem5)
self.uiPushButtonOK = QtWidgets.QPushButton(update)
self.uiPushButtonOK.setObjectName("uiPushButtonOK")
self.uiLayoutButton.addWidget(self.uiPushButtonOK)
self.uiLayoutRight.addLayout(self.uiLayoutButton)
self.horizontalLayout_2.addLayout(self.uiLayoutRight)
self.horizontalLayout_2.setStretch(1, 100)

self.retranslateUi(update)
QtCore.QMetaObject.connectSlotsByName(update)

def retranslateUi(self, update):
_translate = QtCore.QCoreApplication.translate
update.setWindowTitle(_translate("update", "Update Notice"))
self.uiLabelHeader.setText(_translate("update", "Update Available!"))
self.uiLabelFooter.setText(_translate("update", "To update, close IBL Rig Wizard and run the following command within the iblrigv8 Python environment:"))
self.uiLineEditCommand.setText(_translate("update", "iblrig_update"))
self.uiPushButtonOK.setText(_translate("update", "OK"))
Loading

0 comments on commit 9ebfe07

Please sign in to comment.