diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-10-08 18:10:39 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-10-08 18:13:41 +0100 |
commit | 138543d4b3a9c1543bf54b55149d648edb8c4bf2 (patch) | |
tree | 226e21d8ee03e40c7a58df0bc59dae13f6a560c8 | |
parent | ec8822c913652cad2b8ed31bd6bb513c641c3d11 (diff) |
Update requested width+height to be more friendly with mobile linux
Also fix rendering error with messages at low window widths.
Co-authored-by: Peter <peter@linmob.net>
-rw-r--r-- | src/gtk/chat.ui | 1 | ||||
-rw-r--r-- | src/gtk/message.ui | 32 | ||||
-rw-r--r-- | src/message.py | 6 | ||||
-rw-r--r-- | src/window.ui | 4 |
4 files changed, 12 insertions, 31 deletions
diff --git a/src/gtk/chat.ui b/src/gtk/chat.ui index 65765e5..fa4d77d 100644 --- a/src/gtk/chat.ui +++ b/src/gtk/chat.ui @@ -124,3 +124,4 @@ </property> </template> </interface> + diff --git a/src/gtk/message.ui b/src/gtk/message.ui index dca0237..9619342 100644 --- a/src/gtk/message.ui +++ b/src/gtk/message.ui @@ -3,10 +3,6 @@ <requires lib="gtk" version="4.0"/> <template class="WeegtkMessage" parent="GtkBox"> <property name="orientation">horizontal</property> - <property name="valign">start</property> - <property name="halign">start</property> - <!-- <property name="margin-top">2</property> --> - <!-- <property name="margin-bottom">2</property> --> <style> <class name="message"/> </style> @@ -18,17 +14,17 @@ <property name="margin-start">10</property> <property name="margin-end">10</property> <property name="valign">start</property> + <property name="halign">start</property> </object> </child> <child> <object class="GtkBox" id="MessageText"> - <property name="orientation">1</property> - <property name="valign">1</property> - <property name="halign">1</property> + <property name="orientation">vertical</property> + <property name="halign">start</property> <child> <object class="GtkLabel" id="username"> <property name="label" translatable="true">Username</property> - <property name="halign">1</property> + <property name="halign">start</property> <property name="selectable">true</property> <style> <class name="username"/> @@ -37,27 +33,11 @@ </child> <child> <object class="GtkBox" id="message_list"> - <property name="orientation">1</property> - <property name="valign">1</property> - <property name="halign">1</property> - <!-- <child> --> - <!-- <object class="GtkLabel" id="message"> --> - <!-- <property name="label" translatable="true">This is the the message that some user sent</property> --> - <!-- <property name="halign">1</property> --> - <!-- <property name="selectable">true</property> --> - <!-- <property name="wrap">true</property> --> - <!-- <property name="halign">0</property> --> - <!-- <property name="hexpand">true</property> --> - <!-- <property name="hexpand-set">true</property> --> - <!-- <property name="xalign">0</property> --> - <!-- <style> --> - <!-- <class name="message"/> --> - <!-- </style> --> - <!-- </object> --> - <!-- </child> --> + <property name="orientation">vertical</property> </object> </child> </object> </child> </template> </interface> + diff --git a/src/message.py b/src/message.py index 5f70b9e..e61957d 100644 --- a/src/message.py +++ b/src/message.py @@ -16,7 +16,7 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. # # SPDX-License-Identifier: GPL-3.0-or-later -from gi.repository import Adw, Gtk, GLib +from gi.repository import Adw, Gtk, GLib, Pango import re @@ -71,8 +71,8 @@ class WeegtkMessage(Gtk.Box): first = False markuped = self.parse_message(message) msg = Gtk.Label(label=markuped, selectable=True, - wrap=True, halign=0, hexpand=True, hexpand_set=True, - xalign=0, margin_top=margin, use_markup=True) + wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR, xalign=0, + margin_top=margin, use_markup=True) self.message_list.append(msg) diff --git a/src/window.ui b/src/window.ui index 8aca68c..58f26b4 100644 --- a/src/window.ui +++ b/src/window.ui @@ -24,8 +24,8 @@ <property name="title" translatable="yes">Weegtk</property> <property name="default_width">800</property> <property name="default_height">576</property> - <property name="width-request">400</property> - <property name="height-request">500</property> + <property name="width-request">360</property> + <property name="height-request">294</property> <child> <object class="AdwBreakpoint"> <condition>max-width: 560</condition> |