Preferred Editor Dialog opens twice

Bug #1558353 reported by dwilches
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Low
dwilches

Bug Description

When you don't have a Text Editor configured, selecting the option "Preferences -> Set Text Editor" shows two different dialogs asking for the executable of the new Text Editor if in the first one you select "Cancel".

Steps to reproduce the problem:

1. Go To "Preferences -> Set Text Editor".
2. The message "No default editor found, you must choose it" appears. Press OK.
3. A dialog titled "Preferred Editor:" appears. Press Cancel.
4. A new dialog titled "Select Preferred Editor" appears. (This is the bug, it should ask again for the editor).
5. Press "Cancel" again. The dialog closes.

I'm reporting this bug here to know if someone else is working on it, but actually, I want to correct it myself. I want to start contributing to the project and I'd like to solve this bug to get used to the process.

So please tell me if anyone else is looking into this issue. I've attached a video showing the error.

Thanks.

----------------- Extra Info -----------------

The version of kicad that has the problem is below, but in case it is necessary, note that I'm in Windows 10 Pro, whereas below it says Windows 8.

Application: kicad
Version: (2016-03-15 BZR 6622)-product, release build
Libraries: wxWidgets 3.0.2
           libcurl/7.47.1 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 libssh2/1.7.0 librtmp/2.3
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.57.0
Curl: 7.47.1
KiCad - Compiler: GCC 5.3.0 with C++ ABI 1009
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=ON
                  KICAD_SCRIPTING_WXPYTHON=ON
                  USE_FP_LIB_TABLE=HARD_CODED_ON
                  BUILD_GITHUB_PLUGIN=ON

Tags: kicad

Related branches

Revision history for this message
dwilches (dwilches) wrote :
Revision history for this message
Chris Pavlina (pavlina-chris) 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
assignee: nobody → dwilches (dwilches)
importance: Undecided → Low
Revision history for this message
dwilches (dwilches) wrote : Re: [Bug 1558353] Re: Preferred Editor Dialog opens twice

Hello Chris,

I've just submitted a patch for the bug.
I think I'm not on the developers list, so will I receive followups for
that email I just sent to that list?

Thanks.

--
Daniel Wilches

On Wed, Mar 16, 2016 at 9:35 PM, Chris Pavlina <email address hidden>
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
>

Revision history for this message
Chris Pavlina (pavlina-chris) wrote :

Hm, I probably should have clarified something in the contributors' guide - the guide says to submit to the mailing list, but you can also attach patches directly to bug reports.

I don't think you can even _send_ to the list if you're not on it, let alone receive replies - indeed, I don't see your mail. For now, you can just attach the patch to this bug report (see the "Add attachment or patch" link below). If you plan on continuing to work on KiCad development, you can register for the list here: https://launchpad.net/~kicad-developers

Revision history for this message
dwilches (dwilches) wrote :

Hello,
I'm attaching a patch for this bug.

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,

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Anyone can submit a message to the kicad developers mailing list but it
will get held until someone (me) approves it which in this case I just
did. I prefer that devs join the mailing list because moderating
messages is extra work that I really don't need.

On 3/17/2016 4:00 PM, Chris Pavlina wrote:
> Hm, I probably should have clarified something in the contributors'
> guide - the guide says to submit to the mailing list, but you can also
> attach patches directly to bug reports.
>
> I don't think you can even _send_ to the list if you're not on it, let
> alone receive replies - indeed, I don't see your mail. For now, you can
> just attach the patch to this bug report (see the "Add attachment or
> patch" link below). If you plan on continuing to work on KiCad
> development, you can register for the list here: https://launchpad.net
> /~kicad-developers
>

Revision history for this message
Chris Pavlina (pavlina-chris) wrote :

Your patch looks good, thank you very much for your time. I'm in the process of building and testing this on Windows and will commit it when finished.

Changed in kicad:
status: Confirmed → In Progress
Changed in kicad:
status: In Progress → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.