Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #226768 > unrolled thread

Looking for a generic drag and drop gui for custom commands

Started by"Christoph K." <christoph@kobenetz.de>
First post2020-09-07 22:50 +0200
Last post2020-09-08 20:00 +0200
Articles 12 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  Looking for a generic drag and drop gui for custom commands "Christoph K." <christoph@kobenetz.de> - 2020-09-07 22:50 +0200
    Re: Looking for a generic drag and drop gui for custom commands David Christensen <dpchrist@holgerdanske.com> - 2020-09-08 12:00 +0200
      Re: Looking for a generic drag and drop gui for custom commands "Christoph K." <christoph@kobenetz.de> - 2020-09-08 14:20 +0200
        Re: Looking for a generic drag and drop gui for custom commands David Christensen <dpchrist@holgerdanske.com> - 2020-09-09 00:40 +0200
    Re: Looking for a generic drag and drop gui for custom commands mick crane <mick.crane@gmail.com> - 2020-09-08 14:10 +0200
      Re: Looking for a generic drag and drop gui for custom commands Tixy <tixy@yxit.co.uk> - 2020-09-08 14:50 +0200
        Re: Looking for a generic drag and drop gui for custom commands Tixy <tixy@yxit.co.uk> - 2020-09-08 15:20 +0200
        Re: Looking for a generic drag and drop gui for custom commands "Christoph K." <christoph@kobenetz.de> - 2020-09-08 17:20 +0200
          Re: Looking for a generic drag and drop gui for custom commands Tixy <tixy@yxit.co.uk> - 2020-09-08 18:50 +0200
            Re: Looking for a generic drag and drop gui for custom commands Tixy <tixy@yxit.co.uk> - 2020-09-08 19:00 +0200
            Re: Looking for a generic drag and drop gui for custom commands "Christoph K." <christoph@kobenetz.de> - 2020-10-13 14:20 +0200
    Re: Looking for a generic drag and drop gui for custom commands Charles Curley <charlescurley@charlescurley.com> - 2020-09-08 20:00 +0200

#226768 — Looking for a generic drag and drop gui for custom commands

From"Christoph K." <christoph@kobenetz.de>
Date2020-09-07 22:50 +0200
SubjectLooking for a generic drag and drop gui for custom commands
Message-ID<AMwfn-2fw-7@gated-at.bofh.it>
Dear all,

I'd like to "automate" a couple of tasks that I (until now) do on the
command line manually. Examples include splitting of video files using
ffmpeg, run backups with specific parameters, display checksums(md5), etc.

I'm tired of typing the same long commands that I often need to look up
in my wiki and just replace one or two parameters, usually just the file
names.

So I was thinking about writing an application which will do just what I
want. But then I thought: Maybe someone did that already! ;-)

So that's my question:

Is there a kind of generic drag and drop gui for custom commands?

My idea is that I'd start up the gui and select a task (e. g. split a
video file). A command line will be loaded (maybe from a config file)
with placeholders for input, output and other parameters.
I will then drag some file on the gui and the filename will be used as a
parameter, in this case as the input file.
Then I will click some run button, which executes the command.
Ideally the output and exit code will be displayed.

Any hints will be appreciated.

Thanks,
Christoph

[toc] | [next] | [standalone]


#226783

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2020-09-08 12:00 +0200
Message-ID<AMIzU-24z-7@gated-at.bofh.it>
In reply to#226768
On 9/7/20 1:43 PM, Christoph K. wrote:

> I'd like to "automate" a couple of tasks that I (until now) do on the
> command line manually. Examples include splitting of video files using
> ffmpeg, run backups with specific parameters, display checksums(md5), etc.

> My idea is that I'd start up the gui and select a task (e. g. split a
> video file). A command line will be loaded (maybe from a config file)
> with placeholders for input, output and other parameters.
> I will then drag some file on the gui and the filename will be used as a
> parameter, in this case as the input file.
> Then I will click some run button, which executes the command.
> Ideally the output and exit code will be displayed.

There are a great many ways to implement graphical user interface 
applications.  Drag-and-drop support implies good integration with the 
window manager or desktop environment.  One option is to use a 
programming language and a GUI library to build a script or executable 
(e.g. Tcl/Tk, C/GTK).  Another option is to use a stack to deliver an 
application with a web browser interface (e.g. 
LAMP/HTML/CSS/JavaScript).  Another option is to use a RAD/IDE 
environment that expedites one or both of the former and/or provides a 
platform-agnostic platform whose apps can be cross-compiled to many 
platforms (e.g. Delphi, Java, .NET, Unity, LiveCode).  And there are 
more options to choose from, especially if you are wiling to consider 
commercial tools (many of which offer free-as-in-beer editions).


You should define some criteria to narrow the choices.  This is a Debian 
mailing list, so I assume you want to build and run apps on Debian using 
tools packaged on Debian (?).  Do you want to develop and/or deploy on 
other platforms?  Will the apps be single-user or multi-user (including 
yourself on multiple devices)?  Will the app include accessibility 
features?  Privacy?  Security?  What license(s) will apply to the app? 
Will you use any external development infrastructure (e.g SourceForge, 
GitHub).  Tell us about your programming knowledge and skills.  How much 
time and money do you want to put into developing the first app?  What 
about apps after that (and how many)?  Are the apps a hobby, or do you 
want to leverage this into a programmer job and/or commercial venture? 
And, whatever else comes to mind.


David

[toc] | [prev] | [next] | [standalone]


#226785

From"Christoph K." <christoph@kobenetz.de>
Date2020-09-08 14:20 +0200
Message-ID<AMKLo-3zF-7@gated-at.bofh.it>
In reply to#226783
Hello David,

Am Tue, 8 Sep 2020 02:57:30 -0700
schrieb David Christensen <dpchrist@holgerdanske.com>:

> There are a great many ways to implement graphical user interface 
> applications.  Drag-and-drop support implies good integration with the 
> window manager or desktop environment.  One option is to use a 
> programming language and a GUI library to build a script or executable 
> (e.g. Tcl/Tk, C/GTK).

That's what I'm thinking about.

I'll probably go with the QT GUI Framework with either C++ or Python as
programming language.


> You should define some criteria to narrow the choices.  This is a Debian 
> mailing list, so I assume you want to build and run apps on Debian using 
> tools packaged on Debian (?).

Yes, mostly. But if there's some nice command line utility that doesn't
ship with Debian (such as stereo tool audio processor), I'll use that as
well. BTW I'm doing a lot of audio / video editing at the moment.


> Do you want to develop and/or deploy on other platforms?

I was primarily aiming at Linux, but you made me realize it would be
useful to have the same applications on other system, e. g. Windows
(which I'm using occasionally). I'll develop on Linux (Debian).


> Will the apps be single-user or multi-user (including 
> yourself on multiple devices)?

Single User. Did you get the idea of what I want to do?
Did you just copy/paste an app development questionaire? ;-)
I'll answer the rest of your questions anyway ...


> Will the app include accessibility  features?  Privacy?  Security?

No.
It'll be just one window that accepts files and folders to drag onto.
The only goal (for now) of this "app" is to execute a single command.


> What license(s) will apply to the app? 

I don't care. Maybe MIT or Public domain.


> Will you use any external development infrastructure (e.g SourceForge, 
> GitHub). 

I'm not planning to do that, but if a lot of people find my command-gui
useful, I might do that. Are you interested? ;-)


> Tell us about your programming knowledge and skills.

I've done similar, more complicated Projects in the past.
Some experience with C/C++, Python, Kivy, wxWidgets, perl, php, etc.


> How much time and money do you want to put into developing the first app?

As little as possible. That's why I asked if there's a similar app
available already. There are many beautiful and useful pieces of software
out in the world. The main reason to ask here on the list is that I
assume people know more about those tools than I do.


> What about apps after that (and how many)?  Are the apps a hobby, or do you 
> want to leverage this into a programmer job and/or commercial venture? 
> And, whatever else comes to mind.

The program is meant to be used by myself – to simplify my life /
workflow. So you could call it a hobby. And I haven't done programming
for a couple of months, which I would like to do now. And I would enjoy to
learn something new (QT in this case).

I've just installed the QT Designer this morning, clicked around for a
couple of minutes and managed to get the window displayed with python
(PyQT / Pyside2). The next step will be to get the drop functionality
working. After that, I will put some predefined command statements in the
list of selectable tasks. Then I'll go for the argument replacement and
with that in place, I have a working tool. Everything else will be "nice
to have". But I'll soon figure out it's annoying to only have predefined
commands, so I will add some configuration file whicht might be editable
from the gui.

That's my plan for now.

Thanks for your support,
Christoph

[toc] | [prev] | [next] | [standalone]


#226814

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2020-09-09 00:40 +0200
Message-ID<AMUrn-17d-1@gated-at.bofh.it>
In reply to#226785
On 2020-09-08 05:16, Christoph K. wrote:

> David Christensen wrote:

> I'll probably go with the QT GUI Framework with either C++ or Python as
> programming language.

Those sound like plausible choices.


>> Will the app include accessibility  features?  Privacy?  Security?
> 
> No.

That response may not be compatible with releasing the software or using 
external development infrastructure.


But if you keep it personal use only, many issues go away.


>> Will you use any external development infrastructure (e.g SourceForge,
>> GitHub).
> 
> I'm not planning to do that, but if a lot of people find my command-gui
> useful, I might do that. Are you interested? ;-)

I have come to a realization:

     Moore's Law -- "The king is dead!".

     Amdahl's Law -- "Long live the new king!".


The future is concurrent distributed programming.


My preferred tool has been Perl for 20+ years.  I have been struggling 
with writing multi-threaded apps, libraries, and frameworks in Perl for 
a several years now.  Distributed execution will be a whole new Odyssey. 
  If and when I give up, Erlang is at the top of my list.


Choose your tools carefully.


David

[toc] | [prev] | [next] | [standalone]


#226784

Frommick crane <mick.crane@gmail.com>
Date2020-09-08 14:10 +0200
Message-ID<AMKBI-3wD-13@gated-at.bofh.it>
In reply to#226768
On 2020-09-07 21:43, Christoph K. wrote:
> Dear all,
> 
> I'd like to "automate" a couple of tasks that I (until now) do on the
> command line manually. Examples include splitting of video files using
> ffmpeg, run backups with specific parameters, display checksums(md5), 
> etc.
> 
> I'm tired of typing the same long commands that I often need to look up
> in my wiki and just replace one or two parameters, usually just the 
> file
> names.

Put the (ffmpeg) command in a script and run it with argument/s ?

mick

-- 
Key ID    4BFEBB31

[toc] | [prev] | [next] | [standalone]


#226787

FromTixy <tixy@yxit.co.uk>
Date2020-09-08 14:50 +0200
Message-ID<AMLep-3Jv-1@gated-at.bofh.it>
In reply to#226784
On Tue, 2020-09-08 at 13:05 +0100, mick crane wrote:
> On 2020-09-07 21:43, Christoph K. wrote:
> > Dear all,
> > 
> > I'd like to "automate" a couple of tasks that I (until now) do on
> > the
> > command line manually. Examples include splitting of video files
> > using
> > ffmpeg, run backups with specific parameters, display
> > checksums(md5), 
> > etc.
> > 
> > I'm tired of typing the same long commands that I often need to
> > look up
> > in my wiki and just replace one or two parameters, usually just
> > the 
> > file
> > names.
> 
> Put the (ffmpeg) command in a script and run it with argument/s ?

And run the script from a 'desktop entry' [1] and your desktop GUI may
let you run it with file arguments just by dropping files onto it. You
can put these 'desktop' files on you desktop or in there own directory
you can open when you have tasks to do.

The above works for me with LXDE. Though you don't get to edit
parameters to you scripts, just pass files to them.

[1] https://wiki.archlinux.org/index.php/desktop_entries

-- 
Tixy

[toc] | [prev] | [next] | [standalone]


#226789

FromTixy <tixy@yxit.co.uk>
Date2020-09-08 15:20 +0200
Message-ID<AMLHr-48w-1@gated-at.bofh.it>
In reply to#226787
On Tue, 2020-09-08 at 13:40 +0100, Tixy wrote:
> And run the script from a 'desktop entry' [1] and your desktop GUI may
> let you run it with file arguments just by dropping files onto it. You
> can put these 'desktop' files on you desktop or in there own directory
> you can open when you have tasks to do.
> 
> The above works for me with LXDE. Though you don't get to edit
> parameters to you scripts, just pass files to them.

Or get the 'desktop' file to run the script in a terminal and use shell
scripting to ask for parameters. E.g. a 'video-resize' script could ask
to width and height with a default to using your most common
requirement.

-- 
Tixy 

[toc] | [prev] | [next] | [standalone]


#226791

From"Christoph K." <christoph@kobenetz.de>
Date2020-09-08 17:20 +0200
Message-ID<AMNzz-5kX-3@gated-at.bofh.it>
In reply to#226787
Am Tue, 08 Sep 2020 13:40:03 +0100
schrieb Tixy <tixy@yxit.co.uk>:

> > Put the (ffmpeg) command in a script and run it with argument/s ?
> 
> And run the script from a 'desktop entry' [1] and your desktop GUI may
> let you run it with file arguments just by dropping files onto it. You
> can put these 'desktop' files on you desktop or in there own directory
> you can open when you have tasks to do.

That ssound like a good idea and close to what I want to achieve, but it
doesn't seem to work in XFCE. When I drop some a file on a desktop file
("starter") that is associated with my testdnd.sh script, the script
doesn't get any input:

----testdnd.sh----
#!/bin/bash

echo 'testdnd.sh'

echo 'First two arguments:'
echo -n '$1: '
echo $1
echo -n '$2: '
echo $2

echo 'Standard Input: '
while read line
do
  echo "$line"
done < "${VAR:-/dev/stdin}"

read
----end----

When I drag a text file on the starter / desktop file, the mouse cursor
displays a '+' Symbol, as if the starter accepts that file. But when I
drop it, I get neither parameters nor standard input (that's what I
expect).

----output----
testdnd.sh
First two arguments:
$1: 
$2: 
Standard Input: 
----end----

In contrast, when I call the script from the command line, it gives me
both, parameters and stdin:

----
$ cat test.txt | ./testdnd.sh a b
testdnd.sh
First two arguments:
$1: a
$2: b
Standard Input: 
This is
a multiline
text file
----


> The above works for me with LXDE. Though you don't get to edit
> parameters to you scripts, just pass files to them.

It doesn't work for me. Am I doing something wrong?

Anyway, this wouldn't be an optimal solution. In some cases I need to
pass multiple arguments in a specific order. For example an audio and
video file that should be combined into a single .mp4 file.

Christoph

[toc] | [prev] | [next] | [standalone]


#226794

FromTixy <tixy@yxit.co.uk>
Date2020-09-08 18:50 +0200
Message-ID<AMOYF-681-3@gated-at.bofh.it>
In reply to#226791
On Tue, 2020-09-08 at 17:15 +0200, Christoph K. wrote:
[...]
> It doesn't work for me. Am I doing something wrong?
> 
> Anyway, this wouldn't be an optimal solution. In some cases I need to
> pass multiple arguments in a specific order. For example an audio and
> video file that should be combined into a single .mp4 file.

It works for me, though I found that multiple files launches multiple
copies of the script, one for each file. To get around that you can use
and explicit %F in the desktop file's Exec command, see [1].

This is what I did to test, including some code to distinguish audio
files from extension. (The 'file' command would probably be best for
testing file type properly, never used this though.)

#------------------------------------------------
~$ cat Desktop/test.desktop 
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=true
Exec=/home/tixy/test.sh %F
Name=Test launcher
Icon=/home/tixy/test.svg

#------------------------------------------------
~$ cat test.sh
#!/bin/bash

if [ -z "$1" ] || [ -z "$2" ]
then
	echo Expected two files
	sleep 2
	exit 1
fi

audiofile=$1
videofile=$2

if [ "${videofile##*.}" = "mp3" ]
then
	# files in wrong order, swap them
	audiofile=$2
	videofile=$1
fi

echo Audio=$audiofile Video=$videofile

sleep 2

#------------------------------------------------
~$ touch audio.mp3
~$ touch video.avi
~$ ./test.sh video.avi audio.mp3
Audio=audio.mp3 Video=video.avi

#------------------------------------------------

If using the GUI file manager I highlight the audio.mp3 and video.avi
files and drag them onto "Test launcher" then I get a terminal window
open up with the same output as I got above using the commandline.

You don't have to rely on the GUIs default terminal. If you set
"Terminal=false" in the .desktop file you can launch your script how
you want, e.g. I've used something...

Exec=lxterminal --geometry=80x30 -e "sh -c /my/script"

To have my preferred terminal at a preferred size,

[1] https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html

-- 
Tixy

[toc] | [prev] | [next] | [standalone]


#226799

FromTixy <tixy@yxit.co.uk>
Date2020-09-08 19:00 +0200
Message-ID<AMP8m-6cx-17@gated-at.bofh.it>
In reply to#226794
On Tue, 2020-09-08 at 17:41 +0100, Tixy wrote:
[...]
> You don't have to rely on the GUIs default terminal. If you set
> "Terminal=false" in the .desktop file you can launch your script how
> you want, e.g. I've used something...
> 
> Exec=lxterminal --geometry=80x30 -e "sh -c /my/script"
> 

I've just realised that may not work for you as the freedesktop spec
[1] says

"Field codes must not be used inside a quoted argument, the result of
field code expansion inside a quoted argument is undefined."

So it may not work for you using %F to specify passing multiple files
to your script like:

Exec=lxterminal --geometry=80x30 -e "sh -c /my/script %F"

[1] https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html

-- 
Tixy

[toc] | [prev] | [next] | [standalone]


#227765

From"Christoph K." <christoph@kobenetz.de>
Date2020-10-13 14:20 +0200
Message-ID<AZrrz-6NM-1@gated-at.bofh.it>
In reply to#226794
Am Tue, 08 Sep 2020 17:41:55 +0100
schrieb Tixy <tixy@yxit.co.uk>:

> #------------------------------------------------
> ~$ cat Desktop/test.desktop 
> [Desktop Entry]
> Encoding=UTF-8
> Version=1.0
> Type=Application
> Terminal=true
> Exec=/home/tixy/test.sh %F
> Name=Test launcher
> Icon=/home/tixy/test.svg
> 
> #------------------------------------------------

Thanks so much Tixy.

To my shame I have to admit that I was missing the %F (or %U) in my
desktop starter file.

Now with '%F' I can drag and drop, the programm accepts the argument,
but only one. When I give two arguments (select two files from the
desktop, drag and drop them on the starter), xfce will spawn two
instances, even though I used capital '%F'.

I've asked a question in the xfce forums about this:
https://forum.xfce.org/viewtopic.php?pid=60260

> This is what I did to test, including some code to distinguish audio
> files from extension. (The 'file' command would probably be best for
> testing file type properly, never used this though.)

Thanks for your audio/video code, but I *really* want a gui that will
handle stuff in a more generic way. Your example inpired me to "auto
sort" the arguments if there are multiple that need to be in exact order.
That would be a super feature for the really lazy "grab all - drop all"
users ;-)

Actually I've got the basic idea implemented already (using Python/QT).
The GUI lets me select the task from a list (by files in a configuration
directory) and load the "command template" from that file. The program
will then substitue the placeholders with my drag and drop arguments.

For now I can combine/split video files and also upload files to a server
using scp and interactivly ask for a password (spawned a terminal running
bash). And of course I have a "hello argument" test ;-)

There are plenty of ideas how to improve the program. The source code is
still quite dirty (it's more a proof of concept at the moment). But I
might decided to release it in case some of my friends find it useful ;-)

Best regards,
Christoph

[toc] | [prev] | [next] | [standalone]


#226804

FromCharles Curley <charlescurley@charlescurley.com>
Date2020-09-08 20:00 +0200
Message-ID<AMQ4q-6S9-7@gated-at.bofh.it>
In reply to#226768
On Mon, 7 Sep 2020 22:43:37 +0200
"Christoph K." <christoph@kobenetz.de> wrote:

> I'd like to "automate" a couple of tasks that I (until now) do on the
> command line manually. Examples include splitting of video files using
> ffmpeg, run backups with specific parameters, display checksums(md5),
> etc.
> 
> I'm tired of typing the same long commands that I often need to look
> up in my wiki and just replace one or two parameters, usually just
> the file names.

Is there any reason it has to be a GUI tool? Much of what you want is
already in BASH.

To retrieve past command lines ready for editing and re-execution,
CTL-R.

To retrieve past command lines and edit them on the fly, FC.

http://charlescurley.com/blog/posts/2019/Aug/02/bash-line-editing/

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web