Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd OST committed May 10, 2024
2 parents e4abbf0 + 3261b4d commit 0bf90e2
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: push
jobs:
build:
name: Build docs
runs-on: macos-latest
runs-on: macos-11

steps:
- name: Checkout
Expand Down Expand Up @@ -38,4 +38,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true
force: true
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
mac-tests:
name: Run tests on Mac
runs-on: macos-latest
runs-on: macos-11

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
scratch.*
# PyPi
dist/
build/
# Google Drive
desktop.ini
# Python environment
Expand Down
18 changes: 18 additions & 0 deletions docs_src/app/ExamplePluginRibbonSection.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-------------------------------
ExamplePluginRibbonSection
-------------------------------

When you load PsychoPy, provided you have `psychopy-plugin-template` installed, the ExamplePluginRibbonSection will be added to the Builder, Coder and Runner ribbons.


Buttons
-------------------------------

Example button
This example button will simply open the documentation for `psychopy-plugin-template` in the default browser when clicked.


.. autoclass:: psychopy_plugin_template.app.ribbon.ExamplePluginRibbonSection
:members:
:undoc-members:
:inherited-members:
7 changes: 7 additions & 0 deletions docs_src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Welcome to psychopy-plugin-template's documentation!

The `psychopy-template` plugin is designed to show you how to make a plugin.

.. toctree::
:maxdepth: 1
:caption: Added content for the PsychoPy app
:glob:

app/*

.. toctree::
:maxdepth: 1
:caption: Added content for Builder
Expand Down
32 changes: 32 additions & 0 deletions psychopy_plugin_template/app/ribbon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import wx
from psychopy.app.ribbon import FrameRibbonPluginSection


class ExamplePluginRibbonSection(FrameRibbonPluginSection):
def __init__(self, parent):
# initialise the base class
FrameRibbonPluginSection.__init__(
self, parent, name="example", label="Example"
)
# add a button
self.addButton(
"exampleBtn",
label="Example button",
icon="example",
tooltip="Open the documentation for psychopy-plugin-template",
callback=self.openExamplePluginDocs,
style=wx.BU_NOTEXT
)

def openExamplePluginDocs(self, evt=None):
"""
Button callback to open the docs for psychopy-plugin-template in the default web browser.
Parameters
----------
evt : wx.Event, optional
The button press event triggering this callback, unused but needs to be accepted as wx will provide it.
"""
import webbrowser
webbrowser.open("https://psychopy.github.io/psychopy-plugin-template")

Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# the name of your plugin (required)
name = "psychopy-plugin-template"
# the current version of the plugin (required)
version = "0.0.3"
version = "0.0.4"
# a brief description of what your plugin does
description = "Tutorial on how to create a plugin component for both PsychoPy and PsychoJS"
# link to the README.md file for a longer description of the project
Expand Down Expand Up @@ -51,6 +51,22 @@ ExampleVisualStim = "psychopy_plugin_template.visual.exampleVisualStim:ExampleVi
ExampleDevice = "psychopy_plugin_template.hardware.exampleDevice:ExampleDevice"
ExampleResponseDevice = "psychopy_plugin_template.hardware.exampleResponseDevice:ExampleResponseDevice"

[project.entry-points."psychopy.app.builder"]
# if you want to add a section to the PsychoPy Builder ribbon, add it here
ExamplePluginRibbonSection = "psychopy_plugin_template.app.ribbon:ExamplePluginRibbonSection"

[project.entry-points."psychopy.app.coder"]
# if you want to add a section to the PsychoPy Coder ribbon, add it here
ExamplePluginRibbonSection = "psychopy_plugin_template.app.ribbon:ExamplePluginRibbonSection"

[project.entry-points."psychopy.app.runner"]
# if you want to add a section to the PsychoPy Runner ribbon, add it here
ExamplePluginRibbonSection = "psychopy_plugin_template.app.ribbon:ExamplePluginRibbonSection"

[project.entry-points."psychopy.app.themes.icons"]
# if you want to add icons to the PsychoPy app, add them here
example = "psychopy_plugin_template.icons.example"

[tool.setuptools.package-data]
# any resources you want including in the package, add their file extensions here (e.g. "*.wav" if you want audio files)
"*" = ["*.png"]
Expand Down

0 comments on commit 0bf90e2

Please sign in to comment.