Light weight screenshot and annotate combo

Forum Forums antiX-development Graphics Light weight screenshot and annotate combo

Tagged: 

  • This topic has 147 replies, 8 voices, and was last updated May 8-11:54 pm by ile.
Viewing 13 posts - 136 through 148 (of 148 total)
  • Author
    Posts
  • #58397
    Moderator
    AvatarBobC

    MTPaint 3.50 is now in the repos. Not sure if it made it to backports or not for 17.4.1. Unfortunately, it’s not quite up to date enough, so I’m using xdotool to do the annotation setup.

    ile, Were there reasons you chose those particular percentages on the pulldown for thumbnail size? I am trying to include the good ideas I found in your code in my latest version.

    I added pulldowns with defaults similar to ile’s idea, but with different values. When I get this running, let me know if you think any values need to be changed, removed or added.

    Since MTPaint can do command line operations now, I used it to do reduction and thumbnails rather than taking separate screenshots as the original design worked. This allowed me to do reduction as well as changed the thumbnail logic that if selected, it will create a thumbnail in addition to the screenshot. The standard program was deleting the thumbnail files, but never creating them, and I’ve corrected that.

    I found that the way the standard code worked, it was killing the wallpaper as a side effect. I changed it to just use MTPaint in “annotate” mode to preview, so now it doesn’t use feh at all.

    I added an Action dialog screen. So now it takes the screenshot, does requested manipulations, then pops up a preview in MTPaint to annotate or tweak if desired, and separately a dialog Action box where you can decide what you want it to do with your screenshot. I did this is instead of depending on the Action ability from within MTPaint because there is no easy way to translate the ones in MTPaint’s configuration, where doing it from the script translation isn’t a big problem.

    This is not well tested, especially the program calls from the action dialog, and is a work in progress especially in that area. Let me know if anyone tries it and finds any bugs or things that could/should/would be better. The .mtpaint file needs to go in your home directory. I’d suggest just running the script from a terminal.

    I need help with one thing. On the second dialog box, I’d like to get the system to tell me what programs are installed that can open the picture based on its extension, then add those programs to a pop up dynamic program list to display, and let you select one of them to open it, as one of the dialog box actions. Can anyone help me with how to do that? Maybe its good enough this way? KISS principle applied allowed me to get it working, just not optimal…

    • This reply was modified 1 week, 3 days ago by BobC.
    • This reply was modified 1 week, 3 days ago by BobC.
    #58403
    Member
    Avatarskidoo

    get the system to tell me what programs are installed that can open the picture based on its extension, then add those programs to a pop up dynamic program list to display, and let you select one of them to open it, as one of the dialog box actions.

    $ apropos magic

    Trusting the validity of a filename extension is dicey.
    Better would be to test the file of interest using the file command.
    (it consults the ‘magic’ database of filetypes//MIMEtype)

    $ man file

    $ file zzzfm24.png
    zzzfm24.png: PNG image data, 24 x 24, 8-bit/color RGBA, non-interlaced

    $ file zzzfm24.png | cut -f 2 -d':' | cut -f 2 -d' '
    PNG
    apropos mime
    ^---v
    man mimeopen
    man xdg-mime
    $ dpkg -l | grep 'image viewer' | cut -f 3 -d' '
    feh
    mirage
    #58423
    Forum Admin
    anticapitalistaanticapitalista

    MTPaint 3.50 is now in the repos. Not sure if it made it to backports or not for 17.4.1. Unfortunately, it’s not quite up to date enough, so I’m using xdotool to do the annotation setup.

    The version is the very latest from mtpaint git repo. (Version 3.50.09). How more up to date can it be?

    Philosophers have interpreted the world in many ways; the point is to change it.

    antiX with runit - leaner and meaner.

    #58435
    Moderator
    AvatarBobC

    Thanks anticapitalista.

    Sorry, it’s likely my fault then, either by running the wrong code or not using the correct syntax for the new environment variables then.

    I’ll have to look at that…

    PS: I found that when I built the mtpaint myself, it installed by default to a different directory, higher up in the path. Once I removed that your newer version ran instead. I think maybe those features were added after my build and I forgot 🙂

    • This reply was modified 1 week, 3 days ago by BobC.
    #58461
    Member
    Avatarskidoo

    The following seems to be effective in harvesting a list of suitable, installed, OpenWith candidates

    $ grep -nr MimeType= /usr/share/applications | grep image/png \
          | cut -f 1 -d':' | sed 's/.*\///' | cut -f1 -d'.' | grep -v display-im6
    
    ^---v
    
    feh
    firefox-esr
    mirage
    mtpaint
    gimp

    Do you have a handle on coding the remainder?
    – read the list into a bash array
    – use the array elements to populate a yad radiobox picklist
    – parse the yad return
    – use a case statement, invoke the itemNN that matches the returned yad value

    #58462
    Moderator
    Brian MasinickBrian Masinick

    @skidoo: Yes, that’s perfect. On my system, the list is slightly different because of what I have installed:

    $ grep -nr MimeType= /usr/share/applications | grep image/png \
    | cut -f 1 -d’:’ | sed ‘s/.*\///’ | cut -f1 -d’.’ | grep -v display-im6

    ^—v

    feh
    firefox-esr
    firefox
    google-chrome
    mirage
    mtpaint
    waterfox-g3

    Brian Masinick

    #58475
    Moderator
    AvatarBobC

    I will have to think on it. I would need to replace only some of the options with the mine ones, and I am using Gtkdialog to do the window rather than yad.

    But yes, I agree that is a better type of solution than hard coding the mime options leaving out ones added by the user.

    #58526
    Moderator
    AvatarBobC

    I was able to find and resolve all known problems with the program. I added a separate option for XDG email vs Claws mail. It now also remembers the options you used previously and brings them up as the defaults.

    I was not able to try skidoo’s mime based options idea, as I seem to have hosed my development system beyond repair. The cut command no longer works, and tries to run hstr, mc subshell no longer works, and it takes 12 seconds to load. Anyway, it looks like time for me to reload my system from scratch. This happens every couple years as I try to learn too many new things.

    Please post feedback if you give it a try…

    #58596
    Moderator
    AvatarBobC

    I tried adding it under 19.4 from flashdrive and there was no problem executing the code, so definitely the issue is with my 19.3 Dev setup.

    Adding the code to use mime to build the radiobuttons dynamically is beyond my ability. I was able to get the desktop filenames, but the displayed application names need to come in from the desktop file so they can be translated to the users language, but the matching desktop filename also needs to be stored, and then the desktop file needs to be launched.

    Anyone else capable want to add the mime list/launchers??? The program seems to be working well on my systems at this point, otherwise. All setup to be translated with a minimum of new/changed strings.

    I can’t tell if anyone else tried it?

    #58603
    Member
    Avatarskidoo

    Across several runs, playing with the options… it did not consistently display the directory chooser even though the checkbox was ticked. I tried choosing png vs jgs, and tried blank filename and various custom filenames. In several cases, upon ultimately choosing Save, click OK, output messages like the following

    mv: cannot stat '/home/demo/scr23185/scr.png.png': No such file or directory
    
    mv: cannot stat '/home/demo/scr1405/.png': No such file or directory
    
    mv: cannot stat '/home/demo/scr2423/screenshots.png': No such file or directory
    
    antixscreenshot.sh: line 121: soffice: command not found

    ^——- libreoffice is not installed. It tried anyhow… and did not display a prompt to advise an error had occurred (user would miss seeing this unless launching the script from terminal prompt).

    Afterward, browsing $HOME for recently created files, I found

    /home/demo/scr13916/scr-thumb.png
    /home/demo/scr13916/scr.png
    /home/demo/scr14654/scr-thumb.png
    /home/demo/scr14654/scr.png
    /home/demo/scr/screenshot.jpg
    /home/demo/Documents/topcorner.png (correct chosen name and path)
    /home/demo/Documents/.png (named had been blanked in the dialog)
    /home/demo/Documents/hello.png (correct chosen name and path)
    /home/demo/scr/screenshot-thumb.jpg

    the displayed application names need to come in from the desktop file so they can be translated to the users language

    env | grep LANG | cut -f2 -d'=' | cut -c 1-2

    …but, are the .desktop files consistently well-populated with localized “Name” strings?
    No, they are not.

    $ grep ^Name  /usr/share/applications/mirage.desktop
    Name=Mirage
    
    $ grep ^Name  /usr/share/applications/mtpaint.desktop
    Name=mtPaint Graphic Editor

    Surprised at the result, I double-checked:
    https://sources.debian.org/src/mirage/0.9.5.2-1/mirage.desktop/
    (no localized namestrings are present in the debian -provided mirage desktop file)

    https://sources.debian.org/src/mtpaint/3.40-3/debian/mtpaint.desktop/
    (no localized namestrings are present in the debian -provided mtpaint desktop file)

    #58619
    Moderator
    AvatarBobC

    Thanks for trying it.

    Even if the mime list couldn’t be used, there must be another way. SpaceFM brought up the image viewer list well, but I didn’t see a way to call it other than by opening the working directory. Maybe that would be ok.

    The directory chooser logic should just be to choose it up front, I think, and then it could be saved as your default.

    I got my dev system working again last night. I had created a .inputrc file with a key to run hstr and it was running unexpectedly.

    Not ready for prime time… I’ll have time to work on this more nights later in the week.

    #58630
    Member
    Avatarskidoo

    For spacefm, the “another way” is using a C routine to query the system’s mime database(s). AFAIK, no similar task-specific command is available for use in a bash script… but the earlier posts alread covered how to handle that (generated a lookup list of image viewer candidates) detail.

    If localized strings are absent from the .desktop files, “ain’t nuttin ya can do ’bout that”. In that case, worldwide users must be collectively seeing “mirage” and “mtpaint” as the labeltext for menu entries anyhow, right?

    >>> it did not consistently display the directory chooser even though the checkbox was ticked

    My point in mentioning that was to underscore the fact that, clearly, some needed error handling is missing. Don’t accept “blank” filename, don’t progress to the file chooser until certain conditions are met. Sniff ‘which libreoffice’ (er ‘soffice’?) et al, and omit from the picklist the unreachable items.

    #58975
    Member
    ileile

    Hello BobC and Everyone
    Which is your font preference for numerals?
    example
    Use of scrot ” -note” to mark on face of screenshot the timestamp
    available from the naming convention in the script.
    font is scaled within -thumb.
    Select with checkbox ” – – note” print or no-print included.

    Can you use it? (Does it work for you?)
    Will the imprint option have use?
    note
    (?)

    antixscreenshotgenNOTE. s,h as zip

Viewing 13 posts - 136 through 148 (of 148 total)
  • You must be logged in to reply to this topic.