Jarvis icon indicating copy to clipboard operation
Jarvis copied to clipboard

Graphical interface Version1

Open YasmineBOU opened this issue 6 years ago • 14 comments

Hi!

This is the first version of the graphical interface that we have done so far. However, we have worked on the version of February.

We apologize of the time we took to pull a version. That was because we had other projects to work in at the same time.

We have used Pygame for this GUI.

YasmineBOU avatar May 12 '19 19:05 YasmineBOU

Hi!

First to ask a stupid question: How do I run the GUI ;).

Noticed something apparently went wrong with your commit 95b1fda. You did check in lots of stuff ignored by git (e.g. the whole and big env-folder) - which should definitely not be added to git. And which git should actually not add expect you force git to do so.

If you don't know git that well, I'll can only recommend the git book: https://git-scm.com/book/en/v2.

In our case, especially this chapter: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

Maybe if you want to practice bit with git, you could try? But don't worry, if not I could also "clean up" the git commit ;)).

Finally failed checks:

Every programming language has some kind of style guides. For Python that's PEP 8. These style guides say, how you should format the code (e.g. where or where not to put spaces) or how to indent (e.g. Python: Never indent with tabs, always with 4 spaces). Just so that the code looks "nice" and most important consistent.

We follow PEP 8 quite strictly. Doesn't mean you have to read the whole PEP 8 standard. Fortunately there are tools - e.g. flake8. Just run e.g. ./test.sh - that till you all PEP 8 violations - e.g. like that:

jarviscli/windowClass.py:345:25: E265 block comment should start with '# '

Probably also take a look at autopep8 - probably faster than fixing all errors manually ;).

pnhofmann avatar May 13 '19 10:05 pnhofmann

Thank you for replying us.

We have added some files in the folder 'jarviscli' and modified the file 'Jarvis.py' so as it imports the interface and we run it only with the command 'jarvis'.

What do you mean by "clean up the git commit". Does it mean to delete the whole pull request ? Or anything else?

Thank you for your helpful response about the failed checks. We will try to fix that.

YasmineBOU avatar May 13 '19 11:05 YasmineBOU

Tests have passed, excellent ;).

modified the file 'Jarvis.py'

Hmm... Can't find these modifications in your git commits...

What do you mean by "clean up the git commit". Does it mean to delete the whole pull request ? Or anything else?

It's possible to rewrite a pull request without closing and creating a new one. Basically take a look here:

https://github.com/sukeesh/Jarvis/pull/493/files

That's all stuff you changed. As you can see: Your PR changed 9,124 files. Which is a lot more than you indented ;). This folder 'env' - that's basically the installation folder for all packages specified in requirements.txt. Like e.g. pygame. It's created was created when you ran setup.sh.

By default this folder is just ignored when using git. Because it's quite big and it does not make sense to use version control.

But somehow you imported this complete folder to git. Which should actually not happen... But as I said, don't worry - no problem ;). Let's first investigate where the modification of Jarvis.py are.

Are you normally using git on command line or a fancy gui (like git kraken)?

What does git diff origin/master -- jarviscli/Jarvis.py and git status print?

pnhofmann avatar May 13 '19 12:05 pnhofmann

We mean by modifying the file 'Jarvis.py' , replacing the last lines of the method executor() by two lines that allows us to launch Jarvis with a GUI.

This folder 'env' - that's basically the installation folder for all packages specified in requirements.txt. Like e.g. pygame. It's created was created when you ran setup.sh.

Normally we had deleted it before commiting.

Are you normally using git on command line or a fancy gui (like git kraken)?

We are using it on command line.

What does git diff origin/master -- jarviscli/Jarvis.py

We got no difference.

... and git status print?

It prints all the deleted files like shown in the screenshots below. Jarvis Jarvis2

YasmineBOU avatar May 13 '19 12:05 YasmineBOU

We mean by modifying the file 'Jarvis.py' , replacing the last lines of the method executor() by two lines that allows us to launch Jarvis with a GUI.

Hmm?

        """
        This method is opening a terminal session with the user.
        We can say that it is the core function of this whole class
        and it joins all the function above to work together like a
        clockwork. (Terminates when the user send the "exit", "quit"
        or "goodbye command")
        :return: Nothing to return.
        """
        self.speak()
        self.cmdloop(self.first_reaction_text)

You'll probably have to add these 2 lines again - they are really not in your commits.

Normally we had deleted it before commiting.

Were you using "--force" with "git add"? You definitely don't have to delete anything! There is this file .gitignore.more information. env is in .gitignore so won't show up in your commit or in git status - usually. Unless added with git add --force ;).

Ok, we need to remove this env-folder, so I'll rewrite and repush your commits. Note: As a result your local copy of Jarvis and your repo in github will diverge - you won't be able to 'push'. You could probably simply do:

  • Rename your Jarvis copy e.g. Jarvis_old
  • Clone your repo again git clone https://github.com/YasmineBOU/Jarvis.git
  • cd Jarvis, Re-run ./setup.sh
  • Add your two lines to executor()
  • Call git add .
  • Call git commit
  • Call git push

Note that 'git status' now prints nothing to commit, working tree clean.

pnhofmann avatar May 13 '19 14:05 pnhofmann

We're sorry we added the wrong file 'Jarvis.py'. We will commit it soon !

kenzaal avatar May 13 '19 14:05 kenzaal

Looks great!

Just wondering - why do I need to start with: SDL_VIDEODRIVER=x11 ./jarvis? Otherwise I get:

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/phil/git/Jarvis/jarviscli/__main__.py", line 11, in <module>
    main()
  File "/home/phil/git/Jarvis/jarviscli/__main__.py", line 7, in main
    jarvis.executor()
  File "/home/phil/git/Jarvis/jarviscli/Jarvis.py", line 182, in executor
    Jarvis_window = JarvisWindow(self)
  File "/home/phil/git/Jarvis/jarviscli/windowClass.py", line 59, in __init__
    screen_resolution = pygame.display.Info()
pygame.error: video system not initialized

That is definitely a issue with pygame (and not your code) - just wondering if you know more by chance?

Yeah, works good and code looks ok to me. I'll just add way to run Jarvis as CLI + note to README.md (or you do if you want). But afterwards we can merge.

Nice work!

pnhofmann avatar May 13 '19 17:05 pnhofmann

Thanks a lot, we're so glad that you like our work. For the Pygame error it's probably in our code that we forgot to add pygame.quit we're gonna fix that.

kenzaal avatar May 13 '19 18:05 kenzaal

We just wanted to get you noticed that this is not the final version of the GUI because there are some commands which need to communicate with the user like the command gmail that for now not working.

For sure, we will continue to work on it. However, to do that, we need to modify the files corresponding.

YasmineBOU avatar May 13 '19 18:05 YasmineBOU

Thank you for liking our work, we're so glad to work with you .

alyciaa avatar May 13 '19 21:05 alyciaa

there are some commands which need to communicate with the user like the command gmail that for now not working.

Of course - Yes.

I just remembered - we once had an issue with color + input on windows. Therefore I created a central function input(self, prompt, color="") which should be used for all user input. That was 8c2d9b58. Currently this patch is only in branch 'windows-port'.

So I'll merge this commit (sometime today) into master and rewrite other occurrences of 'input' - that should make your work bit easier because you would only have to modify this Method CmdInterpreter.py:JarvisAPI:input(self, prompt, color='').

pnhofmann avatar May 14 '19 08:05 pnhofmann

Thank you! that will really make our work easier.

YasmineBOU avatar May 14 '19 08:05 YasmineBOU

Ok, merged the input-patch as #495. You'll need to git fetch and git merge origin/master.

pnhofmann avatar May 14 '19 15:05 pnhofmann

Hello! Sorry for the time we took to answer you. We're gonna work on it as soon as we can.

kenzaal avatar May 16 '19 10:05 kenzaal