Categories
Development

oci-bucket-gui in Python, Qt.

I don’t like giving up 🙂 And so I gave Qt another chance and installed the complete Qt Creator IDE from https://www.qt.io/product/development-tools. Most of it is targeted to C++ development and very little was done for Python – my idea is to continue using VSCode as code development editor and only use the Qt Designer from the Creator package for visual GUI development.

The Qt Designer that I’ve previously installed as a stand-alone application, wasn’t working well and my hope was that it’ll be better if I installed the whole QT Creator IDE thing.

And this indeed helped – no more docked window that resize spontaneously or others glitches, this is good news.

In VSCode, I’ve installed the “Qt for Python https://github.com/seanwu1105/vscode-qt-for-python that adds couple of nice features like ability to call QT Designer directly from the .ui file and to recognize PyQt and PySide file types.

What’s next? The next step is trying to create the GUI in the designer and then to start wiring the logic. More news to come 🙂

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

Categories
Development

Flutter?

In a desperation move, tried to look into Flutter.

The first “hello world” experience was the smoothest so far – the dev workstation installation is simple, a very good plugin for VSCode is provided and the “getting started” page is great: https://developers.google.com/learn/pathways/intro-to-flutter

Dart language is very much like Java, so when you know one you’ll understand the other just fine.

The negatives:

  • no GUI designer
  • and no cross platform builds – you need to build on a Mac to build an OS X app…

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 (•̀ᴗ•́)و ̑̑

Categories
Audio and Video Blogging

Merging multi-file action cam videos (fast)

Gosh, it’s December already? This year is at the same time too long but with time flying too fast.

A one-off post unrelated to previous ones, to change the subject!

If you have an action camera and you shoot videos that go over 4 GB, then you know that the cam will split your footage in 4 GB chunks – and if you want to make a single video out of these, then you need to somehow merge the pieces into one.

My DJI Osmo Action camera is producing videos like that:

DJI_0062_001.MP4
DJI_0062_002.MP4
DJI_0062_003.MP4
...

Even if you have no need to edit the video at all, you probably end up working in some kind of video editor spending MANY hours exporting (or rendering, whatever is the word used in your software). Even with a decent GPUs capable of fast encoding this can take long time, growing exponentially with resolution. You can forget about rendering long 4K mp4 videos on a machine without a very capable GPU costing around €1000!

Guess what, I don’t have that, my main laptop doesn’t have any dedicated GPU at all – a 1 hour 4K video takes more than 24 hours to render! 😁

Ideally I need something that can “concatenate” videos without decoding and re-encoding, and the solutions exist. I’m on Windows and I’ve found these tools called MP4 Splitter and MP4 Joiner, but they were very unreliable with my files, crashing a lot and producing corrupted videos. Maybe Osmo Action is creating buggy files – I don’t know.

Even the most complex video and audio processing tasks can be done using this amazing tool call ffmpeg, it’s a real command line powerhouse able to do any kind of conversions on most audio and video formats. The command line interface is totally allright with me for my own usage, I don’t need a GUI for myself. So I did a bit of research and finally found what works well for my use case and this is the “quick and dirty” batch script I ended up with:

@echo ------------ STARTED ENCODING ---------------

set file-name=new_video

:: Create input File List
for %%i in (DJI*.mp4) do echo file '%%i'>> mylist.temp.txt

:: Concatenate input video files
ffmpeg -f concat -safe 0 -i mylist.temp.txt -c copy -hide_banner -loglevel warning -stats %file-name%.mp4

:: cleanup
rm mylist.temp.txt

@echo ------------ FINISHED ENCODING ---------------

As a prerequisite, you need:

  1. Install ffmpeg.exe and put it somewhere in user or system path. I already had one installed by “MP4Tools” https://www.mp4joiner.org/ so I used it but there are other prebuilt packages available.
  2. Put your video files to concatenate in a directory – they will be joined by the alphabetical order of their filenames
  3. Put the concat.bat in the same directory and just run it. When it finishes, you’ll have a new file “new_video.mp4” in the same directory, having roughly the total size of the original videos.

DJI_0062_001.MP4
DJI_0062_002.MP4
DJI_0062_003.MP4
new_video.mp4

...

On my i5 Lenovo T470 Notebook without GPU it takes about 30 minutes to process a 1-hour long 4K video which is so significantly faster than reencoding it in the video editor!

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

Categories
Development

oci-bucket-gui MVP: First mockup

Even if this is my personal hobby project, I’ll be trying to apply some “real” software development practices. First thing to do is to describe the scope of the first “Minimal Viable Product”. So far, I’ve noted these MVP limitations I’ll be trying to stick to:

  • Windows target only
  • Javascript (no Typescript yet)
  • Single thread uploads and downloads, no parallelism
  • No simulated folders in Object Storage
  • Simplified choice of compartments and buckets, probably using setup files / environment variables
  • Single file up/download (no bulk operations)

These will be good enough for the “alpha” versions – once this one is working I’ll think about moving further.

This is my mockup for the MVP:

Not sure yet what exactly will be happening when pressing the “Setup” button – either loading a file or opening a dialog when the fields will be entered (to be saved in a file?) Will think about that some more.

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

Categories
Blogging Development

Yak Shaving is real!

In my quest for Electron.js app development mastery, I’ve discovered that my own company (Oracle) publishes own frontend javascript toolkit that’s opensource and it actually is looking nice and useful! Whole lot of prebaked components you can just copy and paste and data binding looks simple enough.

Welcome Oracle JET – Javascript Extention Toolkit: https://www.oracle.com/webfolder/technetwork/jet/index.html

Also has both Javascript and Type Script versions. Couldn’t find much examples for it’s usage in Electron apps but I don’t see what could prevent that. I guess mine will be the newest example when I finish it 🙂

Categories
Development

oci-bucket-gui: alternatives?

Continuing with this personal project of mine.

Tried to look into other alternatives for a desktop multi-platform application. In a very distant past I developed a bit in Java – so the first thing I wanted to see is the old good Swing. There was also a GUI builder in Netbeans IDE as I remembered – for sure this was updated since then, right? Having a visual GUI builder could be nice, it speeds up development quite a lot, no?

By “then” I mean early 2000’s, so roughly 20 years ago! (Time flies…)

And so, I’ve downloaded the latest version of now-Apache Netbeans 12.1 and fired a sample project called “GuiFormExamples”…

What can I say… this looks exactly like what should’ve been a new modern app built in 2001 for Windows XP 😁

Well, this doesn’t look very inspiring to me – some searching suggests that there are ways to squeeze more modern look and feel from Swing components, but I don’t know if it makes sense for me to invest more time in that. The attractive part of Electron was that it’s built on the web technologies that are useful anyway for a foreseeable future, because most of the application development is happening for the web anyway and I would like to refresh my knowledge of web development that’s starting to be a bit dated with me doing mostly infrastructure these days.

It looks like his project is going to be a classic case of “Yak Shaving” where I would need to go deeper yet, every time I need to advance. So far, to master Electron I’ll need to be at least half-knowledgeable in at least one web framework.

News to follow, stay tuned and as always:

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

Categories
Development

oci-bucket-gui – Electron / Node.js shenanigans

Still fighting with the tech stack selection – from my first noob looks, the Electron ecosystem seams somewhat sparse and lacking detailed successful tutorials. Especially for people developing on Windows.

Node.js is the main piece of the puzzle and this isn’t easy either. The versions are advancing very fast – even the LTS versions are created every year (twice as fast as Ubuntu for example). And the whole life of the Node.js LTS version from start to EOL is 2.5 years only.

A fun fact – current LTS as of today is 12.19, but the 14 LTS is starting in 5 days – should I wait? 😅

With this in mind, a need for easy version switch is there – and there is the project called “nvm” – that’s the Node version manager. The problem is, it doesn’t work on Windows that I wanted to use as my dev platform! An equivalent windows project exists, it’s called “nvm-windows” but it doesn’t work properly on my machine (and I see I’m not the only person who has the same problem, without clear resolution – the incidents are mostly closed by the project maintainers saying “check your windows security” – not terribly helpful). There is possibility apparently to develop in WSL, but again the problem is I don’t have WSL2, only WSL1 because my Windows build is too old. So basically I can’t use nvm or nvm-windows, so will have to stick to locally installed LTS Node.js and hope I don’t need to develop in different versions at the same time.

All of this isn’t very reassuring, I should’ve probably just go with JavaFX or .NET Core/C# – both have supported SDKs for OCI and much larger community support for desktop apps 😅.

Let’s see how it all advances,

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

Categories
Blogging Cloud Infrastructure Development

oci-bucket-gui

In parallel with regular work, I’ve spent the week since last blog post trying to discover resources for electron.js development newbees.

The situation is “interesting”! On one side lots of simple easy to put in place “hello world” samples, on the other side a number of very advanced open source projects (like VSCode) but not much in between! It’s kind of assumed that the developer interested by Electron already has extensive full stack or front-end experience using popular frameworks like React or Vue. I am not such developer 😅. Back end – yes a bit, but front end – not so much!

Am I abandoning this idea – hell no! I’m searching and I’m looking and I will find a way.

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