Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/main/python/gui/locationspecification_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,7 @@ def is_onehanded_sign(self):
specslist = []
if hasattr(self.parent().mainwindow.current_sign.signtype, "specslist"):
specslist = self.parent().mainwindow.current_sign.signtype.specslist
if ('1h', True) in specslist:
return True
return False
return '1h' in specslist

def default_neutral_loctype(self):
if self.is_onehanded_sign():
Expand Down
2 changes: 1 addition & 1 deletion src/main/python/gui/modulespecification_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self, moduletype, xslotstructure=None, moduletoload=None, linkedfro

if HAND in incl_articulators and self.parent().sign.signtype:
# set default articulators
self.signtype_specslist = { art_setting[0] for art_setting in self.parent().sign.signtype.specslist }
self.signtype_specslist = { art_setting for art_setting in self.parent().sign.signtype.specslist }
if SIGN_TYPE["ONE_HAND"] in self.signtype_specslist and \
(SIGN_TYPE["ONE_HAND_NO_MVMT"] not in self.signtype_specslist or self.moduletype != ModuleTypes.MOVEMENT):
articulators = (HAND, {1: True, 2: False})
Expand Down
31 changes: 5 additions & 26 deletions src/main/python/gui/signtypespecification_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ def __init__(self, **kwargs):
self.handstype_group = SigntypeButtonGroup(prt=self)
self.handstype_unspec_radio = SigntypeRadioButton("Unspecified", parentbutton=None)
self.handstype_unspec_radio.setProperty('abbreviation.path', 'Unspecified')
self.handstype_unspec_radio.setProperty('abbreviation.include', True)
self.addedinfobutton = AddedInfoPushButton("Notes")
self.handstype_1h_radio = SigntypeRadioButton("1 hand", parentbutton=None)
self.handstype_1h_radio.setProperty('abbreviation.path', SIGN_TYPE["ONE_HAND"])
self.handstype_1h_radio.setProperty('abbreviation.include', True)
self.handstype_2h_radio = SigntypeRadioButton("2 hands", parentbutton=None)
self.handstype_2h_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS"])
self.handstype_2h_radio.setProperty('abbreviation.include', True)
self.handstype_group.addButton(self.handstype_unspec_radio)
self.handstype_group.addButton(self.handstype_1h_radio)
self.handstype_group.addButton(self.handstype_2h_radio)
Expand All @@ -61,11 +58,9 @@ def __init__(self, **kwargs):
self.handstype_1h_group = SigntypeButtonGroup(prt=self)
self.handstype_1hmove_radio = SigntypeRadioButton('The hand moves', parentbutton=self.handstype_1h_radio)
self.handstype_1hmove_radio.setProperty('abbreviation.path', SIGN_TYPE["ONE_HAND_MVMT"])
self.handstype_1hmove_radio.setProperty('abbreviation.include', True)
self.handstype_1hnomove_radio = SigntypeRadioButton("The hand doesn\'t move",
parentbutton=self.handstype_1h_radio)
self.handstype_1hnomove_radio.setProperty('abbreviation.path', SIGN_TYPE["ONE_HAND_NO_MVMT"])
self.handstype_1hnomove_radio.setProperty('abbreviation.include', True)
self.handstype_1h_group.addButton(self.handstype_1hmove_radio)
self.handstype_1h_group.addButton(self.handstype_1hnomove_radio)
self.buttongroups.append(self.handstype_1h_group)
Expand All @@ -75,11 +70,9 @@ def __init__(self, **kwargs):
self.handstype_2hsameshapes_radio = SigntypeRadioButton("H1 and H2 use same set(s) of hand configurations",
parentbutton=self.handstype_2h_radio)
self.handstype_2hsameshapes_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_SAME_HCONF"])
self.handstype_2hsameshapes_radio.setProperty('abbreviation.include', True)
self.handstype_2hdiffshapes_radio = SigntypeRadioButton("H1 and H2 use different set(s) of hand configurations",
parentbutton=self.handstype_2h_radio)
self.handstype_2hdiffshapes_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_DIFF_HCONF"])
self.handstype_2hdiffshapes_radio.setProperty('abbreviation.include', True)
# self.handstype_2hdiffshapes_radio.toggled.connect(self.linkhandconfigbuttons)
self.handstype_handshapereln_group.addButton(self.handstype_2hsameshapes_radio)
self.handstype_handshapereln_group.addButton(self.handstype_2hdiffshapes_radio)
Expand All @@ -90,11 +83,9 @@ def __init__(self, **kwargs):
self.handstype_2hcontactyes_radio = SigntypeRadioButton("H1 and H2 maintain contact throughout sign",
parentbutton=self.handstype_2h_radio)
self.handstype_2hcontactyes_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_MAINT_CONT"])
self.handstype_2hcontactyes_radio.setProperty('abbreviation.include', True)
self.handstype_2hcontactno_radio = SigntypeRadioButton("H1 and H2 do not maintain contact",
parentbutton=self.handstype_2h_radio)
self.handstype_2hcontactno_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_NO_CONT"])
self.handstype_2hcontactno_radio.setProperty('abbreviation.include', False)
self.handstype_contactreln_group.addButton(self.handstype_2hcontactyes_radio)
self.handstype_contactreln_group.addButton(self.handstype_2hcontactno_radio)
self.buttongroups.append(self.handstype_contactreln_group)
Expand All @@ -104,11 +95,9 @@ def __init__(self, **kwargs):
self.handstype_2hsymmetryyes_radio = SigntypeRadioButton("H1 and H2 are bilaterally symmetric",
parentbutton=self.handstype_2h_radio)
self.handstype_2hsymmetryyes_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_BISYM"])
self.handstype_2hsymmetryyes_radio.setProperty('abbreviation.include', True)
self.handstype_2hsymmetryno_radio = SigntypeRadioButton("H1 and H2 are not bilaterally symmetric",
parentbutton=self.handstype_2h_radio)
self.handstype_2hsymmetryno_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_NO_BISYM"])
self.handstype_2hsymmetryno_radio.setProperty('abbreviation.include', False)
self.handstype_symmetryreln_group.addButton(self.handstype_2hsymmetryyes_radio)
self.handstype_symmetryreln_group.addButton(self.handstype_2hsymmetryno_radio)
self.buttongroups.append(self.handstype_symmetryreln_group)
Expand All @@ -118,13 +107,10 @@ def __init__(self, **kwargs):
self.handstype_2hmvmtneither_radio = SigntypeRadioButton("Neither hand moves",
parentbutton=self.handstype_2h_radio)
self.handstype_2hmvmtneither_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_NO_MVMT"])
self.handstype_2hmvmtneither_radio.setProperty('abbreviation.include', True)
self.handstype_2hmvmtone_radio = SigntypeRadioButton("Only 1 hand moves", parentbutton=self.handstype_2h_radio)
self.handstype_2hmvmtone_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_ONE_MVMT"])
self.handstype_2hmvmtone_radio.setProperty('abbreviation.include', False)
self.handstype_2hmvmtboth_radio = SigntypeRadioButton("Both hands move", parentbutton=self.handstype_2h_radio)
self.handstype_2hmvmtboth_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_BOTH_MVMT"])
self.handstype_2hmvmtboth_radio.setProperty('abbreviation.include', False)
self.handstype_mvmtreln_group.addButton(self.handstype_2hmvmtneither_radio)
self.handstype_mvmtreln_group.addButton(self.handstype_2hmvmtone_radio)
self.handstype_mvmtreln_group.addButton(self.handstype_2hmvmtboth_radio)
Expand All @@ -135,11 +121,9 @@ def __init__(self, **kwargs):
self.handstype_2hmvmtoneH1_radio = SigntypeRadioButton("Only H1 moves",
parentbutton=self.handstype_2hmvmtone_radio)
self.handstype_2hmvmtoneH1_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_ONLY_H1"])
self.handstype_2hmvmtoneH1_radio.setProperty('abbreviation.include', True)
self.handstype_2hmvmtoneH2_radio = SigntypeRadioButton("Only H2 moves",
parentbutton=self.handstype_2hmvmtone_radio)
self.handstype_2hmvmtoneH2_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_ONLY_H2"])
self.handstype_2hmvmtoneH2_radio.setProperty('abbreviation.include', True)
self.handstype_mvmtonehandreln_group.addButton(self.handstype_2hmvmtoneH1_radio)
self.handstype_mvmtonehandreln_group.addButton(self.handstype_2hmvmtoneH2_radio)
self.buttongroups.append(self.handstype_mvmtonehandreln_group)
Expand All @@ -149,11 +133,9 @@ def __init__(self, **kwargs):
self.handstype_2hmvmtbothdiff_radio = SigntypeRadioButton("H1 and H2 move differently",
parentbutton=self.handstype_2hmvmtboth_radio)
self.handstype_2hmvmtbothdiff_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_BOTH_MVMT_DIFF"])
self.handstype_2hmvmtbothdiff_radio.setProperty('abbreviation.include', True)
self.handstype_2hmvmtbothsame_radio = SigntypeRadioButton("H1 and H2 move similarly",
parentbutton=self.handstype_2hmvmtboth_radio)
self.handstype_2hmvmtbothsame_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_BOTH_MVMT_SAME"])
self.handstype_2hmvmtbothsame_radio.setProperty('abbreviation.include', True)
self.handstype_mvmtbothhandreln_group.addButton(self.handstype_2hmvmtbothdiff_radio)
self.handstype_mvmtbothhandreln_group.addButton(self.handstype_2hmvmtbothsame_radio)
self.buttongroups.append(self.handstype_mvmtbothhandreln_group)
Expand All @@ -163,11 +145,9 @@ def __init__(self, **kwargs):
self.handstype_2hmvmtseq_radio = SigntypeRadioButton("Sequential",
parentbutton=self.handstype_2hmvmtbothsame_radio)
self.handstype_2hmvmtseq_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_BOTH_MVMT_SEQ"])
self.handstype_2hmvmtseq_radio.setProperty('abbreviation.include', True)
self.handstype_2hmvmtsimult_radio = SigntypeRadioButton("Simultaneous",
parentbutton=self.handstype_2hmvmtbothsame_radio)
self.handstype_2hmvmtsimult_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_BOTH_MVMT_SIMU"] )
self.handstype_2hmvmtsimult_radio.setProperty('abbreviation.include', True)
self.handstype_2hmvmtsimult_radio.setProperty('abbreviation.path', SIGN_TYPE["TWO_HANDS_BOTH_MVMT_SIMU"])
self.handstype_mvmttimingreln_group.addButton(self.handstype_2hmvmtseq_radio)
self.handstype_mvmttimingreln_group.addButton(self.handstype_2hmvmtsimult_radio)
self.buttongroups.append(self.handstype_mvmttimingreln_group)
Expand Down Expand Up @@ -299,8 +279,8 @@ def setsigntype(self, signtype):
signtypepaths = [btn.property('abbreviation.path') for btn in allbuttons]
nolongeravailable = [] # for backward compatibility
for spec in signtype.specslist:
if spec[0] in signtypepaths:
btnidx = signtypepaths.index(spec[0])
if spec in signtypepaths:
btnidx = signtypepaths.index(spec)
allbuttons[btnidx].setChecked(True)
else:
nolongeravailable.append(spec)
Expand All @@ -310,7 +290,7 @@ def setsigntype(self, signtype):
"This sign had sign type options specified that are no longer available and will be removed" +
" if you click 'save' (but not 'cancel'). Please make note of the following characteristics:")
for spec in nolongeravailable:
print(spec[0])
print(spec)
signtype.specslist.remove(spec)

self.addedinfobutton.addedinfo = deepcopy(signtype.addedinfo)
Expand All @@ -329,8 +309,7 @@ def getsigntype(self):

allbuttons = [btn for btngrp in self.buttongroups for btn in btngrp.buttons()]
# when saving, only use options that are both checked AND enabled!
specslist = [(btn.property('abbreviation.path'), btn.property('abbreviation.include')) for btn in allbuttons if
btn.isChecked() and btn.isEnabled()]
specslist = [btn.property('abbreviation.path') for btn in allbuttons if btn.isChecked() and btn.isEnabled()]

signtype = Signtype(specslist, addedinfo=addedinfo)

Expand Down
3 changes: 3 additions & 0 deletions src/main/python/lexicon/lexicon_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def __init__(self, signlevel_info=None, serializedsign=None):
# these attributes don't need to be deep-copied
self._signlevel_information = SignLevelInformation(serializedsignlevelinfo=serializedsign['signlevel'], parentsign=self)
self._signtype = serializedsign['type']
# backward compatibility with pre-20250505 signtype structure
if len(self.signtype.specslist) > 0 and isinstance(self.signtype.specslist[0], tuple):
self.signtype.specslist = [duple[0] for duple in self.signtype.specslist]
self._xslotstructure = serializedsign['xslot structure']
self._specifiedxslots = serializedsign['specified xslots']

Expand Down
12 changes: 6 additions & 6 deletions src/main/python/lexicon/module_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
QSettings
)

from constant import NULL, PREDEFINED_MAP, HAND, ARM, LEG, userdefinedroles as udr, treepathdelimiter, ModuleTypes, SURFACE_SUBAREA_ABBREVS, DEFAULT_LOC_1H, DEFAULT_LOC_2H, TargetTypes, HandConfigSlots
from constant import NULL, PREDEFINED_MAP, HAND, ARM, LEG, userdefinedroles as udr, treepathdelimiter, ModuleTypes, \
SURFACE_SUBAREA_ABBREVS, DEFAULT_LOC_1H, DEFAULT_LOC_2H, TargetTypes, HandConfigSlots, SIGN_TYPE
from constant import (specifytotalcycles_str, numberofreps_str, custom_abbrev)

PREDEFINED_MAP = {handshape.canonical: handshape for handshape in PREDEFINED_MAP.values()}
Expand Down Expand Up @@ -1243,11 +1244,10 @@ def makeabbreviationstring(self, abbrevsdict):

def convertspecstodict(self):
abbrevsdict = {}
specscopy = [duple for duple in self._specslist]
for duple in specscopy:
if duple[1]: # this is the flag to include the abbreviation in the concise form
pathlist = duple[0].split('.') # this is the path of abbreviations to this particular setting
self.ensurepathindict(pathlist, abbrevsdict)
for spec in self._specslist:
# include abbreviations for all options
pathlist = spec.split('.') # this is the path of abbreviations to this particular setting
self.ensurepathindict(pathlist, abbrevsdict)
return abbrevsdict

def ensurepathindict(self, pathelements, abbrevsdict):
Expand Down
21 changes: 10 additions & 11 deletions src/main/python/search/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,40 +110,39 @@ def loctypedisplaytext(loctype):
todisplay = txt
return todisplay


def signtypedisplaytext(specslist):

specs = [s[0] for s in specslist]
disp = []
if 'Unspecified' in specs:
if 'Unspecified' in specslist:
disp.append('Unspecified')
if '1h' in specs:
if '1h' in specslist:
oneh = ['1h']
for s in ['1h.moves', '1h.no mvmt']:
if s in specs:
if s in specslist:
oneh.append(s)
if len(oneh) > 0:
disp.extend(oneh)
else:
disp.append('1h')

if '2h' in specs:
if '2h' in specslist:
twoh = ['2h']
for s in ['same HCs', 'different HCs', 'maintain contact', 'contact not maintained', 'bilaterally symmetric', 'not bilaterally symmetric', 'neither moves']:
if ('2h.' + s) in specs:
if ('2h.' + s) in specslist:
twoh.append('2h.' + s)
if '2h.only 1 moves' in specs:
if '2h.only 1 moves' in specslist:
only1moves = []
for s in ['H1 moves', 'H2 moves']:
if ('2h.only 1 moves.' + s) in specs:
if ('2h.only 1 moves.' + s) in specslist:
only1moves.append('2h.only ' + s)
if len(only1moves) > 0:
twoh.extend(only1moves)
else:
twoh.append('2h.one hand moves')
if '2h.both move' in specs:
if '2h.both move' in specslist:
bothmove = []
for s in ['move differently', 'move similarly']:
if ('2h.both move.' + s) in specs:
if ('2h.both move.' + s) in specslist:
bothmove.append('2h.hands ' + s)
if len(bothmove) > 0:
twoh.extend(bothmove)
Expand Down