Menu

Bug Report: A Tnotebook within a TNotebook causes the Python Generator to Crash

Anonymous
2018-03-16
2018-03-25
  • Anonymous

    Anonymous - 2018-03-16

    First, I really appreciate the hardwork Don spent in creating Page, I could not have done better.

    Anyways, I am here to report a bug found when embedding a TNotebook within a TNotebook

    This can be reproduced as follows:

    1) Create a TNotebook (parentNotebook), add a couple of pages beyond the default number of 2
    2) Insert another TNotebook in page 1 (subNotebook1), and in this TNotebook, add a couple of pages
    3) Add a canvas in page 1, and page 2 of subNotebook1
    4) Insert a second TNotebook in page 2 of parentNotebook (call it subNotebook2), add a couple of pages to subNotebook2
    5) Add a canvas in page 1, and page 2 of subNotebook2
    6) Save
    7) Close PAGE and restart PAGE
    8) Attempt to generate python code. The following error is observed "cant read parent_geometry : no such variable

    Here is the stack trace

    can't read "parent_geometry": no such variable
        while executing
    "split $parent_geometry "x+""
        (procedure "vTcl:python_source_widget" line 72)
        invoked from within
    "vTcl:python_source_widget $i ""  $subwidget"
        (procedure "vTcl:python_source_subwidgets" line 19)
        invoked from within
    "vTcl:python_source_subwidgets $p $p"
        (procedure "vTcl:python_source_widget" line 504)
        invoked from within
    "vTcl:python_source_widget $i ""  $subwidget"
        (procedure "vTcl:python_source_subwidgets" line 19)
        invoked from within
    "vTcl:python_source_subwidgets $p $p"
        (procedure "vTcl:python_source_widget" line 504)
        invoked from within
    "vTcl:python_source_widget $widget $prefix $window"
        (procedure "vTcl:py_source_frame" line 18)
        invoked from within
    "vTcl:py_source_frame $window   ""  "" "
        (procedure "vTcl:generate_python" line 88)
        invoked from within
    "vTcl:generate_python $window"
        (procedure "vTcl:generate_python_UI" line 107)
        invoked from within
    "vTcl:generate_python_UI"
        (menu invoke)
    
     
  • Anonymous

    Anonymous - 2018-03-16

    For a quick reference, below is the .tcl file for the problem listed above (generated with 4.11 version of PAGE)

    #############################################################################
    # Generated by PAGE version 4.11
    # in conjunction with Tcl version 8.6
    set vTcl(timestamp) ""
    
    if {!$vTcl(borrow)} {
    
    set vTcl(actual_gui_bg) #f8f8f8
    set vTcl(actual_gui_fg) #000000
    set vTcl(actual_gui_menu_bg) #f8f8f8
    set vTcl(actual_gui_menu_fg) #000000
    set vTcl(complement_color) #f7f7f7
    set vTcl(analog_color_p) #f7f7f7
    set vTcl(analog_color_m) #f7f7f7
    set vTcl(active_fg) #000000
    set vTcl(actual_gui_menu_active_bg)  #f7f7f7
    set vTcl(active_menu_fg) #000000
    }
    
    #################################
    #LIBRARY PROCEDURES
    #
    
    if {[info exists vTcl(sourcing)]} {
    
    proc vTcl:project:info {} {
        set base .top37
        global vTcl
        set base $vTcl(btop)
        if {$base == ""} {
            set base .top37
        }
        namespace eval ::widgets::$base {
            set dflt,origin 0
            set runvisible 1
        }
        set site_4_0 .top37.tNo38.t0 
        set site_4_0 $site_4_0
        set site_6_0 .top37.tNo38.t0.tNo39.t0 
        set site_6_0 $site_6_0
        set site_6_1 .top37.tNo38.t0.tNo39.t1 
        set site_6_2 .top37.tNo38.t0.tNo39.t2 
        set site_6_0 $site_6_2
        set site_4_1 .top37.tNo38.t1 
        set site_4_0 $site_4_1
        set site_6_0 .top37.tNo38.t1.tNo40.t0 
        set site_6_0 $site_6_0
        set site_6_1 .top37.tNo38.t1.tNo40.t1 
        set site_6_0 $site_6_1
        set site_6_2 .top37.tNo38.t1.tNo40.t2 
        set site_4_2 .top37.tNo38.t2 
        set site_4_3 .top37.tNo38.t3 
        set site_4_4 .top37.tNo38.t4 
        namespace eval ::widgets_bindings {
            set tagslist _TopLevel
        }
        namespace eval ::vTcl::modules::main {
            set procs {
            }
            set compounds {
            }
            set projectType single
        }
    }
    }
    
    #################################
    # GENERATED GUI PROCEDURES
    #
    
    proc vTclWindow.top37 {base} {
        if {$base == ""} {
            set base .top37
        }
        if {[winfo exists $base]} {
            wm deiconify $base; return
        }
        set top $base
        ###################
        # CREATING WIDGETS
        ###################
        vTcl::widgets::core::toplevel::createCmd $top -class Toplevel \
            -background {#f8f8f8} 
        wm focusmodel $top passive
        wm geometry $top 870x689+650+150
        update
        # set in toplevel.wgt.
        global vTcl
        global img_list
        set vTcl(save,dflt,origin) 0
        wm maxsize $top 1916 1054
        wm minsize $top 116 1
        wm overrideredirect $top 0
        wm resizable $top 1 1
        wm deiconify $top
        wm title $top "New Toplevel"
        vTcl:DefineAlias "$top" "Toplevel1" vTcl:Toplevel:WidgetProc "" 1
        ttk::style configure TNotebook -background #f8f8f8
        ttk::style configure TNotebook.Tab -background #f8f8f8
        ttk::style configure TNotebook.Tab -foreground #000000
        ttk::style configure TNotebook.Tab -font TkDefaultFont
        ttk::style map TNotebook.Tab -background [list disabled #f8f8f8 selected #f7f7f7]
        ttk::notebook $top.tNo38 \
            -width 594 -height 376 -takefocus {} 
        vTcl:DefineAlias "$top.tNo38" "TNotebook1" vTcl:WidgetProc "Toplevel1" 1
        frame $top.tNo38.t0 \
            -background {#f8f8f8} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$top.tNo38.t0" "TNotebook1_t0" vTcl:WidgetProc "Toplevel1" 1
        $top.tNo38 add $top.tNo38.t0 \
            -padding 0 -sticky nsew -state normal -text {Page 1} -image {} \
            -compound left -underline -1 
        set site_4_0  $top.tNo38.t0
        ttk::style configure TNotebook -background #f8f8f8
        ttk::style configure TNotebook.Tab -background #f8f8f8
        ttk::style configure TNotebook.Tab -foreground #000000
        ttk::style configure TNotebook.Tab -font TkDefaultFont
        ttk::style map TNotebook.Tab -background [list disabled #f8f8f8 selected #f7f7f7]
        ttk::notebook $site_4_0.tNo39 \
            -width 494 -height 246 -takefocus {} 
        vTcl:DefineAlias "$site_4_0.tNo39" "TNotebook2" vTcl:WidgetProc "Toplevel1" 1
        frame $site_4_0.tNo39.t0 \
            -background {#f8f8f8} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$site_4_0.tNo39.t0" "TNotebook2_t0" vTcl:WidgetProc "Toplevel1" 1
        $site_4_0.tNo39 add $site_4_0.tNo39.t0 \
            -padding 0 -sticky nsew -state normal -text {Page 1} -image {} \
            -compound left -underline -1 
        set site_6_0  $site_4_0.tNo39.t0
        canvas $site_6_0.can44 \
            -background {#f8f8f8} -borderwidth 2 -closeenough 1.0 -height 183 \
            -insertbackground black -relief ridge -selectbackground {#c6c6c6} \
            -selectforeground black -width 363 
        vTcl:DefineAlias "$site_6_0.can44" "Canvas4" vTcl:WidgetProc "Toplevel1" 1
        place $site_6_0.can44 \
            -in $site_6_0 -x 70 -y 20 -width 363 -relwidth 0 -height 183 \
            -relheight 0 -anchor nw -bordermode ignore 
        frame $site_4_0.tNo39.t1 \
            -background {#f8f8f8} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$site_4_0.tNo39.t1" "TNotebook2_t1" vTcl:WidgetProc "Toplevel1" 1
        $site_4_0.tNo39 add $site_4_0.tNo39.t1 \
            -padding 0 -sticky nsew -state normal -text {Page 2} -image {} \
            -compound left -underline -1 
        set site_6_1  $site_4_0.tNo39.t1
        frame $site_4_0.tNo39.t2 \
            -background {#dcdcdc} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$site_4_0.tNo39.t2" "TNotebook2_t2" vTcl:WidgetProc "Toplevel1" 1
        $site_4_0.tNo39 add $site_4_0.tNo39.t2 \
            -padding 0 -sticky nsew -state normal -text {New Page} -image {} \
            -compound none -underline -1 
        set site_6_2  $site_4_0.tNo39.t2
        canvas $site_6_2.can43 \
            -background {#f8f8f8} -borderwidth 2 -closeenough 1.0 -height 163 \
            -insertbackground black -relief ridge -selectbackground {#c6c6c6} \
            -selectforeground black -width 293 
        vTcl:DefineAlias "$site_6_2.can43" "Canvas3" vTcl:WidgetProc "Toplevel1" 1
        place $site_6_2.can43 \
            -in $site_6_2 -x 20 -y 20 -width 293 -relwidth 0 -height 163 \
            -relheight 0 -anchor nw -bordermode ignore 
        place $site_4_0.tNo39 \
            -in $site_4_0 -x 30 -y 30 -width 494 -relwidth 0 -height 246 \
            -relheight 0 -anchor nw -bordermode ignore 
        frame $top.tNo38.t1 \
            -background {#f8f8f8} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$top.tNo38.t1" "TNotebook1_t1" vTcl:WidgetProc "Toplevel1" 1
        $top.tNo38 add $top.tNo38.t1 \
            -padding 0 -sticky nsew -state normal -text {Page 2} -image {} \
            -compound left -underline -1 
        set site_4_1  $top.tNo38.t1
        ttk::style configure TNotebook -background #f8f8f8
        ttk::style configure TNotebook.Tab -background #f8f8f8
        ttk::style configure TNotebook.Tab -foreground #000000
        ttk::style configure TNotebook.Tab -font TkDefaultFont
        ttk::style map TNotebook.Tab -background [list disabled #f8f8f8 selected #f7f7f7]
        ttk::notebook $site_4_1.tNo40 \
            -width 494 -height 266 -takefocus {} 
        vTcl:DefineAlias "$site_4_1.tNo40" "TNotebook3" vTcl:WidgetProc "Toplevel1" 1
        frame $site_4_1.tNo40.t0 \
            -background {#f8f8f8} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$site_4_1.tNo40.t0" "TNotebook3_t0" vTcl:WidgetProc "Toplevel1" 1
        $site_4_1.tNo40 add $site_4_1.tNo40.t0 \
            -padding 0 -sticky nsew -state normal -text {Page 1} -image {} \
            -compound left -underline -1 
        set site_6_0  $site_4_1.tNo40.t0
        canvas $site_6_0.can41 \
            -background {#f8f8f8} -borderwidth 2 -closeenough 1.0 -height 173 \
            -insertbackground black -relief ridge -selectbackground {#c6c6c6} \
            -selectforeground black -width 353 
        vTcl:DefineAlias "$site_6_0.can41" "Canvas1" vTcl:WidgetProc "Toplevel1" 1
        place $site_6_0.can41 \
            -in $site_6_0 -x 80 -y 40 -width 353 -relwidth 0 -height 173 \
            -relheight 0 -anchor nw -bordermode ignore 
        frame $site_4_1.tNo40.t1 \
            -background {#f8f8f8} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$site_4_1.tNo40.t1" "TNotebook3_t1" vTcl:WidgetProc "Toplevel1" 1
        $site_4_1.tNo40 add $site_4_1.tNo40.t1 \
            -padding 0 -sticky nsew -state normal -text {Page 2} -image {} \
            -compound left -underline -1 
        set site_6_1  $site_4_1.tNo40.t1
        canvas $site_6_1.can42 \
            -background {#f8f8f8} -borderwidth 2 -closeenough 1.0 -height 203 \
            -insertbackground black -relief ridge -selectbackground {#c6c6c6} \
            -selectforeground black -width 443 
        vTcl:DefineAlias "$site_6_1.can42" "Canvas2" vTcl:WidgetProc "Toplevel1" 1
        place $site_6_1.can42 \
            -in $site_6_1 -x 20 -y 20 -width 443 -relwidth 0 -height 203 \
            -relheight 0 -anchor nw -bordermode ignore 
        frame $site_4_1.tNo40.t2 \
            -background {#dcdcdc} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$site_4_1.tNo40.t2" "TNotebook3_t2" vTcl:WidgetProc "Toplevel1" 1
        $site_4_1.tNo40 add $site_4_1.tNo40.t2 \
            -padding 0 -sticky nsew -state normal -text {New Page} -image {} \
            -compound none -underline -1 
        set site_6_2  $site_4_1.tNo40.t2
        place $site_4_1.tNo40 \
            -in $site_4_1 -x 40 -y 30 -width 494 -relwidth 0 -height 266 \
            -relheight 0 -anchor nw -bordermode ignore 
        frame $top.tNo38.t2 \
            -background {#dcdcdc} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$top.tNo38.t2" "TNotebook1_t2" vTcl:WidgetProc "Toplevel1" 1
        $top.tNo38 add $top.tNo38.t2 \
            -padding 0 -sticky nsew -state normal -text p3 -image {} \
            -compound none -underline -1 
        set site_4_2  $top.tNo38.t2
        frame $top.tNo38.t3 \
            -background {#dcdcdc} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$top.tNo38.t3" "TNotebook1_t3" vTcl:WidgetProc "Toplevel1" 1
        $top.tNo38 add $top.tNo38.t3 \
            -padding 0 -sticky nsew -state normal -text p4 -image {} \
            -compound none -underline -1 
        set site_4_3  $top.tNo38.t3
        frame $top.tNo38.t4 \
            -background {#dcdcdc} -highlightbackground {#dcdcdc} \
            -highlightcolor black 
        vTcl:DefineAlias "$top.tNo38.t4" "TNotebook1_t4" vTcl:WidgetProc "Toplevel1" 1
        $top.tNo38 add $top.tNo38.t4 \
            -padding 0 -sticky nsew -state normal -text p5 -image {} \
            -compound none -underline -1 
        set site_4_4  $top.tNo38.t4
        ###################
        # SETTING GEOMETRY
        ###################
        place $top.tNo38 \
            -in $top -x 120 -y 110 -width 594 -relwidth 0 -height 376 \
            -relheight 0 -anchor nw -bordermode ignore 
    
        vTcl:FireEvent $base <<Ready>>
    }
    
    #############################################################################
    ## Binding tag:  _TopLevel
    
    bind "_TopLevel" <<Create>> {
        if {![info exists _topcount]} {set _topcount 0}; incr _topcount
    }
    bind "_TopLevel" <<DeleteWindow>> {
        if {[set ::%W::_modal]} {
                    vTcl:Toplevel:WidgetProc %W endmodal
                } else {
                    destroy %W; if {$_topcount == 0} {exit}
                }
    }
    bind "_TopLevel" <Destroy> {
        if {[winfo toplevel %W] == "%W"} {incr _topcount -1}
    }
    
    set btop ""
    if {$vTcl(borrow)} {
        set btop .bor[expr int([expr rand() * 100])]
        while {[lsearch $btop $vTcl(tops)] != -1} {
            set btop .bor[expr int([expr rand() * 100])]
        }
    }
    set vTcl(btop) $btop
    Window show .
    Window show .top37 $btop
    if {$vTcl(borrow)} {
        $btop configure -background plum
    }
    
     
  • Anonymous

    Anonymous - 2018-03-16

    Update:

    It seems the problem occurs if the current page in view does not show the subNotebook

    Example:

    Assume that there is a parentTNotebook with a child subNotebook in page 1 of parentTNotebook

    1) With page 1 of parentTNotebook in view, attempt to generate the python code and everything is ok.

    2) However, if page 2 of parentTNotebook is in view, any attempt to generate the python code will cause an error and python code generation is not possible

    In the python GUI that I am trying to build , I have a parent TNotebook with another TNotebook inside each of the pages of the parent TNotebook. Therefore, as of now, I am unable to generate the python code.

     
  • Don Rozenberg

    Don Rozenberg - 2018-03-25

    I believe the problem may be fixed with release 4.12

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.