Categories
Development

oci-bucket-gui in Python, cont.

What are the news? Not great 🙂

Advanced further a bit, these are the results:

  • GTK+ was running reasonably well on Linux and the development “inner cycle” is fast enough. Passing signals and data back and forth from GUI to code works well.
  • Glade GUI Editor is pretty unstable, crashes often as soon as you have slightly more complicated layouts.
  • However tried to make sens of it on Windows – oh the horrors! No native Windows wheels or binaries for PyGObject (main GTK parent class) is available that actually work, and building it from sources is incredibly difficult involving C++ toolchain and tons of prerequisites. Installing Glade on Windows involves too many tricks and requires MSYS2 tools and mingw64 emulator (and it isn’t more stable than on Linux). Cross-compiling and distributing to Windows from Linux is as artisanal as it gets, looks way too brittle.

Explored another multi platform GUI framework: Qt.

Qt, like GTK, is also developed in C++, so using it from Python requires bindings. The most popular seems the “Qt for Python” AKA “PySide2” or the very new (available since couple of weeks) “PySide6” from qt.io. It has its own IDE that is mostly targeted to C++ development but not so much to Python though. There is a GUI designer but so far it misbehaved rather badly for me (continually resizing dialogs to unusable sizes), also the layout and editing of widgets’ properties is weird, I find it unnatural. Not as good as Glade’s.

Maybe I should just switch to C++. Just kidding – no way!

It’s a good thing this is just a hobby project – I have possibility to burn time and not have a product yet 🙂

I’m unpleasantly surprised at the state of multi-platform GUI development today, it seems like all the brain power is spent on Web technologies, and the desktop GUI efforts are few and far between, you can’t just easily try it as a novice and “make it work” without tearing your hear off in the process.

Microsoft announced a new promising MAUI framework this year that evolves from Xamarin Forms: https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/ but so far there is no preview SDK delivered. There is hope they will be able to deliver good developer experience as they always did. We’ll see, I’ll be certainly tracking this project.

In the meantime I’m thinking at what I’ll be doing next, so far not sure what that would be…

Keep hacking (•̀ᴗ•́)و ̑̑

Categories
Development

oci-bucket-gui in Python

Do you think I was able to stick to my initial idea of developing in Electron? Did I power through no matter what? Haha: no.

Here I am, switching languages again – this time it’s Python. It’s impressive how little code you need to create a mock GUI using GTK+ and GTK Builder with Glade visual editor.

It’s literally this much:

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk


class Handler:
    def onDestroy(self, *args):
        Gtk.main_quit()

    def on_btnSetup_clicked(self, button):
        print("Setup button clicked")

    def on_btnConnect_clicked(self, button):
        print("Connect button clicked")


builder = Gtk.Builder()
builder.add_from_file("MyGUI.glade")
builder.connect_signals(Handler())

window = builder.get_object("window1")
window.show_all()

Gtk.main()

The only other piece of code is a .glade file – an XML containing description of all the widgets, their layouts and signals (call backs).

Sure, it does nothing but it’s already looking great:

In the Glade editor, most of the layout is done visually like in the olden Visual Basic 6 days!

The most complex part is understanding how Glade layouts work – how containers and widgets interact and how sizes and positions are negotiated, but once understood it’s easy enough to get going and develop fast. So far I’m impressed.

I’ve done this on my old computer running Ubuntu, next step – testing it on Windows.

Keep hacking (•̀ᴗ•́)و ̑̑