← Back to team overview

kicad-developers team mailing list archive

[PATCH] [Bug 1558353] Re: Preferred Editor Dialog opens twice

 

Hello,
I'm attaching a patch for bug 1558353
<https://bugs.launchpad.net/bugs/1558353> .

The functions involved in the problem were PGM_BASE::GetEditorName
and EDA_BASE_FRAME::OnSelectPreferredEditor:

   1. OnSelectPreferredEditor showed a dialog to allow the user selecting
   the editor, but before that called GetEditorName to get the name of the
   current editor (to show as a default in the choose file dialog).
   2. The problem was when there was no editor, GetEditorName showed its
   own dialog.
   3. So the user was seeing first the dialog from (2) and then the dialog
   from (1).
   4. As GetEditorName is used in many other places the solution I did was
   to add to it an optional parameter that tells it what to do if no editor is
   set. To avoid modifying other code that relies on the current behaviour,
   this parameter has a default value that causes to show the dialog. But now
   when OnSelectPreferredEditor calls it, it passes the parameter that
   causes it to return an empty string if no editor was set.
   5. Also, I found a second bug while doing it which allowed in the first
   dialog to select an unexistent file (the dialog was missing the
wxFD_FILE_MUST_EXIST
   flag).
   6. Lastly, to avoid having duplicated code (the one that showed the same
   dialog and that configured the wildcard was in two methods) I created a
   single function that now both functions call:
   PGM_BASE::AskUserForPreferredEditor. This way we also will have
   consistency in the behaviour of both dialogs and there is a single place
   where it needs to be modified.

Regards,

--
Daniel Wilches


On Wed, Mar 16, 2016 at 9:35 PM, Chris Pavlina <Pavlina.Chris@xxxxxxxxx>
wrote:

> I can confirm this bug. Thanks for looking to contribute! I've assigned
> you to the bug so nobody else takes it while you work. If you change
> your mind about wanting to fix it, make sure to un-assign yourself.
>
> Make sure you have a look at the contributors' guide, at
> Documentation/HOW_TO_CONTRIBUTE.txt in the source tree. Let me know if
> you have any questions :)
>
> ** Changed in: kicad
>        Status: New => Confirmed
>
> ** Changed in: kicad
>      Assignee: (unassigned) => dwilches (dwilches)
>
> ** Changed in: kicad
>    Importance: Undecided => Low
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> ​​
> https://bugs.launchpad.net/bugs/1558353
>
> Title:
>   Preferred Editor Dialog opens twice
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1558353/+subscriptions
>

Attachment: feature-bugfix-1558353.patch
Description: Binary data


Follow ups