cmpilato / thotkeeper

ThotKeeper — cross-platform personal daily journaling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Font changed even when Options menu cancelled

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1. File, Options
2. Choose a font
3. Click OK
4. Click Cancel

What is the expected output? What do you see instead?
Expected: changes to options discarded and font left at original value.
Actual: font is changed to new value

Please use labels and text to provide additional information.


Original issue reported on code.google.com by smith.d...@gmail.com on 3 May 2008 at 6:29

I took a crack at this tonight, and ultimately failed after about an hour. :-(  
The
Options dialog presents the need for this middle-ground data state situation 
(the
results of font-choices not yet realized) that isn't currently reflected by any 
data
structure in the code.

One workaround approach:  The whole options handling bit could be vastly 
simplified
at this stage by losing the Options menu dialog in favor of a "Set ThotKeeper 
Font"
menu that just uses the little font-chooser dialog.  After all, we only have 
the one
option.

Original comment by cmpilato on 7 May 2008 at 6:52

Will this not work?

    def _FileOptionsMenu(self, event):
        oldfont = self.frame.FindWindowById(self.text_id).GetFont()
        def _ChooseFontButton(event2):
            text = self.frame.FindWindowById(self.text_id)
            font_data = wxFontData()
            font_data.SetInitialFont(text.GetFont())
            dialog = wxFontDialog(self.options_dialog, font_data)
            if dialog.ShowModal() == wxID_OK:
                font = dialog.GetFontData().GetChosenFont()
                self._SetFont(font)
            dialog.Destroy()
        EVT_BUTTON(self, self.choose_font_id, _ChooseFontButton)
        if (self.options_dialog.ShowModal() == wxID_CANCEL):
            self._SetFont(oldfont)

Original comment by smith.d...@gmail.com on 7 May 2008 at 4:37

2008:05:07 09:45:03 | cmpilato shakes his head, packs his bags, and moves to the
                    | alley next to the drugstore.
2008:05:07 09:45:04 | * cmpilato has left #thotkeeper.

Original comment by cmpilato on 7 May 2008 at 4:45

I guess I shouldn't be trying to code late in the evening on the West Coast 
when my
brain is still on East Coast time.  Yeah, that works fine.  Great, even.  I was
trying to avoid having the font of the journal text widget change until after 
the
Options dialog was successfully closed, but I remember now that I actually 
*wanted*
that font to change as the user selected different fonts because it provides a 
nice
preview of how the font will look.  Doh!  Stupidly, I was failing to keep it 
simple.

Commit away, Davo!

Original comment by cmpilato on 7 May 2008 at 4:48

Davo committed his tweaks in r70.  FIXED.

Original comment by cmpilato on 7 May 2008 at 8:50

  • Changed state: Fixed
  • Added labels: Milestone-Version0.2.0

Original comment by cmpilato on 20 May 2008 at 5:05

  • Added labels: Milestone-0.2.0