gtk - FileChooserButton behaviour -


i've been getting strange behaviour when connect selection_changed function in filechooserbutton. of so users understand selection_changed syntax. weird happening when use second time in same program.

context

my aim create window 2 filechooserbuttons , entry text @ end position of window. first filechooserbutton helps user pick directory , causes second filechooserbutton open @ directory user chose in first one. until point code working perfectly. entry drawn , says "here goes filename". intended behaviour change entry's text upon selection of filename in second filechooserbutton after checking whether file writable.

the strategy used connect selection_changed function takes care of checking wether file writable , change of entry's text.

the problem function never called. added debugging dumb code like:

stdout.printf("checking whether function called") 

it never gets printed,thus suppose function never gets called. function in question file_changed 1 below.

[indent=4] uses     gtk  class testwindow:window     _file_chooser:filechooserbutton     _entry:gtk.entry      construct()          title = "file chooser"         window_position = windowposition.center         destroy.connect( gtk.main_quit )          var folder_chooser = new filechooserbutton("choose folder",filechooseraction.select_folder)         folder_chooser.set_current_folder( environment.get_home_dir() )         folder_chooser.selection_changed.connect( folder_changed )          _file_chooser = new filechooserbutton("choose file",filechooseraction.open)         _file_chooser.set_current_folder( environment.get_home_dir() )          _file_chooser.selection_changed.connect( file_changed )         var _entry = new gtk.entry()         _entry.set_text("here file name")          var box = new box( orientation.vertical, 0 )         box.pack_start( folder_chooser, true, true, 0 )         box.pack_start( _file_chooser, true, true, 0 )         box.pack_start( _entry, true, true, 0 )          add( box )      def folder_changed( folder_chooser_widget:filechooser )         folder:string = folder_chooser_widget.get_uri()         _file_chooser.set_current_folder_uri( folder )      def file_changed ( file_chooser_widget: filechooser )         stdout.printf(file_chooser_widget.get_filename())          stdout.printf("checking whether function called")          file:file = file.new_for_uri(file_chooser_widget.get_filename())         stdout.printf(file_chooser_widget.get_filename())         info:fileinfo = file.query_info (fileattribute.access_can_write, filequeryinfoflags.none, null)         writable:bool = info.get_attribute_boolean (fileattribute.access_can_write)         stdout.printf(writable.to_string())         if writable true             _entry.set_sensitive(false)   init     gtk.init( ref args )     var test = new testwindow()     test.show_all()     gtk.main() 

question

  • why second selection_changed call not work? filechooserbutton action.open behaves differently 1 select_folder action?

stdout line buffered default.

for output, can these:

var = "message" print message (that)   stdout.printf ("%s\n", that)    // add newline stdout.printf (that)   // no newline, stdout.flush ()             // flush if no newline in 

a problem here:

var _entry = ...    // 1 unvisiable in file_changed _entry = ...        // remove var, visiable in file_changed 

but still have problem code (in machine):

opration not supported

try     info:fileinfo = file.query_info (fileattribute.access_can_write, filequeryinfoflags.none, null)     writable: bool = info.get_attribute_boolean (fileattribute.access_can_write)     if writable true     _entry.set_sensitive (false)  except e: error     print e.message // opration not supported 

i have try find problem. got nothing.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -