Skip to content

Commit c3d1340

Browse files
committed
- improves event undo
- first steps into UI modes
1 parent c2edf36 commit c3d1340

8 files changed

Lines changed: 1041 additions & 849 deletions

File tree

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.2.0
3+
rev: v6.0.0
44
hooks:
55
- id: check-yaml
66
- id: check-xml
@@ -12,8 +12,8 @@ repos:
1212
exclude: ^(src/uic/|src/translations/|src/includes/|src/test/data/|src/test/sanity/data/)
1313
- id: check-ast
1414
- repo: https://github.com/asottile/pyupgrade
15-
rev: v3.9.0
15+
rev: v3.21.2
1616
hooks:
1717
- id: pyupgrade
18-
args: [--py38-plus]
18+
args: [--py312-plus]
1919
exclude: ^(src/uic/|src/translations/|src/includes/)

src/artisanlib/canvas.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14486,9 +14486,8 @@ def markDryEnd(self, noaction:bool = False) -> None:
1448614486
self.autoDRYenabled = False
1448714487
self.timeindex[1] = 0
1448814488
removed = True
14489-
st = stringfromseconds(self.timex[self.timeindex[1]]-start,False)
14490-
DE_str = self.aw.arabicReshape(QApplication.translate('Scope Annotation','DE {0}').format(st))
14491-
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text() == DE_str:
14489+
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','DE {0}').format(0)).rstrip('0')
14490+
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text().startswith(st1):
1449214491
self.ystep_down, self.ystep_up = 0, 0
1449314492
try:
1449414493
self.l_annotations[-1].remove()
@@ -14602,8 +14601,8 @@ def mark1Cstart(self, noaction:bool = False) -> None:
1460214601
self.autoFCsenabled = False
1460314602
self.timeindex[2] = 0
1460414603
removed = True
14605-
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','FCs {0}').format(stringfromseconds(self.timex[self.timeindex[2]]-start,False)))
14606-
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text() == st1:
14604+
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','FCs {0}').format(0)).rstrip('0')
14605+
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text().startswith(st1):
1460714606
self.ystep_down, self.ystep_up = 0, 0
1460814607
try:
1460914608
self.l_annotations[-1].remove()
@@ -14710,11 +14709,12 @@ def mark1Cend(self, noaction:bool = False) -> None:
1471014709
else:
1471114710
start = 0
1471214711
if self.aw.buttonFCe.isFlat() and self.timeindex[3] > 0:
14712+
_log.debug('PRINT FCe UNDO')
1471314713
# undo wrongly set FCe
1471414714
self.timeindex[3] = 0
1471514715
removed = True
14716-
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','FCe {0}').format(stringfromseconds(self.timex[self.timeindex[3]]-start,False)))
14717-
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text() == st1:
14716+
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','FCe {0}').format(0)).rstrip('0')
14717+
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text().startswith(st1):
1471814718
self.ystep_down, self.ystep_up = 0, 0
1471914719
try:
1472014720
self.l_annotations[-1].remove()
@@ -14750,6 +14750,7 @@ def mark1Cend(self, noaction:bool = False) -> None:
1475014750
else:
1475114751
self.ystep_down,self.ystep_up = self.findtextgap(self.ystep_down,self.ystep_up,temp,temp,d)
1475214752
time_temp_annos = self.annotate(temp,st1,self.timex[self.timeindex[3]],temp,self.ystep_up,self.ystep_down,draggable_anno_key=3)
14753+
_log.debug('PRINT time_temp_annos: %s',time_temp_annos)
1475314754
if time_temp_annos is not None:
1475414755
self.l_annotations += time_temp_annos
1475514756
if self.alignEvent not in {3, 7}: # in this case the updateBackground is triggered by the redraw of timealign below
@@ -14821,11 +14822,11 @@ def mark2Cstart(self, noaction:bool = False) -> None:
1482114822
else:
1482214823
start = 0
1482314824
if self.aw.buttonSCs.isFlat() and self.timeindex[4] > 0:
14824-
# undo wrongly set FCs
14825-
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','SCs {0}').format(stringfromseconds(self.timex[self.timeindex[4]]-start,False)))
14825+
# undo wrongly set SCs
1482614826
self.timeindex[4] = 0
1482714827
removed = True
14828-
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text() == st1:
14828+
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','SCs {0}').format(0)).rstrip('0')
14829+
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text().startswith(st1):
1482914830
self.ystep_down, self.ystep_up = 0, 0
1483014831
try:
1483114832
self.l_annotations[-1].remove()
@@ -14937,10 +14938,10 @@ def mark2Cend(self, noaction:bool = False) -> None:
1493714938
else:
1493814939
start = 0
1493914940
if self.aw.buttonSCe.isFlat() and self.timeindex[5] > 0:
14940-
# undo wrongly set FCs
14941+
# undo wrongly set SCe
1494114942
self.timeindex[5] = 0
1494214943
removed = True
14943-
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','SCe {0}').format(stringfromseconds(self.timex[self.timeindex[5]]-start,False)))
14944+
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','SCe {0}').format(0)).rstrip('0')
1494414945
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text() == st1:
1494514946
self.ystep_down, self.ystep_up = 0, 0
1494614947
try:
@@ -15060,8 +15061,8 @@ def markDrop(self, noaction:bool = False) -> None:
1506015061
#decrease BatchCounter again
1506115062
self.decBatchCounter()
1506215063
removed = True
15063-
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','DROP {0}').format(stringfromseconds(self.timex[self.timeindex[6]]-start,False)))
15064-
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text() == st1:
15064+
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','DROP {0}').format(0)).rstrip('0')
15065+
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text().startswith(st1):
1506515066
self.ystep_down, self.ystep_up = 0, 0
1506615067
try:
1506715068
self.l_annotations[-1].remove()
@@ -15252,10 +15253,8 @@ def markCoolEnd(self, noaction:bool = False) -> None:
1525215253
# undo wrongly set COOL
1525315254
self.timeindex[7] = 0
1525415255
removed = True
15255-
15256-
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','CE {0}').format(stringfromseconds(self.timex[self.timeindex[7]] - start)))
15257-
15258-
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text() == st1:
15256+
st1 = self.aw.arabicReshape(QApplication.translate('Scope Annotation','CE {0}').format(0)).rstrip('0')
15257+
if len(self.l_annotations) > 1 and self.l_annotations[-1].get_text().startswith(st1):
1525915258
self.ystep_down, self.ystep_up = 0, 0
1526015259
try:
1526115260
self.l_annotations[-1].remove()

0 commit comments

Comments
 (0)