本文整理汇总了Python中main_window.MainWindow.update_pomodoro_count方法的典型用法代码示例。如果您正苦于以下问题:Python MainWindow.update_pomodoro_count方法的具体用法?Python MainWindow.update_pomodoro_count怎么用?Python MainWindow.update_pomodoro_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main_window.MainWindow
的用法示例。
在下文中一共展示了MainWindow.update_pomodoro_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DomorIndicator
# 需要导入模块: from main_window import MainWindow [as 别名]
# 或者: from main_window.MainWindow import update_pomodoro_count [as 别名]
#.........这里部分代码省略.........
self.reset()
def _update_item(self, item_id, img_path, label=None):
"""
Update image for button
:param button_id: id of button which is updated
:param img_path: path to image
:return: None
"""
try:
item = self.builder.get_object(item_id)
img = Gtk.Image.new_from_file(img_path)
item.set_image(img)
if label:
item.set_label(label)
except Exception as e:
print item_id
print e.message
def _update_time(self):
"""
Update display time on UI
:return:
"""
time_string = "%02d:%02d" % (self.time / 60, self.time % 60)
self.lb_clock.set_label(time_string)
if self.state == State.BREAK:
self.break_screen.update_time(time_string)
if self.main_window:
self.main_window.update_time(time_string)
def _update_pomodoro_count(self):
label = str(self.count) + \
(" pomodoro" if self.count <= 1 else " pomodoros")
self.lb_counter.set_label(label)
if self.main_window:
self.main_window.update_pomodoro_count(self.count)
def count_down(self):
if self.state != State.IDLE:
if self.state == State.WORK:
if self.time == 0:
self.count += 1
# long_work_time is the number of short working session
# between long break
if self.count % self.settings.long_work_time == 0:
self.start_break_period(self.settings.long_break_time)
else:
self.start_break_period(self.settings.short_break_time)
self._update_pomodoro_count()
else:
self.time -= 1
self.work_time += 1
else:
if self.state == State.BREAK and self.time == 0:
# end of break period star new short work period
self.start_work_period()
else:
self.time -= 1
self._update_time()