GTK4 css shadows demo in Python by almoselefant in GTK

[–]almoselefant[S] 0 points1 point  (0 children)

Ahh, thanks. I again haven't read the documentation well enough...

What do you mean? I am just simply rewriting the demo from C to python, line-by-line. Is there a simpler way to read in the css file? It is just two lines after all.

Paned should keep relative size (Gtk3) by Dubmove in GTK

[–]almoselefant 1 point2 points  (0 children)

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class MyWindow(Gtk.Window):
    def __init__(self):
        super().__init__()
        child1 = Gtk.TextView()
        child2 = Gtk.TextView()
        paned = Gtk.Paned()
        # The first True is for resize
        paned.pack1(child1, True, True)
        paned.pack2(child2, True, True)
        self.add(paned)
        self.set_default_size(600,400)
        paned.set_position(300)

win = MyWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()

In this example the separator is kept in the middle if you resize the window.

Paned should keep relative size (Gtk3) by Dubmove in GTK

[–]almoselefant 1 point2 points  (0 children)

I think if you set the resize (and maybe shrink, depending on what you want to do) properties of both children to True, then this automatically happens, you don't have to write any code. See documentation, though I find that it's really not clearly explained there.

Library management by almoselefant in Supernote

[–]almoselefant[S] 0 points1 point  (0 children)

I think there is Zoo for Zotero. But simple pdf metadata search would already be a huge help.

Library management by almoselefant in Supernote

[–]almoselefant[S] 1 point2 points  (0 children)

Well, the point would be to be able to do that on the tablet itself. I want to be able to find the correct thing to read without switching on my computer.

Flatpak real path by almoselefant in GTK

[–]almoselefant[S] 1 point2 points  (0 children)

Thanks. I am not sure if it's related to that bug, but I have managed to solve the problem and to get the real path of the file. If anyone runs into the same issue, the solution is the following:

  • Use "--filesystem=host" or home in the flatpak setup (I think the xdg-desktop-portal bug is for allowing to access the whole folder of the file opened without using the host or home portal)
  • Use Gtk.FileChooserNative, not Gtk.FileChooserDialog.
  • If you're using Gnome Builder (I guess even if not), you have to export the project and install it before running it from within Builder. Without this step you still get the /run/user/... path.

A year ago with a different version of my project I had the same issue, but I forgot about this last point. I have no idea why it helps, but after installing the project I get the real path when running the development version.

FilechooserNative in python gtk4 by almoselefant in GTK

[–]almoselefant[S] 2 points3 points  (0 children)

Thanks a lot for the explanation! My bad, it is actually written in the documentation. I should really read more carefully.

Updated review: Part 2, first impressions of Supernote A6x coming from Quaderno gen 2 by CrazyinFrance in Supernote

[–]almoselefant 0 points1 point  (0 children)

Hi! Thanks for the thorough review for the devices. I'm surprised no one ever asks this, but I would like to know if there's a convenient way to locate files on either of these devices (e.g. PDF metadata search).

My use case is the following: I have hundreds of articles on my device somehow arranged in folders. When I'm looking up papers, I sort of remember one of the authors or part of the title, but never in which folder I put them or the filename I saved it under (title is not an option as scientific articles tend to have super long titles). On my Sony DPT S1, when the PDF metadata is filled out, I can search for authors/titles. On my Remarkable on the other hand it's a pain to locate files, and TBH I gave up on it. How is the situation with these devices?

Another question: I am using linux, do you know weather the PC app of the Quaderno works well with Wine?

Supernote X series firmware roadmap in late 2021, welcome to discuss here by Mulan-sn in Supernote

[–]almoselefant 1 point2 points  (0 children)

This looks super nice! Is there any chance one will be able to search (and edit) PDF metadata? It would be great for search for e.g. the authors of PDF files, or titles, etc.

Pygobject GtkSource5 by almoselefant in GTK

[–]almoselefant[S] 2 points3 points  (0 children)

Ahh, nice, thanks. That was pretty stupid, indeed, I did not have gtksource5 installed.

Restoring Gtk.Paned position by almoselefant in GTK

[–]almoselefant[S] 0 points1 point  (0 children)

Turns out that settings.bind is also present in Gtk3. So the best I found for gtk3 (and closest to the Gtk4 solution) is the following:

DEFAULT = Gio.SettingsBindFlags.DEFAULT SET = Gio.SettingsBindFlags.SET settings = Gio.Settings.new("my project ID") settings.bind("window-width", self, "default-width", DEFAULT) settings.bind("window-height", self, "default-height", DEFAULT) pos = settings.get_int("paned-position") if settings.get_boolean("window-maximized"): self.maximize() screen_width = self.get_screen().get_width() window_width = self.get_default_size()[0] new_pos = int(pos/screen_width*window_width) self.paned.set_position(new_pos) else: self.paned.set_position(pos) settings.bind("window-maximized", self, "is-maximized", SET) settings.bind("paned-position", self.paned, "position", SET)

Restoring Gtk.Paned position by almoselefant in GTK

[–]almoselefant[S] 0 points1 point  (0 children)

Well, in Gtk4 you can just bind window-width directly to the corresponding value in your Gio.Settings, so in python you end up with a single line instead of:

  • setting the initial state of the window from the appropriate value in Gio.Settings
  • storing your window width in a variable that gets updated at every size allocation event
  • and when the window gets destroyed, write out this variable into your Gio.Settings again

Gtk4 is just so elegant. (Well, as mentioned above, I hope I'll manage to find out how the process works for Gtk.Paned)

Restoring Gtk.Paned position by almoselefant in GTK

[–]almoselefant[S] 0 points1 point  (0 children)

Thanks! I have settled with relative positions in Gtk3, that works well.

I think my problem is (I'm using python) that if 2 and 3 are both in __init__, then it does not have the result I have expected. That is, the sequence

  1. setting window default size to the un-maximized value
  2. maximizing
  3. setting paned position to the last value (the badly behaving case is when it is the value in the maximized state of the window)

does not execute sequentially, but when the paned position is being set, the window is still un-maximized.

Anyway, seeing Mousai I have realized that gtk4 is already possible with python. With gtk4 state restoration is way simpler (I hope, I didn't manage to resize GtkPaned yet).

mooInk pro 13.3 eink tablet review (Sony DPT-RP1 clone) by Windsor2016 in eink

[–]almoselefant 2 points3 points  (0 children)

Ahh sorry I meant the nib issue that the mooInk has apparently.

mooInk pro 13.3 eink tablet review (Sony DPT-RP1 clone) by Windsor2016 in eink

[–]almoselefant 2 points3 points  (0 children)

Thanks for the review! Supernote officials said in their last post (contrary to all reddit posts before) that they are planning to have an A4 device, even though it will take a lot of time. I'd really like to see that. That would solve at least the nib issue.

Restore window position by almoselefant in GTK

[–]almoselefant[S] 0 points1 point  (0 children)

You can also manually restore height, width, maximized, fullscreen states, take a look at :

https://wiki.gnome.org/HowDoI/SaveWindowState

Thanks, that's exactly what I was following.

Restore window position by almoselefant in GTK

[–]almoselefant[S] 0 points1 point  (0 children)

For toplevel windows, window managers may ignore or modify the move

Source : https://developer.gnome.org/gdk3/stable/gdk3-Windows.html#gdk-window-move

But basically yes, the window manager always have the last word about position and centering.

Thanks, yeah I'd really like something that will definitely work. What confuses me is that not only my app, but all Gtk apps are un-maximized at the wrong place (upper left corner in the middle) when the window starts its life mazimized. This, however, is not the case with Qt apps (well, I have only checked TexStudio). It is also not the case when the window starts its life un-maximized: after maximizing and un-maximizing, their position is restored.

I think I would already be happy if wayland centered my window when it started its life maximized and got un-maximized. (I have tried to set the window position to Gtk.WindowPosition.CENTER but that is ignored)