Skip to content

Commit bbe6bf5

Browse files
committed
BF: Allow hyphens in Pavlovia project name
1 parent f5ba322 commit bbe6bf5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

psychopy/app/pavlovia_ui/sync.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import re
1313
from pathlib import Path
1414
from psychopy.tools.versionchooser import _translate
15+
from ...tools.stringtools import valid_proj_name
1516

1617

1718
class SyncDialog(wx.Dialog):
@@ -144,7 +145,7 @@ def __init__(self, parent, user, name="", path=""):
144145
def validate(self, evt=None):
145146
# Test name
146147
name = self.nameCtrl.GetValue()
147-
nameValid = bool(re.fullmatch("\w+", name))
148+
nameValid = bool(valid_proj_name.fullmatch(name))
148149
# Test path
149150
path = Path(self.rootCtrl.GetValue())
150151
pathValid = path.is_dir() and path not in self.invalidFolders

psychopy/tools/stringtools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
__all__ = ["prettyname"]
1515

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

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

0 commit comments

Comments
 (0)