genie

Avoiding global variables in Genie

佐手、 提交于 2019-11-28 12:15:14
问题 Below is a working code of a ToolbarButton in Genie. The objective is to get the uri for the chosen file and return it back to the construct/init of the class. The problem is that in all examples I’ve come across global _variables are used (as shown in the code below). It looks unintuitive and I fear that whenever the code gets larger, it will become more difficult to remove bugs, since these variables will start to accumulate. Is any other way of making the function openfile return the uri

The signal.connect syntax

Deadly 提交于 2019-11-28 10:57:40
问题 I am trying to create a window with two FileChooserButtons . The first one should help the user pick a directory, thus I am using the action Select_folder; the second is to allow the user pick a file. The problem is that I wanted the second one to change the current folder depending on the choice the user made in the first one. My initial idea was to use Signal.connect, as in the line: Signal.connect(chooser1, "selection_changed", folder_changed, null) However, this is getting me the