1
0
mirror of https://github.com/gryf/pygtkworldclock.git synced 2025-12-17 03:20:23 +01:00

Use GLib.timeout instead of GObject.timeout

This commit is contained in:
2023-03-21 08:08:39 +01:00
parent 5d129e54c4
commit 4527b518b6
2 changed files with 5 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ Requirement
- Python3 - Python3
- PyCairo - PyCairo
- PyGObject - PyGObject (GTK3)
Configuration Configuration
------------- -------------
@@ -68,7 +68,7 @@ and the result:
.. image:: /images/vertical.png .. image:: /images/vertical.png
:alt: single clock :alt: single clock
Same in horizontal arragement: Same in horizontal arrangement:
.. code:: yaml .. code:: yaml

View File

@@ -35,8 +35,8 @@ import sys
import cairo import cairo
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")
from gi.repository import GLib
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GObject
import pytz import pytz
import yaml import yaml
@@ -191,13 +191,13 @@ class Clocks(Gtk.DrawingArea):
width = len(row) if len(row) > width else width width = len(row) if len(row) > width else width
for col_no, conf in enumerate(row): for col_no, conf in enumerate(row):
self._clocks.append(Clock(conf, row_no, col_no, self.size, self._clocks.append(Clock(conf, row_no, col_no, self.size,
self.show_seconds)) self.show_seconds))
self.width = self.size * width self.width = self.size * width
def run(self): def run(self):
self.connect('draw', self._draw) self.connect('draw', self._draw)
GObject.timeout_add(100, self.on_timeout) GLib.timeout_add(100, self.on_timeout)
win = Gtk.Window() win = Gtk.Window()
win.set_title('World Clock') win.set_title('World Clock')
win.set_resizable(not self.disable_resize) win.set_resizable(not self.disable_resize)