Author Topic: About add hover information and login using extension  (Read 118 times)

June 13, 2019, 12:58:53 AM
Read 118 times

HaroldTang

  • Sr. Newbie

  • Offline
  • **

  • 3
Hi all, I am a novice developer in Inkscape Extension developing. I am using Windows 10, python 2.7, MySQL and pymysql package to develop a python script to draw circuit diagram.

With the help of the InkscapeMadeEasy extension, I am able to draw svg circuit components and they are so cool! Thanks a lot!

Here is the question, I want to display a text component with extra information hovering above the component. When user move the mouse over the text component, an information window will pop out in the Inkscape.
I notice that there are multiple ways to display it in the web browser(using JS or CSS, etc), but can I display it directly in the Inkscape? I want to display the corresponding values to help user to draw on this diagram with the retrieved information so it has to be in the software rather than in a web browser. Is it possible and can someone give me some ideas? I really appreciate it.

Another question. Can I do the user login function in extension to visit specific information in MySQL database? That is to say, can I keep user login information(like username and password) in one extension and another window pop out for further selection? Thanks a lot!!!
  • 0.92
  • Windows 10

June 13, 2019, 08:29:15 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,782
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

I can't be much help with this.  Writing extensions is beyond my ability.  But we have other members who can probably help.

I was just thinking whether I've seen any current extensions which do what you're describing, but I can't think of any.  There might be some, I just haven't seen it.

The closest thing I've seen is Extensions menu > Visualize Path > Measure Path.  This extension puts a text object on the page, showing the measurement that was requested.  I know it's not hover text, like you described.  It's just the closest thing I've seen.

Typically in Inkscape the status bar is used to give info to the user.  Maybe that would be an option?  In extensions, I've occassionally seen a little window which typically contains Traceback info, but sometimes has an error message.  There might be some way to use that?

Hopefully someone else will be along shortly, who can give you more concrete info.  If not, I would suggest trying the development chat channel https://chat.inkscape.org/channel/team_devel  Or the development mailing list:  https://lists.inkscape.org/postorius/lists/?all-lists
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

June 14, 2019, 12:48:06 AM
Reply #2

HaroldTang

  • Sr. Newbie

  • Offline
  • **

  • 3
Hi brynn,thank you for your suggestion!

I found that the text generated by Measure Path extension is not what I want cause it generates another text component, but I would use it as an alternative if I can't figure this out eventually.

Besides, this Measure Path extension menu has a tab for user to choose different input options, it solves a huge problem for me! I was wondering how to create different input options for different user demands, and it solves this problem perfectly! Many thanks!!

For the little error window suggestion, I saw a function called "inkex.errormsg()" in the source code. However, if this errormsg window is raised, the whole software is not accessible until I close this window, and I can't return to this page again. So it is not desirable for this situation.

Again, thanks a lot for your help! :th: I would keep waiting for others' opinions!
  • 0.92
  • Windows 10

June 14, 2019, 04:42:09 AM
Reply #3

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,488
    • VektorRascheln
but can I display it directly in the Inkscape?

- No, not like a bubble. You can add an inkscape:label, that will then be visible in the 'Objects' dialog.

Can I do the user login function in extension to visit specific information in MySQL database? That is to say, can I keep user login information(like username and password) in one extension and another window pop out for further selection?

- Yes, I think that would be possible. Some people use multiple extensions for this purpose (see gcodetools). Extensions can only access their own preference settings, though, so you may need to save the login data to a file. Or you can write an interactive extension in, say, Tkinter or any other GUI framework of your choice.

June 14, 2019, 05:32:57 PM
Reply #4

HaroldTang

  • Sr. Newbie

  • Offline
  • **

  • 3
Hi Moini,

Thank you for your explanation!

For the text bubble, I decide to communicate with my client and show the objects dialog to them instead of the hover effect and explain this to them.

For the login function, I would start learning the Tkinter GUI now, and thank you so much for the suggestion!

 :ur:
  • 0.92
  • Windows 10