37 self.__time = 0 |
37 self.__time = 0 |
38 self.__length = 0 |
38 self.__length = 0 |
39 self.__toggle = True |
39 self.__toggle = True |
40 |
40 |
41 # text is taken from paintEvent with maximum number plus some margin |
41 # text is taken from paintEvent with maximum number plus some margin |
42 self.resize( |
42 try: |
43 self.fontMetrics().width(self.tr( |
43 fmWidth = self.fontMetrics().horizontalAdvance(self.tr( |
44 "Snapshot will be taken in %n seconds", "", 99)) + 6, |
44 "Snapshot will be taken in %n seconds", "", 99)) |
45 self.fontMetrics().height() + 4) |
45 except AttributeError: |
|
46 fmWidth = self.fontMetrics().width(self.tr( |
|
47 "Snapshot will be taken in %n seconds", "", 99)) |
|
48 self.resize(fmWidth + 6, self.fontMetrics().height() + 4) |
46 |
49 |
47 self.__timer.timeout.connect(self.__bell) |
50 self.__timer.timeout.connect(self.__bell) |
48 |
51 |
49 def start(self, seconds): |
52 def start(self, seconds): |
50 """ |
53 """ |