Changeset 1801


Ignore:
Timestamp:
Apr 21, 2015 2:01:23 PM (9 years ago)
Author:
toby
Message:

fix selection problem in G2MultiChoiceDialog; range selection broken -- at least on Mac

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIctrls.py

    r1770 r1801  
    11461146        if event.GetKeyCode() == wx.WXK_SHIFT:
    11471147            self.trigger = True
     1148            print 'debug: Shift pressed'
    11481149        if self.timer.IsRunning():
    11491150            self.timer.Stop()
     
    11651166                if iB < 0:
    11661167                    break
    1167         self.trigger = not self.trigger
     1168            self.trigger = False
    11681169       
    11691170    def Filter(self,event):
     
    13651366
    13661367################################################################################
    1367 #### Single choice Dialog with set all, toggle & filter options
     1368#### Single choice Dialog with filter options
    13681369################################################################################
    13691370class G2SingleChoiceDialog(wx.Dialog):
     
    17811782            print 'Error: help lookup failed!',event.GetEventObject()
    17821783            print 'id=',event.GetId()
    1783         #elif helpType == 'OldTutorials': # this will go away
    1784             #ShowHelp(helpType,self.frame)
    17851784        elif helpType == 'Tutorials':
    17861785            dlg = OpenTutorial(self.frame)
     
    23652364        sizer.Add(sizer1,0,wx.EXPAND|wx.ALL,0)
    23662365        sizer.Add((10,10))
    2367         #======================================================================
    2368         # # This is needed only until we get all the tutorials items moved
    2369         # btn = wx.Button(pnl, wx.ID_ANY, "Open older tutorials")
    2370         # btn.Bind(wx.EVT_BUTTON, self.OpenOld)
    2371         # sizer.Add(btn,0,wx.ALIGN_CENTRE|wx.ALL)
    2372         #======================================================================
    23732366        self.BrowseMode = 1
    23742367        choices = [
     
    25952588    frm = wx.Frame(None) # create a frame
    25962589    frm.Show(True)
    2597     dlg = OpenTutorial(frm)
    2598     if dlg.ShowModal() == wx.ID_OK:
    2599         print "OK"
    2600     else:
    2601         print "Cancel"
    2602     dlg.Destroy()
    2603     import sys
    2604     sys.exit()
     2590    #dlg = OpenTutorial(frm)
     2591    #if dlg.ShowModal() == wx.ID_OK:
     2592    #    print "OK"
     2593    #else:
     2594    #    print "Cancel"
     2595    #dlg.Destroy()
     2596    #import sys
     2597    #sys.exit()
    26052598    #======================================================================
    26062599    # test ScrolledMultiEditor
     
    26552648    #print dictlst,"\n",elemlst
    26562649    #print Checkdictlst,"\n",Checkelemlst
    2657     dlg = ScrolledMultiEditor(
    2658         frm,dictlst,elemlst,prelbl,
    2659         checkdictlst=Checkdictlst,checkelemlst=Checkelemlst,
    2660         checklabel="Refine?",
    2661         header="test",CopyButton=True)
    2662     if dlg.ShowModal() == wx.ID_OK:
    2663         print "OK"
    2664     else:
    2665         print "Cancel"
     2650    # dlg = ScrolledMultiEditor(
     2651    #     frm,dictlst,elemlst,prelbl,
     2652    #     checkdictlst=Checkdictlst,checkelemlst=Checkelemlst,
     2653    #     checklabel="Refine?",
     2654    #     header="test",CopyButton=True)
     2655    # if dlg.ShowModal() == wx.ID_OK:
     2656    #     print "OK"
     2657    # else:
     2658    #     print "Cancel"
    26662659    #print 'after',Data3,'\n',Data2
    26672660
     
    26892682    # test G2MultiChoiceDialog
    26902683    #======================================================================
    2691     # choices = []
    2692     # for i in range(21):
    2693     #     choices.append("option_"+str(i))
    2694     # dlg = G2MultiChoiceDialog(frm, 'Sequential refinement',
    2695     #                           'Select dataset to include',
    2696     #                           choices)
    2697     # sel = range(2,11,2)
    2698     # dlg.SetSelections(sel)
    2699     # dlg.SetSelections((1,5))
    2700     # if dlg.ShowModal() == wx.ID_OK:
    2701     #     for sel in dlg.GetSelections():
    2702     #         print sel,choices[sel]
     2684    choices = []
     2685    for i in range(21):
     2686        choices.append("option_"+str(i))
     2687    dlg = G2MultiChoiceDialog(frm, 'Sequential refinement',
     2688                              'Select dataset to include',
     2689                              choices)
     2690    sel = range(2,11,2)
     2691    dlg.SetSelections(sel)
     2692    dlg.SetSelections((1,5))
     2693    if dlg.ShowModal() == wx.ID_OK:
     2694        for sel in dlg.GetSelections():
     2695            print sel,choices[sel]
    27032696   
    27042697    #======================================================================
     
    27152708    #         print sel,choices[sel]
    27162709
    2717     pnl = wx.Panel(frm)
    2718     siz = wx.BoxSizer(wx.VERTICAL)
    2719 
    2720     td = {'Goni':200.,'a':1.,'calc':1./3.,'string':'s'}
    2721     for key in sorted(td):
    2722         txt = ValidatedTxtCtrl(pnl,td,key)
    2723         siz.Add(txt)
    2724     pnl.SetSizer(siz)
    2725     siz.Fit(frm)
    2726     app.MainLoop()
    2727     print td
     2710    # pnl = wx.Panel(frm)
     2711    # siz = wx.BoxSizer(wx.VERTICAL)
     2712
     2713    # td = {'Goni':200.,'a':1.,'calc':1./3.,'string':'s'}
     2714    # for key in sorted(td):
     2715    #     txt = ValidatedTxtCtrl(pnl,td,key)
     2716    #     siz.Add(txt)
     2717    # pnl.SetSizer(siz)
     2718    # siz.Fit(frm)
     2719    # app.MainLoop()
     2720    # print td
Note: See TracChangeset for help on using the changeset viewer.