From 'Yad' to 'Dialogbox'

Since the limitations of Yad are quite restricting for some things that I cobble together, I decided to look for alternatives and ( since GTK is getting less and less attractive each consecutive version) preferrably Qt or the like. And I found something :slight_smile:

It is more flexible than yad and gives output “while running” instead of “on exit” which makes it suitable for a much wider range of applications.

Here is an example for a frontend that I cobbled together in bash and it works like a dream :slight_smile:

3 Likes

I’ve used yad and zenity quite a bit and have no problems with them. From your screenshot, I can’t tell what kind of dialog is being thrown. It would seem you are embedding a YouTube video, but why do you need a dialog for that? Where are the controls (buttons) and options?

2 Likes

Looks like a movie player with option to use/ignore a subtitle file.

1 Like

For simple things it is enough, but the layout you see in my example can not be done in Yad.
Nor can it do any intermediate output without exiting first (which can be quite inconvenient)

I streched the possibilities of yad to the limit when I made a kind of ‘shoppinglist’ app. It ended up with two minor inconveniences that I could not work around because of this.

Do you remember the graphical youtube-downloader frontend that we used to have in Ubuntu MATE some years ago ?
AFAIK it was Wimpy who made that in python.
Since it’s no longer available, I thought that I could have a go at it just to see if it was possible in ‘dialogbox’ (also tried in yad but making a reasonable practical layout was impossible)

The options are right in front of you, there will be some more.
Controls are not needed, it’s not a mediaplayer :slight_smile:

3 Likes

Almost correct. :slight_smile:

It is an attempt to create a frontend for yt-dlp , nothing serious though, just to see how far I can get with ‘dialogbox’.

2 Likes

That looks VERY good!

As you say, unfortunate that you can’t have a same dialog use intermediate outputs. Given that it is Qt-based, coming out of the KDE crowd, it’s possible that they will address that “shortcoming” relatively quickly, once it has been pointed out! :slight_smile:

I will definitely give that a spin! Thank you very much for bringing that to our attention!

1 Like

Oh no, sorry, I explained it not clearly:
Yad is the one that doesn’t do intermediate outputs, but dialogbox does ! :star_struck:

So, I can create a script in bash, driven by the output of dialogbox, which in turn is again driven by the script: a perfect eventloop and quite simple to create :slight_smile:

2 Likes

According to the READ.ME file:

Installation

First, before compiling, create the makefile with qmake. For QT 4, run from the source directory:

qmake -qt=qt4 -makefile

For QT5, you need to run instead:

qmake -qt=qt5 -makefile

To compile and install the application, issue the following commands from the source directory:

make
make install
2 Likes

Tried with qt5 and got way to many errors.

So, tried with qt4 and got this:

root@OasisMega1:/opt/dialogbox-1.0# qmake -qt=qt4 -makefile
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
root@OasisMega1:/opt/dialogbox-1.0#

Would you have insights as to why that error and how to fix?

Can I simply “transplant” the qmake from qt5 install into the qt4 file tree (or symlink to the qt5 file)?

qtchooser is “ELF” so no opportunity for “tweaking”! :frowning:



Errlog from qt5 attempt:

In file included from dialogbox.cpp:21:
dialogbox.hpp:154:26: error: invalid use of incomplete type ‘class QDialog’
154 | class DialogBox : public QDialog
| ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qevent.h:44,
from /usr/include/x86_64-linux-gnu/qt5/QtGui/qtextlayout.h:49,
from /usr/include/x86_64-linux-gnu/qt5/QtGui/qabstracttextdocumentlayout.h:45,
from /usr/include/x86_64-linux-gnu/qt5/QtGui/QtGui:5,
from dialogbox.hpp:24,
from dialogbox.cpp:21:
/usr/include/x86_64-linux-gnu/qt5/QtGui/qwindowdefs.h:55:7: note: forward declaration of ‘class QDialog’
55 | class QDialog;
| ^~~~~~~
In file included from dialogbox.cpp:21:
dialogbox.hpp:206:24: error: ‘QTabWidget’ has not been declared
206 | void ClearTabs(QTabWidget*);
| ^~~~~~~~~~
dialogbox.hpp:217:9: error: ‘QLayout’ does not name a type; did you mean ‘QTextLayout’?
217 | QLayout* FindLayout(QWidget* widget);
| ^~~~~~~
| QTextLayout
dialogbox.hpp:219:44: error: ‘QLayout’ has not been declared
219 | bool IsLayoutOnPage(QWidget* page, QLayout* layout);
| ^~~~~~~
dialogbox.hpp:221:54: error: ‘QLayout’ has not been declared
221 | bool IsLayoutOnContainer(QWidget* container, QLayout* layout);
| ^~~~~~~
dialogbox.hpp:238:34: error: ‘QListWidgetItem’ has not been declared
238 | void ListboxItemSelected(QListWidgetItem*);
| ^~~~~~~~~~~~~~~
dialogbox.hpp:245:9: error: ‘QPushButton’ does not name a type
245 | QPushButton* default_pb;
| ^~~~~~~~~~~

(*** remaining log truncated ***)

Issue reported on the dialogbox site:

1 Like

OK, I get it. Since I don’t use YouTube on my Ubuntu MATE server, it was lost on me.

The error says: qmake is not installed.

After some searching it seems that qt4-qmake is no longer in the repositories, but qt5-qmake is.

apt install qt5-qmake

Only look at the first one or two errors :
Often, after solving the first one or two, the rest of the errors will probably also be solved

Let me know if it doesn’t work. I can send you my compiled binary.

2 Likes

I realize that only the first few errors are relevant … but those mean nothing to me. :frowning:

For people who want to try it out but don’t feel comfortable to compile this, i’ve uploaded the binary to WeTransfer incuding an example.

Here is the link, valid for three days.

2 Likes

And here a dialogbox binary for ubuntu-mate 20.04 and higher :slight_smile:

1 Like

Well, since you were kind enough to make it available, and this sort of thing fits right in my wheelhouse, I’m going to give it a try. Thanks!

2 Likes

What about Python + TkInter?

2 Likes

I've thought about that, but the flaws of python are a bit of a roadblock.

  1. highly unstable language (think python 2 vs python 3)
  2. highly unstable implementation (every minor version update breaks half of the applications on this planet)
  3. extremely bad in multiprocessing ( and therefore bad at IPC )

What I wrote 5 years ago should still run now or in 5 years time without even looking at it. I wrote a serverapplication 12 years ago in bash that still runs to this day. It survived several OS upgrades without even looking at it.
Try that with python. :joy:

So yeah, I would sooner chooce for Tk/Tcl than Tkinter, Tcl is at least stable :slight_smile:
But then, Tcl would then just be a translation layer between bash and Tk and I first would have to learn Tcl from scratch, so I rather search for a solution without an intermediate layer.

If I have to go with an intermediate layer then I would use WxWidgets which has a GUI Designer and a code generator. I've used that several years ago to create a EQ frontend for MPV:

EDIT: oops, the name of the screenshot is a bit, let's say, misleading. Sorry :slight_smile:

2 Likes

I agree wholeheartedly, which is why, contrary to much of what I see, I have spent more time on Bash scripting, however inelegant at times, than trying to create (and repeatedly fix) compiled languages. :slight_smile:

Sure, it may be deemed limited and “niche” by some, but for what I chose to apply myself to, those were essentially “mainstream” to me!

2 Likes

bash is always my first go-to when I’m trying to automate a task. Most of my scripts don’t need “prettying up,” but sometimes I like to add something, maybe in the way of feedback. Linux gives us all sorts of tools, like the simple one-line notify-send that simply pop up a notification dialog.

When you combine bash (or zsh, csh, or any of the various shells) with other built-ins, like sed, awkand similar utility programs, one can build quite a library of local, custom jobs.

Don’t forget that programs like bashtop and htop also exist, further proving that there’s an awful lot that can be done without having to learn a new language.

4 Likes

Also, as a distant historical reference, while he was working at Hydro-Quebec back in the 1980s, my now-deceased older brother (for his Doctoral thesis) had used shell scripts (plugged into databases and real-time controls) on a Unix box as the logic of an adaptive “expert-system” controlling Hydro-Quebec power station transmission voltage to ensure the amount of power being generated was responsive to demand, without overloading the transmission “breakers” (I may have the wrong term there), and adjusting those controls simultaneously on 3 parallel transmission loops, ensuring stable transmission from James Bay to New England states.

At the time, he conjectured that Unix and Bourne Shell together offered a clear seed resource to creating Artificial Intelligence! :slight_smile:

3 Likes