From 68a2cd9b11d703417409cbcb41db82f2b97c6684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Fri, 25 Mar 2022 01:47:20 +0100 Subject: [PATCH] WIP: Improve rendering on touch/mobile devices. --- main.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index e6cca21..fbd05d6 100644 --- a/main.py +++ b/main.py @@ -23,7 +23,6 @@ gi.require_version(namespace='Adw', version='1') from gi.repository import Gtk, Polkit, GObject, Gio, Adw, Gdk - class MainWindow(Gtk.Window): ## Setup @@ -46,13 +45,17 @@ class MainWindow(Gtk.Window): self.header_bar = None self.progress_spinner = None - self.main_box = Gtk.Box(name='main-box') - self.task_list = Gtk.ListBox(name='task-list') + # self.main_box = Gtk.Box(name='main-box', vexpand=True, hexpand=True) + self.scrollview = Gtk.ScrolledWindow(vexpand=True, hexpand=True) - self.main_box.props.valign = Gtk.Align.CENTER - self.main_box.props.halign = Gtk.Align.CENTER - self.main_box.append(self.task_list) - self.set_child(self.main_box) + self.task_list = Gtk.ListBox(name='task-list') + self.scrollview.set_child(self.task_list) + + # self.main_box.props.valign = Gtk.Align.CENTER + # self.main_box.props.halign = Gtk.Align.CENTER + # self.main_box.append(self.scrollview) + # self.set_child(self.main_box) + self.set_child(self.scrollview) self.loading += 1 self.task_manager.get_task_list(self.on_task_list_ready) @@ -72,13 +75,15 @@ class MainWindow(Gtk.Window): clock_button.connect("clicked", self.on_clock_button_clicked) hbox.append(clock_button) - task_name_label = Gtk.Entry(text=task.title, width_chars=max(MIN_TITLE_WIDTH_CHARS, len(task.title))) + # task_name_label = Gtk.Entry(text=task.title, width_chars=max(MIN_TITLE_WIDTH_CHARS, len(task.title))) + task_name_label = Gtk.Label() + task_name_label.set_text(task.title) task_name_label.props.css_classes = ('task-name',) hbox.append(task_name_label) - row.set_child(hbox) - return row + + return row def on_ready(self): self.loading -= 1 @@ -132,7 +137,7 @@ class Application(Gtk.Application): def main(): """ Run the main application""" - GObject.threads_init() + # GObject.threads_init() logging.basicConfig(level=logging.INFO, format="%(levelname)-8s %(message)s") app = Application() return app.run(sys.argv)