def update_monitor_views(self): """ Updates all of our MonitorViews based on the power or Awake states. """ low_power = not self.power_client.plugged_in if (not settings.should_show_plugin()) or ( settings.should_show_plugin() and low_power): if self.clock_widget != None and settings.get_show_clock(): self.clock_widget.start_positioning() if self.albumart_widget != None and settings.get_show_albumart(): self.albumart_widget.start_positioning() else: if self.clock_widget != None: self.clock_widget.stop_positioning() self.clock_widget.hide() if self.albumart_widget != None: self.albumart_widget.stop_positioning() self.albumart_widget.hide() for monitor in self.monitors: monitor.update_view(status.Awake, low_power) if not monitor.get_reveal_child(): monitor.reveal()
def update_monitor_views(self): """ Updates all of our MonitorViews based on the power or Awake states. """ low_power = not self.power_client.plugged_in if not status.Awake: if (not settings.should_show_plugin()) or (settings.should_show_plugin() and low_power): if self.clock_widget != None and settings.get_show_clock(): self.clock_widget.start_positioning() if self.albumart_widget != None and settings.get_show_albumart(): self.albumart_widget.start_positioning() else: if self.clock_widget != None: self.clock_widget.stop_positioning() self.clock_widget.hide() if self.albumart_widget != None: self.albumart_widget.stop_positioning() self.albumart_widget.hide() for monitor in self.monitors: monitor.update_view(status.Awake, low_power) if not monitor.get_reveal_child(): monitor.reveal()
def __init__(self, away_message=None, initial_monitor=0): super(ClockWidget, self).__init__(initial_monitor) self.get_style_context().add_class("clock") self.set_halign(Gtk.Align.START) self.clock = None if not settings.get_show_clock(): return self.away_message = away_message self.label = Gtk.Label() self.label.show() self.add(self.label) self.clock = CinnamonDesktop.WallClock() self.set_clock_format() trackers.con_tracker_get().connect(self.clock, "notify::clock", self.on_clock_changed) tz = Gio.File.new_for_path(path="/etc/localtime") self.tz_monitor = tz.monitor_file(0, None) trackers.con_tracker_get().connect(self.tz_monitor, "changed", self.on_tz_changed) trackers.con_tracker_get().connect(self, "destroy", self.on_destroy) self.update_clock()
def setup_clock(self): self.clock_widget = ClockWidget(self.screen, self.away_message, utils.get_mouse_monitor()) self.add_child_widget(self.clock_widget) if not settings.should_show_plugin() and settings.get_show_clock(): self.put_on_top(self.clock_widget) self.clock_widget.start_positioning()
def __init__(self, away_message=None, initial_monitor=0, low_res=False): super(ClockWidget, self).__init__(initial_monitor) self.get_style_context().add_class("clock") self.set_halign(Gtk.Align.START) self.set_property("margin", 6) self.clock = None self.low_res = low_res if not settings.get_show_clock(): return self.away_message = away_message box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(box) box.show() self.label = Gtk.Label() self.label.show() self.label.set_line_wrap(True) self.label.set_alignment(0.5, 0.5) box.pack_start(self.label, True, False, 6) self.msg_label = Gtk.Label() self.msg_label.show() self.msg_label.set_line_wrap(True) self.msg_label.set_alignment(0.5, 0.5) if self.low_res: self.msg_label.set_max_width_chars(50) else: self.msg_label.set_max_width_chars(80) box.pack_start(self.msg_label, True, True, 6) self.clock = CinnamonDesktop.WallClock() self.set_clock_format() trackers.con_tracker_get().connect(self.clock, "notify::clock", self.on_clock_changed) tz = Gio.File.new_for_path(path="/etc/localtime") self.tz_monitor = tz.monitor_file(0, None) trackers.con_tracker_get().connect(self.tz_monitor, "changed", self.on_tz_changed) trackers.con_tracker_get().connect(self, "destroy", self.on_destroy) self.update_clock()
def after_transitioned_back_to_sleep(self, monitor, data=None): trackers.con_tracker_get().disconnect(monitor, "current-view-change-complete", self.after_transitioned_back_to_sleep) self.info_panel.update_revealed() if not status.PluginRunning and settings.get_show_clock(): self.put_on_top(self.clock_widget) self.clock_widget.start_positioning()
def update_monitor_views(self): """ Updates all of our MonitorViews based on the power or Awake states. """ if not status.Awake: if self.clock_widget != None and settings.get_show_clock(): self.clock_widget.start_positioning() if self.albumart_widget != None and settings.get_show_albumart(): self.albumart_widget.start_positioning() for monitor in self.monitors: monitor.show()
def after_transitioned_back_to_sleep(self, monitor, data=None): """ Called after the MonitorViews have updated - re-show the clock (if desired) and the InfoPanel (if required.) """ trackers.con_tracker_get().disconnect(monitor, "current-view-change-complete", self.after_transitioned_back_to_sleep) self.info_panel.update_revealed() if not status.PluginRunning: if settings.get_show_clock(): self.clock_widget.start_positioning() if settings.get_show_albumart(): self.albumart_widget.start_positioning()
def setup_clock(self): """ Construct the clock widget and add it to the overlay, but only actually show it if we're a) Not running a plug-in, and b) The user wants it via preferences. Initially invisible, regardless - its visibility is controlled via its own positioning timer. """ self.clock_widget = ClockWidget(self.screen, self.away_message, utils.get_mouse_monitor()) self.add_child_widget(self.clock_widget) self.floaters.append(self.clock_widget) if not settings.should_show_plugin() and settings.get_show_clock(): self.clock_widget.start_positioning()
def after_transitioned_back_to_sleep(self, monitor, data=None): """ Called after the MonitorViews have updated - re-show the clock (if desired) and the InfoPanel (if required.) """ trackers.con_tracker_get().disconnect( monitor, "current-view-change-complete", self.after_transitioned_back_to_sleep) self.info_panel.update_revealed() if not status.PluginRunning: if settings.get_show_clock(): self.clock_widget.start_positioning() if settings.get_show_albumart(): self.albumart_widget.start_positioning()