Skip to content

Commit

Permalink
BF: Allow hyphens in Pavlovia project name
Browse files Browse the repository at this point in the history
  • Loading branch information
TEParsons committed Mar 17, 2022
1 parent f5ba322 commit bbe6bf5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion psychopy/app/pavlovia_ui/sync.py
Expand Up @@ -12,6 +12,7 @@
import re
from pathlib import Path
from psychopy.tools.versionchooser import _translate
from ...tools.stringtools import valid_proj_name


class SyncDialog(wx.Dialog):
Expand Down Expand Up @@ -144,7 +145,7 @@ def __init__(self, parent, user, name="", path=""):
def validate(self, evt=None):
# Test name
name = self.nameCtrl.GetValue()
nameValid = bool(re.fullmatch("\w+", name))
nameValid = bool(valid_proj_name.fullmatch(name))
# Test path
path = Path(self.rootCtrl.GetValue())
pathValid = path.is_dir() and path not in self.invalidFolders
Expand Down
3 changes: 3 additions & 0 deletions psychopy/tools/stringtools.py
Expand Up @@ -13,6 +13,9 @@

__all__ = ["prettyname"]

# Regex for identifying a valid Pavlovia project name
valid_proj_name = re.compile(r'(\w|-)+')


def prettyname(name, wrap=False):
"""Convert a camelCase, TitleCase or underscore_delineated title to Full Title Case"""
Expand Down

0 comments on commit bbe6bf5

Please sign in to comment.