@@ -877,6 +877,7 @@ def show(self):
877
877
string_changed_handler = self ._string_changed )
878
878
self ._widgets [0 ].bracket = False
879
879
self ._widgets [0 ].set_global_functions (self ._global_functions )
880
+ self ._widgets [0 ].id = 0
880
881
self ._line_editor = self ._widgets [0 ]
881
882
# add copy checkbox
882
883
if self ._widgets [1 ] is None :
@@ -887,6 +888,7 @@ def show(self):
887
888
self ._line_editor_yx [0 ] + 2 , 2 ,
888
889
'Copy playlist instead of renaming it' ,
889
890
curses .color_pair (9 ), curses .color_pair (4 ), curses .color_pair (5 ))
891
+ self ._widgets [1 ].id = 1
890
892
# add open afterwards checkbox
891
893
adjust_line_Y = - 1
892
894
if self ._open_afterwards :
@@ -903,6 +905,7 @@ def show(self):
903
905
self .initial_enabled [2 ] = True
904
906
else :
905
907
self ._widgets [2 ] = DisabledWidget ()
908
+ self ._widgets [2 ].id = 2
906
909
if self ._create :
907
910
adjust_line_Y = - 1
908
911
# add buttons
@@ -919,6 +922,8 @@ def show(self):
919
922
self ._widgets [3 ]._focused = self ._widgets [4 ].focused = False
920
923
else :
921
924
self ._h_buttons .calculate_buttons_position (parent = self ._win )
925
+ self ._widgets [3 ].id = 3
926
+ self ._widgets [4 ].id = 4
922
927
923
928
if self ._create :
924
929
adjust_line_Y = - 2
@@ -1085,22 +1090,34 @@ def _update_focus(self):
1085
1090
x ._focused = False
1086
1091
1087
1092
def _focus_next (self ):
1093
+ # logger.error('nn i self.focus = {}'.format(self.focus))
1088
1094
if self ._focus == len (self ._widgets ) - 1 :
1089
1095
self .focus = 0
1096
+ # logger.error('nn f self.focus = 0')
1090
1097
else :
1091
1098
focus = self .focus + 1
1099
+ focus = self ._widgets [focus ].id
1100
+ # logger.error('nn focus = {}'.format(focus))
1092
1101
while not self ._widgets [focus ].enabled :
1093
1102
focus += 1
1103
+ # logger.error('nn+ focus = {}'.format(focus))
1094
1104
self .focus = focus
1105
+ # logger.error('nn o self.focus = {}'.format(self.focus))
1095
1106
1096
1107
def _focus_previous (self ):
1108
+ # logger.error('pp i self.focus = {}'.format(self.focus))
1097
1109
if self ._focus == 0 :
1098
1110
self .focus = len (self ._widgets ) - 1
1111
+ # logger.error('pp l self.focus = {}'.format(self.focus))
1099
1112
else :
1100
1113
focus = self .focus - 1
1114
+ focus = self ._widgets [focus ].id
1115
+ logger .error ('pp focus = {}' .format (focus ))
1101
1116
while not self ._widgets [focus ].enabled :
1102
1117
focus -= 1
1118
+ # logger.error('pp+ focus = {}'.format(focus))
1103
1119
self .focus = focus
1120
+ # logger.error('pp o self.focus = {}'.format(self.focus))
1104
1121
1105
1122
def _act_on_file (self ):
1106
1123
"""Rename the playlist (if self._create is False)
@@ -1170,6 +1187,7 @@ def keypress(self, char):
1170
1187
return - 1 , '' , '' , False , False , False
1171
1188
return 0 , '' , '' , False , False , False
1172
1189
else :
1190
+ logger .error ('self.focus = {}' .format (self .focus ))
1173
1191
if char in (curses .KEY_EXIT , 27 , ord ('q' )) and \
1174
1192
self .focus > 0 :
1175
1193
return - 1 , '' , '' , False , False , False
@@ -1180,6 +1198,7 @@ def keypress(self, char):
1180
1198
self ._widgets [self ._focus ].toggle_checked ()
1181
1199
if self ._focus == 1 and self ._opened_from_editor :
1182
1200
self ._widgets [2 ].enabled = self ._widgets [1 ].checked
1201
+ logger .error ('len widgets = {}' .format (len (self ._widgets )))
1183
1202
elif char in (ord ('\t ' ), 9 , curses .KEY_DOWN ):
1184
1203
self ._focus_next ()
1185
1204
elif char in (curses .KEY_UP , curses .KEY_BTAB ):
@@ -1197,13 +1216,13 @@ def keypress(self, char):
1197
1216
return self ._get_result (ret )
1198
1217
elif self ._focus == 4 :
1199
1218
# cancel
1200
- return - 1 , '' , '' , False , False
1219
+ return - 1 , '' , '' , False , False , False
1201
1220
elif char == ord ('s' ) and self ._focus > 0 :
1202
1221
# s, execute
1203
1222
if self ._widgets [- 2 ].enabled :
1204
1223
ret = self ._act_on_file ()
1205
1224
return self ._get_result (ret )
1206
- return 0 , '' , '' , False , False
1225
+ return 0 , '' , '' , False , False , False
1207
1226
elif self ._focus == 0 :
1208
1227
"""
1209
1228
Returns:
0 commit comments