Global search GUI for antiX

Forum Forums General Software Global search GUI for antiX

  • This topic has 175 replies, 12 voices, and was last updated Jan 13-9:33 pm by Brian Masinick.
Viewing 15 posts - 136 through 150 (of 176 total)
  • Author
    Posts
  • #124397
    Member
    PPC

      @sybok – it’s always a pleasure to get some of your much valid tips!

      1-On your first tip – I don’t have that much time right now, but I did a simple test and I don’t really know how to implement find …. 2>/dev/null and still output the result of the command to a file… Any pointers on that?
      Note: although if I run a search without redirecting the output to a file I see permition errors, I did not notice any problem when reading the text file when I redirect the output of the command to it (i.e. output with errors is not echoed to the file).

      3- I never thought about simultaneous users! Really nice detail!
      I particuarly like the use of a random code on the output file. this allows recent search results to be saved too, and remain in the tmp folder, instead of just the last one.
      I’ll try to implement that

      2, 4 and 5 – Thanks for the suggestions, but I make no promisses, I tried to improve, but I remain a messy coder. It’s the way my mind works…

      P.

      #124411
      Member
      Wallon

        Hi, @PPC, did not read the whole thread and I have some rather general comments to the RC2 (but most of them may apply to any other scripts any of the developers kindly provide us with):

        5) You and other developers are kindly encouraged to use a linter such as ‘shellcheck’.
        I found that it does often provide useful hints even though its suggestions to (safer) double quote may sometimes breaking the code (when iterating over the to-be-quoted or passing as multiple arguments where splitting into words is desirable).

        Dear Sybok,

        Thank you for your valuable advice.

        Regarding the use of double quotes, this is almost compulsory when translating a language like French.
        I tried again in a terminal to pass the apostrophe, which is used a lot in French, in a variable.
        Example;
        – in English (The administration)
        – in French (L’administration)
        I invite you to type the following command in a terminal;
        variable1='L'administration'
        Enter.
        The terminal will freeze!

        Developers need to take other languages into account too!

        As a translator, I force myself to replace this right apostrophe so as not to break programmes.
        But there’s a problem. Users of an azerty keyboard will always use the right apostrophe when they type on their keyboard to make an entry! It’s impossible to avoid!
        In the Finder program, the French user could save his searches by typing as the file name; « L’administration.txt »

        Kind regards,
        Wallon

        #124412
        Member
        PPC

          The terminal will freeze!

          Not here. The terminal will simply remain waiting for you to close the quotes it considers you opened…
          When using single quotes, like you did:
          variable1='L'administration'

          The terminal interprets each first single quote as the one that opens what’s being quoted, and the second single quote as the one that closes the quotation.
          The terminal reads what you entered as:
          variable1=’L’ and then it “thinks” you enter a command called “administration” and open a quote, without closing it.
          When you run that command, as you typed it, I think the terminal tries to set variable1 as being “L”, and run a command called “administration”, sees you opened the quotes and waits for you to enter something else (even if it’s just a closing quote)

          What works:
          variable1=’L`administration’
          echo $variable1

          Edit: the forum software mangles the code. Please place the value of the variable inside the single quotes you used in your example.

          P.

          • This reply was modified 3 months, 1 week ago by PPC.
          • This reply was modified 3 months, 1 week ago by PPC.
          • This reply was modified 3 months, 1 week ago by PPC.
          #124422
          Member
          PPC

            @Sybok- this script took a lot out of me… I tried, but I was unable to adapt it to fully use randomly generated temporary file names.
            I implemented that in file search, in web search and in gpt search. I only partly implemented it on the app search. For some reason, the scripts refuses to launch automatically, when only one app that matches the query exists (I even used yad to output it’s value to a window- it looks perfectly fine, but the “eval” command fails, and I can’t figure out why.
            If you can, please take a look at the code and try to implement that (and any one of your previous suggestions), I pretty much want for this script to be as perfect as it can be, since it will be replacing searchmonkey, that’s a pretty good at what is does- I know that there’s little chance that in an antiX multiuser system, more than one user is trying to use Finder… even so, I would like the script to by as much fail proof as possible…
            EDIT: any idea on how to stop the temporary files from piling up too much on the /tmp folder?
            Also, one of the solutions I though was simple: just save the files, hidden, on the user’s home folder… But I don’t like polluting the home folder… The other option would be to delete them at the startup/end of the script

            P.

            • This reply was modified 3 months, 1 week ago by PPC.
            Attachments:
            #124427
            Member
            Wallon

              Cher PPC,

              I know what you’ve explained, but I didn’t want to expand on it.
              You shouldn’t invent words that don’t exist in French by adding a kind of grave accent! There is no direct key with the grave accent on an azerty keyboard.
              The apostrophe is used in many languages.

              Here are a few examples,
              English
              German
              Greek,
              French,
              Italian,
              Esperanto
              Catalan,
              Dutch,
              Danish,
              Turkish,
              Ukrainian,
              ….
              If Finder is going to search for text, it needs to be able to handle the apostrophe in other languages!
              Users like @rantanplan or @ChPol or @madibi or me always use the English typewriter apostrophe « ‘ » on our keyboard to enter text in an application.

              Kind regards,
              Wallon

              • This reply was modified 3 months, 1 week ago by Wallon.
              • This reply was modified 3 months, 1 week ago by Wallon.
              • This reply was modified 3 months, 1 week ago by Wallon.
              #124447
              Member
              sybok

                @PPC:
                I carried on (a bit) with your effort, attached.
                Some notable changes:
                – most of the temporary files are now in variables
                – repeated piece of code closing previous windows moved into a separate function

                The script seems to work.
                When I search a file and provide a path, it does not find such a file.
                Question: Does it mean that no path is to be provided, only the “bare” filename?

                Regarding my previous items:
                @1) One can redirect STDOUT (typically 1) and STDERR (typically 2) independently, e.g.
                command 1>/file/where/to/store/stdout 2>/dev/null
                On the other hand, running finder from terminal, the STDERR can be used for debugging.

                @3) The way that worked for me the best was:
                A) define a variable near top of the script, e.g.
                resultados=”/tmp/resultado_${fix_unique}.txt”
                B) global substitutions elsewhere, e.g.
                ‘/tmp/resultado.txt’ -> “${resultados}”
                and fix doubled double quotes in some parts of the code.

                Also, I added a comment when closing function, e.g.

                funny_fun_function(){
                }

                is newly

                funny_fun_function(){
                } # funny_fun_function

                to make it more clear which function does end there.

                #124459
                Member
                PPC

                  @Sybok . many thanks!
                  I’m trying the new version of the script out. For now it seems to run perfectly!

                  P.

                  #124464
                  Member
                  Wallon

                    Thanks sybok,

                    OK, it works fine if you run the Finder file directly (not in a terminal).
                    I did 3 aggressive tests with French;

                    1) Search with GPT with bad apostrophe used in many languages;

                    C'est quoi Linux antiX distribution?

                    Test OK

                    2) Save file name with bad apostrophe and spaces

                    C'est quoi Linux antix distribution.txt

                    Test OK

                    3) Search file name with bad apostrophe use in many languages;

                    C'est quoi Linux

                    Test OK

                    Would you please confirm that this is the definitive script? After your confirmation, I’ll check the *.pot file.

                    Kind regards,
                    Wallon

                    #124483
                    Member
                    PPC

                      Dear all:

                      I had to retouch Sybok’s version of the script:
                      – tgpt was not installing
                      – due to the erratic behavior of the script right after installing tgpt or ddgr (if the user does not quit after installing the dependency and does a second search, the script tries to reinstall the dependency), I decided to change the warning that is shown before the script asks to install the dependencies, and the script tries to completely restart. If it fails, it simply exits and users have no run Finder again, users have a tiny bit of “extra work”, but the script always works as it should.
                      – I changed the way the “please wait” window is closed during file search, because it failed to close on my very slow netbook. The sleep 0.8 commands seems to be the ideal wait time for that command to work correctly…

                      Please do test. If the changes I performed work for everyone, then this is the final version of the script!!!

                      Once again, thanks, Sybok!

                      EDIT: Dear Moderators- the fact that the forum does not let us directly upload scripts is a bit of a chore… But not it also did not let me upload a .tar file? When the forum stops us from uploading anything, we’ll have to use git, or a file sharing service, to share our work here…

                      P.

                      • This reply was modified 3 months ago by PPC.
                      • This reply was modified 3 months ago by PPC.
                      • This reply was modified 3 months ago by PPC.
                      Attachments:
                      #124500
                      Member
                      sybok

                        @PPC: Regarding the failed upload of ‘tar’.
                        Reminds me of an e-mail that got to a block-list due to spams being sent from the domain.
                        Now, google behaves erratically; the IT support suspects|expects that there is an machine learning (a.k.a. AI) involved because sometimes the e-mail to google gets through, sometimes it does not.

                        BTW, I recall that ‘pastebin’ was used in the past to share some code.
                        Git is not a bad idea if we would be willing to do the work related to over-head (pull requests and merging) which may not be very economical in case of smaller scripts.

                        #124501
                        Member
                        PPC

                          Question: Does it mean that no path is to be provided, only the “bare” filename?

                          Hi, I forgot to address that question – since you looked at the code, by now, you probably noticed that Finder uses the find command to perform file searches. The find command requires users to tell it where to look for a file/folder with a name containing a certain pattern, and what that pattern is. I haven’t explored find into greater detail, other than what It required for this script, but I think that you can’t tell it directly, using a GUI such as Finder, to search for a file, using the path for that file (well, I can see indirect ways to do that- parsing user input, removing the path, trying to find the folder with the path the user entered and then finding for a file with a name that matches the pattern the user is looking for, but that would be very complex and probably quite slow- I prefer to keep it simple – the user is looking for a file, then all that is required is entering part of that file’s name (and not path, just, like you said the “bare filename”) and press enter…

                          P.

                          #124505
                          Member
                          PPC

                            Dear all:

                            I timed Finder’s file search and compared it to Searchmonkey – the initial search takes sometimes much longer than Searchmonkey (even 5 times more, but even so, still it takes just some seconds). Usually, Finder does take about the same time, since user enters the search term and gets the final results (Searchmonkey does start displaying results as they are found, Finder only does so when the search is complete).
                            In all, I think that, for average users trying to find a document on their home folder or on a pen-drive, Finder does provide a simpler GUI, that does not scare users away, about the same results (if users are looking for a document- since Finder does not look system wide), and, on average, it takes about the same time as Searchmonkey does (and even when it takes longer, if just by a margin of some seconds).
                            Finder has the bonus of being easily localized to any language (and Searchmonkey is not offered on that many languages). It also does much more than just looking for files by their names (but, unlike Searchmonkey, it does not look for text inside documents, in case you require that feature).
                            For normal daily use, I do think average user’s lives with be simpler, and more productive using Finder. If you really require system wide file search, you can select where to search, when using the search functionality included in our File Manager, ZZZFM. It even also allows searching inside text files… So users won’t lose much functionality when Finder replaces Searchmonkey.

                            That said, I hope the latest version is bug free, works for everyone and has no typos. I’m tired of “polishing” it’s details 🙁 and also eager to see it shipped with antiX 🙂

                            #124591
                            Member
                            Wallon

                              Dear PPC,

                              I’ve tested your latest version “RC3”. Everything works for me.
                              Here is a new *.pot file with comments to help translators.
                              This *.pot file is to be put on Gitlab with your new Finder script.

                              Kind regards,
                              Wallon

                              Attachments:
                              #124609
                              Member
                              PPC

                                Thanks, Wallon. I’ll wait a bit more (one day or so) and then try to send the script and your pot file to anticapitalista.
                                If anyone is interest, now is the time to test this script! After all the work that went into it, it *should* work perfectly (famous last words) 🙂
                                By the way, I used Finder to search who “you” are- Henri Wallon (1879-1962). Any particular reason you choose that nickname?

                                P.

                                #124616
                                Member
                                marcelocripe

                                  Hello PPC.

                                  I tested the “finderRC3.zip” version and found no errors or crashes. The only thing people will need to get used to is that GPT will not always provide an answer. I got good answers on “what is antiX Linux?”.
                                  Can I give some suggestions?
                                  In the title bar where “Finder” is written in the results windows, text could be written, such as “Double-click to open the file or folder”, “Double-click to start the program”, “Click twice to start the program or click the ‘Run’ button”, etc. This way, no one can complain that they don’t know what they should do when the “Finder” window appears.

                                  Thank you very much.

                                  – – – – –

                                  Olá, PPC.

                                  Eu testei a versão “finderRC3.zip” e não encontrei erros ou falhas. A única coisa que as pessoas precisarão se acostumar é que nem sempre o GPT trará um resposta. Eu obtive boas respostas sobre “o que é o antiX Linux?”.
                                  Eu posso dar algumas sugestões?
                                  Na barra de título onde está escrito “Finder” nas janelas dos resulados, poderia estar escrito um texto, como por exemplo, “Clique duas vezes para abrir o arquivo ou a pasta”, “Clique duas vezes para iniciar o programa”, “Clique duas vezes para iniciar o programa ou clique no botão ‘Run'”, etc. Desta forma, ninguém poderá reclamar que não sabe o que deve fazer quando a janela “Finder” for exibida.

                                  Muito obrigado.

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