291 if itm.text(0) != keyname: |
291 if itm.text(0) != keyname: |
292 for col in [1, 2]: # check against primary, then alternative binding |
292 for col in [1, 2]: # check against primary, then alternative binding |
293 itmseq = itm.text(col) |
293 itmseq = itm.text(col) |
294 # step 1: check if shortcut is already allocated |
294 # step 1: check if shortcut is already allocated |
295 if keystr == itmseq: |
295 if keystr == itmseq: |
296 res = E5MessageBox.warning(self, |
296 res = E5MessageBox.yesNo(self, |
297 self.trUtf8("Edit shortcuts"), |
297 self.trUtf8("Edit shortcuts"), |
298 self.trUtf8(\ |
298 self.trUtf8(\ |
299 """<p><b>{0}</b> has already been allocated""" |
299 """<p><b>{0}</b> has already been allocated""" |
300 """ to the <b>{1}</b> action. """ |
300 """ to the <b>{1}</b> action. """ |
301 """Remove this binding?</p>""") |
301 """Remove this binding?</p>""") |
302 .format(keystr, itm.text(0)), |
302 .format(keystr, itm.text(0)), |
303 QMessageBox.StandardButtons(\ |
303 type_ = E5MessageBox.Warning) |
304 QMessageBox.No | \ |
304 if res: |
305 QMessageBox.Yes), |
|
306 QMessageBox.No) |
|
307 if res == QMessageBox.Yes: |
|
308 itm.setText(col, "") |
305 itm.setText(col, "") |
309 return True |
306 return True |
310 else: |
307 else: |
311 return False |
308 return False |
312 |
309 |
313 if not itmseq: |
310 if not itmseq: |
314 continue |
311 continue |
315 |
312 |
316 # step 2: check if shortcut hides an already allocated |
313 # step 2: check if shortcut hides an already allocated |
317 if itmseq.startswith("{0}+".format(keystr)): |
314 if itmseq.startswith("{0}+".format(keystr)): |
318 res = E5MessageBox.warning(self, |
315 res = E5MessageBox.yesNo(self, |
319 self.trUtf8("Edit shortcuts"), |
316 self.trUtf8("Edit shortcuts"), |
320 self.trUtf8(\ |
317 self.trUtf8(\ |
321 """<p><b>{0}</b> hides the <b>{1}</b> action. """ |
318 """<p><b>{0}</b> hides the <b>{1}</b> action. """ |
322 """Remove this binding?</p>""") |
319 """Remove this binding?</p>""") |
323 .format(keystr, itm.text(0)), |
320 .format(keystr, itm.text(0)), |
324 QMessageBox.StandardButtons(\ |
321 type_ = E5MessageBox.Warning) |
325 QMessageBox.No | \ |
322 if res: |
326 QMessageBox.Yes), |
|
327 QMessageBox.No) |
|
328 if res == QMessageBox.Yes: |
|
329 itm.setText(col, "") |
323 itm.setText(col, "") |
330 return True |
324 return True |
331 else: |
325 else: |
332 return False |
326 return False |
333 |
327 |
334 # step 3: check if shortcut is hidden by an already allocated |
328 # step 3: check if shortcut is hidden by an already allocated |
335 if keystr.startswith("{0}+".format(itmseq)): |
329 if keystr.startswith("{0}+".format(itmseq)): |
336 res = E5MessageBox.warning(self, |
330 res = E5MessageBox.yesNo(self, |
337 self.trUtf8("Edit shortcuts"), |
331 self.trUtf8("Edit shortcuts"), |
338 self.trUtf8(\ |
332 self.trUtf8(\ |
339 """<p><b>{0}</b> is hidden by the """ |
333 """<p><b>{0}</b> is hidden by the """ |
340 """<b>{1}</b> action. """ |
334 """<b>{1}</b> action. """ |
341 """Remove this binding?</p>""") |
335 """Remove this binding?</p>""") |
342 .format(keystr, itm.text(0)), |
336 .format(keystr, itm.text(0)), |
343 QMessageBox.StandardButtons(\ |
337 type_ = E5MessageBox.Warning) |
344 QMessageBox.No | \ |
338 if res: |
345 QMessageBox.Yes), |
|
346 QMessageBox.No) |
|
347 if res == QMessageBox.Yes: |
|
348 itm.setText(col, "") |
339 itm.setText(col, "") |
349 return True |
340 return True |
350 else: |
341 else: |
351 return False |
342 return False |
352 |
343 |